Commit 721cbf6d authored by Dominique Marcadet's avatar Dominique Marcadet

Merge branch '25-apref-must-be-taken-into-account-in-iedname-doresolvelinks' into 'master'

Resolve "apRef must be taken into account in IEDName.doResolveLinks"

Closes #25

See merge request RiseClipseGroup/RiseClipseMetamodel_SCL2003!22
parents be52115f 7a418975
......@@ -862,7 +862,7 @@
<eStructuralFeatures xsi:type="ecore:EAttribute" name="lnInst" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
unsettable="true"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="prefix" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
unsettable="true"/>
defaultValueLiteral="" unsettable="true"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="serviceType" eType="#//ServiceType"
unsettable="true"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="srcCBName" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
......@@ -1052,7 +1052,7 @@
<eStructuralFeatures xsi:type="ecore:EAttribute" name="lnInst" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
unsettable="true"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="prefix" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
unsettable="true"/>
defaultValueLiteral="" unsettable="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="ControlWithIEDName" ordered="false"
eType="#//ControlWithIEDName" transient="true" unsettable="true" resolveProxies="false"
eOpposite="#//ControlWithIEDName/IEDName"/>
......@@ -2266,7 +2266,7 @@
<eStructuralFeatures xsi:type="ecore:EAttribute" name="lnInst" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
unsettable="true"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="prefix" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
unsettable="true"/>
defaultValueLiteral="" unsettable="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="AgDATrgOp" abstract="true">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="dchg" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBooleanObject"
......
......@@ -139,6 +139,7 @@ public interface AgLNRef extends AgLDRef {
/**
* Returns the value of the '<em><b>Prefix</b></em>' attribute.
* The default value is <code>""</code>.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the value of the '<em>Prefix</em>' attribute.
......@@ -146,7 +147,7 @@ public interface AgLNRef extends AgLDRef {
* @see #unsetPrefix()
* @see #setPrefix(String)
* @see fr.centralesupelec.edf.riseclipse.iec61850.scl.SclPackage#getAgLNRef_Prefix()
* @model unsettable="true"
* @model default="" unsettable="true"
* @generated
*/
String getPrefix();
......
......@@ -429,6 +429,7 @@ public interface ExtRef extends BaseElement, AgDesc {
/**
* Returns the value of the '<em><b>Prefix</b></em>' attribute.
* The default value is <code>""</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Prefix</em>' attribute isn't clear,
......@@ -440,7 +441,7 @@ public interface ExtRef extends BaseElement, AgDesc {
* @see #unsetPrefix()
* @see #setPrefix(String)
* @see fr.centralesupelec.edf.riseclipse.iec61850.scl.SclPackage#getExtRef_Prefix()
* @model unsettable="true"
* @model default="" unsettable="true"
* @generated
*/
String getPrefix();
......
......@@ -256,6 +256,7 @@ public interface IEDName extends ExplicitLinkResolver {
/**
* Returns the value of the '<em><b>Prefix</b></em>' attribute.
* The default value is <code>""</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Prefix</em>' attribute isn't clear,
......@@ -267,7 +268,7 @@ public interface IEDName extends ExplicitLinkResolver {
* @see #unsetPrefix()
* @see #setPrefix(String)
* @see fr.centralesupelec.edf.riseclipse.iec61850.scl.SclPackage#getIEDName_Prefix()
* @model unsettable="true"
* @model default="" unsettable="true"
* @generated
*/
String getPrefix();
......
......@@ -110,7 +110,7 @@ public class AgLNRefImpl extends AgLDRefImpl implements AgLNRef {
* @generated
* @ordered
*/
protected static final String PREFIX_EDEFAULT = null;
protected static final String PREFIX_EDEFAULT = "";
/**
* The cached value of the '{@link #getPrefix() <em>Prefix</em>}' attribute.
......
......@@ -218,7 +218,7 @@ public class AssociationImpl extends BaseElementImpl implements Association {
* @generated
* @ordered
*/
protected static final String PREFIX_EDEFAULT = null;
protected static final String PREFIX_EDEFAULT = "";
/**
* The cached value of the '{@link #getPrefix() <em>Prefix</em>}' attribute.
* <!-- begin-user-doc -->
......
......@@ -216,7 +216,7 @@ public class ClientLNImpl extends ExplicitLinkResolverImpl implements ClientLN {
* @generated
* @ordered
*/
protected static final String PREFIX_EDEFAULT = null;
protected static final String PREFIX_EDEFAULT = "";
/**
* The cached value of the '{@link #getPrefix() <em>Prefix</em>}' attribute.
......
......@@ -309,7 +309,7 @@ public class ExtRefImpl extends BaseElementImpl implements ExtRef {
* @generated
* @ordered
*/
protected static final String PREFIX_EDEFAULT = null;
protected static final String PREFIX_EDEFAULT = "";
/**
* The cached value of the '{@link #getPrefix() <em>Prefix</em>}' attribute.
......
......@@ -20,6 +20,7 @@ package fr.centralesupelec.edf.riseclipse.iec61850.scl.impl;
import java.util.List;
import fr.centralesupelec.edf.riseclipse.iec61850.scl.AccessPoint;
import fr.centralesupelec.edf.riseclipse.iec61850.scl.AnyLN;
import fr.centralesupelec.edf.riseclipse.iec61850.scl.ControlWithIEDName;
import fr.centralesupelec.edf.riseclipse.iec61850.scl.IED;
......@@ -183,7 +184,7 @@ public class IEDNameImpl extends ExplicitLinkResolverImpl implements IEDName {
* @generated
* @ordered
*/
protected static final String PREFIX_EDEFAULT = null;
protected static final String PREFIX_EDEFAULT = "";
/**
* The cached value of the '{@link #getPrefix() <em>Prefix</em>}' attribute.
......@@ -960,6 +961,42 @@ public class IEDNameImpl extends ExplicitLinkResolverImpl implements IEDName {
//AbstractRiseClipseConsole.getConsole().info( "found " + mess2 );
ied = res1.get( 0 );
}
if( ied.getAccessPoint().size() == 0 ) return;
AccessPoint ap = ied.getAccessPoint().get( 0 );
if( ied.getAccessPoint().size() > 1 ) {
if( getApRef() == null ) return;
SclSwitch< Boolean > s2 = new SclSwitch< Boolean >() {
@Override
public Boolean caseAccessPoint( AccessPoint object ) {
return getApRef().equals( object.getName() );
}
@Override
public Boolean defaultCase( EObject object ) {
return false;
}
};
List< AccessPoint > res2 = shallowSearchObjects( ied.getAccessPoint(), s2 );
String mess2 = "AccessPoint( apRef = " + getApRef() + " ) for IEDName on line " + getLineNumber()
+ " ( in ied = " + ied.getName() + " )";
if( res2.isEmpty() ) {
AbstractRiseClipseConsole.getConsole().error( "cannot find " + mess2 );
return;
}
if( res2.size() > 1 ) {
AbstractRiseClipseConsole.getConsole().error( "found several " + mess2 );
return;
}
//AbstractRiseClipseConsole.getConsole().info( "found " + mess2 );
ap = res2.get( 0 );
}
if( ap == null ) return;
// The following is copy/paste from ClientLN (with modification)
// TODO: factor out ?
......@@ -968,7 +1005,7 @@ public class IEDNameImpl extends ExplicitLinkResolverImpl implements IEDName {
if( getLdInst() != null ) {
// find inside an LDevice with
// LDevice.name == IEDName.ldInst
SclSwitch< Boolean > s2 = new SclSwitch< Boolean >() {
SclSwitch< Boolean > s3 = new SclSwitch< Boolean >() {
@Override
public Boolean caseLDevice( LDevice object ) {
......@@ -982,19 +1019,19 @@ public class IEDNameImpl extends ExplicitLinkResolverImpl implements IEDName {
};
List< LDevice > res2 = deepSearchObjects( ied.getAccessPoint(), s2 );
String mess2 = "LDevice( inst = " + getLdInst() + " ) for IEDName on line " + getLineNumber()
List< LDevice > res3 = shallowSearchObjects( ap.getServer().getLDevice(), s3 );
String mess3 = "LDevice( inst = " + getLdInst() + " ) for IEDName on line " + getLineNumber()
+ " ( in ied = " + ied.getName() + " )";
if( res2.isEmpty() ) {
AbstractRiseClipseConsole.getConsole().error( "cannot find " + mess2 );
if( res3.isEmpty() ) {
AbstractRiseClipseConsole.getConsole().error( "cannot find " + mess3 );
return;
}
if( res2.size() > 1 ) {
AbstractRiseClipseConsole.getConsole().error( "found several " + mess2 );
if( res3.size() > 1 ) {
AbstractRiseClipseConsole.getConsole().error( "found several " + mess3 );
return;
}
//AbstractRiseClipseConsole.getConsole().info( "found " + mess2 );
lDevice = res2.get( 0 );
//AbstractRiseClipseConsole.getConsole().info( "found " + mess3 );
lDevice = res3.get( 0 );
}
if( lDevice == null ) return;
......@@ -1015,7 +1052,7 @@ public class IEDNameImpl extends ExplicitLinkResolverImpl implements IEDName {
// LN.lnClass == IEDName.lnClass
// LN.prefix == IEDName.prefix
// LN.inst == IEDName.lnInst
SclSwitch< Boolean > s3 = new SclSwitch< Boolean >() {
SclSwitch< Boolean > s4 = new SclSwitch< Boolean >() {
@Override
public Boolean caseLN( LN object ) {
......@@ -1033,19 +1070,19 @@ public class IEDNameImpl extends ExplicitLinkResolverImpl implements IEDName {
};
List< LN > res3 = shallowSearchObjects( lDevice.getLN(), s3 );
String mess3 = "LN( lnClass = " + getLnClass() + ", inst = " + getLnInst() + " ) for IEDName on line "
List< LN > res4 = shallowSearchObjects( lDevice.getLN(), s4 );
String mess4 = "LN( lnClass = " + getLnClass() + ", inst = " + getLnInst() + " ) for IEDName on line "
+ getLineNumber() + " ( in ied = " + ied.getName() + " )";
if( res3.isEmpty() ) {
AbstractRiseClipseConsole.getConsole().error( "cannot find " + mess3 );
if( res4.isEmpty() ) {
AbstractRiseClipseConsole.getConsole().error( "cannot find " + mess4 );
return;
}
if( res3.size() > 1 ) {
AbstractRiseClipseConsole.getConsole().error( "found several " + mess3 );
if( res4.size() > 1 ) {
AbstractRiseClipseConsole.getConsole().error( "found several " + mess4 );
return;
}
//AbstractRiseClipseConsole.getConsole().info( "found " + mess3 );
setRefersToAnyLN( res3.get( 0 ));
//AbstractRiseClipseConsole.getConsole().info( "found " + mess4 );
setRefersToAnyLN( res4.get( 0 ));
}
}
......
......@@ -862,7 +862,7 @@
<eStructuralFeatures xsi:type="ecore:EAttribute" name="lnInst" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
unsettable="true"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="prefix" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
unsettable="true"/>
defaultValueLiteral="" unsettable="true"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="serviceType" eType="#//ServiceType"
unsettable="true"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="srcCBName" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
......@@ -1052,7 +1052,7 @@
<eStructuralFeatures xsi:type="ecore:EAttribute" name="lnInst" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
unsettable="true"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="prefix" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
unsettable="true"/>
defaultValueLiteral="" unsettable="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="ControlWithIEDName" ordered="false"
eType="#//ControlWithIEDName" transient="true" unsettable="true" resolveProxies="false"
eOpposite="#//ControlWithIEDName/IEDName"/>
......@@ -2266,7 +2266,7 @@
<eStructuralFeatures xsi:type="ecore:EAttribute" name="lnInst" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
unsettable="true"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="prefix" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
unsettable="true"/>
defaultValueLiteral="" unsettable="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="AgDATrgOp" abstract="true">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="dchg" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBooleanObject"
......
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