Skip to content

Commit

Permalink
Rename equivalent methods
Browse files Browse the repository at this point in the history
  • Loading branch information
robertcsakany committed Feb 2, 2024
1 parent 45baa46 commit 4020988
Show file tree
Hide file tree
Showing 44 changed files with 237 additions and 203 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ operation JSL!TransferActionDeclaration getFqName(): String {
}

@cached
operation JSL!TransferActionDeclaration getPSMRangeEquivalent(): JUDOPSM!ReferenceAccessor {
operation JSL!TransferActionDeclaration getTransferActionRangeEquivalent(): JUDOPSM!ReferenceAccessor {
var choice = self.modifiers.selectOne(m | m.isTypeOf(JSL!TransferChoiceModifier));

if (choice.isDefined() and self.eContainer.map.isDefined()) {
Expand All @@ -40,7 +40,7 @@ operation JSL!TransferActionDeclaration getPSMRangeEquivalent(): JUDOPSM!Referen


@cached
operation JSL!TransferActionDeclaration getPSMOperationEquivalent(): JUDOPSM!OperationDeclaration {
operation JSL!TransferActionDeclaration getOperationDeclarationEquivalent(): JUDOPSM!OperationDeclaration {

if (self.eContainer.map.isUndefined()) {
return self.equivalent("CreateUnboundOperationForUnmappedTransferObjectType");
Expand All @@ -54,7 +54,7 @@ operation JSL!TransferActionDeclaration getPSMOperationEquivalent(): JUDOPSM!Ope
}

@cached
operation JSL!TransferActionDeclaration getPSMBehaviourOperationEquivalent(): JUDOPSM!OperationDeclaration {
operation JSL!TransferActionDeclaration getBehaviourOperationDeclarationEquivalent(): JUDOPSM!OperationDeclaration {

if (self.eContainer.map.isDefined()) {
return self.equivalent("CreateGetRangeActionInputOperationForMappedTransferType");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ operation JSL!ActorAccessDeclaration isGetRangeSupported() : Boolean {
}

@cached
operation JSL!ActorAccessDeclaration getPSMRangeEquivalent(): JUDOPSM!ReferenceAccessor {
operation JSL!ActorAccessDeclaration getTransferActionRangeEquivalent(): JUDOPSM!ReferenceAccessor {
var choice = self.modifiers.selectOne(m | m.isTypeOf(JSL!TransferChoiceModifier));

if (choice.isDefined() and self.eContainer.map.isDefined()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,38 @@ operation JSL!ActorDeclaration getFqName(): String {
return self.eContainer.getFqName() + "::" + self.name;
}

/*

@cached
operation JSL!ActorDeclaration getPSMEquivalent(): JUDOPSM!TransferObjectType {
if (self.map.isUndefined()) {
return self.equivalent("CreateUnmappedActorTransferObjectType");
} else {
return self.equivalent("CreateMappedActorTransferObjectType");
operation JSL!ActorDeclaration getActorDeclarationEquivalent(): JUDOPSM!TransferObjectType {
if (self.getPrincipal().isDefined() and not self.getPrincipal().map.isDefined()) {
return self.equivalent("CreateActorType");
} else if (self.getPrincipal().isDefined() and self.getPrincipal().map.isDefined()) {
return self.equivalent("CreateMappedActorType");
} else if (self.getPrincipal().isUndefined()) {
return self.equivalent("CreateActorTypeWithoutPrincipal");
}
}
*/

@cached
operation JSL!ActorDeclaration getIdentity(): JSL!IdentityModifier {
return self.modifiers.selectOne(m | m.isTypeOf(JSL!IdentityModifier));
}

@cached
operation JSL!ActorDeclaration getRealm(): JSL!RealmModifier {
return self.modifiers.selectOne(m | m.isTypeOf(JSL!RealmModifier));
}

@cached
operation JSL!ActorDeclaration getClaim(): JSL!ClaimModifier {
return self.modifiers.selectOne(m | m.isTypeOf(JSL!ClaimModifier));
}

@cached
operation JSL!ActorDeclaration getGuard(): JSL!GuardModifier {
return self.modifiers.selectOne(m | m.isTypeOf(JSL!GuardModifier));
}

@cached
operation JSL!ActorDeclaration getPrincipal(): JSL!TransferDeclaration {
return self.getIdentity()?.field?.eContainer;
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@cached
operation JSL!EntityDeclaration getPSMEquivalent(): JUDOPSM!EntityType {
operation JSL!EntityDeclaration getEntityDeclarationEquivalent(): JUDOPSM!EntityType {
return self.equivalent("CreateEntityType");
}

Expand All @@ -10,7 +10,7 @@ operation JSL!EntityDeclaration getId(): String {

@cached
operation JSL!EntityDeclaration getModelRoot(): JUDOPSM!Package {
return self.getPsmEquivalent().getModelRoot();
return self.getEntityDeclarationEquivalent().getModelRoot();
}


Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@cached
operation JSL!ModelDeclaration getPSMEquivalent(): JUDOPSM!Model {
operation JSL!ModelDeclaration getModelDeclarationEquivalent(): JUDOPSM!Model {
return defaultModelName.equivalent("CreateRootModel");
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@cached
operation JSL!PrimitiveDeclaration getPSMEquivalent(): JUDOPSM!Primitive {
operation JSL!PrimitiveDeclaration getPrimitiveDeclarationEquivalent(): JUDOPSM!Primitive {
if (self.primitive.isDefined()) {
var byName = self.eContainer.name.equivalent("CreateModelPackages").elements.selectOne(e | e.name == self.name);
if (byName.isDefined()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,5 @@ operation JSL!TransferCreateDeclaration getId(): String {
return (self.eContainer.getId() + "/" + self.name);
}

@cached
operation JSL!TransferCreateDeclaration getModelRoot(): JUDOPSM!Package {
return self.getPSMEquivalent().eContainer().getModelRoot();
}


Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@cached
operation JSL!TransferDeclaration getPSMEquivalent(): JUDOPSM!TransferObjectType {
operation JSL!TransferDeclaration getTransferDeclarationEquivalent(): JUDOPSM!TransferObjectType {
if (self.map.isUndefined()) {
return self.equivalent("CreateUnmappedTransferObjectType");
} else {
Expand All @@ -14,7 +14,7 @@ operation JSL!TransferDeclaration getId(): String {

@cached
operation JSL!TransferDeclaration getModelRoot(): JUDOPSM!Package {
return self.getPSMEquivalent().eContainer().getModelRoot();
return self.getTransferDeclarationEquivalent().eContainer().getModelRoot();
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ operation JSL!TransferDeleteDeclaration getId(): String {
return (self.eContainer.getId() + "/" + self.name);
}

@cached
operation JSL!TransferDeleteDeclaration getModelRoot(): JUDOPSM!Package {
return self.getPSMEquivalent().eContainer().getModelRoot();
}
//@cached
//operation JSL!TransferDeleteDeclaration getModelRoot(): JUDOPSM!Package {
// return self.getPSMEquivalent().eContainer().getModelRoot();
//}


Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ operation JSL!TransferFieldDeclaration isGetUploadTokenSupported(): Boolean {


@cached
operation JSL!TransferFieldDeclaration getPSMEquivalent() : JUDOPSM!TransferAttribute {
operation JSL!TransferFieldDeclaration getTransferFieldDeclarationEquivalent() : JUDOPSM!TransferAttribute {
if (not self.maps() and not self.reads()) {
return self.equivalent("CreateTransientTransferAttribute");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ operation JSL!TransferRelationDeclaration isGetRangeSupported() : Boolean {
}

@cached
operation JSL!TransferRelationDeclaration getPSMRangeEquivalent(): JUDOPSM!ReferenceAccessor {
operation JSL!TransferRelationDeclaration getTransferActionRangeEquivalent(): JUDOPSM!ReferenceAccessor {
var choice = self.modifiers.selectOne(m | m.isTypeOf(JSL!TransferChoiceModifier));

if (choice.isDefined() and self.eContainer.map.isDefined()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ operation JSL!TransferUpdateDeclaration getId(): String {
return (self.eContainer.getId() + "/" + self.name);
}

@cached
operation JSL!TransferUpdateDeclaration getModelRoot(): JUDOPSM!Package {
return self.getPSMEquivalent().eContainer().getModelRoot();
}
//@cached
//operation JSL!TransferUpdateDeclaration getModelRoot(): JUDOPSM!Package {
// return self.getPSMEquivalent().eContainer().getModelRoot();
//}


Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ post {

// Collect primitive types which are not directly referenced as field types
for (c in JSL!NavigationBaseDeclarationReference.all().select(n | n.reference.isKindOf(JSL!PrimitiveDeclaration))) {
var dummy = c.reference.getPSMEquivalent();
var dummy = c.reference.getPrimitiveDeclarationEquivalent();
}
for (c in JSL!QueryParameterDeclaration.all()) {
var dummy = c.referenceType.getPSMEquivalent();
var dummy = c.referenceType.getPrimitiveDeclarationEquivalent();
}

var enumsWithoutOrdinal = JUDOPSM!EnumerationMember.all.select(m | m.ordinal == -1).collect(m | m.eContainer).flatten().asSet();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ rule AbstractTransferActionDeclarationReturnParameter

t.cardinality = s.equivalent("CreateCardinalityForTransferActionDeclarationOutput");
t.name = "return";
t.type = s.`return`.getPSMEquivalent();
t.type = s.`return`.getTransferDeclarationEquivalent();
}

@abstract
Expand All @@ -59,7 +59,7 @@ rule AbstractTransferActionDeclarationInputParameter
t.cardinality = s.equivalent("CreateCardinalityForTransferActionDeclarationInput");
t.name = s.paramaterName;

t.type = s.parameterType.getPSMEquivalent();
t.type = s.parameterType.getTransferDeclarationEquivalent();

}

Expand Down Expand Up @@ -141,7 +141,7 @@ rule CreateUnboundOperationForMappedTransferObjectType
guard: s.eContainer.map.isDefined() and s.static

t.setId("(jsl/" + s.getId() + ")/CreateUnboundOperationForMappedTransferObjectType");
s.eContainer.getPSMEquivalent().operations.add(t);
s.eContainer.getTransferDeclarationEquivalent().operations.add(t);
log.debug("Created CreateUnboundOperationForMappedTransferObjectType: " + t.name);
}

Expand Down Expand Up @@ -182,14 +182,14 @@ rule CreateBoundOperationForEntityType

t.`abstract` = false;
t.implementation = s.equivalent("CreateEmptyOperationBody");
t.instanceRepresentation = s.eContainer.getPSMEquivalent();
t.instanceRepresentation = s.eContainer.getTransferDeclarationEquivalent();
t.name = s.name + s.eContainer.getFqName().fqNameToCamelCase();

for (error in s.errors) {
t.faults.add(error.equivalentDiscriminated("CreateFaultParameter", s.getId() + "/Entity"));
}

s.eContainer.map.entity.getPSMEquivalent().operations.add(t);
s.eContainer.map.entity.getEntityDeclarationEquivalent().operations.add(t);

log.debug("Created CreateBoundOperationForEntity: " + t.name);
}
Expand All @@ -205,7 +205,7 @@ rule CreateBoundOperationForEntityTypeInputParameter
t.cardinality = s.equivalent("CreateCardinalityForTransferActionDeclarationEntityInput");
t.name = s.paramaterName;

t.type = s.parameterType.getPSMEquivalent();
t.type = s.parameterType.getTransferDeclarationEquivalent();

s.equivalent("CreateBoundOperationForEntityType").input = t;
log.debug("Created CreateBoundOperationForEntityTypeInputParameter: " + t.name);
Expand All @@ -222,7 +222,7 @@ rule CreateBoundOperationForEntityTypeOutputParameter
t.setId("(jsl/" + s.getId() + ")/CreateBoundOperationForEntityTypeOutputParameter");
t.cardinality = s.equivalent("CreateCardinalityForTransferActionDeclarationEntityOutput");
t.name = "return";
t.type = s.`return`.getPSMEquivalent();
t.type = s.`return`.getTransferDeclarationEquivalent();
s.equivalent("CreateBoundOperationForEntityType").output = t;
log.debug("Created CreateBoundOperationForEntityTypeOutputParameter: " + t.name);
}
Expand All @@ -238,7 +238,7 @@ rule CreateBoundOperationForMappedTransferObjectType
t.setId("(jsl/" + s.getId() + ")/CreateBoundOperationForMappedTransferObjectType");
t.binding = s.equivalent("CreateBoundOperationForEntityType");

s.eContainer.getPSMEquivalent().operations.add(t);
s.eContainer.getTransferDeclarationEquivalent().operations.add(t);
log.debug("Created CreateBoundOperationForMappedTransferObjectType: " + t.name);
}

Expand Down Expand Up @@ -349,9 +349,9 @@ rule CreateActionInputParameterRangeNavigationPropertyForMappedTransferActionDec

t.setId("(jsl/" + s.eContainer.getId() + ")/CreateActionInputParameterRangeNavigationPropertyForMappedTransferActionDeclaration");
t.name = defaultActionInputParameterRangeNamePrefix + s.eContainer.name + defaultActionInputParameterRangeNameMidfix + s.eContainer.eContainer.name + defaultActionInputParameterRangeNamePostfix;
t.target = s.eContainer.getParameterType().getPSMEquivalent().entityType;
t.target = s.eContainer.getParameterType().getTransferDeclarationEquivalent().entityType;
t.cardinality = s.eContainer.equivalentDiscriminated("CreateCardinalityForGetActionInputParameterRangeEntityRelation", t.getId());
s.eContainer.eContainer.map.entity.getPSMEquivalent().navigationProperties.add(t);
s.eContainer.eContainer.map.entity.getEntityDeclarationEquivalent().navigationProperties.add(t);

log.debug("Created NavigationProperty for Transfer Object Default Value: " + s);
}
Expand All @@ -377,7 +377,7 @@ rule CreateActionInputParameterRangeStaticNavigationForUnmappedTransferActionDec

t.setId("(jsl/" + s.eContainer.getId() + ")/CreateActionInputParameterRangeStaticNavigationForUnmappedTransferActionDeclaration");
t.name = defaultActionInputParameterRangeNamePrefix + s.eContainer.name + defaultActionInputParameterRangeNameMidfix + s.eContainer.eContainer.name + defaultActionInputParameterRangeNamePostfix;
t.target = s.eContainer.getParameterType().getPSMEquivalent().entityType;
t.target = s.eContainer.getParameterType().getTransferDeclarationEquivalent().entityType;
t.cardinality = s.eContainer.equivalentDiscriminated("CreateCardinalityForGetActionInputParameterRangeEntityRelation", t.getId());

s.eContainer.eContainer.eContainer.getModelRoot().elements.add(t);
Expand All @@ -394,12 +394,12 @@ rule CreateActionInputParameterRangeTransferObjectRelation

t.setId("(esm/" + s.getId() + ")/CreateActionInputParameterRangeTransferObjectRelation");

t.name = s.eContainer.getPSMRangeEquivalent().name;
t.name = s.eContainer.getTransferActionRangeEquivalent().name;
t.cardinality = s.eContainer.equivalent("CreateCardinalityForGetActionInputParameterRangeTransferObjectRelation");
t.target = s.eContainer.getParameterType().getPSMEquivalent();
t.binding = s.eContainer.getPSMRangeEquivalent();
t.target = s.eContainer.getParameterType().getTransferDeclarationEquivalent();
t.binding = s.eContainer.getTransferActionRangeEquivalent();

s.eContainer.eContainer.getPSMEquivalent().relations.add(t);
s.eContainer.eContainer.getTransferDeclarationEquivalent().relations.add(t);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ rule CreateDeleteOperationForEntityType
guard: generateBehaviours and s.instead ?: false

t.setId("(jsl/" + s.getId() + ")/CreateDeleteOperationForEntityType");
t.instanceRepresentation = s.eContainer.getPSMEquivalent();
t.instanceRepresentation = s.eContainer.getTransferDeclarationEquivalent();
t.name = s.name + s.eContainer.getFqName().fqNameToCamelCase();
s.eContainer.map.entity.getPSMEquivalent().operations.add(t);
s.eContainer.map.entity.getEntityDeclarationEquivalent().operations.add(t);
log.debug("Created CreateDeleteOperationForEntityType: " + t.name);
}

Expand All @@ -22,7 +22,7 @@ rule CreateDeleteBehaviourForTransferType

t.setId("(jsl/" + s.getId() + ")/CreateDeleteBehaviourForTransferType");
t.behaviourType = JUDOPSM!TransferOperationBehaviourType#DELETE_INSTANCE;
t.owner = s.eContainer.getPSMEquivalent();
t.owner = s.eContainer.getTransferDeclarationEquivalent();
log.debug("Created CreateDeleteBehaviourForTransferType: " + s.name);
}

Expand All @@ -36,7 +36,7 @@ rule CreateDeleteOperationForTransferType
t.name = s.name;
t.binding = s.equivalent("CreateDeleteOperationForEntityType");
t.behaviour = s.equivalent("CreateDeleteBehaviourForTransferType");
s.eContainer.getPSMEquivalent().operations.add(t);
s.eContainer.getTransferDeclarationEquivalent().operations.add(t);
log.debug("Created CreateDeleteOperationForTransferType: " + t.name);
}

Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ rule CreateGetRangeActionInputOperationForEntityType
guard: generateBehaviours and s.parameterType?.map.isDefined() and s.eContainer.map.isDefined()

t.setId("(jsl/" + s.getId() + ")/CreateGetRangeActionInputOperationForEntityType");
t.instanceRepresentation = s.eContainer.getPSMEquivalent();
t.instanceRepresentation = s.eContainer.getTransferDeclarationEquivalent();
t.name = "getRangeForRelation" + s.getFqName().fqNameToCamelCase();
s.eContainer.map.entity.getPSMEquivalent().operations.add(t);
s.eContainer.map.entity.getEntityDeclarationEquivalent().operations.add(t);
log.debug("Created CreateGetRangeActionInputOperationForEntityType: " + t.name);
}

Expand All @@ -24,7 +24,7 @@ rule CreateGetRangeActionInputBehaviourForTransferType
t.behaviourType = JUDOPSM!TransferOperationBehaviourType#GET_RANGE;
// t.owner = s.equivalent("CreateDerivedTransferObjectEmbeddedRelationForTransferRelationDeclaration");
//t.owner = s.modifiers.selectOne(m | m.isTypeOf(JSL!TransferChoiceModifier)).equivalent("CreateActionInputParameterRangeTransferObjectRelation");
t.owner = s.getPSMOperationEquivalent();
t.owner = s.getOperationDeclarationEquivalent();
log.debug("Created CreateGetRangeActionInputBehaviourForTransferType: " + s.name);
}

Expand All @@ -47,7 +47,7 @@ rule CreateGetRangeActionInputOperationForMappedTransferType
//t.updateOnResult = s.referenceType.isUpdateSupported();
//t.deleteOnResult = s.referenceType.isDeleteSupported();

s.eContainer.getPSMEquivalent().operations.add(t);
s.eContainer.getTransferDeclarationEquivalent().operations.add(t);
log.debug("Created CreateGetRangeActionInputOperationForMappedTransferType: " + t.name);
}

Expand Down Expand Up @@ -81,7 +81,7 @@ rule CreateGetRangeActionInputOperationForTransferTypeInputParameter
t.name = "input";
t.type = s.parameterType.equivalent("CreateQueryCustomizerType");
// s.equivalent("CreateGetRangeActionInputOperationForTransferType").input = t;
s.getPSMBehaviourOperationEquivalent().input = t;
s.getBehaviourOperationDeclarationEquivalent().input = t;
log.debug("Created CreateGetRangeActionInputOperationForTransferTypeInputParameter: " + t.name);
}

Expand All @@ -94,9 +94,9 @@ rule CreateGetRangeActionInputOperationForTransferTypeOutputParameter
t.setId("(jsl/" + s.getId() + ")/CreateGetRangeActionInputOperationForTransferTypeOutputParameter");
t.cardinality = s.equivalent("CreateCardinalityForGetRangeActionInputTransferTypeOutput");
t.name = "return";
t.type = s.parameterType.getPSMEquivalent();
t.type = s.parameterType.getTransferDeclarationEquivalent();
//s.equivalent("CreateGetRangeActionInputOperationForTransferType").output = t;
s.getPSMBehaviourOperationEquivalent().output = t;
s.getBehaviourOperationDeclarationEquivalent().output = t;
log.debug("Created CreateGetRangeActionInputOperationForTransferTypeOutputParameter: " + t.name);
}

Expand All @@ -123,7 +123,7 @@ rule CreateGetRangeActionInputOperationForEntityTypeOutputParameter
t.setId("(jsl/" + s.getId() + ")/CreateGetRangeActionInputOperationForEntityTypeOutputParameter");
t.cardinality = s.equivalent("CreateCardinalityForGetRangeActionInputEntityTypeOutput");
t.name = "return";
t.type = s.parameterType.getPSMEquivalent();
t.type = s.parameterType.getTransferDeclarationEquivalent();
s.equivalent("CreateGetRangeActionInputOperationForEntityType").output = t;
log.debug("Created CreateGetRangeActionInputOperationForEntityTypeOutputParameter: " + t.name);
}
Expand Down
Loading

0 comments on commit 4020988

Please sign in to comment.