Bug 560032 - [IoTML] SensiNact Action stereotype should not have a
derived state property

Change-Id: Ibfcf488e4283d69bc1ceee481aa3b7eb332c262a
Signed-off-by: Shuai Li <shuai.li@cea.fr>
diff --git a/org.eclipse.papyrus.iotml.profile/model/IoT-ML.profile.genmodel b/org.eclipse.papyrus.iotml.profile/model/IoT-ML.profile.genmodel
index c5f715a..c8f8e3f 100644
--- a/org.eclipse.papyrus.iotml.profile/model/IoT-ML.profile.genmodel
+++ b/org.eclipse.papyrus.iotml.profile/model/IoT-ML.profile.genmodel
@@ -353,10 +353,7 @@
         <genFeatures xsi:type="genmodel:GenFeature" notify="false" createChild="false"
             propertySortChoices="true" ecoreFeature="ecore:EReference iotml.ecore#//sensinact/StateVariable/modifier"/>
       </genClasses>
-      <genClasses xsi:type="genmodel:GenClass" ecoreClass="iotml.ecore#//sensinact/Action">
-        <genFeatures xsi:type="genmodel:GenFeature" notify="false" createChild="false"
-            propertySortChoices="true" ecoreFeature="ecore:EReference iotml.ecore#//sensinact/Action/state"/>
-      </genClasses>
+      <genClasses xsi:type="genmodel:GenClass" ecoreClass="iotml.ecore#//sensinact/Action"/>
     </nestedGenPackages>
     <nestedGenPackages xsi:type="genmodel:GenPackage" prefix="WoT" basePackage="org.eclipse.papyrus.iotml"
         disposableProviderFactory="true" ecorePackage="iotml.ecore#//wot">
diff --git a/org.eclipse.papyrus.iotml.profile/model/IoT-ML.profile.uml b/org.eclipse.papyrus.iotml.profile/model/IoT-ML.profile.uml
index 1fb3e80..72bf44f 100644
--- a/org.eclipse.papyrus.iotml.profile/model/IoT-ML.profile.uml
+++ b/org.eclipse.papyrus.iotml.profile/model/IoT-ML.profile.uml
@@ -712,7 +712,6 @@
       </packagedElement>
       <packagedElement xmi:type="uml:Stereotype" xmi:id="_LyDDkCuCEemAOL1eRjr3BA" name="Action">
         <generalization xmi:type="uml:Generalization" xmi:id="_ARBE0CuMEemAOL1eRjr3BA" general="_GxJVgCuCEemAOL1eRjr3BA"/>
-        <ownedAttribute xmi:type="uml:Property" xmi:id="_KSCBVCuNEemAOL1eRjr3BA" name="state" type="_K7TBwCuCEemAOL1eRjr3BA" isDerived="true" association="_KSCBUCuNEemAOL1eRjr3BA"/>
       </packagedElement>
       <packagedElement xmi:type="uml:Stereotype" xmi:id="_MrU08CuCEemAOL1eRjr3BA" name="Attribute">
         <generalization xmi:type="uml:Generalization" xmi:id="_y1gsgCuMEemAOL1eRjr3BA" general="_S5I2gCuMEemAOL1eRjr3BA"/>
@@ -817,6 +816,7 @@
         <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_KSCBUSuNEemAOL1eRjr3BA" source="org.eclipse.papyrus">
           <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_KSCBUiuNEemAOL1eRjr3BA" key="nature" value="UML_Nature"/>
         </eAnnotations>
