Commit a7ad63f3 authored by Dominique Marcadet's avatar Dominique Marcadet

Merge branch '53-getnamespace-must-also-look-in-datatypetemplate' into 'master'

Resolve "getNamespace() must also look in DataTypeTemplate"

Closes #53

See merge request RiseClipseGroup/RiseClipseMetamodel_SCL2003!48
parents 0fb2fa80 a1db4c12
...@@ -21,7 +21,9 @@ package fr.centralesupelec.edf.riseclipse.iec61850.scl.impl; ...@@ -21,7 +21,9 @@ package fr.centralesupelec.edf.riseclipse.iec61850.scl.impl;
import fr.centralesupelec.edf.riseclipse.iec61850.scl.AnyLN; import fr.centralesupelec.edf.riseclipse.iec61850.scl.AnyLN;
import fr.centralesupelec.edf.riseclipse.iec61850.scl.Association; import fr.centralesupelec.edf.riseclipse.iec61850.scl.Association;
import fr.centralesupelec.edf.riseclipse.iec61850.scl.ClientLN; import fr.centralesupelec.edf.riseclipse.iec61850.scl.ClientLN;
import fr.centralesupelec.edf.riseclipse.iec61850.scl.DA;
import fr.centralesupelec.edf.riseclipse.iec61850.scl.DAI; import fr.centralesupelec.edf.riseclipse.iec61850.scl.DAI;
import fr.centralesupelec.edf.riseclipse.iec61850.scl.DO;
import fr.centralesupelec.edf.riseclipse.iec61850.scl.DOI; import fr.centralesupelec.edf.riseclipse.iec61850.scl.DOI;
import fr.centralesupelec.edf.riseclipse.iec61850.scl.DataSet; import fr.centralesupelec.edf.riseclipse.iec61850.scl.DataSet;
import fr.centralesupelec.edf.riseclipse.iec61850.scl.DataTypeTemplates; import fr.centralesupelec.edf.riseclipse.iec61850.scl.DataTypeTemplates;
...@@ -1071,33 +1073,80 @@ public abstract class AnyLNImpl extends UnNamingImpl implements AnyLN { ...@@ -1071,33 +1073,80 @@ public abstract class AnyLNImpl extends UnNamingImpl implements AnyLN {
*/ */
@Override @Override
public String getNamespace() { public String getNamespace() {
List< DOI > lplDoi = List< DOI > namPltDoi =
getDOI() getDOI()
.stream() .stream()
.filter( doi -> "NamPlt".equals( doi.getName() )) .filter( doi -> "NamPlt".equals( doi.getName() ))
.collect( Collectors.toList() ); .collect( Collectors.toList() );
if( lplDoi.size() == 1 ) { if( namPltDoi.size() == 1 ) {
List< DAI > ldNsDai = List< DAI > lnNsDai =
lplDoi namPltDoi
.get( 0 ) .get( 0 )
.getDAI() .getDAI()
.stream() .stream()
.filter( dai -> "lnNs".equals( dai.getName() )) .filter( dai -> "lnNs".equals( dai.getName() ))
.collect( Collectors.toList() ); .collect( Collectors.toList() );
if( ldNsDai.size() == 1 ) { if( lnNsDai.size() == 1 ) {
if(( ldNsDai.get( 0 ).getVal().size() == 1 ) if(( lnNsDai.get( 0 ).getVal().size() == 1 )
&& ( ldNsDai.get( 0 ).getVal().get( 0 ).getValue() != null ) && ( lnNsDai.get( 0 ).getVal().get( 0 ).getValue() != null )
&& ( ldNsDai.get( 0 ).getVal().get( 0 ).getValue().length() != 0 )) { && ( lnNsDai.get( 0 ).getVal().get( 0 ).getValue().length() != 0 )) {
return ldNsDai.get( 0 ).getVal().get( 0 ).getValue(); return lnNsDai.get( 0 ).getVal().get( 0 ).getValue();
}
if(( lnNsDai.get( 0 ).getRefersToAbstractDataAttribute() != null )
&& ( lnNsDai.get( 0 ).getRefersToAbstractDataAttribute().getVal().size() == 1 )
&& ( lnNsDai.get( 0 ).getRefersToAbstractDataAttribute().getVal().get( 0 ).getValue() != null )
&& ( lnNsDai.get( 0 ).getRefersToAbstractDataAttribute().getVal().get( 0 ).getValue().length() != 0 )) {
return lnNsDai.get( 0 ).getRefersToAbstractDataAttribute().getVal().get( 0 ).getValue();
}
}
if( namPltDoi.get( 0 ).getRefersToDO() != null ) {
List< DA > lnNsDa =
namPltDoi
.get( 0 )
.getRefersToDO()
.getRefersToDOType()
.getDA()
.stream()
.filter( da -> "lnNs".equals( da.getName() ))
.collect( Collectors.toList() );
if( lnNsDa.size() == 1 ) {
if(( lnNsDa.get( 0 ).getVal().size() == 1 )
&& ( lnNsDa.get( 0 ).getVal().get( 0 ).getValue() != null )
&& ( lnNsDa.get( 0 ).getVal().get( 0 ).getValue().length() != 0 )) {
return lnNsDa.get( 0 ).getVal().get( 0 ).getValue();
}
}
}
}
if( getRefersToLNodeType() != null ) {
List< DO > namPltDo =
getRefersToLNodeType()
.getDO()
.stream()
.filter( doi -> "NamPlt".equals( doi.getName() ))
.collect( Collectors.toList() );
if( namPltDo.size() == 1 ) {
if( namPltDo.get( 0 ).getRefersToDOType() != null ) {
List< DA > lnNsDa =
namPltDo
.get( 0 )
.getRefersToDOType()
.getDA()
.stream()
.filter( da -> "lnNs".equals( da.getName() ))
.collect( Collectors.toList() );
if( lnNsDa.size() == 1 ) {
if(( lnNsDa.get( 0 ).getVal().size() == 1 )
&& ( lnNsDa.get( 0 ).getVal().get( 0 ).getValue() != null )
&& ( lnNsDa.get( 0 ).getVal().get( 0 ).getValue().length() != 0 )) {
return lnNsDa.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; if( getParentLDevice() == null ) return null;
return getParentLDevice().getNamespace(); return getParentLDevice().getNamespace();
} }
......
...@@ -33,6 +33,7 @@ import org.eclipse.emf.ecore.util.EcoreUtil; ...@@ -33,6 +33,7 @@ import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.emf.ecore.util.InternalEList; import org.eclipse.emf.ecore.util.InternalEList;
import fr.centralesupelec.edf.riseclipse.iec61850.scl.AnyLN; import fr.centralesupelec.edf.riseclipse.iec61850.scl.AnyLN;
import fr.centralesupelec.edf.riseclipse.iec61850.scl.DA;
import fr.centralesupelec.edf.riseclipse.iec61850.scl.DAI; import fr.centralesupelec.edf.riseclipse.iec61850.scl.DAI;
import fr.centralesupelec.edf.riseclipse.iec61850.scl.DO; import fr.centralesupelec.edf.riseclipse.iec61850.scl.DO;
import fr.centralesupelec.edf.riseclipse.iec61850.scl.DOI; import fr.centralesupelec.edf.riseclipse.iec61850.scl.DOI;
...@@ -590,6 +591,24 @@ public class DOIImpl extends UnNamingImpl implements DOI { ...@@ -590,6 +591,24 @@ public class DOIImpl extends UnNamingImpl implements DOI {
return ldNsDai.get( 0 ).getRefersToAbstractDataAttribute().getVal().get( 0 ).getValue(); return ldNsDai.get( 0 ).getRefersToAbstractDataAttribute().getVal().get( 0 ).getValue();
} }
} }
if( getRefersToDO() != null ) {
List< DA > lnNsDa =
getRefersToDO()
.getRefersToDOType()
.getDA()
.stream()
.filter( da -> "dataNs".equals( da.getName() ))
.collect( Collectors.toList() );
if( lnNsDa.size() == 1 ) {
if(( lnNsDa.get( 0 ).getVal().size() == 1 )
&& ( lnNsDa.get( 0 ).getVal().get( 0 ).getValue() != null )
&& ( lnNsDa.get( 0 ).getVal().get( 0 ).getValue().length() != 0 )) {
return lnNsDa.get( 0 ).getVal().get( 0 ).getValue();
}
}
}
if( getParentAnyLN() == null ) return null; if( getParentAnyLN() == null ) return null;
return getParentAnyLN().getNamespace(); return getParentAnyLN().getNamespace();
} }
......
...@@ -34,7 +34,9 @@ import org.eclipse.emf.ecore.util.FeatureMap; ...@@ -34,7 +34,9 @@ import org.eclipse.emf.ecore.util.FeatureMap;
import org.eclipse.emf.ecore.util.InternalEList; import org.eclipse.emf.ecore.util.InternalEList;
import fr.centralesupelec.edf.riseclipse.iec61850.scl.AccessControl; import fr.centralesupelec.edf.riseclipse.iec61850.scl.AccessControl;
import fr.centralesupelec.edf.riseclipse.iec61850.scl.DA;
import fr.centralesupelec.edf.riseclipse.iec61850.scl.DAI; import fr.centralesupelec.edf.riseclipse.iec61850.scl.DAI;
import fr.centralesupelec.edf.riseclipse.iec61850.scl.DO;
import fr.centralesupelec.edf.riseclipse.iec61850.scl.DOI; import fr.centralesupelec.edf.riseclipse.iec61850.scl.DOI;
import fr.centralesupelec.edf.riseclipse.iec61850.scl.IED; import fr.centralesupelec.edf.riseclipse.iec61850.scl.IED;
import fr.centralesupelec.edf.riseclipse.iec61850.scl.IEDName; import fr.centralesupelec.edf.riseclipse.iec61850.scl.IEDName;
...@@ -585,15 +587,16 @@ public class LDeviceImpl extends UnNamingImpl implements LDevice { ...@@ -585,15 +587,16 @@ public class LDeviceImpl extends UnNamingImpl implements LDevice {
*/ */
@Override @Override
public String getNamespace() { public String getNamespace() {
List< DOI > lplDoi = if( getLN0() == null ) return null;
List< DOI > namPltDoi =
getLN0() getLN0()
.getDOI() .getDOI()
.stream() .stream()
.filter( doi -> "NamPlt".equals( doi.getName() )) .filter( doi -> "NamPlt".equals( doi.getName() ))
.collect( Collectors.toList() ); .collect( Collectors.toList() );
if( lplDoi.size() == 1 ) { if( namPltDoi.size() == 1 ) {
List< DAI > ldNsDai = List< DAI > ldNsDai =
lplDoi namPltDoi
.get( 0 ) .get( 0 )
.getDAI() .getDAI()
.stream() .stream()
...@@ -612,7 +615,53 @@ public class LDeviceImpl extends UnNamingImpl implements LDevice { ...@@ -612,7 +615,53 @@ public class LDeviceImpl extends UnNamingImpl implements LDevice {
return ldNsDai.get( 0 ).getRefersToAbstractDataAttribute().getVal().get( 0 ).getValue(); return ldNsDai.get( 0 ).getRefersToAbstractDataAttribute().getVal().get( 0 ).getValue();
} }
} }
if( namPltDoi.get( 0 ).getRefersToDO() != null ) {
List< DA > lnNsDa =
namPltDoi
.get( 0 )
.getRefersToDO()
.getRefersToDOType()
.getDA()
.stream()
.filter( da -> "ldNs".equals( da.getName() ))
.collect( Collectors.toList() );
if( lnNsDa.size() == 1 ) {
if(( lnNsDa.get( 0 ).getVal().size() == 1 )
&& ( lnNsDa.get( 0 ).getVal().get( 0 ).getValue() != null )
&& ( lnNsDa.get( 0 ).getVal().get( 0 ).getValue().length() != 0 )) {
return lnNsDa.get( 0 ).getVal().get( 0 ).getValue();
}
}
} }
}
if( getLN0().getRefersToLNodeType() == null ) return null;
List< DO > namPltDo =
getLN0()
.getRefersToLNodeType()
.getDO()
.stream()
.filter( do_ -> "NamPlt".equals( do_.getName() ))
.collect( Collectors.toList() );
if( namPltDo.size() == 1 ) {
if( namPltDo.get( 0 ).getRefersToDOType() == null ) return null;
List< DA > ldNsDa =
namPltDo
.get( 0 )
.getRefersToDOType()
.getDA()
.stream()
.filter( da -> "ldNs".equals( da.getName() ))
.collect( Collectors.toList() );
if( ldNsDa.size() == 1 ) {
if(( ldNsDa.get( 0 ).getVal().size() == 1 )
&& ( ldNsDa.get( 0 ).getVal().get( 0 ).getValue() != null )
&& ( ldNsDa.get( 0 ).getVal().get( 0 ).getValue().length() != 0 )) {
return ldNsDa.get( 0 ).getVal().get( 0 ).getValue();
}
}
}
return null; return null;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment