Skip to content

Commit

Permalink
Guarding out actor
Browse files Browse the repository at this point in the history
  • Loading branch information
robertcsakany committed Feb 1, 2024
1 parent 0def5a0 commit 45baa46
Show file tree
Hide file tree
Showing 19 changed files with 104 additions and 130 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,3 +113,8 @@ operation JSL!TransferDeclaration getCreateEventAfter(): JSL!TransferCreateDecla
operation JSL!TransferDeclaration hasSortableField(): Boolean {
return self.members.select(m | m.isKindOf(JSL!TransferFieldDeclaration)).exists(a | a.isSortable());
}

@cached
operation JSL!TransferDeclaration isActorRelated(): Boolean {
return self.isKindOf(JSL!ActorDeclaration);
}
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,9 @@ operation JSL!TransferRelationDeclaration getMappedTransferRelationEquivalent()
return ret;
}


@cached
operation JSL!TransferRelationDeclaration isActorRelated(): Boolean {
return self.isKindOf(JSL!ActorAccessDeclaration);
}

Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ rule CreateUnboundOperationForMappedTransferObjectType
guard: s.eContainer.map.isDefined() and s.static

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

Expand Down Expand Up @@ -238,7 +238,7 @@ rule CreateBoundOperationForMappedTransferObjectType
t.setId("(jsl/" + s.getId() + ")/CreateBoundOperationForMappedTransferObjectType");
t.binding = s.equivalent("CreateBoundOperationForEntityType");

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

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

t.setId("(jsl/" + s.getId() + ")/CreateDeleteOperationForEntityType");
t.instanceRepresentation = s.eContainer.equivalent("CreateMappedTransferObjectType");
t.instanceRepresentation = s.eContainer.getPSMEquivalent();
t.name = s.name + s.eContainer.getFqName().fqNameToCamelCase();
s.eContainer.map.entity.getPSMEquivalent().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.equivalent("CreateMappedTransferObjectType");
t.owner = s.eContainer.getPSMEquivalent();
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.equivalent("CreateMappedTransferObjectType").operations.add(t);
s.eContainer.getPSMEquivalent().operations.add(t);
log.debug("Created CreateDeleteOperationForTransferType: " + t.name);
}

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