+        <ownedEnd xmi:type="uml:Property" xmi:id="_KSCBVCuNEemAOL1eRjr3BA" name="state" type="_K7TBwCuCEemAOL1eRjr3BA" association="_KSCBUCuNEemAOL1eRjr3BA"/>
       </packagedElement>
       <packagedElement xmi:type="uml:Extension" xmi:id="_AZ0z0CuSEemAOL1eRjr3BA" name="E_AccessMethod_Operation29" memberEnd="_AZ0z0SuSEemAOL1eRjr3BA _AZ0z0iuSEemAOL1eRjr3BA">
         <ownedEnd xmi:type="uml:ExtensionEnd" xmi:id="_AZ0z0SuSEemAOL1eRjr3BA" name="extension_AccessMethod" type="_N7NvgCuCEemAOL1eRjr3BA" aggregation="composite" association="_AZ0z0CuSEemAOL1eRjr3BA"/>
diff --git a/org.eclipse.papyrus.iotml.profile/model/iotml.ecore b/org.eclipse.papyrus.iotml.profile/model/iotml.ecore
index 211cbf6..f252c0a 100644
--- a/org.eclipse.papyrus.iotml.profile/model/iotml.ecore
+++ b/org.eclipse.papyrus.iotml.profile/model/iotml.ecore
@@ -560,14 +560,9 @@
     <eClassifiers xsi:type="ecore:EClass" name="SensorData" eSuperTypes="#//sensinact/Resource"/>
     <eClassifiers xsi:type="ecore:EClass" name="StateVariable" eSuperTypes="#//sensinact/Resource">
       <eStructuralFeatures xsi:type="ecore:EReference" name="modifier" ordered="false"
-          lowerBound="1" eType="#//sensinact/Action" volatile="true" transient="true"
-          derived="true" eOpposite="#//sensinact/Action/state"/>
+          lowerBound="1" eType="#//sensinact/Action"/>
     </eClassifiers>
-    <eClassifiers xsi:type="ecore:EClass" name="Action" eSuperTypes="#//sensinact/Resource">
-      <eStructuralFeatures xsi:type="ecore:EReference" name="state" ordered="false"
-          lowerBound="1" eType="#//sensinact/StateVariable" volatile="true" transient="true"
-          derived="true" eOpposite="#//sensinact/StateVariable/modifier"/>
-    </eClassifiers>
+    <eClassifiers xsi:type="ecore:EClass" name="Action" eSuperTypes="#//sensinact/Resource"/>
   </eSubpackages>
   <eSubpackages name="wot" nsURI="http://www.eclipse.org/papyrus/iotml/0.7/IoTML/WoT"
       nsPrefix="WoT">
diff --git a/org.eclipse.papyrus.iotml.profile/src-gen/org/eclipse/papyrus/iotml/sensinact/Action.java b/org.eclipse.papyrus.iotml.profile/src-gen/org/eclipse/papyrus/iotml/sensinact/Action.java
index 86e7456..ce3b953 100644
--- a/org.eclipse.papyrus.iotml.profile/src-gen/org/eclipse/papyrus/iotml/sensinact/Action.java
+++ b/org.eclipse.papyrus.iotml.profile/src-gen/org/eclipse/papyrus/iotml/sensinact/Action.java
@@ -18,44 +18,11 @@
  * A representation of the model object '<em><b>Action</b></em>'.
  * <!-- end-user-doc -->
  *
- * <p>
- * The following features are supported:
- * </p>
- * <ul>
- *   <li>{@link org.eclipse.papyrus.iotml.sensinact.Action#getState <em>State</em>}</li>
- * </ul>
  *
  * @see org.eclipse.papyrus.iotml.sensinact.SensinactPackage#getAction()
  * @model
  * @generated
  */
 public interface Action extends Resource {
-	/**
-	 * Returns the value of the '<em><b>State</b></em>' reference.
-	 * It is bidirectional and its opposite is '{@link org.eclipse.papyrus.iotml.sensinact.StateVariable#getModifier <em>Modifier</em>}'.
-	 * <!-- begin-user-doc -->
-	 * <p>
-	 * If the meaning of the '<em>State</em>' reference isn't clear,
-	 * there really should be more of a description here...
-	 * </p>
-	 * <!-- end-user-doc -->
-	 * @return the value of the '<em>State</em>' reference.
-	 * @see #setState(StateVariable)
-	 * @see org.eclipse.papyrus.iotml.sensinact.SensinactPackage#getAction_State()
-	 * @see org.eclipse.papyrus.iotml.sensinact.StateVariable#getModifier
-	 * @model opposite="modifier" required="true" transient="true" volatile="true" derived="true" ordered="false"
-	 * @generated
-	 */
-	StateVariable getState();
-
-	/**
-	 * Sets the value of the '{@link org.eclipse.papyrus.iotml.sensinact.Action#getState <em>State</em>}' reference.
-	 * <!-- begin-user-doc -->
-	 * <!-- end-user-doc -->
-	 * @param value the new value of the '<em>State</em>' reference.
-	 * @see #getState()
-	 * @generated
-	 */
-	void setState(StateVariable value);
 
 } // Action
diff --git a/org.eclipse.papyrus.iotml.profile/src-gen/org/eclipse/papyrus/iotml/sensinact/SensinactPackage.java b/org.eclipse.papyrus.iotml.profile/src-gen/org/eclipse/papyrus/iotml/sensinact/SensinactPackage.java
index afc3952..1bb14be 100644
--- a/org.eclipse.papyrus.iotml.profile/src-gen/org/eclipse/papyrus/iotml/sensinact/SensinactPackage.java
+++ b/org.eclipse.papyrus.iotml.profile/src-gen/org/eclipse/papyrus/iotml/sensinact/SensinactPackage.java
@@ -973,22 +973,13 @@
 	int ACTION__ATTRIBUTES = RESOURCE__ATTRIBUTES;
 
 	/**
-	 * The feature id for the '<em><b>State</b></em>' reference.
-	 * <!-- begin-user-doc -->
-	 * <!-- end-user-doc -->
-	 * @generated
-	 * @ordered
-	 */
-	int ACTION__STATE = RESOURCE_FEATURE_COUNT + 0;
-
-	/**
 	 * The number of structural features of the '<em>Action</em>' class.
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->
 	 * @generated
 	 * @ordered
 	 */
-	int ACTION_FEATURE_COUNT = RESOURCE_FEATURE_COUNT + 1;
+	int ACTION_FEATURE_COUNT = RESOURCE_FEATURE_COUNT + 0;
 
 	/**
 	 * The meta object id for the '{@link org.eclipse.papyrus.iotml.sensinact.AccessMethodType <em>Access Method Type</em>}' enum.
@@ -1329,17 +1320,6 @@
 	EClass getAction();
 
 	/**
-	 * Returns the meta object for the reference '{@link org.eclipse.papyrus.iotml.sensinact.Action#getState <em>State</em>}'.
-	 * <!-- begin-user-doc -->
-	 * <!-- end-user-doc -->
-	 * @return the meta object for the reference '<em>State</em>'.
-	 * @see org.eclipse.papyrus.iotml.sensinact.Action#getState()
-	 * @see #getAction()
-	 * @generated
-	 */
-	EReference getAction_State();
-
-	/**
 	 * Returns the meta object for enum '{@link org.eclipse.papyrus.iotml.sensinact.AccessMethodType <em>Access Method Type</em>}'.
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->
@@ -1648,14 +1628,6 @@
 		EClass ACTION = eINSTANCE.getAction();
 
 		/**
-		 * The meta object literal for the '<em><b>State</b></em>' reference feature.
-		 * <!-- begin-user-doc -->
-		 * <!-- end-user-doc -->
-		 * @generated
-		 */
-		EReference ACTION__STATE = eINSTANCE.getAction_State();
-
-		/**
 		 * The meta object literal for the '{@link org.eclipse.papyrus.iotml.sensinact.AccessMethodType <em>Access Method Type</em>}' enum.
 		 * <!-- begin-user-doc -->
 		 * <!-- end-user-doc -->
diff --git a/org.eclipse.papyrus.iotml.profile/src-gen/org/eclipse/papyrus/iotml/sensinact/StateVariable.java b/org.eclipse.papyrus.iotml.profile/src-gen/org/eclipse/papyrus/iotml/sensinact/StateVariable.java
index 72d767c..a859396 100644
--- a/org.eclipse.papyrus.iotml.profile/src-gen/org/eclipse/papyrus/iotml/sensinact/StateVariable.java
+++ b/org.eclipse.papyrus.iotml.profile/src-gen/org/eclipse/papyrus/iotml/sensinact/StateVariable.java
@@ -32,7 +32,6 @@
 public interface StateVariable extends Resource {
 	/**
 	 * Returns the value of the '<em><b>Modifier</b></em>' reference.
-	 * It is bidirectional and its opposite is '{@link org.eclipse.papyrus.iotml.sensinact.Action#getState <em>State</em>}'.
 	 * <!-- begin-user-doc -->
 	 * <p>
 	 * If the meaning of the '<em>Modifier</em>' reference isn't clear,
@@ -42,8 +41,7 @@
 	 * @return the value of the '<em>Modifier</em>' reference.
 	 * @see #setModifier(Action)
 	 * @see org.eclipse.papyrus.iotml.sensinact.SensinactPackage#getStateVariable_Modifier()
-	 * @see org.eclipse.papyrus.iotml.sensinact.Action#getState
-	 * @model opposite="state" required="true" transient="true" volatile="true" derived="true" ordered="false"
+	 * @model required="true" ordered="false"
 	 * @generated
 	 */
 	Action getModifier();
diff --git a/org.eclipse.papyrus.iotml.profile/src-gen/org/eclipse/papyrus/iotml/sensinact/impl/ActionImpl.java b/org.eclipse.papyrus.iotml.profile/src-gen/org/eclipse/papyrus/iotml/sensinact/impl/ActionImpl.java
index e057f1c..a2eb736 100644
--- a/org.eclipse.papyrus.iotml.profile/src-gen/org/eclipse/papyrus/iotml/sensinact/impl/ActionImpl.java
+++ b/org.eclipse.papyrus.iotml.profile/src-gen/org/eclipse/papyrus/iotml/sensinact/impl/ActionImpl.java
@@ -14,21 +14,13 @@
 package org.eclipse.papyrus.iotml.sensinact.impl;
 
 import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.InternalEObject;
 import org.eclipse.papyrus.iotml.sensinact.Action;
 import org.eclipse.papyrus.iotml.sensinact.SensinactPackage;
-import org.eclipse.papyrus.iotml.sensinact.StateVariable;
 
 /**
  * <!-- begin-user-doc -->
  * An implementation of the model object '<em><b>Action</b></em>'.
  * <!-- end-user-doc -->
- * <p>
- * The following features are implemented:
- * </p>
- * <ul>
- *   <li>{@link org.eclipse.papyrus.iotml.sensinact.impl.ActionImpl#getState <em>State</em>}</li>
- * </ul>
  *
  * @generated
  */
@@ -52,98 +44,4 @@
 		return SensinactPackage.Literals.ACTION;
 	}
 
