From 67ef95ed8b391582e43f04bb42a398cb3da76156 Mon Sep 17 00:00:00 2001
From: Andreas Bayha <bayha@fortiss.org>
Date: Thu, 26 Mar 2020 16:16:00 +0100
Subject: [PATCH] Kernel: Removed unnused contraint package

Removed unused constraint package from kernel (ecore and code).

Issue-Ref: 3977
Issue-Url: https://af3-developer.fortiss.org/issues/3977

Signed-off-by: Andreas Bayha <bayha@fortiss.org>
---
 .../org/fortiss/tooling/base/compose/.ratings |   5 +-
 .../HierarchicElementCompositorBase.java      |   6 -
 .../compose/ModelElementCompositorBase.java   |  11 --
 .../fortiss/tooling/kernel/ui/util/.ratings   |   2 +-
 .../kernel/ui/util/CopyPasteUtils.java        |   4 -
 .../META-INF/MANIFEST.MF                      |   3 -
 org.fortiss.tooling.kernel/model/.ratings     |   2 +-
 org.fortiss.tooling.kernel/model/kernel.ecore | 105 ------------------
 .../model/kernel.genmodel                     |  28 -----
 9 files changed, 4 insertions(+), 162 deletions(-)

diff --git a/org.fortiss.tooling.base/src/org/fortiss/tooling/base/compose/.ratings b/org.fortiss.tooling.base/src/org/fortiss/tooling/base/compose/.ratings
index c4e75d147..9337c7479 100644
--- a/org.fortiss.tooling.base/src/org/fortiss/tooling/base/compose/.ratings
+++ b/org.fortiss.tooling.base/src/org/fortiss/tooling/base/compose/.ratings
@@ -2,10 +2,9 @@ ConnectionCompositorBase.java 692689b535d7136acab2ab67a015f70809e64b6b GREEN
 ConnectorCompositorBase.java 0264edd4034da7187d1dbdf35a674c7067adf3cd GREEN
 ConnectorConnectionCompositorBase.java eed310a4710492b7ce3bc302c3db4e5c40f4d817 GREEN
 ConnectorHierarchicElementConnectionCompositorBase.java 7a8e4acf235d5eb006c859056cce89fbb0aac05d GREEN
-ConstraintInstanceContainerCompositor.java 9cb23f13c6cddba18ac7f9dcfd1afd9e7bce4d77 GREEN
-HierarchicElementCompositorBase.java eed5112371a5819843d65ab8463ec385e50ed1e4 GREEN
+HierarchicElementCompositorBase.java 79381013dcbce69031523221e9fe5ba1224580df YELLOW
 HierarchicElementConnectionCompositorBase.java c5c4914d01f96a8f564f9a3c9bf4685e0f1e9155 GREEN
 HierarchicElementConnectorConnectionCompositorBase.java 0dfbe483e893be9c97d681a2610549d73e5adebc GREEN
 LogMessageUserInteractionContext.java b145045589fba08b67a12b5d41c51729aa4ae94e GREEN
-ModelElementCompositorBase.java 0c69a61e750fc67cb71093f077eb749d248da924 GREEN
+ModelElementCompositorBase.java 7cf2c62b70258f3b0e7e2a2979078e4fce7c9856 YELLOW
 ModelElementWithRefCopyMessage.java 486c90c5896d7fe4a4595c6dbe602838a044ad14 GREEN
diff --git a/org.fortiss.tooling.base/src/org/fortiss/tooling/base/compose/HierarchicElementCompositorBase.java b/org.fortiss.tooling.base/src/org/fortiss/tooling/base/compose/HierarchicElementCompositorBase.java
index eed511237..79381013d 100644
--- a/org.fortiss.tooling.base/src/org/fortiss/tooling/base/compose/HierarchicElementCompositorBase.java
+++ b/org.fortiss.tooling.base/src/org/fortiss/tooling/base/compose/HierarchicElementCompositorBase.java
@@ -26,7 +26,6 @@ import org.fortiss.tooling.base.model.element.IConnection;
 import org.fortiss.tooling.base.model.element.IConnector;
 import org.fortiss.tooling.base.model.element.IHierarchicElement;
 import org.fortiss.tooling.base.model.element.IHierarchicElementContainer;
-import org.fortiss.tooling.kernel.model.constraints.IConstrained;
 import org.fortiss.tooling.kernel.service.IConnectionCompositorService;
 import org.fortiss.tooling.kernel.service.IElementCompositorService;
 
@@ -44,11 +43,6 @@ public abstract class HierarchicElementCompositorBase<HE extends IHierarchicElem
 	 */
 	@Override
 	public final boolean decompose(EObject contained) {
-		// If there exist any constraints, remove them first to avoid verification launches due to
-		// EMF notifications when the container is removed.
-		if(contained instanceof IConstrained) {
-			((IConstrained)contained).getConstraintInstances().clear();
-		}
 		return iterateDecompose(contained) && decomposeSpecific(contained);
 	}
 
diff --git a/org.fortiss.tooling.base/src/org/fortiss/tooling/base/compose/ModelElementCompositorBase.java b/org.fortiss.tooling.base/src/org/fortiss/tooling/base/compose/ModelElementCompositorBase.java
index 0c69a61e7..7cf2c62b7 100644
--- a/org.fortiss.tooling.base/src/org/fortiss/tooling/base/compose/ModelElementCompositorBase.java
+++ b/org.fortiss.tooling.base/src/org/fortiss/tooling/base/compose/ModelElementCompositorBase.java
@@ -31,8 +31,6 @@ import org.fortiss.tooling.kernel.extension.IElementCompositor;
 import org.fortiss.tooling.kernel.extension.data.IElementCompositionContext;
 import org.fortiss.tooling.kernel.extension.data.ITopLevelElement;
 import org.fortiss.tooling.kernel.model.INamedElement;
-import org.fortiss.tooling.kernel.model.constraints.ConstraintInstance;
-import org.fortiss.tooling.kernel.model.constraints.IConstrained;
 import org.fortiss.tooling.kernel.service.IElementCompositorService;
 import org.fortiss.tooling.kernel.service.IPersistencyService;
 
@@ -88,15 +86,6 @@ public abstract class ModelElementCompositorBase<C extends EObject> extends Obse
 	 */
 	@Override
 	public boolean decompose(EObject contained) {
-		// Removes first the constraints
-		if(contained instanceof IConstrained) {
-			for(ConstraintInstance ci : ((IConstrained)contained).getConstraintInstances()) {
-				for(IConstrained c : ci.getConstraineds()) {
-					c.getConstraintInstances().remove(ci);
-				}
-				EcoreUtil.delete(ci, true);
-			}
-		}
 		return iterateDecompose(contained) && decomposeSpecific(contained);
 	}
 
diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/util/.ratings b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/util/.ratings
index fd2078b76..54dbbaa30 100644
--- a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/util/.ratings
+++ b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/util/.ratings
@@ -1,5 +1,5 @@
 ActionUtils.java 4553e487264e3d1f86f4767da4a7400cce4b9a5d GREEN
-CopyPasteUtils.java bbc5cf9c9dc03ebf8dc75d42c919fe6eb60b388e GREEN
+CopyPasteUtils.java aa9a24ff499a505cbb27e6e5a6f462776caa5025 YELLOW
 DataBindingUtils.java 631c47881caa13fc567679a7e4416eb777af0713 GREEN
 DragAndDropUtils.java 7aab91518aa12d76533a345bf6ed0be9ac7ff0e5 GREEN
 EObjectSelectionUtils.java 128cf8f96c6b9478171dff3deda662d5934f5f44 GREEN
diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/util/CopyPasteUtils.java b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/util/CopyPasteUtils.java
index bbc5cf9c9..aa9a24ff4 100644
--- a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/util/CopyPasteUtils.java
+++ b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/util/CopyPasteUtils.java
@@ -36,7 +36,6 @@ import org.eclipse.ui.PlatformUI;
 import org.fortiss.tooling.kernel.extension.data.IElementCompositionContext;
 import org.fortiss.tooling.kernel.model.INamedElement;
 import org.fortiss.tooling.kernel.model.ISpeciallyCopyiable;
