From d7f0247f3112b83da3f9924551dfdc2167fb98ad Mon Sep 17 00:00:00 2001 From: Dominique Marcadet <Dominique.Marcadet@centralesupelec.fr> Date: Thu, 30 May 2019 16:54:45 +0200 Subject: [PATCH] add getNamespace() to LDevive, LN and DOI --- .../model/SCL.ecore | 3 + .../model/SCL.genmodel | 3 + .../edf/riseclipse/iec61850/scl/AnyLN.java | 8 ++ .../edf/riseclipse/iec61850/scl/DOI.java | 8 ++ .../edf/riseclipse/iec61850/scl/LDevice.java | 8 ++ .../riseclipse/iec61850/scl/SclPackage.java | 81 ++++++++++++++++++- .../iec61850/scl/impl/AnyLNImpl.java | 41 ++++++++++ .../riseclipse/iec61850/scl/impl/DOIImpl.java | 44 ++++++++++ .../iec61850/scl/impl/LDeviceImpl.java | 58 +++++++++++++ .../iec61850/scl/impl/SclPackageImpl.java | 30 +++++++ .../riseclipse/iec61850/scl/impl/scl.ecore | 3 + 11 files changed, 284 insertions(+), 3 deletions(-) diff --git a/fr.centralesupelec.edf.riseclipse.iec61850.scl/model/SCL.ecore b/fr.centralesupelec.edf.riseclipse.iec61850.scl/model/SCL.ecore index e412298..ba22ce5 100644 --- a/fr.centralesupelec.edf.riseclipse.iec61850.scl/model/SCL.ecore +++ b/fr.centralesupelec.edf.riseclipse.iec61850.scl/model/SCL.ecore @@ -602,6 +602,7 @@ </eClassifiers> <eClassifiers xsi:type="ecore:EClass" name="AnyLN" abstract="true" eSuperTypes="#//UnNaming"> <eOperations name="getParentLDevice" eType="#//LDevice"/> + <eOperations name="getNamespace" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> <eStructuralFeatures xsi:type="ecore:EAttribute" name="inst" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString" unsettable="true"/> <eStructuralFeatures xsi:type="ecore:EAttribute" name="lnClass" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString" @@ -851,6 +852,7 @@ resolveProxies="false" eOpposite="#//AbstractDataAttribute/ReferredByDAI"/> </eClassifiers> <eClassifiers xsi:type="ecore:EClass" name="DOI" eSuperTypes="#//UnNaming"> + <eOperations name="getNamespace" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> <eStructuralFeatures xsi:type="ecore:EAttribute" name="ix" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EIntegerObject" unsettable="true"/> <eStructuralFeatures xsi:type="ecore:EReference" name="ParentAnyLN" ordered="false" @@ -1149,6 +1151,7 @@ eOpposite="#//AccessPoint/ReferredByKDC"/> </eClassifiers> <eClassifiers xsi:type="ecore:EClass" name="LDevice" eSuperTypes="#//UnNaming"> + <eOperations name="getNamespace" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> <eStructuralFeatures xsi:type="ecore:EAttribute" name="inst" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString" unsettable="true"/> <eStructuralFeatures xsi:type="ecore:EAttribute" name="ldName" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString" diff --git a/fr.centralesupelec.edf.riseclipse.iec61850.scl/model/SCL.genmodel b/fr.centralesupelec.edf.riseclipse.iec61850.scl/model/SCL.genmodel index bc112d7..3f908ca 100644 --- a/fr.centralesupelec.edf.riseclipse.iec61850.scl/model/SCL.genmodel +++ b/fr.centralesupelec.edf.riseclipse.iec61850.scl/model/SCL.genmodel @@ -376,6 +376,7 @@ <genFeatures property="None" notify="false" createChild="false" ecoreFeature="ecore:EAttribute SCL.ecore#//AnyLN/ControlWithTriggerOpt"/> <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EAttribute SCL.ecore#//AnyLN/Control"/> <genOperations ecoreOperation="SCL.ecore#//AnyLN/getParentLDevice"/> + <genOperations ecoreOperation="SCL.ecore#//AnyLN/getNamespace"/> </genClasses> <genClasses ecoreClass="SCL.ecore#//Association"> <genFeatures createChild="false" ecoreFeature="ecore:EAttribute SCL.ecore#//Association/associationID"/> @@ -480,6 +481,7 @@ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute SCL.ecore#//DOI/accessControl"/> <genFeatures createChild="false" ecoreFeature="ecore:EAttribute SCL.ecore#//DOI/name"/> <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference SCL.ecore#//DOI/RefersToDO"/> + <genOperations ecoreOperation="SCL.ecore#//DOI/getNamespace"/> </genClasses> <genClasses ecoreClass="SCL.ecore#//DataObjectDirectory"> <genFeatures property="None" notify="false" createChild="false" ecoreFeature="ecore:EReference SCL.ecore#//DataObjectDirectory/ParentServices"/> @@ -632,6 +634,7 @@ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference SCL.ecore#//LDevice/LN0"/> <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference SCL.ecore#//LDevice/LN"/> <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference SCL.ecore#//LDevice/ReferredByIEDName"/> + <genOperations ecoreOperation="SCL.ecore#//LDevice/getNamespace"/> </genClasses> <genClasses ecoreClass="SCL.ecore#//LN"> <genFeatures createChild="false" ecoreFeature="ecore:EAttribute SCL.ecore#//LN/prefix"/> diff --git a/fr.centralesupelec.edf.riseclipse.iec61850.scl/src/fr/centralesupelec/edf/riseclipse/iec61850/scl/AnyLN.java b/fr.centralesupelec.edf.riseclipse.iec61850.scl/src/fr/centralesupelec/edf/riseclipse/iec61850/scl/AnyLN.java index 7e25e57..2b704c8 100644 --- a/fr.centralesupelec.edf.riseclipse.iec61850.scl/src/fr/centralesupelec/edf/riseclipse/iec61850/scl/AnyLN.java +++ b/fr.centralesupelec.edf.riseclipse.iec61850.scl/src/fr/centralesupelec/edf/riseclipse/iec61850/scl/AnyLN.java @@ -807,4 +807,12 @@ public interface AnyLN extends UnNaming { */ LDevice getParentLDevice(); + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @model kind="operation" + * @generated + */ + String getNamespace(); + } // AnyLN diff --git a/fr.centralesupelec.edf.riseclipse.iec61850.scl/src/fr/centralesupelec/edf/riseclipse/iec61850/scl/DOI.java b/fr.centralesupelec.edf.riseclipse.iec61850.scl/src/fr/centralesupelec/edf/riseclipse/iec61850/scl/DOI.java index fa77a54..fe46c97 100644 --- a/fr.centralesupelec.edf.riseclipse.iec61850.scl/src/fr/centralesupelec/edf/riseclipse/iec61850/scl/DOI.java +++ b/fr.centralesupelec.edf.riseclipse.iec61850.scl/src/fr/centralesupelec/edf/riseclipse/iec61850/scl/DOI.java @@ -351,4 +351,12 @@ public interface DOI extends UnNaming { */ boolean isSetRefersToDO(); + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @model kind="operation" + * @generated + */ + String getNamespace(); + } // DOI diff --git a/fr.centralesupelec.edf.riseclipse.iec61850.scl/src/fr/centralesupelec/edf/riseclipse/iec61850/scl/LDevice.java b/fr.centralesupelec.edf.riseclipse.iec61850.scl/src/fr/centralesupelec/edf/riseclipse/iec61850/scl/LDevice.java index 4daa706..7ab4471 100644 --- a/fr.centralesupelec.edf.riseclipse.iec61850.scl/src/fr/centralesupelec/edf/riseclipse/iec61850/scl/LDevice.java +++ b/fr.centralesupelec.edf.riseclipse.iec61850.scl/src/fr/centralesupelec/edf/riseclipse/iec61850/scl/LDevice.java @@ -338,6 +338,14 @@ public interface LDevice extends UnNaming { */ boolean isSetReferredByIEDName(); + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @model kind="operation" + * @generated + */ + String getNamespace(); + /** * Returns the value of the '<em><b>LN0</b></em>' containment reference. * It is bidirectional and its opposite is '{@link fr.centralesupelec.edf.riseclipse.iec61850.scl.LN0#getParentLDevice <em>Parent LDevice</em>}'. diff --git a/fr.centralesupelec.edf.riseclipse.iec61850.scl/src/fr/centralesupelec/edf/riseclipse/iec61850/scl/SclPackage.java b/fr.centralesupelec.edf.riseclipse.iec61850.scl/src/fr/centralesupelec/edf/riseclipse/iec61850/scl/SclPackage.java index 0a337c5..c6991c9 100644 --- a/fr.centralesupelec.edf.riseclipse.iec61850.scl/src/fr/centralesupelec/edf/riseclipse/iec61850/scl/SclPackage.java +++ b/fr.centralesupelec.edf.riseclipse.iec61850.scl/src/fr/centralesupelec/edf/riseclipse/iec61850/scl/SclPackage.java @@ -7240,6 +7240,15 @@ public interface SclPackage extends EPackage { */ int ANY_LN___GET_PARENT_LDEVICE = UN_NAMING_OPERATION_COUNT + 0; + /** + * The operation id for the '<em>Get Namespace</em>' operation. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int ANY_LN___GET_NAMESPACE = UN_NAMING_OPERATION_COUNT + 1; + /** * The number of operations of the '<em>Any LN</em>' class. * <!-- begin-user-doc --> @@ -7247,7 +7256,7 @@ public interface SclPackage extends EPackage { * @generated * @ordered */ - int ANY_LN_OPERATION_COUNT = UN_NAMING_OPERATION_COUNT + 1; + int ANY_LN_OPERATION_COUNT = UN_NAMING_OPERATION_COUNT + 2; /** * The feature id for the '<em><b>Line Number</b></em>' attribute. @@ -9720,6 +9729,15 @@ public interface SclPackage extends EPackage { */ int DOI___BUILD_EXPLICIT_LINKS__IRISECLIPSECONSOLE_BOOLEAN = UN_NAMING___BUILD_EXPLICIT_LINKS__IRISECLIPSECONSOLE_BOOLEAN; + /** + * The operation id for the '<em>Get Namespace</em>' operation. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int DOI___GET_NAMESPACE = UN_NAMING_OPERATION_COUNT + 0; + /** * The number of operations of the '<em>DOI</em>' class. * <!-- begin-user-doc --> @@ -9727,7 +9745,7 @@ public interface SclPackage extends EPackage { * @generated * @ordered */ - int DOI_OPERATION_COUNT = UN_NAMING_OPERATION_COUNT + 0; + int DOI_OPERATION_COUNT = UN_NAMING_OPERATION_COUNT + 1; /** * The feature id for the '<em><b>Line Number</b></em>' attribute. @@ -12458,6 +12476,15 @@ public interface SclPackage extends EPackage { */ int LDEVICE___BUILD_EXPLICIT_LINKS__IRISECLIPSECONSOLE_BOOLEAN = UN_NAMING___BUILD_EXPLICIT_LINKS__IRISECLIPSECONSOLE_BOOLEAN; + /** + * The operation id for the '<em>Get Namespace</em>' operation. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int LDEVICE___GET_NAMESPACE = UN_NAMING_OPERATION_COUNT + 0; + /** * The number of operations of the '<em>LDevice</em>' class. * <!-- begin-user-doc --> @@ -12465,7 +12492,7 @@ public interface SclPackage extends EPackage { * @generated * @ordered */ - int LDEVICE_OPERATION_COUNT = UN_NAMING_OPERATION_COUNT + 0; + int LDEVICE_OPERATION_COUNT = UN_NAMING_OPERATION_COUNT + 1; /** * The feature id for the '<em><b>Line Number</b></em>' attribute. @@ -12737,6 +12764,15 @@ public interface SclPackage extends EPackage { */ int LN___GET_PARENT_LDEVICE = ANY_LN___GET_PARENT_LDEVICE; + /** + * The operation id for the '<em>Get Namespace</em>' operation. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int LN___GET_NAMESPACE = ANY_LN___GET_NAMESPACE; + /** * The number of operations of the '<em>LN</em>' class. * <!-- begin-user-doc --> @@ -13034,6 +13070,15 @@ public interface SclPackage extends EPackage { */ int LN0___GET_PARENT_LDEVICE = ANY_LN___GET_PARENT_LDEVICE; + /** + * The operation id for the '<em>Get Namespace</em>' operation. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int LN0___GET_NAMESPACE = ANY_LN___GET_NAMESPACE; + /** * The number of operations of the '<em>LN0</em>' class. * <!-- begin-user-doc --> @@ -25008,6 +25053,16 @@ public interface SclPackage extends EPackage { */ EOperation getAnyLN__GetParentLDevice(); + /** + * Returns the meta object for the '{@link fr.centralesupelec.edf.riseclipse.iec61850.scl.AnyLN#getNamespace() <em>Get Namespace</em>}' operation. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the '<em>Get Namespace</em>' operation. + * @see fr.centralesupelec.edf.riseclipse.iec61850.scl.AnyLN#getNamespace() + * @generated + */ + EOperation getAnyLN__GetNamespace(); + /** * Returns the meta object for class '{@link fr.centralesupelec.edf.riseclipse.iec61850.scl.Association <em>Association</em>}'. * <!-- begin-user-doc --> @@ -25935,6 +25990,16 @@ public interface SclPackage extends EPackage { */ EReference getDOI_RefersToDO(); + /** + * Returns the meta object for the '{@link fr.centralesupelec.edf.riseclipse.iec61850.scl.DOI#getNamespace() <em>Get Namespace</em>}' operation. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the '<em>Get Namespace</em>' operation. + * @see fr.centralesupelec.edf.riseclipse.iec61850.scl.DOI#getNamespace() + * @generated + */ + EOperation getDOI__GetNamespace(); + /** * Returns the meta object for class '{@link fr.centralesupelec.edf.riseclipse.iec61850.scl.DataObjectDirectory <em>Data Object Directory</em>}'. * <!-- begin-user-doc --> @@ -27308,6 +27373,16 @@ public interface SclPackage extends EPackage { */ EReference getLDevice_ReferredByIEDName(); + /** + * Returns the meta object for the '{@link fr.centralesupelec.edf.riseclipse.iec61850.scl.LDevice#getNamespace() <em>Get Namespace</em>}' operation. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the '<em>Get Namespace</em>' operation. + * @see fr.centralesupelec.edf.riseclipse.iec61850.scl.LDevice#getNamespace() + * @generated + */ + EOperation getLDevice__GetNamespace(); + /** * Returns the meta object for the containment reference '{@link fr.centralesupelec.edf.riseclipse.iec61850.scl.LDevice#getLN0 <em>LN0</em>}'. * <!-- begin-user-doc --> diff --git a/fr.centralesupelec.edf.riseclipse.iec61850.scl/src/fr/centralesupelec/edf/riseclipse/iec61850/scl/impl/AnyLNImpl.java b/fr.centralesupelec.edf.riseclipse.iec61850.scl/src/fr/centralesupelec/edf/riseclipse/iec61850/scl/impl/AnyLNImpl.java index 4277c0b..57b62dc 100644 --- a/fr.centralesupelec.edf.riseclipse.iec61850.scl/src/fr/centralesupelec/edf/riseclipse/iec61850/scl/impl/AnyLNImpl.java +++ b/fr.centralesupelec.edf.riseclipse.iec61850.scl/src/fr/centralesupelec/edf/riseclipse/iec61850/scl/impl/AnyLNImpl.java @@ -21,6 +21,7 @@ package fr.centralesupelec.edf.riseclipse.iec61850.scl.impl; import fr.centralesupelec.edf.riseclipse.iec61850.scl.AnyLN; import fr.centralesupelec.edf.riseclipse.iec61850.scl.Association; import fr.centralesupelec.edf.riseclipse.iec61850.scl.ClientLN; +import fr.centralesupelec.edf.riseclipse.iec61850.scl.DAI; import fr.centralesupelec.edf.riseclipse.iec61850.scl.DOI; import fr.centralesupelec.edf.riseclipse.iec61850.scl.DataSet; import fr.centralesupelec.edf.riseclipse.iec61850.scl.DataTypeTemplates; @@ -1063,6 +1064,44 @@ public abstract class AnyLNImpl extends UnNamingImpl implements AnyLN { throw new RiseClipseFatalException( "AnyLN.getParentLDevice() called", null ); } + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public String getNamespace() { + List< DOI > lplDoi = + getDOI() + .stream() + .filter( doi -> "NamPlt".equals( doi.getName() )) + .collect( Collectors.toList() ); + if( lplDoi.size() == 1 ) { + List< DAI > ldNsDai = + lplDoi + .get( 0 ) + .getDAI() + .stream() + .filter( dai -> "lnNs".equals( dai.getName() )) + .collect( Collectors.toList() ); + if( ldNsDai.size() == 1 ) { + if(( ldNsDai.get( 0 ).getVal().size() == 1 ) + && ( ldNsDai.get( 0 ).getVal().get( 0 ).getValue() != null ) + && ( ldNsDai.get( 0 ).getVal().get( 0 ).getValue().length() != 0 )) { + return ldNsDai.get( 0 ).getVal().get( 0 ).getValue(); + } + if(( ldNsDai.get( 0 ).getRefersToAbstractDataAttribute() != null ) + && ( ldNsDai.get( 0 ).getRefersToAbstractDataAttribute().getVal().size() == 1 ) + && ( ldNsDai.get( 0 ).getRefersToAbstractDataAttribute().getVal().get( 0 ).getValue() != null ) + && ( ldNsDai.get( 0 ).getRefersToAbstractDataAttribute().getVal().get( 0 ).getValue().length() != 0 )) { + return ldNsDai.get( 0 ).getRefersToAbstractDataAttribute().getVal().get( 0 ).getValue(); + } + } + } + if( getParentLDevice() == null ) return null; + return getParentLDevice().getNamespace(); + } + /** * <!-- begin-user-doc --> * <!-- end-user-doc --> @@ -1385,6 +1424,8 @@ public abstract class AnyLNImpl extends UnNamingImpl implements AnyLN { switch (operationID) { case SclPackage.ANY_LN___GET_PARENT_LDEVICE: return getParentLDevice(); + case SclPackage.ANY_LN___GET_NAMESPACE: + return getNamespace(); } return super.eInvoke(operationID, arguments); } diff --git a/fr.centralesupelec.edf.riseclipse.iec61850.scl/src/fr/centralesupelec/edf/riseclipse/iec61850/scl/impl/DOIImpl.java b/fr.centralesupelec.edf.riseclipse.iec61850.scl/src/fr/centralesupelec/edf/riseclipse/iec61850/scl/impl/DOIImpl.java index d67ec37..69e04f8 100644 --- a/fr.centralesupelec.edf.riseclipse.iec61850.scl/src/fr/centralesupelec/edf/riseclipse/iec61850/scl/impl/DOIImpl.java +++ b/fr.centralesupelec.edf.riseclipse.iec61850.scl/src/fr/centralesupelec/edf/riseclipse/iec61850/scl/impl/DOIImpl.java @@ -40,6 +40,7 @@ import fr.centralesupelec.edf.riseclipse.iec61850.scl.SDI; import fr.centralesupelec.edf.riseclipse.iec61850.scl.SclPackage; import fr.centralesupelec.edf.riseclipse.iec61850.scl.util.SclUtilities; import fr.centralesupelec.edf.riseclipse.util.IRiseClipseConsole; +import java.lang.reflect.InvocationTargetException; /** * <!-- begin-user-doc --> @@ -564,6 +565,35 @@ public class DOIImpl extends UnNamingImpl implements DOI { return refersToDOESet; } + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public String getNamespace() { + List< DAI > ldNsDai = + getDAI() + .stream() + .filter( dai -> "dataNs".equals( dai.getName() )) + .collect( Collectors.toList() ); + if( ldNsDai.size() == 1 ) { + if(( ldNsDai.get( 0 ).getVal().size() == 1 ) + && ( ldNsDai.get( 0 ).getVal().get( 0 ).getValue() != null ) + && ( ldNsDai.get( 0 ).getVal().get( 0 ).getValue().length() != 0 )) { + return ldNsDai.get( 0 ).getVal().get( 0 ).getValue(); + } + if(( ldNsDai.get( 0 ).getRefersToAbstractDataAttribute() != null ) + && ( ldNsDai.get( 0 ).getRefersToAbstractDataAttribute().getVal().size() == 1 ) + && ( ldNsDai.get( 0 ).getRefersToAbstractDataAttribute().getVal().get( 0 ).getValue() != null ) + && ( ldNsDai.get( 0 ).getRefersToAbstractDataAttribute().getVal().get( 0 ).getValue().length() != 0 )) { + return ldNsDai.get( 0 ).getRefersToAbstractDataAttribute().getVal().get( 0 ).getValue(); + } + } + if( getParentAnyLN() == null ) return null; + return getParentAnyLN().getNamespace(); + } + /** * <!-- begin-user-doc --> * <!-- end-user-doc --> @@ -744,6 +774,20 @@ public class DOIImpl extends UnNamingImpl implements DOI { return super.eIsSet(featureID); } + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public Object eInvoke(int operationID, EList<?> arguments) throws InvocationTargetException { + switch (operationID) { + case SclPackage.DOI___GET_NAMESPACE: + return getNamespace(); + } + return super.eInvoke(operationID, arguments); + } + /** * <!-- begin-user-doc --> * <!-- end-user-doc --> diff --git a/fr.centralesupelec.edf.riseclipse.iec61850.scl/src/fr/centralesupelec/edf/riseclipse/iec61850/scl/impl/LDeviceImpl.java b/fr.centralesupelec.edf.riseclipse.iec61850.scl/src/fr/centralesupelec/edf/riseclipse/iec61850/scl/impl/LDeviceImpl.java index 81b1869..13be551 100644 --- a/fr.centralesupelec.edf.riseclipse.iec61850.scl/src/fr/centralesupelec/edf/riseclipse/iec61850/scl/impl/LDeviceImpl.java +++ b/fr.centralesupelec.edf.riseclipse.iec61850.scl/src/fr/centralesupelec/edf/riseclipse/iec61850/scl/impl/LDeviceImpl.java @@ -19,6 +19,9 @@ package fr.centralesupelec.edf.riseclipse.iec61850.scl.impl; import java.util.Collection; +import java.util.List; +import java.util.stream.Collectors; + import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.common.notify.NotificationChain; import org.eclipse.emf.common.util.EList; @@ -31,6 +34,8 @@ import org.eclipse.emf.ecore.util.FeatureMap; import org.eclipse.emf.ecore.util.InternalEList; import fr.centralesupelec.edf.riseclipse.iec61850.scl.AccessControl; +import fr.centralesupelec.edf.riseclipse.iec61850.scl.DAI; +import fr.centralesupelec.edf.riseclipse.iec61850.scl.DOI; import fr.centralesupelec.edf.riseclipse.iec61850.scl.IED; import fr.centralesupelec.edf.riseclipse.iec61850.scl.IEDName; import fr.centralesupelec.edf.riseclipse.iec61850.scl.LDevice; @@ -38,6 +43,7 @@ import fr.centralesupelec.edf.riseclipse.iec61850.scl.LN; import fr.centralesupelec.edf.riseclipse.iec61850.scl.LN0; import fr.centralesupelec.edf.riseclipse.iec61850.scl.SclPackage; import fr.centralesupelec.edf.riseclipse.iec61850.scl.Server; +import java.lang.reflect.InvocationTargetException; /** * <!-- begin-user-doc --> @@ -572,6 +578,44 @@ public class LDeviceImpl extends UnNamingImpl implements LDevice { return referredByIEDNameESet; } + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated NOT + */ + @Override + public String getNamespace() { + List< DOI > lplDoi = + getLN0() + .getDOI() + .stream() + .filter( doi -> "NamPlt".equals( doi.getName() )) + .collect( Collectors.toList() ); + if( lplDoi.size() == 1 ) { + List< DAI > ldNsDai = + lplDoi + .get( 0 ) + .getDAI() + .stream() + .filter( dai -> "ldNs".equals( dai.getName() )) + .collect( Collectors.toList() ); + if( ldNsDai.size() == 1 ) { + if(( ldNsDai.get( 0 ).getVal().size() == 1 ) + && ( ldNsDai.get( 0 ).getVal().get( 0 ).getValue() != null ) + && ( ldNsDai.get( 0 ).getVal().get( 0 ).getValue().length() != 0 )) { + return ldNsDai.get( 0 ).getVal().get( 0 ).getValue(); + } + if(( ldNsDai.get( 0 ).getRefersToAbstractDataAttribute() != null ) + && ( ldNsDai.get( 0 ).getRefersToAbstractDataAttribute().getVal().size() == 1 ) + && ( ldNsDai.get( 0 ).getRefersToAbstractDataAttribute().getVal().get( 0 ).getValue() != null ) + && ( ldNsDai.get( 0 ).getRefersToAbstractDataAttribute().getVal().get( 0 ).getValue().length() != 0 )) { + return ldNsDai.get( 0 ).getRefersToAbstractDataAttribute().getVal().get( 0 ).getValue(); + } + } + } + return null; + } + /** * <!-- begin-user-doc --> * <!-- end-user-doc --> @@ -841,6 +885,20 @@ public class LDeviceImpl extends UnNamingImpl implements LDevice { return super.eIsSet(featureID); } + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public Object eInvoke(int operationID, EList<?> arguments) throws InvocationTargetException { + switch (operationID) { + case SclPackage.LDEVICE___GET_NAMESPACE: + return getNamespace(); + } + return super.eInvoke(operationID, arguments); + } + /** * <!-- begin-user-doc --> * <!-- end-user-doc --> diff --git a/fr.centralesupelec.edf.riseclipse.iec61850.scl/src/fr/centralesupelec/edf/riseclipse/iec61850/scl/impl/SclPackageImpl.java b/fr.centralesupelec.edf.riseclipse.iec61850.scl/src/fr/centralesupelec/edf/riseclipse/iec61850/scl/impl/SclPackageImpl.java index 194011c..717034e 100644 --- a/fr.centralesupelec.edf.riseclipse.iec61850.scl/src/fr/centralesupelec/edf/riseclipse/iec61850/scl/impl/SclPackageImpl.java +++ b/fr.centralesupelec.edf.riseclipse.iec61850.scl/src/fr/centralesupelec/edf/riseclipse/iec61850/scl/impl/SclPackageImpl.java @@ -4511,6 +4511,16 @@ public class SclPackageImpl extends EPackageImpl implements SclPackage { return getAnyLN().getEOperations().get(0); } + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public EOperation getAnyLN__GetNamespace() { + return getAnyLN().getEOperations().get(1); + } + /** * <!-- begin-user-doc --> * <!-- end-user-doc --> @@ -5425,6 +5435,16 @@ public class SclPackageImpl extends EPackageImpl implements SclPackage { return (EReference)getDOI().getEStructuralFeatures().get(6); } + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public EOperation getDOI__GetNamespace() { + return getDOI().getEOperations().get(0); + } + /** * <!-- begin-user-doc --> * <!-- end-user-doc --> @@ -6767,6 +6787,16 @@ public class SclPackageImpl extends EPackageImpl implements SclPackage { return (EReference)getLDevice().getEStructuralFeatures().get(7); } + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public EOperation getLDevice__GetNamespace() { + return getLDevice().getEOperations().get(0); + } + /** * <!-- begin-user-doc --> * <!-- end-user-doc --> diff --git a/fr.centralesupelec.edf.riseclipse.iec61850.scl/src/fr/centralesupelec/edf/riseclipse/iec61850/scl/impl/scl.ecore b/fr.centralesupelec.edf.riseclipse.iec61850.scl/src/fr/centralesupelec/edf/riseclipse/iec61850/scl/impl/scl.ecore index e412298..ba22ce5 100644 --- a/fr.centralesupelec.edf.riseclipse.iec61850.scl/src/fr/centralesupelec/edf/riseclipse/iec61850/scl/impl/scl.ecore +++ b/fr.centralesupelec.edf.riseclipse.iec61850.scl/src/fr/centralesupelec/edf/riseclipse/iec61850/scl/impl/scl.ecore @@ -602,6 +602,7 @@ </eClassifiers> <eClassifiers xsi:type="ecore:EClass" name="AnyLN" abstract="true" eSuperTypes="#//UnNaming"> <eOperations name="getParentLDevice" eType="#//LDevice"/> + <eOperations name="getNamespace" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> <eStructuralFeatures xsi:type="ecore:EAttribute" name="inst" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString" unsettable="true"/> <eStructuralFeatures xsi:type="ecore:EAttribute" name="lnClass" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString" @@ -851,6 +852,7 @@ resolveProxies="false" eOpposite="#//AbstractDataAttribute/ReferredByDAI"/> </eClassifiers> <eClassifiers xsi:type="ecore:EClass" name="DOI" eSuperTypes="#//UnNaming"> + <eOperations name="getNamespace" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> <eStructuralFeatures xsi:type="ecore:EAttribute" name="ix" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EIntegerObject" unsettable="true"/> <eStructuralFeatures xsi:type="ecore:EReference" name="ParentAnyLN" ordered="false" @@ -1149,6 +1151,7 @@ eOpposite="#//AccessPoint/ReferredByKDC"/> </eClassifiers> <eClassifiers xsi:type="ecore:EClass" name="LDevice" eSuperTypes="#//UnNaming"> + <eOperations name="getNamespace" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> <eStructuralFeatures xsi:type="ecore:EAttribute" name="inst" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString" unsettable="true"/> <eStructuralFeatures xsi:type="ecore:EAttribute" name="ldName" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString" -- GitLab