t.setId("(jsl/" + s.getId() + ")/CreateGetRangeActionInputOperationForEntityType");
t.instanceRepresentation = s.eContainer.equivalent("CreateMappedTransferObjectType");
t.instanceRepresentation = s.eContainer.getPSMEquivalent();
t.name = "getRangeForRelation" + s.getFqName().fqNameToCamelCase();
s.eContainer.map.entity.getPSMEquivalent().operations.add(t);
log.debug("Created CreateGetRangeActionInputOperationForEntityType: " + t.name);
Expand Down Expand Up @@ -47,7 +47,7 @@ rule CreateGetRangeActionInputOperationForMappedTransferType
//t.updateOnResult = s.referenceType.isUpdateSupported();
//t.deleteOnResult = s.referenceType.isDeleteSupported();

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import "../../../../operations/_importAll.eol";
rule CreateRefreshOperationForEntityType
transform s: JSL!TransferDeclaration
to t: JUDOPSM!BoundOperation {
guard: generateBehaviours and s.map.isDefined()
guard: generateBehaviours and not s.isActorRelated() and s.map.isDefined()

t.setId("(jsl/" + s.getId() + ")/CreateRefreshOperationForEntityType");
t.instanceRepresentation = s.equivalent("CreateMappedTransferObjectType");
t.instanceRepresentation = s.getPSMEquivalent();
t.name = "Refresh" + s.getFqName().fqNameToCamelCase();
s.map.entity.getPSMEquivalent().operations.add(t);
log.debug("Created CreateRefreshOperationForEntityType: " + t.name);
Expand All @@ -17,19 +17,19 @@ rule CreateRefreshOperationForEntityType
rule CreateRefreshBehaviourForTransferType
transform s: JSL!TransferDeclaration
to t: JUDOPSM!TransferOperationBehaviour {
guard: generateBehaviours and s.map.isDefined()
guard: generateBehaviours and not s.isActorRelated() and s.map.isDefined()

t.setId("(jsl/" + s.getId() + ")/CreateRefreshBehaviourForTransferType");
t.behaviourType = JUDOPSM!TransferOperationBehaviourType#REFRESH;
t.owner = s.equivalent("CreateMappedTransferObjectType");
t.owner = s.getPSMEquivalent();
log.debug("Created CreateRefreshBehaviourForTransferType: " + s.name);
}

@greedy
rule CreateRefreshOperationForTransferType
transform s: JSL!TransferDeclaration
to t: JUDOPSM!BoundTransferOperation {
guard: generateBehaviours and s.map.isDefined()
guard: generateBehaviours and not s.isActorRelated() and s.map.isDefined()

t.setId("(jsl/" + s.getId() + ")/CreateRefreshOperationForTransferType");
t.name = "refreshInstance";
Expand All @@ -39,7 +39,7 @@ rule CreateRefreshOperationForTransferType

t.binding = s.equivalent("CreateRefreshOperationForEntityType");
t.behaviour = s.equivalent("CreateRefreshBehaviourForTransferType");
s.equivalent("CreateMappedTransferObjectType").operations.add(t);
s.getPSMEquivalent().operations.add(t);
log.debug("Created CreateRefreshOperationForTransferType: " + t.name);
}

Expand All @@ -48,7 +48,7 @@ rule CreateRefreshOperationForTransferType
rule CreateRefreshOperationForTransferTypeInputParameter
transform s: JSL!TransferDeclaration
to t: JUDOPSM!Parameter {
guard: generateBehaviours and s.map.isDefined()
guard: generateBehaviours and not s.isActorRelated() and s.map.isDefined()

t.setId("(jsl/" + s.getId() + ")/CreateRefreshOperationForTransferTypeInputParameter");
t.cardinality = s.equivalent("CreateCardinalityForRefreshTransferTypeInput");
Expand All @@ -62,7 +62,7 @@ rule CreateRefreshOperationForTransferTypeInputParameter
rule CreateRefreshOperationForTransferTypeOutputParameter
transform s: JSL!TransferDeclaration
to t: JUDOPSM!Parameter {
guard: generateBehaviours and s.map.isDefined()
guard: generateBehaviours and not s.isActorRelated() and s.map.isDefined()

t.setId("(jsl/" + s.getId() + ")/CreateRefreshOperationForTransferTypeOutputParameter");
t.cardinality = s.equivalent("CreateCardinalityForRefreshTransferTypeOutput");
Expand All @@ -76,7 +76,7 @@ rule CreateRefreshOperationForTransferTypeOutputParameter
rule CreateRefreshOperationForEntityTypeInputParameter
transform s: JSL!TransferDeclaration
to t: JUDOPSM!Parameter {
guard: generateBehaviours and s.map.isDefined()
guard: generateBehaviours and not s.isActorRelated() and s.map.isDefined()

t.setId("(jsl/" + s.getId() + ")/CreateRefreshOperationForEntityTypeInputParameter");
t.cardinality = s.equivalent("CreateCardinalityForRefreshEntityTypeInput");
Expand All @@ -90,7 +90,7 @@ rule CreateRefreshOperationForEntityTypeInputParameter
rule CreateRefreshOperationForEntityTypeOutputParameter
transform s: JSL!TransferDeclaration
to t: JUDOPSM!Parameter {
guard: generateBehaviours and s.map.isDefined()
guard: generateBehaviours and not s.isActorRelated() and s.map.isDefined()

t.setId("(jsl/" + s.getId() + ")/CreateRefreshOperationForEntityTypeOutputParameter");
t.cardinality = s.equivalent("CreateCardinalityForRefreshEntityTypeOutput");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import "../../../../operations/_importAll.eol";
rule CreateAddReferenceOperationForEntityType
transform s: JSL!TransferRelationDeclaration
to t: JUDOPSM!BoundOperation {
guard: generateBehaviours and s.isAddReferenceAllowed()
guard: generateBehaviours and not s.isActorRelated() and s.isAddReferenceAllowed()

t.setId("(jsl/" + s.getId() + ")/CreateAddReferenceOperationForEntityType");
t.instanceRepresentation = s.eContainer.equivalent("CreateMappedTransferObjectType");
t.instanceRepresentation = s.eContainer.getPSMEquivalent();
t.name = "addReferencesToRelation" + s.getFqName().fqNameToCamelCase();
s.eContainer.map.entity.getPSMEquivalent().operations.add(t);
log.debug("Created CreateAddReferenceOperationForEntityType: " + t.name);
Expand All @@ -18,7 +18,7 @@ rule CreateAddReferenceOperationForEntityType
rule CreateAddReferenceBehaviourForTransferType
transform s: JSL!TransferRelationDeclaration
to t: JUDOPSM!TransferOperationBehaviour {
guard: generateBehaviours and s.isAddReferenceAllowed()
guard: generateBehaviours and not s.isActorRelated() and s.isAddReferenceAllowed()

t.setId("(jsl/" + s.getId() + ")/CreateAddReferenceBehaviourForTransferType");
t.behaviourType = JUDOPSM!TransferOperationBehaviourType#ADD_REFERENCE;
Expand All @@ -30,7 +30,7 @@ rule CreateAddReferenceBehaviourForTransferType
rule CreateAddReferenceOperationForTransferType
transform s: JSL!TransferRelationDeclaration
to t: JUDOPSM!BoundTransferOperation {
guard: generateBehaviours and s.isAddReferenceAllowed()
guard: generateBehaviours and not s.isActorRelated() and s.isAddReferenceAllowed()

t.setId("(jsl/" + s.getId() + ")/CreateAddReferenceOperationForTransferType");
t.name = "addReferencesTo" + s.name.firstToUpperCase();
Expand All @@ -44,7 +44,7 @@ rule CreateAddReferenceOperationForTransferType
t.updateOnResult = s.referenceType.isUpdateSupported();
t.deleteOnResult = s.referenceType.isDeleteSupported();

s.eContainer.equivalent("CreateMappedTransferObjectType").operations.add(t);
s.eContainer.getPSMEquivalent().operations.add(t);
log.debug("Created CreateAddReferenceOperationForTransferType: " + t.name);
}

Expand All @@ -53,7 +53,7 @@ rule CreateAddReferenceOperationForTransferType
rule CreateAddReferenceOperationForTransferTypeInputParameter
transform s: JSL!TransferRelationDeclaration
to t: JUDOPSM!Parameter {
guard: generateBehaviours and s.isAddReferenceAllowed()
guard: generateBehaviours and not s.isActorRelated() and s.isAddReferenceAllowed()

t.setId("(jsl/" + s.getId() + ")/CreateAddReferenceOperationForTransferTypeInputParameter");
t.cardinality = s.equivalent("CreateCardinalityForAddReferenceTransferTypeInput");
Expand All @@ -67,7 +67,7 @@ rule CreateAddReferenceOperationForTransferTypeInputParameter
rule CreateAddReferenceOperationForEntityTypeInputParameter
transform s: JSL!TransferRelationDeclaration
to t: JUDOPSM!Parameter {
guard: generateBehaviours and s.isAddReferenceAllowed()
guard: generateBehaviours and not s.isActorRelated() and s.isAddReferenceAllowed()

t.setId("(jsl/" + s.getId() + ")/CreateAddReferenceOperationForEntityTypeInputParameter");
t.cardinality = s.equivalent("CreateCardinalityForAddReferenceEntityTypeInput");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import "../../../../operations/_importAll.eol";
rule CreateCreateOperationForEntityType
transform s: JSL!TransferRelationDeclaration
to t: JUDOPSM!BoundOperation {
guard: generateBehaviours and (s.maps() or s.reads()) and s.referenceType.isCreateSupported() and s.isCreateAllowed()
guard: generateBehaviours and not s.isActorRelated() and (s.maps() or s.reads()) and s.referenceType.isCreateSupported() and s.isCreateAllowed()

t.setId("(jsl/" + s.getId() + ")/CreateCreateOperationForEntityType");
t.instanceRepresentation = s.eContainer.equivalent("CreateMappedTransferObjectType");
t.instanceRepresentation = s.eContainer.getPSMEquivalent();
t.name = s.referenceType.getCreateEventInsteadOf().name + "ForRelation" + s.getFqName().fqNameToCamelCase();
s.eContainer.map.entity.getPSMEquivalent().operations.add(t);
log.debug("Created CreateCreateOperationForEntityType: " + t.name);
Expand All @@ -18,7 +18,7 @@ rule CreateCreateOperationForEntityType
rule CreateCreateBehaviourForTransferType
transform s: JSL!TransferRelationDeclaration
to t: JUDOPSM!TransferOperationBehaviour {
guard: generateBehaviours and (s.maps() or s.reads()) and s.referenceType.isCreateSupported() and s.isCreateAllowed()
guard: generateBehaviours and not s.isActorRelated() and (s.maps() or s.reads()) and s.referenceType.isCreateSupported() and s.isCreateAllowed()

t.setId("(jsl/" + s.getId() + ")/CreateCreateBehaviourForTransferType");
t.behaviourType = JUDOPSM!TransferOperationBehaviourType#CREATE_INSTANCE;
Expand All @@ -30,7 +30,7 @@ rule CreateCreateBehaviourForTransferType
rule CreateCreateOperationForTransferType
transform s: JSL!TransferRelationDeclaration
to t: JUDOPSM!BoundTransferOperation {
guard: generateBehaviours and (s.maps() or s.reads()) and s.referenceType.isCreateSupported() and s.isCreateAllowed()
guard: generateBehaviours and not s.isActorRelated() and (s.maps() or s.reads()) and s.referenceType.isCreateSupported() and s.isCreateAllowed()

t.setId("(jsl/" + s.getId() + ")/CreateCreateOperationForTransferType");
t.name = s.referenceType.getCreateEventInsteadOf().name + "Of" + s.name.firstToUpperCase();
Expand All @@ -44,7 +44,7 @@ rule CreateCreateOperationForTransferType
t.updateOnResult = s.referenceType.isUpdateSupported();
t.deleteOnResult = s.referenceType.isDeleteSupported();

s.eContainer.equivalent("CreateMappedTransferObjectType").operations.add(t);
s.eContainer.getPSMEquivalent().operations.add(t);
log.debug("Created CreateCreateOperationForTransferType: " + t.name);
}

Expand All @@ -53,7 +53,7 @@ rule CreateCreateOperationForTransferType
rule CreateCreateOperationForTransferTypeInputParameter
transform s: JSL!TransferRelationDeclaration
to t: JUDOPSM!Parameter {
guard: generateBehaviours and (s.maps() or s.reads()) and s.referenceType.isCreateSupported() and s.isCreateAllowed()
guard: generateBehaviours and not s.isActorRelated() and (s.maps() or s.reads()) and s.referenceType.isCreateSupported() and s.isCreateAllowed()

t.setId("(jsl/" + s.getId() + ")/CreateCreateOperationForTransferTypeInputParameter");
t.cardinality = s.equivalent("CreateCardinalityForCreateTransferTypeInput");
Expand All @@ -67,7 +67,7 @@ rule CreateCreateOperationForTransferTypeInputParameter
rule CreateCreateOperationForTransferTypeOutputParameter
transform s: JSL!TransferRelationDeclaration
to t: JUDOPSM!Parameter {
guard: generateBehaviours and (s.maps() or s.reads()) and s.referenceType.isCreateSupported() and s.isCreateAllowed()
guard: generateBehaviours and not s.isActorRelated() and (s.maps() or s.reads()) and s.referenceType.isCreateSupported() and s.isCreateAllowed()

t.setId("(jsl/" + s.getId() + ")/CreateCreateOperationForTransferTypeOutputParameter");
t.cardinality = s.equivalent("CreateCardinalityForCreateTransferTypeOutput");
Expand All @@ -81,7 +81,7 @@ rule CreateCreateOperationForTransferTypeOutputParameter
rule CreateCreateOperationForEntityTypeInputParameter
transform s: JSL!TransferRelationDeclaration
to t: JUDOPSM!Parameter {
guard: generateBehaviours and (s.maps() or s.reads()) and s.referenceType.isCreateSupported() and s.isCreateAllowed()
guard: generateBehaviours and not s.isActorRelated() and (s.maps() or s.reads()) and s.referenceType.isCreateSupported() and s.isCreateAllowed()

t.setId("(jsl/" + s.getId() + ")/CreateCreateOperationForEntityTypeInputParameter");
t.cardinality = s.equivalent("CreateCardinalityForCreateEntityTypeInput");
Expand All @@ -95,7 +95,7 @@ rule CreateCreateOperationForEntityTypeInputParameter
rule CreateCreateOperationForEntityTypeOutputParameter
transform s: JSL!TransferRelationDeclaration
to t: JUDOPSM!Parameter {
guard: generateBehaviours and (s.maps() or s.reads()) and s.referenceType.isCreateSupported() and s.isCreateAllowed()
guard: generateBehaviours and not s.isActorRelated() and (s.maps() or s.reads()) and s.referenceType.isCreateSupported() and s.isCreateAllowed()

t.setId("(jsl/" + s.getId() + ")/CreateCreateOperationForEntityTypeOutputParameter");
t.cardinality = s.equivalent("CreateCardinalityForCreateEntityTypeOutput");
Expand Down
Loading

0 comments on commit 45baa46

Please sign in to comment.