-	/**
-	 * <!-- begin-user-doc -->
-	 * <!-- end-user-doc -->
-	 * @generated
-	 */
-	@Override
-	public StateVariable getState() {
-		StateVariable state = basicGetState();
-		return state != null && state.eIsProxy() ? (StateVariable)eResolveProxy((InternalEObject)state) : state;
-	}
-
-	/**
-	 * <!-- begin-user-doc -->
-	 * <!-- end-user-doc -->
-	 * @generated
-	 */
-	public StateVariable basicGetState() {
-		// TODO: implement this method to return the 'State' reference
-		// -> do not perform proxy resolution
-		// Ensure that you remove @generated or mark it @generated NOT
-		throw new UnsupportedOperationException();
-	}
-
-	/**
-	 * <!-- begin-user-doc -->
-	 * <!-- end-user-doc -->
-	 * @generated
-	 */
-	@Override
-	public void setState(StateVariable newState) {
-		// TODO: implement this method to set the 'State' reference
-		// Ensure that you remove @generated or mark it @generated NOT
-		throw new UnsupportedOperationException();
-	}
-
-	/**
-	 * <!-- begin-user-doc -->
-	 * <!-- end-user-doc -->
-	 * @generated
-	 */
-	@Override
-	public Object eGet(int featureID, boolean resolve, boolean coreType) {
-		switch (featureID) {
-			case SensinactPackage.ACTION__STATE:
-				if (resolve) return getState();
-				return basicGetState();
-		}
-		return super.eGet(featureID, resolve, coreType);
-	}
-
-	/**
-	 * <!-- begin-user-doc -->
-	 * <!-- end-user-doc -->
-	 * @generated
-	 */
-	@Override
-	public void eSet(int featureID, Object newValue) {
-		switch (featureID) {
-			case SensinactPackage.ACTION__STATE:
-				setState((StateVariable)newValue);
-				return;
-		}
-		super.eSet(featureID, newValue);
-	}
-
-	/**
-	 * <!-- begin-user-doc -->
-	 * <!-- end-user-doc -->
-	 * @generated
-	 */
-	@Override
-	public void eUnset(int featureID) {
-		switch (featureID) {
-			case SensinactPackage.ACTION__STATE:
-				setState((StateVariable)null);
-				return;
-		}
-		super.eUnset(featureID);
-	}
-
-	/**
-	 * <!-- begin-user-doc -->
-	 * <!-- end-user-doc -->
-	 * @generated
-	 */
-	@Override
-	public boolean eIsSet(int featureID) {
-		switch (featureID) {
-			case SensinactPackage.ACTION__STATE:
-				return basicGetState() != null;
-		}
-		return super.eIsSet(featureID);
-	}
-
 } //ActionImpl