-import org.fortiss.tooling.kernel.model.constraints.IConstrained;
 import org.fortiss.tooling.kernel.service.IElementCompositorService;
 import org.fortiss.tooling.kernel.ui.dnd.CompositionServiceLocalCopyPasteTransfer;
 import org.fortiss.tooling.kernel.ui.internal.editor.ExtendableMultiPageEditor;
@@ -70,9 +69,6 @@ public class CopyPasteUtils {
 				TreeIterator<EObject> it = content[i].eAllContents();
 				while(it.hasNext()) {
 					EObject subObj = it.next();
-					if(subObj instanceof IConstrained) {
-						((IConstrained)subObj).getConstraintInstances().clear();
-					}
 				}
 				i++;
 			}
diff --git a/org.fortiss.tooling.kernel/META-INF/MANIFEST.MF b/org.fortiss.tooling.kernel/META-INF/MANIFEST.MF
index 8871b532b..dd8e11900 100644
--- a/org.fortiss.tooling.kernel/META-INF/MANIFEST.MF
+++ b/org.fortiss.tooling.kernel/META-INF/MANIFEST.MF
@@ -24,9 +24,6 @@ Export-Package: org.fortiss.tooling.kernel;uses:="org.eclipse.core.runtime,
  org.fortiss.tooling.kernel.introspection,
  org.fortiss.tooling.kernel.introspection.items,
  org.fortiss.tooling.kernel.model;uses:=org.eclipse.emf.ecore,
- org.fortiss.tooling.kernel.model.constraints,
- org.fortiss.tooling.kernel.model.constraints.impl,
- org.fortiss.tooling.kernel.model.constraints.util,
  org.fortiss.tooling.kernel.model.impl;uses:=org.fortiss.tooling.kernel.model,
  org.fortiss.tooling.kernel.model.util;uses:="org.eclipse.emf.ecore,
    org.fortiss.tooling.kernel.model,
diff --git a/org.fortiss.tooling.kernel/model/.ratings b/org.fortiss.tooling.kernel/model/.ratings
index 998f10420..e43d8d841 100644
--- a/org.fortiss.tooling.kernel/model/.ratings
+++ b/org.fortiss.tooling.kernel/model/.ratings
@@ -1 +1 @@
-kernel.ecore 4a3d1961b1e127d034898770d2899ac722d690a7 GREEN
+kernel.ecore 0b76d12b66f6d7f045a547bb1775428075c82ced YELLOW
diff --git a/org.fortiss.tooling.kernel/model/kernel.ecore b/org.fortiss.tooling.kernel/model/kernel.ecore
index 4a3d1961b..0b76d12b6 100644
--- a/org.fortiss.tooling.kernel/model/kernel.ecore
+++ b/org.fortiss.tooling.kernel/model/kernel.ecore
@@ -144,109 +144,4 @@
       <eParameters name="target" eType="ecore:EClass http://www.eclipse.org/emf/2002/Ecore#//EObject"/>
     </eOperations>
   </eClassifiers>
-  <eSubpackages name="constraints" nsURI="http://www.fortiss.org/tooling/base/model/element/constraints"
-      nsPrefix="org-fortiss-tooling-kernel-constraints">
-    <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
-      <details key="documentation" value="TODO: Consolidate with constraint metaclasses in tooling.base."/>
-    </eAnnotations>
-    <eClassifiers xsi:type="ecore:EClass" name="IConstrained" abstract="true" interface="true">
-      <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
-        <details key="documentation" value="Element which can be constrained. Keeps track of all the constraints which apply to it."/>
-      </eAnnotations>
-      <eStructuralFeatures xsi:type="ecore:EReference" name="constraintInstances"
-          upperBound="-1" eType="#//constraints/ConstraintInstance">
-        <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
-          <details key="documentation" value="TODO: write documentation (in the model!)"/>
-        </eAnnotations>
-      </eStructuralFeatures>
-      <eStructuralFeatures xsi:type="ecore:EReference" name="checksumsPerConstraintName"
-          upperBound="-1" eType="#//constraints/ConstraintNameToChecksum" containment="true">
-        <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
-          <details key="documentation" value="TODO: write documentation (in the model!)"/>
-        </eAnnotations>
-      </eStructuralFeatures>
-    </eClassifiers>
-    <eClassifiers xsi:type="ecore:EClass" name="ConstraintInstance">
-      <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
-        <details key="documentation" value="Constraint &quot;instance&quot;: link between the constrained element(s) and the constraint. Explicitly represented in the model in order to store the status and the checksum(s) of the constrained element(s)"/>
-      </eAnnotations>
-      <eStructuralFeatures xsi:type="ecore:EReference" name="constraineds" upperBound="-1"
-          eType="#//constraints/IConstrained">
-        <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
-          <details key="documentation" value="TODO: write documentation (in the model!)"/>
-        </eAnnotations>
-      </eStructuralFeatures>
-      <eStructuralFeatures xsi:type="ecore:EReference" name="status" eType="#//constraints/IConstraintInstanceStatus"
-          containment="true">
-        <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
-          <details key="documentation" value="TODO: write documentation (in the model!)"/>
-        </eAnnotations>
-      </eStructuralFeatures>
-      <eStructuralFeatures xsi:type="ecore:EAttribute" name="constraintName" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString">
-        <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
-          <details key="documentation" value="TODO: write documentation (in the model!)"/>
-        </eAnnotations>
-      </eStructuralFeatures>
-    </eClassifiers>
-    <eClassifiers xsi:type="ecore:EClass" name="IConstraintInstanceStatus" abstract="true"
-        interface="true">
-      <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
-        <details key="documentation" value="Status of verification of a constraint. Typically, should denote &quot;Success&quot;, &quot;Fail&quot;, &quot;Outdated&quot; or &quot;Error&quot; with possible specializations depending on the particular constraints."/>
-      </eAnnotations>
-      <eOperations name="getConstraint" eType="#//constraints/ConstraintInstance">
-        <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
-          <details key="body" value="return (ConstraintInstance)this.eContainer();"/>
-          <details key="documentation" value="TODO: write documentation (in the model!)"/>
-        </eAnnotations>
-      </eOperations>
-    </eClassifiers>
-    <eClassifiers xsi:type="ecore:EClass" name="OutdatedConstraintInstanceStatus"
-        eSuperTypes="#//constraints/IConstraintInstanceStatus">
-      <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
-        <details key="documentation" value="Status that indicates that the verification of a constraint is outdated."/>
-      </eAnnotations>
-    </eClassifiers>
-    <eClassifiers xsi:type="ecore:EClass" name="FailedConstraintInstanceStatus" eSuperTypes="#//constraints/IConstraintInstanceStatus">
-      <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
-        <details key="documentation" value="Status that indicates that the verification of a constraint has failed."/>
-      </eAnnotations>
-    </eClassifiers>
-    <eClassifiers xsi:type="ecore:EClass" name="ErrorConstraintInstanceStatus" eSuperTypes="#//constraints/IConstraintInstanceStatus">
-      <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
-        <details key="documentation" value="Status that indicates that an error has occurred during the verification of a constraint."/>
-      </eAnnotations>
-    </eClassifiers>
-    <eClassifiers xsi:type="ecore:EClass" name="SuccessConstraintInstanceStatus" eSuperTypes="#//constraints/IConstraintInstanceStatus">
-      <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
-        <details key="documentation" value="Status that indicates that a constraint has succesfully been verified."/>
-      </eAnnotations>
-    </eClassifiers>
-    <eClassifiers xsi:type="ecore:EClass" name="IConstraintInstanceContainer" abstract="true"
-        interface="true">
-      <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
-        <details key="documentation" value="Container to group multiple constraint instances."/>
-      </eAnnotations>
-      <eStructuralFeatures xsi:type="ecore:EReference" name="constraintInstances"
-          upperBound="-1" eType="#//constraints/ConstraintInstance" containment="true">
-        <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
-          <details key="documentation" value="TODO: write documentation (in the model!)"/>
-        </eAnnotations>
-      </eStructuralFeatures>
-    </eClassifiers>
-    <eClassifiers xsi:type="ecore:EClass" name="ConstraintNameToChecksum" instanceClassName="java.util.Map$Entry">
-      <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
-        <details key="documentation" value="Map type to map constraint names to checksum values."/>
-      </eAnnotations>
-      <eStructuralFeatures xsi:type="ecore:EAttribute" name="key" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString">
-        <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
-          <details key="documentation" value="TODO: write documentation (in the model!)"/>
-        </eAnnotations>
-      </eStructuralFeatures>
-      <eStructuralFeatures xsi:type="ecore:EAttribute" name="value" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBigInteger">
-        <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
-          <details key="documentation" value="TODO: write documentation (in the model!)"/>
-        </eAnnotations>
-      </eStructuralFeatures>
-    </eClassifiers>
-  </eSubpackages>
 </ecore:EPackage>
