diff --git a/org.framed.iorm.editpolicymodel/model/editpolicymodel.ecore b/org.framed.iorm.editpolicymodel/model/editpolicymodel.ecore index d9384a2ebc962a64ab26334272b63e965448c128..c930289f6f31b5a70e7057fa788a9b22f79981db 100644 --- a/org.framed.iorm.editpolicymodel/model/editpolicymodel.ecore +++ b/org.framed.iorm.editpolicymodel/model/editpolicymodel.ecore @@ -107,6 +107,7 @@ <eLiterals name="DataType" value="15"/> <eLiterals name="Cyclic" value="16"/> <eLiterals name="NaturalType" value="17"/> + <eLiterals name="Total" value="18"/> </eClassifiers> <eClassifiers xsi:type="ecore:EEnum" name="FeatureNameEnum"> <eLiterals name="Roles"/> diff --git a/org.framed.iorm.editpolicymodel/model/representations.aird b/org.framed.iorm.editpolicymodel/model/representations.aird index 185f396385199a9b8281ab46a3bfdb6398c41927..7f78c749a773a769fcf05b9fe62c75ef897c020f 100644 --- a/org.framed.iorm.editpolicymodel/model/representations.aird +++ b/org.framed.iorm.editpolicymodel/model/representations.aird @@ -476,6 +476,10 @@ <styles xmi:type="notation:FontStyle" xmi:id="_GA6vYS5_Eeiwr8bZ0uTz8g" fontName="Cantarell" fontHeight="8"/> <layoutConstraint xmi:type="notation:Location" xmi:id="_GA6vYi5_Eeiwr8bZ0uTz8g"/> </children> + <children xmi:type="notation:Node" xmi:id="_m9RgMGyPEei7QNUjVddctQ" type="3010" element="_m7-fsGyPEei7QNUjVddctQ"> + <styles xmi:type="notation:FontStyle" xmi:id="_m9RgMWyPEei7QNUjVddctQ" fontName="Cantarell" fontHeight="8"/> + <layoutConstraint xmi:type="notation:Location" xmi:id="_m9RgMmyPEei7QNUjVddctQ"/> + </children> <styles xmi:type="notation:SortingStyle" xmi:id="_wnkmgS5uEeiwr8bZ0uTz8g"/> <styles xmi:type="notation:FilteringStyle" xmi:id="_wnkmgi5uEeiwr8bZ0uTz8g"/> </children> @@ -2401,6 +2405,14 @@ </ownedStyle> <actualMapping xmi:type="description_1:NodeMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EEnum']/@subNodeMappings[name='EC%20EEnumLiteral']"/> </ownedElements> + <ownedElements xmi:type="diagram:DNodeListElement" xmi:id="_m7-fsGyPEei7QNUjVddctQ" name="Total" tooltipText=""> + <target xmi:type="ecore:EEnumLiteral" href="editpolicymodel.ecore#//TypeEnum/Total"/> + <semanticElements xmi:type="ecore:EEnumLiteral" href="editpolicymodel.ecore#//TypeEnum/Total"/> + <ownedStyle xmi:type="diagram:BundledImage" xmi:id="_m7_GwGyPEei7QNUjVddctQ" labelAlignment="LEFT"> + <description xmi:type="style:BundledImageDescription" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EEnum']/@subNodeMappings[name='EC%20EEnumLiteral']/@style"/> + </ownedStyle> + <actualMapping xmi:type="description_1:NodeMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EEnum']/@subNodeMappings[name='EC%20EEnumLiteral']"/> + </ownedElements> </ownedDiagramElements> <ownedDiagramElements xmi:type="diagram:DNodeList" xmi:id="_cSu3gC5yEeiwr8bZ0uTz8g" name="FeatureNameEnum" tooltipText="" width="12" height="10"> <target xmi:type="ecore:EEnum" href="editpolicymodel.ecore#//FeatureNameEnum"/> diff --git a/org.framed.iorm.editpolicymodel/src/editpolicymodel/TypeEnum.java b/org.framed.iorm.editpolicymodel/src/editpolicymodel/TypeEnum.java index 85d3f3c126bb019d1612f5355c50080b3c2414c8..0b95e02bd98f05180d53c2df0d78361f38f7d5d0 100644 --- a/org.framed.iorm.editpolicymodel/src/editpolicymodel/TypeEnum.java +++ b/org.framed.iorm.editpolicymodel/src/editpolicymodel/TypeEnum.java @@ -196,7 +196,15 @@ public enum TypeEnum implements Enumerator { * @generated * @ordered */ - NATURAL_TYPE(17, "NaturalType", "NaturalType"); + NATURAL_TYPE(17, "NaturalType", "NaturalType"), /** + * The '<em><b>Total</b></em>' literal object. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #TOTAL_VALUE + * @generated + * @ordered + */ + TOTAL(18, "Total", "Total"); /** * The '<em><b>Acyclic</b></em>' literal value. @@ -468,6 +476,21 @@ public enum TypeEnum implements Enumerator { */ public static final int NATURAL_TYPE_VALUE = 17; + /** + * The '<em><b>Total</b></em>' literal value. + * <!-- begin-user-doc --> + * <p> + * If the meaning of '<em><b>Total</b></em>' literal object isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @see #TOTAL + * @model name="Total" + * @generated + * @ordered + */ + public static final int TOTAL_VALUE = 18; + /** * An array of all the '<em><b>Type Enum</b></em>' enumerators. * <!-- begin-user-doc --> @@ -494,6 +517,7 @@ public enum TypeEnum implements Enumerator { DATA_TYPE, CYCLIC, NATURAL_TYPE, + TOTAL, }; /** @@ -568,6 +592,7 @@ public enum TypeEnum implements Enumerator { case DATA_TYPE_VALUE: return DATA_TYPE; case CYCLIC_VALUE: return CYCLIC; case NATURAL_TYPE_VALUE: return NATURAL_TYPE; + case TOTAL_VALUE: return TOTAL; } return null; } diff --git a/org.framed.iorm.editpolicymodel/src/editpolicymodel/impl/editpolicymodelPackageImpl.java b/org.framed.iorm.editpolicymodel/src/editpolicymodel/impl/editpolicymodelPackageImpl.java index a1d60d2dae61adaac8e9cb3d6cdc952f1e3cd569..827c3e6312e0f30c7d318d054922c99ba3378478 100644 --- a/org.framed.iorm.editpolicymodel/src/editpolicymodel/impl/editpolicymodelPackageImpl.java +++ b/org.framed.iorm.editpolicymodel/src/editpolicymodel/impl/editpolicymodelPackageImpl.java @@ -1153,6 +1153,7 @@ public class editpolicymodelPackageImpl extends EPackageImpl implements editpoli addEEnumLiteral(typeEnumEEnum, TypeEnum.DATA_TYPE); addEEnumLiteral(typeEnumEEnum, TypeEnum.CYCLIC); addEEnumLiteral(typeEnumEEnum, TypeEnum.NATURAL_TYPE); + addEEnumLiteral(typeEnumEEnum, TypeEnum.TOTAL); initEEnum(featureNameEnumEEnum, FeatureNameEnum.class, "FeatureNameEnum"); addEEnumLiteral(featureNameEnumEEnum, FeatureNameEnum.ROLES); diff --git a/org.framed.iorm.ui/core/fulfillment/Fulfillment.ecl b/org.framed.iorm.ui/core/fulfillment/Fulfillment.ecl index 11f2042238d930de3e3aca12f8620ddb82a112b3..008551c99723cd5c1604b8a2ea6dd687b7a414bc 100644 --- a/org.framed.iorm.ui/core/fulfillment/Fulfillment.ecl +++ b/org.framed.iorm.ui/core/fulfillment/Fulfillment.ecl @@ -1,9 +1,16 @@ //Fullfillment or Players?? -Add Fulfillment (Naturals) when IsSourceType(NaturalType) and IsTargetType(CompartmentType); Start Fulfillment (Naturals) when IsSourceType(NaturalType); -Add Fulfillment (Roles) when IsSourceType(RoleType) and IsTargetType(CompartmentType); +Add Fulfillment (Naturals) when IsSourceType(NaturalType) and IsTargetType(CompartmentType); +Reconnect Fulfillment (Naturals) when IsSourceType(NaturalType) and IsTargetType(CompartmentType); + Start Fulfillment (Roles) when IsSourceType(RoleType); -Add Fulfillment (Compartments) when IsSourceType(CompartmentType) and IsTargetType(CompartmentType) and !SourceEqualsTarget(); +Add Fulfillment (Roles) when IsSourceType(RoleType) and IsTargetType(CompartmentType); +Reconnect Fulfillment (Roles) when IsSourceType(RoleType) and IsTargetType(CompartmentType); + Start Fulfillment (Compartments) when IsSourceType(CompartmentType); +Add Fulfillment (Compartments) when IsSourceType(CompartmentType) and IsTargetType(CompartmentType) and !SourceEqualsTarget(); +Reconnect Fulfillment (Compartments) when IsSourceType(CompartmentType) and IsTargetType(CompartmentType) and !SourceEqualsTarget(); + +Start Fulfillment (Dates) when IsSourceType(DataType); Add Fulfillment (Dates) when IsSourceType(DataType); -Start Fulfillment (Dates) when IsSourceType(DataType); \ No newline at end of file +Reconnect Fulfillment (Dates) when IsSourceType(DataType); \ No newline at end of file diff --git a/org.framed.iorm.ui/core/fulfillment/Fulfillment.editpolicy b/org.framed.iorm.ui/core/fulfillment/Fulfillment.editpolicy index 25b8fe586a1b12a719812f7f838e305e87790112..c513e6b05f94b8017ac93042258f47eeb799efad 100644 --- a/org.framed.iorm.ui/core/fulfillment/Fulfillment.editpolicy +++ b/org.framed.iorm.ui/core/fulfillment/Fulfillment.editpolicy @@ -1,5 +1,9 @@ <?xml version="1.0" encoding="ASCII"?> <editpolicymodel:Model xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:editpolicymodel="http://framed/editpolicymodel"> + <policies action="Start" actionType="Fulfillment"> + <featureRule xsi:type="editpolicymodel:IsFeature" featureName="Naturals"/> + <constraintRule xsi:type="editpolicymodel:IsSourceType" type="NaturalType"/> + </policies> <policies action="Add" actionType="Fulfillment"> <featureRule xsi:type="editpolicymodel:IsFeature" featureName="Naturals"/> <constraintRule xsi:type="editpolicymodel:AndConstraintRule"> @@ -7,9 +11,16 @@ <rules xsi:type="editpolicymodel:IsTargetType" type="CompartmentType"/> </constraintRule> </policies> - <policies action="Start" actionType="Fulfillment"> + <policies action="Reconnect" actionType="Fulfillment"> <featureRule xsi:type="editpolicymodel:IsFeature" featureName="Naturals"/> - <constraintRule xsi:type="editpolicymodel:IsSourceType" type="NaturalType"/> + <constraintRule xsi:type="editpolicymodel:AndConstraintRule"> + <rules xsi:type="editpolicymodel:IsSourceType" type="NaturalType"/> + <rules xsi:type="editpolicymodel:IsTargetType" type="CompartmentType"/> + </constraintRule> + </policies> + <policies action="Start" actionType="Fulfillment"> + <featureRule xsi:type="editpolicymodel:IsFeature"/> + <constraintRule xsi:type="editpolicymodel:IsSourceType" type="RoleType"/> </policies> <policies action="Add" actionType="Fulfillment"> <featureRule xsi:type="editpolicymodel:IsFeature"/> @@ -18,9 +29,16 @@ <rules xsi:type="editpolicymodel:IsTargetType" type="CompartmentType"/> </constraintRule> </policies> - <policies action="Start" actionType="Fulfillment"> + <policies action="Reconnect" actionType="Fulfillment"> <featureRule xsi:type="editpolicymodel:IsFeature"/> - <constraintRule xsi:type="editpolicymodel:IsSourceType" type="RoleType"/> + <constraintRule xsi:type="editpolicymodel:AndConstraintRule"> + <rules xsi:type="editpolicymodel:IsSourceType" type="RoleType"/> + <rules xsi:type="editpolicymodel:IsTargetType" type="CompartmentType"/> + </constraintRule> + </policies> + <policies action="Start" actionType="Fulfillment"> + <featureRule xsi:type="editpolicymodel:IsFeature" featureName="Compartments"/> + <constraintRule xsi:type="editpolicymodel:IsSourceType" type="CompartmentType"/> </policies> <policies action="Add" actionType="Fulfillment"> <featureRule xsi:type="editpolicymodel:IsFeature" featureName="Compartments"/> @@ -34,15 +52,27 @@ </rules> </constraintRule> </policies> - <policies action="Start" actionType="Fulfillment"> + <policies action="Reconnect" actionType="Fulfillment"> <featureRule xsi:type="editpolicymodel:IsFeature" featureName="Compartments"/> - <constraintRule xsi:type="editpolicymodel:IsSourceType" type="CompartmentType"/> + <constraintRule xsi:type="editpolicymodel:AndConstraintRule"> + <rules xsi:type="editpolicymodel:AndConstraintRule"> + <rules xsi:type="editpolicymodel:IsSourceType" type="CompartmentType"/> + <rules xsi:type="editpolicymodel:IsTargetType" type="CompartmentType"/> + </rules> + <rules xsi:type="editpolicymodel:NotConstraintRule"> + <rule xsi:type="editpolicymodel:SourceEqualsTarget"/> + </rules> + </constraintRule> + </policies> + <policies action="Start" actionType="Fulfillment"> + <featureRule xsi:type="editpolicymodel:IsFeature" featureName="Dates"/> + <constraintRule xsi:type="editpolicymodel:IsSourceType" type="DataType"/> </policies> <policies action="Add" actionType="Fulfillment"> <featureRule xsi:type="editpolicymodel:IsFeature" featureName="Dates"/> <constraintRule xsi:type="editpolicymodel:IsSourceType" type="DataType"/> </policies> - <policies action="Start" actionType="Fulfillment"> + <policies action="Reconnect" actionType="Fulfillment"> <featureRule xsi:type="editpolicymodel:IsFeature" featureName="Dates"/> <constraintRule xsi:type="editpolicymodel:IsSourceType" type="DataType"/> </policies> diff --git a/org.framed.iorm.ui/core/fulfillment/FulfillmentPattern.java b/org.framed.iorm.ui/core/fulfillment/FulfillmentPattern.java index e7d9e250bc5e60907e76d132f2f690e231f83c08..0d8d86ab6592cb7f873bbdfe38453d539f3872d3 100644 --- a/org.framed.iorm.ui/core/fulfillment/FulfillmentPattern.java +++ b/org.framed.iorm.ui/core/fulfillment/FulfillmentPattern.java @@ -42,13 +42,6 @@ import org.framed.iorm.ui.palette.ViewVisibility; */ public class FulfillmentPattern extends FRaMEDConnectionPattern { - //TODO To be delete when the type checks are done by the edit policies - /** - * the lists of types for which a fulfillment is applicable - */ - List<Type> sourceTypes = Arrays.asList(Type.NATURAL_TYPE, Type.DATA_TYPE, Type.COMPARTMENT_TYPE, Type.ROLE_TYPE), - targetTypes = Arrays.asList(Type.COMPARTMENT_TYPE); - /** * the object to get names, ids and so on for this feature */ @@ -91,10 +84,7 @@ public class FulfillmentPattern extends FRaMEDConnectionPattern { Anchor newAnchor = context.getNewAnchor(); org.framed.iorm.model.ModelElement newShape = UIUtil.getModelElementForAnchor(newAnchor); if(newShape != null) { - if(context.getReconnectType() == ReconnectionContext.RECONNECT_SOURCE) - return sourceTypes.contains(newShape.getType()) && EditPolicyService.getHandler(this.getDiagram()).canReconnect(context, Type.FULFILLMENT); - else - return targetTypes.contains(newShape.getType()) && EditPolicyService.getHandler(this.getDiagram()).canReconnect(context, Type.FULFILLMENT); + return EditPolicyService.getHandler(this.getDiagram()).canReconnect(context, newShape.getType()); } return false; } @@ -130,8 +120,7 @@ public class FulfillmentPattern extends FRaMEDConnectionPattern { public boolean canAdd(IAddContext addContext) { if (addContext.getNewObject() instanceof Relation) { Relation relation = (Relation) addContext.getNewObject(); - if (relation.getType() == Type.FULFILLMENT) - return EditPolicyService.getHandler(this.getDiagram()).canAdd(addContext, relation.getType()); + return EditPolicyService.getHandler(this.getDiagram()).canAdd(addContext, relation.getType()); } return false; } @@ -210,8 +199,7 @@ public class FulfillmentPattern extends FRaMEDConnectionPattern { org.framed.iorm.model.ModelElement targetShape = UIUtil.getModelElementForAnchor(targetAnchor); if (sourceShape != null && targetShape != null) { if (sourceShape.getContainer() == targetShape.getContainer()) { - if (targetTypes.contains(targetShape.getType())) - return EditPolicyService.getHandler(this.getDiagram()).canCreate(createContext, this.modelType); + return EditPolicyService.getHandler(this.getDiagram()).canCreate(createContext, this.modelType); } } return false; @@ -231,8 +219,7 @@ public class FulfillmentPattern extends FRaMEDConnectionPattern { Anchor sourceAnchor = createContext.getSourceAnchor(); org.framed.iorm.model.ModelElement sourceShape = UIUtil.getModelElementForAnchor(sourceAnchor); if (sourceShape != null) { - // if(sourceTypes.contains(sourceShape.getType())) - return EditPolicyService.getHandler(this.getDiagram()).canStart(createContext, Type.FULFILLMENT); + return EditPolicyService.getHandler(this.getDiagram()).canStart(createContext, Type.FULFILLMENT); } return false; } diff --git a/org.framed.iorm.ui/core/inheritance/Inheritance.ecl b/org.framed.iorm.ui/core/inheritance/Inheritance.ecl new file mode 100644 index 0000000000000000000000000000000000000000..b8562dd24b11cbe2362c733b8e2efb60438c653a --- /dev/null +++ b/org.framed.iorm.ui/core/inheritance/Inheritance.ecl @@ -0,0 +1,4 @@ +//Inheritance +Start Inheritance (Naturals) when IsSourceType(NaturalType); +Add Inheritance (Naturals) when IsSourceType(NaturalType) and SourceEqualsTargetType(); +Reconnect Inheritance (Naturals) when IsSourceType(NaturalType) and SourceEqualsTargetType(); \ No newline at end of file diff --git a/org.framed.iorm.ui/core/inheritance/Inheritance.editpolicy b/org.framed.iorm.ui/core/inheritance/Inheritance.editpolicy new file mode 100644 index 0000000000000000000000000000000000000000..10d72b9ceff4e457edd929a9505d5ed9a86d0091 --- /dev/null +++ b/org.framed.iorm.ui/core/inheritance/Inheritance.editpolicy @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="ASCII"?> +<editpolicymodel:Model xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:editpolicymodel="http://framed/editpolicymodel"> + <policies action="Start" actionType="Inheritance"> + <featureRule xsi:type="editpolicymodel:IsFeature" featureName="Naturals"/> + <constraintRule xsi:type="editpolicymodel:IsSourceType" type="NaturalType"/> + </policies> + <policies action="Add" actionType="Inheritance"> + <featureRule xsi:type="editpolicymodel:IsFeature" featureName="Naturals"/> + <constraintRule xsi:type="editpolicymodel:AndConstraintRule"> + <rules xsi:type="editpolicymodel:IsSourceType" type="NaturalType"/> + <rules xsi:type="editpolicymodel:SourceEqualsTargetType"/> + </constraintRule> + </policies> + <policies action="Reconnect" actionType="Inheritance"> + <featureRule xsi:type="editpolicymodel:IsFeature" featureName="Naturals"/> + <constraintRule xsi:type="editpolicymodel:AndConstraintRule"> + <rules xsi:type="editpolicymodel:IsSourceType" type="NaturalType"/> + <rules xsi:type="editpolicymodel:SourceEqualsTargetType"/> + </constraintRule> + </policies> +</editpolicymodel:Model> diff --git a/org.framed.iorm.ui/core/inheritance/InheritancePattern.java b/org.framed.iorm.ui/core/inheritance/InheritancePattern.java index 5b6109860c2898a71a7fc95d077774b57648bda2..b3268ec1b8d479e5e061f0171ec150237d07e787 100644 --- a/org.framed.iorm.ui/core/inheritance/InheritancePattern.java +++ b/org.framed.iorm.ui/core/inheritance/InheritancePattern.java @@ -37,14 +37,7 @@ import org.framed.iorm.ui.palette.ViewVisibility; * (2) adding inheritances to the diagram, especially their pictogram elements<br> * @author Kevin Kassin */ -public class InheritancePattern extends FRaMEDConnectionPattern { - - //TODO To be delete when the type checks are done by the edit policies - /** - * the lists of types for which a inheritance is applicable - */ - List<Type> types = Arrays.asList(Type.NATURAL_TYPE, Type.DATA_TYPE, Type.COMPARTMENT_TYPE, Type.ROLE_TYPE); - +public class InheritancePattern extends FRaMEDConnectionPattern { /** * the object to get names, ids and so on for this feature */ @@ -184,9 +177,9 @@ public class InheritancePattern extends FRaMEDConnectionPattern { org.framed.iorm.model.Shape sourceShape = (org.framed.iorm.model.Shape) source; org.framed.iorm.model.Shape targetShape = (org.framed.iorm.model.Shape) target; if(sourceShape != null && targetShape != null && sM == tM) { - if(types.contains(sourceShape.getType())) //TODO: Remove these tests and defer them to the EditPolicyHandler - return EditPolicyService.getHandler(this.getDiagram()).canCreate(createContext, Type.INHERITANCE); - } } + return EditPolicyService.getHandler(this.getDiagram()).canCreate(createContext, Type.INHERITANCE); + } + } return false; } @@ -205,9 +198,8 @@ public class InheritancePattern extends FRaMEDConnectionPattern { if(source instanceof org.framed.iorm.model.Shape) { org.framed.iorm.model.Shape sourceShape = (org.framed.iorm.model.Shape) source; if(sourceShape.getFirstSegment() != null && sourceShape.getSecondSegment() !=null) { - if(sourceShape != null){ - if(types.contains(sourceShape.getType())) //TODO: Remove this tests and defer them to the EditPolicyHandler - return EditPolicyService.getHandler(this.getDiagram()).canStart(createContext, Type.INHERITANCE); + if(sourceShape != null){ + return EditPolicyService.getHandler(this.getDiagram()).canStart(createContext, Type.INHERITANCE); } } } return false; } diff --git a/org.framed.iorm.ui/modules/compartment/playing_own_roles/PlayingOwnRoles.ecl b/org.framed.iorm.ui/modules/compartment/playing_own_roles/PlayingOwnRoles.ecl index 343a77e1d86e3a514025638a163a570f4256cd92..a8e6ca779c3a2e209969e4992be236be0e8d9a9c 100644 --- a/org.framed.iorm.ui/modules/compartment/playing_own_roles/PlayingOwnRoles.ecl +++ b/org.framed.iorm.ui/modules/compartment/playing_own_roles/PlayingOwnRoles.ecl @@ -1,3 +1,4 @@ //Playing_own_roles -Start Fulfillment (Playable_by_Defining_Compartment) when IsSourceType(CompartmentType); //sourceEqualsTarget not available on Start -Add Fulfillment (Playable_by_Defining_Compartment) when IsSourceType(CompartmentType) and SourceEqualsTarget(); \ No newline at end of file +Start Fulfillment (Playable_by_Defining_Compartment) when IsSourceType(CompartmentType); +Add Fulfillment (Playable_by_Defining_Compartment) when IsSourceType(CompartmentType) and SourceEqualsTargetType(); +Reconnect Fulfillment (Playable_by_Defining_Compartment) when IsSourceType(CompartmentType) and SourceEqualsTargetType(); \ No newline at end of file diff --git a/org.framed.iorm.ui/modules/compartment/playing_own_roles/PlayingOwnRoles.editpolicy b/org.framed.iorm.ui/modules/compartment/playing_own_roles/PlayingOwnRoles.editpolicy index a780f41882fedb6b2b6028e3406c8b05bf262698..0cd9d7753709c8021e627c6409c78d712e198a26 100644 --- a/org.framed.iorm.ui/modules/compartment/playing_own_roles/PlayingOwnRoles.editpolicy +++ b/org.framed.iorm.ui/modules/compartment/playing_own_roles/PlayingOwnRoles.editpolicy @@ -8,7 +8,14 @@ <featureRule xsi:type="editpolicymodel:IsFeature" featureName="Playable_by_Defining_Compartment"/> <constraintRule xsi:type="editpolicymodel:AndConstraintRule"> <rules xsi:type="editpolicymodel:IsSourceType" type="CompartmentType"/> - <rules xsi:type="editpolicymodel:SourceEqualsTarget"/> + <rules xsi:type="editpolicymodel:SourceEqualsTargetType"/> + </constraintRule> + </policies> + <policies action="Reconnect" actionType="Fulfillment"> + <featureRule xsi:type="editpolicymodel:IsFeature" featureName="Playable_by_Defining_Compartment"/> + <constraintRule xsi:type="editpolicymodel:AndConstraintRule"> + <rules xsi:type="editpolicymodel:IsSourceType" type="CompartmentType"/> + <rules xsi:type="editpolicymodel:SourceEqualsTargetType"/> </constraintRule> </policies> </editpolicymodel:Model> diff --git a/org.framed.iorm.ui/modules/datatype/inheritance/DataTypeInheritance.ecl b/org.framed.iorm.ui/modules/datatype/inheritance/DataTypeInheritance.ecl index 625f62ad8ba7beccdc503f22b6cbad5514c534cd..2d883b001a226dc20b33ecba556fda3045b4c77e 100644 --- a/org.framed.iorm.ui/modules/datatype/inheritance/DataTypeInheritance.ecl +++ b/org.framed.iorm.ui/modules/datatype/inheritance/DataTypeInheritance.ecl @@ -1,3 +1,4 @@ //Inheritance or Role_Inheritance/Data_Type_Inheritance/Compartment_Inheritance Start Inheritance (Data_Type_Inheritance) when IsSourceType(DataType); -Add Inheritance (Data_Type_Inheritance) when IsSourceType(DataType) and !SourceEqualsTarget() and SourceEqualsTargetType(); // check acyclic \ No newline at end of file +Add Inheritance (Data_Type_Inheritance) when IsSourceType(DataType) and !SourceEqualsTarget() and SourceEqualsTargetType(); // check acyclic +Reconnect Inheritance (Data_Type_Inheritance) when IsSourceType(DataType) and !SourceEqualsTarget() and SourceEqualsTargetType(); // check acyclic \ No newline at end of file diff --git a/org.framed.iorm.ui/modules/datatype/inheritance/DataTypeInheritance.editpolicy b/org.framed.iorm.ui/modules/datatype/inheritance/DataTypeInheritance.editpolicy index 8813a4785c24273dbab9ae5238f83afce0e438d9..49d98fc4e5a9cf589bef095e4329c2ed5632dc37 100644 --- a/org.framed.iorm.ui/modules/datatype/inheritance/DataTypeInheritance.editpolicy +++ b/org.framed.iorm.ui/modules/datatype/inheritance/DataTypeInheritance.editpolicy @@ -16,4 +16,16 @@ <rules xsi:type="editpolicymodel:SourceEqualsTargetType"/> </constraintRule> </policies> + <policies action="Reconnect" actionType="Inheritance"> + <featureRule xsi:type="editpolicymodel:IsFeature" featureName="Data_Type_Inheritance"/> + <constraintRule xsi:type="editpolicymodel:AndConstraintRule"> + <rules xsi:type="editpolicymodel:AndConstraintRule"> + <rules xsi:type="editpolicymodel:IsSourceType" type="DataType"/> + <rules xsi:type="editpolicymodel:NotConstraintRule"> + <rule xsi:type="editpolicymodel:SourceEqualsTarget"/> + </rules> + </rules> + <rules xsi:type="editpolicymodel:SourceEqualsTargetType"/> + </constraintRule> + </policies> </editpolicymodel:Model> diff --git a/org.framed.iorm.ui/modules/relationship/Relationship.ecl b/org.framed.iorm.ui/modules/relationship/Relationship.ecl index 7ced21f03b49d4d4e5ec241d7664b383a76d58c3..e7ce2db40232303cb6aa839fb4e42338a0b4e44c 100644 --- a/org.framed.iorm.ui/modules/relationship/Relationship.ecl +++ b/org.framed.iorm.ui/modules/relationship/Relationship.ecl @@ -1,6 +1,8 @@ //Relationships Start Relationship (Relationships) when true; Add Relationship (Relationships) when true; +Reconnect Relationship (Relationships) when true; Start Relationship (true) when IsSourceType(RoleType);//For Relationship-Relation Source and Target must be Role-Type -Add Relationship (true) when IsTargetType(RoleType) and IsSourceType(RoleType); \ No newline at end of file +Add Relationship (true) when IsTargetType(RoleType) and IsSourceType(RoleType); +Reconnect Relationship (true) when IsTargetType(RoleType) and IsSourceType(RoleType); \ No newline at end of file diff --git a/org.framed.iorm.ui/modules/relationship/Relationship.editpolicy b/org.framed.iorm.ui/modules/relationship/Relationship.editpolicy index 46fa4fd4500dedf31230133779214588458f7376..01a89e9e51e54acdad2e9b4d77d758c45d295e5b 100644 --- a/org.framed.iorm.ui/modules/relationship/Relationship.editpolicy +++ b/org.framed.iorm.ui/modules/relationship/Relationship.editpolicy @@ -8,6 +8,10 @@ <featureRule xsi:type="editpolicymodel:IsFeature" featureName="Relationships"/> <constraintRule xsi:type="editpolicymodel:TrueConstraintRule"/> </policies> + <policies action="Reconnect" actionType="Relationship"> + <featureRule xsi:type="editpolicymodel:IsFeature" featureName="Relationships"/> + <constraintRule xsi:type="editpolicymodel:TrueConstraintRule"/> + </policies> <policies action="Start" actionType="Relationship"> <featureRule xsi:type="editpolicymodel:TrueFeatureRule"/> <constraintRule xsi:type="editpolicymodel:IsSourceType" type="RoleType"/> @@ -19,4 +23,11 @@ <rules xsi:type="editpolicymodel:IsSourceType" type="RoleType"/> </constraintRule> </policies> + <policies action="Reconnect" actionType="Relationship"> + <featureRule xsi:type="editpolicymodel:TrueFeatureRule"/> + <constraintRule xsi:type="editpolicymodel:AndConstraintRule"> + <rules xsi:type="editpolicymodel:IsTargetType" type="RoleType"/> + <rules xsi:type="editpolicymodel:IsSourceType" type="RoleType"/> + </constraintRule> + </policies> </editpolicymodel:Model> diff --git a/org.framed.iorm.ui/modules/relationship/RelationshipPattern.java b/org.framed.iorm.ui/modules/relationship/RelationshipPattern.java index a964fb558790af3df8b208954363e4f3fbac3cbd..7a292c185d189d49567ee2cb2fb096c58237bebf 100644 --- a/org.framed.iorm.ui/modules/relationship/RelationshipPattern.java +++ b/org.framed.iorm.ui/modules/relationship/RelationshipPattern.java @@ -51,12 +51,6 @@ import org.framed.iorm.ui.palette.ViewVisibility; */ public class RelationshipPattern extends FRaMEDConnectionPattern { - //TODO To be delete when the type checks are done by the edit policies - /** - * the list of types for which a realtionship is applicable - */ - List<Type> types = Arrays.asList(Type.ROLE_TYPE); - /** * the object to get names, ids and so on for this feature */ @@ -107,8 +101,9 @@ public class RelationshipPattern extends FRaMEDConnectionPattern { public boolean canReconnect(IReconnectionContext context) { Anchor newAnchor = context.getNewAnchor(); org.framed.iorm.model.ModelElement newShape = UIUtil.getModelElementForAnchor(newAnchor); - if(newShape != null) - return types.contains(newShape.getType()); + if(newShape != null) { + return EditPolicyService.getHandler(this.getDiagram()).canReconnect(context, newShape.getType()); + } return false; } @@ -171,9 +166,8 @@ public class RelationshipPattern extends FRaMEDConnectionPattern { public boolean canAdd(IAddContext addContext) { if(addContext.getNewObject() instanceof Relation) { Relation relation = (Relation) addContext.getNewObject(); - if(relation.getType() == Type.RELATIONSHIP) { return EditPolicyService.getHandler(this.getDiagram()).canAdd(addContext, relation.getType()); - } } + } return false; } @@ -296,9 +290,7 @@ public class RelationshipPattern extends FRaMEDConnectionPattern { org.framed.iorm.model.ModelElement sourceShape = UIUtil.getModelElementForAnchor(sourceAnchor); org.framed.iorm.model.ModelElement targetShape = UIUtil.getModelElementForAnchor(targetAnchor); if(sourceShape != null && targetShape != null) { - if(types.contains(sourceShape.getType())) - if(targetShape.getType() == sourceShape.getType()) - return EditPolicyService.getHandler(this.getDiagram()).canCreate(createContext, Type.RELATIONSHIP); + return EditPolicyService.getHandler(this.getDiagram()).canCreate(createContext, Type.RELATIONSHIP); } return false; } @@ -316,8 +308,7 @@ public class RelationshipPattern extends FRaMEDConnectionPattern { Anchor sourceAnchor = createContext.getSourceAnchor(); org.framed.iorm.model.ModelElement sourceShape = UIUtil.getModelElementForAnchor(sourceAnchor); if(sourceShape != null){ - if(types.contains(sourceShape.getType())) - return true; + return EditPolicyService.getHandler(this.getDiagram()).canStart(createContext, sourceShape.getType()); } return false; } diff --git a/org.framed.iorm.ui/modules/relationship/inter_relationship_constraints/AbstractInterRelationshipConstraintPattern.java b/org.framed.iorm.ui/modules/relationship/inter_relationship_constraints/AbstractInterRelationshipConstraintPattern.java index ce8cc44ddb791f50d01080e50f3168c62b8fef53..8a65a02940c47841e5b520b7bb8c18862d10b981 100644 --- a/org.framed.iorm.ui/modules/relationship/inter_relationship_constraints/AbstractInterRelationshipConstraintPattern.java +++ b/org.framed.iorm.ui/modules/relationship/inter_relationship_constraints/AbstractInterRelationshipConstraintPattern.java @@ -76,9 +76,9 @@ public abstract class AbstractInterRelationshipConstraintPattern extends FRaMEDC public boolean canReconnect(IReconnectionContext context) { Anchor newAnchor = context.getNewAnchor(); org.framed.iorm.model.ModelElement newRelation = UIUtil.getModelElementForAnchor(newAnchor); - if(newRelation != null) - //return (newRelation.getType() == Type.RELATIONSHIP); + if(newRelation != null) { return EditPolicyService.getHandler(this.getDiagram()).canReconnect(context, newRelation.getType()); + } return false; } diff --git a/org.framed.iorm.ui/modules/relationship/inter_relationship_constraints/InterRelationship.ecl b/org.framed.iorm.ui/modules/relationship/inter_relationship_constraints/InterRelationship.ecl index e846307e8b64362f01457d81c6a15144bf3298d2..4eafbaffe1ee1330b7afd97495e990dc182ac961 100644 --- a/org.framed.iorm.ui/modules/relationship/inter_relationship_constraints/InterRelationship.ecl +++ b/org.framed.iorm.ui/modules/relationship/inter_relationship_constraints/InterRelationship.ecl @@ -1,15 +1,8 @@ //InterRelationship -Add RelationshipExclusion (Inter_Relationship_Constraints) when true; Start RelationshipExclusion (Inter_Relationship_Constraints) when true; -Add RelationshipImplication (Inter_Relationship_Constraints) when true; -Start RelationshipImplication (Inter_Relationship_Constraints) when true; +Add RelationshipExclusion (Inter_Relationship_Constraints) when true; +Reconnect RelationshipExclusion (Inter_Relationship_Constraints) when true; - -//IntraRelationshipConstraint -/* - * Irreflexive, Acyclic, cyclic, ... - */ -Add Irreflexive (Intra_Relationship_Constraints) when true; -Start Irreflexive (Intra_Relationship_Constraints) when true; -Add Irreflexive (Intra_Relationship_Constraints) when true; -Start Irreflexive (Intra_Relationship_Constraints) when true; +Start RelationshipImplication (Inter_Relationship_Constraints) when true; +Add RelationshipImplication (Inter_Relationship_Constraints) when true; +Reconnect RelationshipImplication (Inter_Relationship_Constraints) when true; diff --git a/org.framed.iorm.ui/modules/relationship/inter_relationship_constraints/InterRelationship.editpolicy b/org.framed.iorm.ui/modules/relationship/inter_relationship_constraints/InterRelationship.editpolicy index e1ca26c4231a435c667edae3fe0ce5a1a6995900..7eff6c62212144743b3c1a193c1e51982ca71253 100644 --- a/org.framed.iorm.ui/modules/relationship/inter_relationship_constraints/InterRelationship.editpolicy +++ b/org.framed.iorm.ui/modules/relationship/inter_relationship_constraints/InterRelationship.editpolicy @@ -1,14 +1,14 @@ <?xml version="1.0" encoding="ASCII"?> <editpolicymodel:Model xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:editpolicymodel="http://framed/editpolicymodel"> - <policies action="Add" actionType="RelationshipExclusion"> + <policies action="Start" actionType="RelationshipExclusion"> <featureRule xsi:type="editpolicymodel:IsFeature" featureName="Inter_Relationship_Constraints"/> <constraintRule xsi:type="editpolicymodel:TrueConstraintRule"/> </policies> - <policies action="Start" actionType="RelationshipExclusion"> + <policies action="Add" actionType="RelationshipExclusion"> <featureRule xsi:type="editpolicymodel:IsFeature" featureName="Inter_Relationship_Constraints"/> <constraintRule xsi:type="editpolicymodel:TrueConstraintRule"/> </policies> - <policies action="Add" actionType="RelationshipImplication"> + <policies action="Reconnect" actionType="RelationshipExclusion"> <featureRule xsi:type="editpolicymodel:IsFeature" featureName="Inter_Relationship_Constraints"/> <constraintRule xsi:type="editpolicymodel:TrueConstraintRule"/> </policies> @@ -16,20 +16,12 @@ <featureRule xsi:type="editpolicymodel:IsFeature" featureName="Inter_Relationship_Constraints"/> <constraintRule xsi:type="editpolicymodel:TrueConstraintRule"/> </policies> - <policies action="Add" actionType="Irreflexive"> - <featureRule xsi:type="editpolicymodel:IsFeature" featureName="Intra_Relationship_Constraints"/> - <constraintRule xsi:type="editpolicymodel:TrueConstraintRule"/> - </policies> - <policies action="Start" actionType="Irreflexive"> - <featureRule xsi:type="editpolicymodel:IsFeature" featureName="Intra_Relationship_Constraints"/> - <constraintRule xsi:type="editpolicymodel:TrueConstraintRule"/> - </policies> - <policies action="Add" actionType="Irreflexive"> - <featureRule xsi:type="editpolicymodel:IsFeature" featureName="Intra_Relationship_Constraints"/> + <policies action="Add" actionType="RelationshipImplication"> + <featureRule xsi:type="editpolicymodel:IsFeature" featureName="Inter_Relationship_Constraints"/> <constraintRule xsi:type="editpolicymodel:TrueConstraintRule"/> </policies> - <policies action="Start" actionType="Irreflexive"> - <featureRule xsi:type="editpolicymodel:IsFeature" featureName="Intra_Relationship_Constraints"/> + <policies action="Reconnect" actionType="RelationshipImplication"> + <featureRule xsi:type="editpolicymodel:IsFeature" featureName="Inter_Relationship_Constraints"/> <constraintRule xsi:type="editpolicymodel:TrueConstraintRule"/> </policies> </editpolicymodel:Model> diff --git a/org.framed.iorm.ui/modules/relationship/intra_relationship_constraints/AbstractIntraRelationshipConstraintPattern.java b/org.framed.iorm.ui/modules/relationship/intra_relationship_constraints/AbstractIntraRelationshipConstraintPattern.java index b6b3be648c6798989d20f6ddb9142b70b300a0d0..e4f86d4d3bcb3e847bc534058f67a12af8807b37 100644 --- a/org.framed.iorm.ui/modules/relationship/intra_relationship_constraints/AbstractIntraRelationshipConstraintPattern.java +++ b/org.framed.iorm.ui/modules/relationship/intra_relationship_constraints/AbstractIntraRelationshipConstraintPattern.java @@ -164,8 +164,7 @@ public abstract class AbstractIntraRelationshipConstraintPattern extends FRaMEDS if(targetConnection != null && getBusinessObjectForPictogramElement(targetConnection) instanceof Relation) { Relation relation = (Relation) getBusinessObjectForPictogramElement(targetConnection); - return relation.getType() == Type.RELATIONSHIP && - EditPolicyService.getHandler(this.getDiagram()).canCreate(createContext, Type.RELATIONSHIP); //TODO: Check actual type of Relationship Constraint + return EditPolicyService.getHandler(this.getDiagram()).canCreate(createContext, relation.getType()); } return false; } diff --git a/org.framed.iorm.ui/modules/relationship/intra_relationship_constraints/IntraRelationship.ecl b/org.framed.iorm.ui/modules/relationship/intra_relationship_constraints/IntraRelationship.ecl new file mode 100644 index 0000000000000000000000000000000000000000..092c74b111c2671b37a0ee696b45f78ade42a107 --- /dev/null +++ b/org.framed.iorm.ui/modules/relationship/intra_relationship_constraints/IntraRelationship.ecl @@ -0,0 +1,11 @@ +//IntraRelationshipConstraint +Add Irreflexive (Intra_Relationship_Constraints) when true; +Start Irreflexive (Intra_Relationship_Constraints) when true; +Add Acyclic (Intra_Relationship_Constraints) when true; +Start Acyclic (Intra_Relationship_Constraints) when true; +Add Cyclic (Intra_Relationship_Constraints) when true; +Start Cyclic (Intra_Relationship_Constraints) when true; +Add Reflexive (Intra_Relationship_Constraints) when true; +Start Reflexive (Intra_Relationship_Constraints) when true; +Add Total (Intra_Relationship_Constraints) when true; +Start Total (Intra_Relationship_Constraints) when true; diff --git a/org.framed.iorm.ui/modules/relationship/intra_relationship_constraints/IntraRelationship.editpolicy b/org.framed.iorm.ui/modules/relationship/intra_relationship_constraints/IntraRelationship.editpolicy new file mode 100644 index 0000000000000000000000000000000000000000..8a701fa18ac0e6f56e54e67014e3c3f191d7cf24 --- /dev/null +++ b/org.framed.iorm.ui/modules/relationship/intra_relationship_constraints/IntraRelationship.editpolicy @@ -0,0 +1,43 @@ +<?xml version="1.0" encoding="ASCII"?> +<editpolicymodel:Model xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:editpolicymodel="http://framed/editpolicymodel"> + <policies action="Add" actionType="Irreflexive"> + <featureRule xsi:type="editpolicymodel:IsFeature" featureName="Intra_Relationship_Constraints"/> + <constraintRule xsi:type="editpolicymodel:TrueConstraintRule"/> + </policies> + <policies action="Start" actionType="Irreflexive"> + <featureRule xsi:type="editpolicymodel:IsFeature" featureName="Intra_Relationship_Constraints"/> + <constraintRule xsi:type="editpolicymodel:TrueConstraintRule"/> + </policies> + <policies action="Add"> + <featureRule xsi:type="editpolicymodel:IsFeature" featureName="Intra_Relationship_Constraints"/> + <constraintRule xsi:type="editpolicymodel:TrueConstraintRule"/> + </policies> + <policies action="Start"> + <featureRule xsi:type="editpolicymodel:IsFeature" featureName="Intra_Relationship_Constraints"/> + <constraintRule xsi:type="editpolicymodel:TrueConstraintRule"/> + </policies> + <policies action="Add" actionType="Cyclic"> + <featureRule xsi:type="editpolicymodel:IsFeature" featureName="Intra_Relationship_Constraints"/> + <constraintRule xsi:type="editpolicymodel:TrueConstraintRule"/> + </policies> + <policies action="Start" actionType="Cyclic"> + <featureRule xsi:type="editpolicymodel:IsFeature" featureName="Intra_Relationship_Constraints"/> + <constraintRule xsi:type="editpolicymodel:TrueConstraintRule"/> + </policies> + <policies action="Add" actionType="Reflexive"> + <featureRule xsi:type="editpolicymodel:IsFeature" featureName="Intra_Relationship_Constraints"/> + <constraintRule xsi:type="editpolicymodel:TrueConstraintRule"/> + </policies> + <policies action="Start" actionType="Reflexive"> + <featureRule xsi:type="editpolicymodel:IsFeature" featureName="Intra_Relationship_Constraints"/> + <constraintRule xsi:type="editpolicymodel:TrueConstraintRule"/> + </policies> + <policies action="Add" actionType="Total"> + <featureRule xsi:type="editpolicymodel:IsFeature" featureName="Intra_Relationship_Constraints"/> + <constraintRule xsi:type="editpolicymodel:TrueConstraintRule"/> + </policies> + <policies action="Start" actionType="Total"> + <featureRule xsi:type="editpolicymodel:IsFeature" featureName="Intra_Relationship_Constraints"/> + <constraintRule xsi:type="editpolicymodel:TrueConstraintRule"/> + </policies> +</editpolicymodel:Model> diff --git a/org.framed.iorm.ui/modules/roletype/group_constraints/RoleGroup.ecl b/org.framed.iorm.ui/modules/roletype/group_constraints/RoleGroup.ecl index 68cdb6f914514a3e9c97bcce731018a21430378a..5063e0e98d356973df078281a9477c65f007438b 100644 --- a/org.framed.iorm.ui/modules/roletype/group_constraints/RoleGroup.ecl +++ b/org.framed.iorm.ui/modules/roletype/group_constraints/RoleGroup.ecl @@ -1,3 +1,3 @@ //groupConstraints/RoleGroup Add RoleGroup (Group_Constraints) when InCompartment(); -Create RoleGroup (Group_Constraints) when InCompartment(); \ No newline at end of file +Create RoleGroup (Group_Constraints) when InCompartment(); diff --git a/org.framed.iorm.ui/modules/roletype/inheritance/RoleInheritance.ecl b/org.framed.iorm.ui/modules/roletype/inheritance/RoleInheritance.ecl index 5ad798c7088b3cdf250d75e572fb8d63b00e7b65..1cf156b175c9326a5e9dc53ba13c5afd52aad285 100644 --- a/org.framed.iorm.ui/modules/roletype/inheritance/RoleInheritance.ecl +++ b/org.framed.iorm.ui/modules/roletype/inheritance/RoleInheritance.ecl @@ -1,3 +1,4 @@ //Inheritance or Role_Inheritance/Data_Type_Inheritance/Compartment_Inheritance Start Inheritance (Role_Inheritance) when IsSourceType(RoleType); -Add Inheritance (Role_Inheritance) when IsSourceType(RoleType) and !SourceEqualsTarget() and SourceEqualsTargetType(); //TODO, check acyclic \ No newline at end of file +Add Inheritance (Role_Inheritance) when IsSourceType(RoleType) and !SourceEqualsTarget() and SourceEqualsTargetType(); //TODO, check acyclic +Reconnect Inheritance (Role_Inheritance) when IsSourceType(RoleType) and !SourceEqualsTarget() and SourceEqualsTargetType(); //TODO, check acyclic \ No newline at end of file diff --git a/org.framed.iorm.ui/modules/roletype/inheritance/RoleInheritance.editpolicy b/org.framed.iorm.ui/modules/roletype/inheritance/RoleInheritance.editpolicy index bbb8896275a530ab9686490992972dc194806c2a..6afa29cb2cf110862a76afa405b2df10b54c8bbd 100644 --- a/org.framed.iorm.ui/modules/roletype/inheritance/RoleInheritance.editpolicy +++ b/org.framed.iorm.ui/modules/roletype/inheritance/RoleInheritance.editpolicy @@ -16,4 +16,16 @@ <rules xsi:type="editpolicymodel:SourceEqualsTargetType"/> </constraintRule> </policies> + <policies action="Reconnect" actionType="Inheritance"> + <featureRule xsi:type="editpolicymodel:IsFeature" featureName="Role_Inheritance"/> + <constraintRule xsi:type="editpolicymodel:AndConstraintRule"> + <rules xsi:type="editpolicymodel:AndConstraintRule"> + <rules xsi:type="editpolicymodel:IsSourceType" type="RoleType"/> + <rules xsi:type="editpolicymodel:NotConstraintRule"> + <rule xsi:type="editpolicymodel:SourceEqualsTarget"/> + </rules> + </rules> + <rules xsi:type="editpolicymodel:SourceEqualsTargetType"/> + </constraintRule> + </policies> </editpolicymodel:Model> diff --git a/org.framed.iorm.ui/modules/roletype/role_constraints/AbstractRoleConstraintPattern.java b/org.framed.iorm.ui/modules/roletype/role_constraints/AbstractRoleConstraintPattern.java index 529874797772041d9739265346334b6eef890576..7ce898ec1fda1dd7474058c4ee5ca745c17bb14b 100644 --- a/org.framed.iorm.ui/modules/roletype/role_constraints/AbstractRoleConstraintPattern.java +++ b/org.framed.iorm.ui/modules/roletype/role_constraints/AbstractRoleConstraintPattern.java @@ -25,13 +25,7 @@ import org.framed.iorm.ui.exceptions.NoModelFoundException; * @author Kevin Kassin */ public abstract class AbstractRoleConstraintPattern extends FRaMEDConnectionPattern{ - - //TODO To be delete when the type checks are done by the edit policies - /** - * the lists of types for which a role constraint is applicable - */ - List<Type> types = Arrays.asList(Type.ROLE_TYPE, Type.ROLE_GROUP); - + /** * Class constructor */ @@ -51,17 +45,12 @@ public abstract class AbstractRoleConstraintPattern extends FRaMEDConnectionPatt org.framed.iorm.model.ModelElement newShape = UIUtil.getModelElementForAnchor(newAnchor); org.framed.iorm.model.ModelElement oldShape = UIUtil.getModelElementForAnchor(oldAnchor); if(newShape != null && oldShape != null) { - if(newShape.getContainer() == oldShape.getContainer() && - !(newShape.equals(oldShape))) { - if(newShape.getType() == Type.ROLE_TYPE) - if(oldShape.getType() == newShape.getType()) - return true; //TODO: call EditPolicyHandler + if(newShape.getContainer() == oldShape.getContainer()) { + return EditPolicyService.getHandler(this.getDiagram()).canReconnect(context, newShape.getType()); } } return false; } - //add feature - //~~~~~~~~~~~ /** * calculates if a role constraint can be added to the pictogram diagram * <p> @@ -71,14 +60,12 @@ public abstract class AbstractRoleConstraintPattern extends FRaMEDConnectionPatt public boolean canAddRoleConstraint(IAddContext addContext, Type type) { if(addContext.getNewObject() instanceof Relation) { Relation relation = (Relation) addContext.getNewObject(); - if(relation.getType() == type) - return EditPolicyService.getHandler(this.getDiagram()).canAdd(addContext,type); //TODO:added Type + if(relation != null && relation.getType() != null) + return EditPolicyService.getHandler(this.getDiagram()).canAdd(addContext, relation.getType()); } return false; } - //create feature - //~~~~~~~~~~~~~~ /** * calculates if a role constraint can be created * <p> @@ -97,11 +84,8 @@ public abstract class AbstractRoleConstraintPattern extends FRaMEDConnectionPatt org.framed.iorm.model.ModelElement sourceShape = UIUtil.getModelElementForAnchor(sourceAnchor); org.framed.iorm.model.ModelElement targetShape = UIUtil.getModelElementForAnchor(targetAnchor); if(sourceShape != null && targetShape != null) { - if(sourceShape.getContainer() == targetShape.getContainer() && - !(sourceShape.equals(targetShape))) { - if(types.contains(sourceShape.getType()) && - types.contains(targetShape.getType())) //TODO: remove types test, as this is handled by EditPolicyHandler - return EditPolicyService.getHandler(this.getDiagram()).canCreate(createContext, Type.ROLE_TYPE); //TODO: fix this call to actually refere to the Role Constraint + if(sourceShape.getContainer() == targetShape.getContainer()) { + return EditPolicyService.getHandler(this.getDiagram()).canCreate(createContext, sourceShape.getType()); } } return false; } @@ -119,8 +103,7 @@ public abstract class AbstractRoleConstraintPattern extends FRaMEDConnectionPatt Anchor sourceAnchor = createContext.getSourceAnchor(); org.framed.iorm.model.ModelElement sourceShape = UIUtil.getModelElementForAnchor(sourceAnchor); if(sourceShape != null){ - if(types.contains(sourceShape.getType())) //TODO: Remove this check - return true; //TODO: Call EditPolicyHandler + return EditPolicyService.getHandler(this.getDiagram()).canStart(createContext, sourceShape.getType()); } return false; } diff --git a/org.framed.iorm.ui/modules/roletype/role_constraints/RoleConstraints.ecl b/org.framed.iorm.ui/modules/roletype/role_constraints/RoleConstraints.ecl index 26b82a358e88fe806c3c28465ad4067f7d7d7dab..ad20c5f9ad3d4dfa16712a3c17fefe627a97b66f 100644 --- a/org.framed.iorm.ui/modules/roletype/role_constraints/RoleConstraints.ecl +++ b/org.framed.iorm.ui/modules/roletype/role_constraints/RoleConstraints.ecl @@ -1,9 +1,12 @@ //RoleConstraints Start RoleImplication (Role_Implication) when IsSourceType(RoleType); Add RoleImplication (Role_Implication) when IsSourceType(RoleType) and !SourceEqualsTarget() and SourceEqualsTargetType(); +Reconnect RoleImplication (Role_Implication) when IsSourceType(RoleType) and !SourceEqualsTarget() and SourceEqualsTargetType(); Start RoleEquivalence (Role_Equivalence) when IsSourceType(RoleType); Add RoleEquivalence (Role_Equivalence) when IsSourceType(RoleType) and !SourceEqualsTarget() and SourceEqualsTargetType(); +Reconnect RoleEquivalence (Role_Equivalence) when IsSourceType(RoleType) and !SourceEqualsTarget() and SourceEqualsTargetType(); Start RoleProhibition (Role_Prohibition) when IsSourceType(RoleType); -Add RoleProhibition (Role_Prohibition) when IsSourceType(RoleType) and !SourceEqualsTarget() and SourceEqualsTargetType(); \ No newline at end of file +Add RoleProhibition (Role_Prohibition) when IsSourceType(RoleType) and !SourceEqualsTarget() and SourceEqualsTargetType(); +Reconnect RoleProhibition (Role_Prohibition) when IsSourceType(RoleType) and !SourceEqualsTarget() and SourceEqualsTargetType(); diff --git a/org.framed.iorm.ui/modules/roletype/role_constraints/RoleConstraints.editpolicy b/org.framed.iorm.ui/modules/roletype/role_constraints/RoleConstraints.editpolicy index f1fe0a70f79a5d60058d9cd735ac68a5c6dac0d0..025337aa02fbe6027ac22d59a29517f80cd4f89c 100644 --- a/org.framed.iorm.ui/modules/roletype/role_constraints/RoleConstraints.editpolicy +++ b/org.framed.iorm.ui/modules/roletype/role_constraints/RoleConstraints.editpolicy @@ -16,6 +16,18 @@ <rules xsi:type="editpolicymodel:SourceEqualsTargetType"/> </constraintRule> </policies> + <policies action="Reconnect" actionType="RoleImplication"> + <featureRule xsi:type="editpolicymodel:IsFeature" featureName="Role_Implication"/> + <constraintRule xsi:type="editpolicymodel:AndConstraintRule"> + <rules xsi:type="editpolicymodel:AndConstraintRule"> + <rules xsi:type="editpolicymodel:IsSourceType" type="RoleType"/> + <rules xsi:type="editpolicymodel:NotConstraintRule"> + <rule xsi:type="editpolicymodel:SourceEqualsTarget"/> + </rules> + </rules> + <rules xsi:type="editpolicymodel:SourceEqualsTargetType"/> + </constraintRule> + </policies> <policies action="Start" actionType="RoleEquivalence"> <featureRule xsi:type="editpolicymodel:IsFeature" featureName="Role_Equivalence"/> <constraintRule xsi:type="editpolicymodel:IsSourceType" type="RoleType"/> @@ -32,6 +44,18 @@ <rules xsi:type="editpolicymodel:SourceEqualsTargetType"/> </constraintRule> </policies> + <policies action="Reconnect" actionType="RoleEquivalence"> + <featureRule xsi:type="editpolicymodel:IsFeature" featureName="Role_Equivalence"/> + <constraintRule xsi:type="editpolicymodel:AndConstraintRule"> + <rules xsi:type="editpolicymodel:AndConstraintRule"> + <rules xsi:type="editpolicymodel:IsSourceType" type="RoleType"/> + <rules xsi:type="editpolicymodel:NotConstraintRule"> + <rule xsi:type="editpolicymodel:SourceEqualsTarget"/> + </rules> + </rules> + <rules xsi:type="editpolicymodel:SourceEqualsTargetType"/> + </constraintRule> + </policies> <policies action="Start" actionType="RoleProhibition"> <featureRule xsi:type="editpolicymodel:IsFeature" featureName="Role_Prohibition"/> <constraintRule xsi:type="editpolicymodel:IsSourceType" type="RoleType"/> @@ -48,4 +72,16 @@ <rules xsi:type="editpolicymodel:SourceEqualsTargetType"/> </constraintRule> </policies> + <policies action="Reconnect" actionType="RoleProhibition"> + <featureRule xsi:type="editpolicymodel:IsFeature" featureName="Role_Prohibition"/> + <constraintRule xsi:type="editpolicymodel:AndConstraintRule"> + <rules xsi:type="editpolicymodel:AndConstraintRule"> + <rules xsi:type="editpolicymodel:IsSourceType" type="RoleType"/> + <rules xsi:type="editpolicymodel:NotConstraintRule"> + <rule xsi:type="editpolicymodel:SourceEqualsTarget"/> + </rules> + </rules> + <rules xsi:type="editpolicymodel:SourceEqualsTargetType"/> + </constraintRule> + </policies> </editpolicymodel:Model> diff --git a/org.framed.iorm.ui/src/org/framed/iorm/ui/editPolicy/ConstraintRuleVisitor.java b/org.framed.iorm.ui/src/org/framed/iorm/ui/editPolicy/ConstraintRuleVisitor.java index 6735388d7ae2eed975a08b3a88d4ddeb02b94e28..50eb4b43a542bfe1ec3360732a46c80418547fca 100644 --- a/org.framed.iorm.ui/src/org/framed/iorm/ui/editPolicy/ConstraintRuleVisitor.java +++ b/org.framed.iorm.ui/src/org/framed/iorm/ui/editPolicy/ConstraintRuleVisitor.java @@ -231,7 +231,7 @@ public class ConstraintRuleVisitor { return false; // travers Containers to find the compartment type. Diagram compartmentDiagram = findContainerDiagramOfType(container, Type.COMPARTMENT_TYPE); - System.out.println("containsCompartmentVisitor: TODO: " + compartmentDiagram != null); + System.out.println("containsCompartmentVisitor: TEST: " + compartmentDiagram != null); return compartmentDiagram != null; } diff --git a/org.framed.iorm.ui/src/org/framed/iorm/ui/editPolicy/EditPolicyHandler.java b/org.framed.iorm.ui/src/org/framed/iorm/ui/editPolicy/EditPolicyHandler.java index 1872daee46da8ac91cf34c2ccb1f0f79efe5c11f..2075e6c156cdefcfbe7eb84c3a1a319bb306c872 100644 --- a/org.framed.iorm.ui/src/org/framed/iorm/ui/editPolicy/EditPolicyHandler.java +++ b/org.framed.iorm.ui/src/org/framed/iorm/ui/editPolicy/EditPolicyHandler.java @@ -38,9 +38,14 @@ public class EditPolicyHandler { this.diagram = diagram; } + /** + * parses all editpolicies to create a list with activated policies + * All constraints of activated policies are then loaded. + * + * @param models + * @param config + */ public void updateConfig(List<editpolicymodel.Model> models, FRaMEDConfiguration config) { - //parse all editpolicies to create list with activated policies - //load all constraints which are activated by current configuration activatedPolicies = new LinkedList<>(); FeatureRuleVisitor featureRuleVisitor = new FeatureRuleVisitor(config);