diff --git a/org.eclipse.papyrus.iotml.profile/src-gen/org/eclipse/papyrus/iotml/sensinact/impl/SensinactPackageImpl.java b/org.eclipse.papyrus.iotml.profile/src-gen/org/eclipse/papyrus/iotml/sensinact/impl/SensinactPackageImpl.java
index 0ea2aa2..9b7a852 100644
--- a/org.eclipse.papyrus.iotml.profile/src-gen/org/eclipse/papyrus/iotml/sensinact/impl/SensinactPackageImpl.java
+++ b/org.eclipse.papyrus.iotml.profile/src-gen/org/eclipse/papyrus/iotml/sensinact/impl/SensinactPackageImpl.java
@@ -683,16 +683,6 @@
 	 * @generated
 	 */
 	@Override
-	public EReference getAction_State() {
-		return (EReference)actionEClass.getEStructuralFeatures().get(0);
-	}
-
-	/**
-	 * <!-- begin-user-doc -->
-	 * <!-- end-user-doc -->
-	 * @generated
-	 */
-	@Override
 	public EEnum getAccessMethodType() {
 		return accessMethodTypeEEnum;
 	}
@@ -770,7 +760,6 @@
 		createEReference(stateVariableEClass, STATE_VARIABLE__MODIFIER);
 
 		actionEClass = createEClass(ACTION);
-		createEReference(actionEClass, ACTION__STATE);
 
 		// Create enums
 		accessMethodTypeEEnum = createEEnum(ACCESS_METHOD_TYPE);