diff --git a/org.fortiss.tooling.kernel/model/kernel.genmodel b/org.fortiss.tooling.kernel/model/kernel.genmodel
index b19daa9d0..d9c1a57ec 100644
--- a/org.fortiss.tooling.kernel/model/kernel.genmodel
+++ b/org.fortiss.tooling.kernel/model/kernel.genmodel
@@ -54,33 +54,5 @@
         <genParameters ecoreParameter="kernel.ecore#//ISpeciallyCopyiable/canPaste/target"/>
       </genOperations>
     </genClasses>
-    <nestedGenPackages prefix="Constraints" basePackage="org.fortiss.tooling.kernel.model"
-        disposableProviderFactory="true" ecorePackage="kernel.ecore#//constraints">
-      <genClasses image="false" ecoreClass="kernel.ecore#//constraints/IConstrained">
-        <genFeatures notify="false" createChild="false" propertySortChoices="true"
-            ecoreFeature="ecore:EReference kernel.ecore#//constraints/IConstrained/constraintInstances"/>
-        <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference kernel.ecore#//constraints/IConstrained/checksumsPerConstraintName"/>
-      </genClasses>
-      <genClasses ecoreClass="kernel.ecore#//constraints/ConstraintInstance">
-        <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference kernel.ecore#//constraints/ConstraintInstance/constraineds"/>
-        <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference kernel.ecore#//constraints/ConstraintInstance/status"/>
-        <genFeatures createChild="false" ecoreFeature="ecore:EAttribute kernel.ecore#//constraints/ConstraintInstance/constraintName"/>
-      </genClasses>
-      <genClasses image="false" ecoreClass="kernel.ecore#//constraints/IConstraintInstanceStatus">
-        <genOperations ecoreOperation="kernel.ecore#//constraints/IConstraintInstanceStatus/getConstraint"
-            body="return (ConstraintInstance)this.eContainer();"/>
-      </genClasses>
-      <genClasses ecoreClass="kernel.ecore#//constraints/OutdatedConstraintInstanceStatus"/>
-      <genClasses ecoreClass="kernel.ecore#//constraints/FailedConstraintInstanceStatus"/>
-      <genClasses ecoreClass="kernel.ecore#//constraints/ErrorConstraintInstanceStatus"/>
-      <genClasses ecoreClass="kernel.ecore#//constraints/SuccessConstraintInstanceStatus"/>
-      <genClasses image="false" ecoreClass="kernel.ecore#//constraints/IConstraintInstanceContainer">
-        <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference kernel.ecore#//constraints/IConstraintInstanceContainer/constraintInstances"/>
-      </genClasses>
-      <genClasses ecoreClass="kernel.ecore#//constraints/ConstraintNameToChecksum">
-        <genFeatures createChild="false" ecoreFeature="ecore:EAttribute kernel.ecore#//constraints/ConstraintNameToChecksum/key"/>
-        <genFeatures createChild="false" ecoreFeature="ecore:EAttribute kernel.ecore#//constraints/ConstraintNameToChecksum/value"/>
-      </genClasses>
-    </nestedGenPackages>
   </genPackages>
 </genmodel:GenModel>
-- 
GitLab