@@ -868,10 +857,9 @@
 		initEClass(sensorDataEClass, SensorData.class, "SensorData", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
 
 		initEClass(stateVariableEClass, StateVariable.class, "StateVariable", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
-		initEReference(getStateVariable_Modifier(), this.getAction(), this.getAction_State(), "modifier", null, 1, 1, StateVariable.class, IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, IS_DERIVED, !IS_ORDERED);
+		initEReference(getStateVariable_Modifier(), this.getAction(), null, "modifier", null, 1, 1, StateVariable.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
 
 		initEClass(actionEClass, Action.class, "Action", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
-		initEReference(getAction_State(), this.getStateVariable(), this.getStateVariable_Modifier(), "state", null, 1, 1, Action.class, IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, IS_DERIVED, !IS_ORDERED);
 
 		// Initialize enums and add enum literals
 		initEEnum(accessMethodTypeEEnum, AccessMethodType.class, "AccessMethodType");
diff --git a/org.eclipse.papyrus.iotml.profile/src-gen/org/eclipse/papyrus/iotml/sensinact/impl/StateVariableImpl.java b/org.eclipse.papyrus.iotml.profile/src-gen/org/eclipse/papyrus/iotml/sensinact/impl/StateVariableImpl.java
index 80cd670..493dd5a 100644
--- a/org.eclipse.papyrus.iotml.profile/src-gen/org/eclipse/papyrus/iotml/sensinact/impl/StateVariableImpl.java
+++ b/org.eclipse.papyrus.iotml.profile/src-gen/org/eclipse/papyrus/iotml/sensinact/impl/StateVariableImpl.java
@@ -13,8 +13,10 @@
  */
 package org.eclipse.papyrus.iotml.sensinact.impl;
 
+import org.eclipse.emf.common.notify.Notification;
 import org.eclipse.emf.ecore.EClass;
 import org.eclipse.emf.ecore.InternalEObject;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
 import org.eclipse.papyrus.iotml.sensinact.Action;
 import org.eclipse.papyrus.iotml.sensinact.SensinactPackage;
 import org.eclipse.papyrus.iotml.sensinact.StateVariable;
@@ -34,6 +36,16 @@
  */
 public class StateVariableImpl extends ResourceImpl implements StateVariable {
 	/**
+	 * The cached value of the '{@link #getModifier() <em>Modifier</em>}' reference.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @see #getModifier()
+	 * @generated
+	 * @ordered
+	 */
+	protected Action modifier;
+
+	/**
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->
 	 * @generated
@@ -59,8 +71,15 @@
 	 */
 	@Override
 	public Action getModifier() {
-		Action modifier = basicGetModifier();
-		return modifier != null && modifier.eIsProxy() ? (Action)eResolveProxy((InternalEObject)modifier) : modifier;
+		if (modifier != null && modifier.eIsProxy()) {
+			InternalEObject oldModifier = (InternalEObject)modifier;
+			modifier = (Action)eResolveProxy(oldModifier);
+			if (modifier != oldModifier) {
+				if (eNotificationRequired())
+					eNotify(new ENotificationImpl(this, Notification.RESOLVE, SensinactPackage.STATE_VARIABLE__MODIFIER, oldModifier, modifier));
+			}
+		}
+		return modifier;
 	}
 
 	/**
@@ -69,10 +88,7 @@
 	 * @generated
 	 */
 	public Action basicGetModifier() {
-		// TODO: implement this method to return the 'Modifier' reference
-		// -> do not perform proxy resolution
-		// Ensure that you remove @generated or mark it @generated NOT
-		throw new UnsupportedOperationException();
+		return modifier;
 	}
 
 	/**
@@ -82,9 +98,10 @@
 	 */
 	@Override
 	public void setModifier(Action newModifier) {
-		// TODO: implement this method to set the 'Modifier' reference
-		// Ensure that you remove @generated or mark it @generated NOT
-		throw new UnsupportedOperationException();
+		Action oldModifier = modifier;
+		modifier = newModifier;
+		if (eNotificationRequired())
+			eNotify(new ENotificationImpl(this, Notification.SET, SensinactPackage.STATE_VARIABLE__MODIFIER, oldModifier, modifier));
 	}
 
 	/**
@@ -141,7 +158,7 @@
 	public boolean eIsSet(int featureID) {
 		switch (featureID) {
 			case SensinactPackage.STATE_VARIABLE__MODIFIER:
-				return basicGetModifier() != null;
+				return modifier != null;
 		}
 		return super.eIsSet(featureID);
 	}