Commit 26a399ec authored by Dominique Marcadet's avatar Dominique Marcadet

Merge branch '43-review-use-of-error-in-dobuildexplicitlinks' into 'master'

Resolve "review use of error() in doBuildExplicitLinks()"

Closes #43

See merge request RiseClipseGroup/RiseClipseMetamodel_SCL2003!39
parents abc80b54 c8f00f78
......@@ -1395,13 +1395,23 @@ public abstract class AbstractDataAttributeImpl extends UnNamingImpl implements
// A referenced attribute shall exist in the same type definition. The default value 0 states that the attribute is no array.
// valKind Determines how the value shall be interpreted if any is given
if( getType() == null ) return;
DataTypeTemplates dtt = SclUtilities.getSCL( this ).getDataTypeTemplates();
if( dtt == null ) return;
if( ! ( "Enum".equals( getBType() ) || "Struct".equals( getBType() ))) {
return;
}
String messagePrefix = "while resolving link from AbstractDataAttribute on line " + getLineNumber() + ": ";
if( "Enum".equals( getBType() ) ) {
if(( getType() == null ) || getType().isEmpty() ) {
console.warning( messagePrefix + "type is missing" );
return;
}
DataTypeTemplates dtt = SclUtilities.getSCL( this ).getDataTypeTemplates();
if( dtt == null ) {
console.warning( messagePrefix + "DataTypeTemplates is missing" );
return;
}
if( "Enum".equals( getBType() )) {
// find an EnumType with
// EnumType.id == DA.type
......@@ -1414,13 +1424,13 @@ public abstract class AbstractDataAttributeImpl extends UnNamingImpl implements
String mess = "EnumType( id = " + getType() + " )";
if( res.size() != 1 ) {
SclUtilities.displayNotFoundError( console, messagePrefix, mess, res.size() );
SclUtilities.displayNotFoundWarning( console, messagePrefix, mess, res.size() );
return;
}
setRefersToEnumType( res.get( 0 ) );
console.info( "AbstractDataAttribute on line " + getLineNumber() + " refers to " + mess + " on line " + getRefersToEnumType().getLineNumber() );
}
else if( "Struct".equals( getBType() ) ) {
else if( "Struct".equals( getBType() )) {
// find an DAType with
// DAType.id == DA.type
......@@ -1433,7 +1443,7 @@ public abstract class AbstractDataAttributeImpl extends UnNamingImpl implements
String mess = "DAType( id = " + getType() + " )";
if( res.size() != 1 ) {
SclUtilities.displayNotFoundError( console, messagePrefix, mess, res.size() );
SclUtilities.displayNotFoundWarning( console, messagePrefix, mess, res.size() );
return;
}
setRefersToDAType( res.get( 0 ) );
......
......@@ -1420,13 +1420,19 @@ public abstract class AnyLNImpl extends UnNamingImpl implements AnyLN {
// lnClass The LN class according to IEC 61850-7-x
// inst The LN instance number identifying this LN – an unsigned integer
if( getLnType() == null ) return;
DataTypeTemplates dtt = SclUtilities.getSCL( this ).getDataTypeTemplates();
if( dtt == null ) return;
String messagePrefix = "while resolving link from AnyLN on line " + getLineNumber() + ": ";
List< LNodeType > res = //shallowSearchObjects( dtt.getLNodeType(), s );
if(( getLnType() == null ) || getLnType().isEmpty() ) {
console.warning( messagePrefix + "lnType is missing" );
return;
}
DataTypeTemplates dtt = SclUtilities.getSCL( this ).getDataTypeTemplates();
if( dtt == null ) {
console.warning( messagePrefix + "DataTypeTemplates is missing" );
return;
}
List< LNodeType > res =
dtt
.getLNodeType()
.stream()
......@@ -1435,14 +1441,14 @@ public abstract class AnyLNImpl extends UnNamingImpl implements AnyLN {
String mess = "LNodeType( id = " + getLnType() + " )";
if( res.size() != 1 ) {
SclUtilities.displayNotFoundError( console, messagePrefix, mess, res.size() );
SclUtilities.displayNotFoundWarning( console, messagePrefix, mess, res.size() );
return;
}
setRefersToLNodeType( res.get( 0 ) );
console.info( "AnyLN on line " + getLineNumber() + " refers to " + mess + " on line " + getRefersToLNodeType().getLineNumber() );
if(( getLnClass() != null ) && ! getLnClass().equals( getRefersToLNodeType().getLnClass() )) {
console.error( messagePrefix + "lnClass in " + mess + "(" + getRefersToLNodeType().getLnClass() + ") is not " + getLnClass() );
console.warning( messagePrefix + "lnClass in " + mess + "(" + getRefersToLNodeType().getLnClass() + ") is not " + getLnClass() );
}
}
......
......@@ -1176,18 +1176,27 @@ public class AssociationImpl extends BaseElementImpl implements Association {
// prefix The LN prefix
// lnInst The instance number of the client LN
if( getIedName() == null ) return;
if( getLdInst() == null ) return;
if( getLnClass() == null ) return;
String messagePrefix = "while resolving link from Association on line " + getLineNumber() + ": ";
if(( getIedName() == null ) || getIedName().isEmpty() ) {
console.warning( messagePrefix + "iedName is missing " );
return;
}
if(( getLdInst() == null ) || getLdInst().isEmpty() ) {
console.warning( messagePrefix + "ldInst is missing " );
return;
}
if(( getLnClass() == null ) || getLnClass().isEmpty() ) {
console.warning( messagePrefix + "lnClass is missing " );
return;
}
// find an IED with
// IED.name == Association.iedName
Pair< IED, Integer > ied = SclUtilities.getIED( SclUtilities.getSCL( this ), getIedName() );
String mess1 = "IED( name = " + getIedName() + " )";
if( ied.getLeft() == null ) {
SclUtilities.displayNotFoundError( console, messagePrefix, mess1, ied.getRight() );
SclUtilities.displayNotFoundWarning( console, messagePrefix, mess1, ied.getRight() );
return;
}
console.verbose( messagePrefix + "found " + mess1 + " on line " + ied.getLeft().getLineNumber() );
......@@ -1197,15 +1206,20 @@ public class AssociationImpl extends BaseElementImpl implements Association {
Pair< LDevice, Integer > lDevice = SclUtilities.getLDevice( ied.getLeft(), getLdInst() );
String mess2 = "LDevice( inst = " + getLdInst() + " )";
if( lDevice.getLeft() == null ) {
SclUtilities.displayNotFoundError( console, messagePrefix, mess2, lDevice.getRight() );
SclUtilities.displayNotFoundWarning( console, messagePrefix, mess2, lDevice.getRight() );
return;
}
console.verbose( messagePrefix + "found " + mess2 + " on line " + lDevice.getLeft().getLineNumber() );
Pair< AnyLN, Integer > anyLN = SclUtilities.getAnyLN( lDevice.getLeft(), getLnClass(), getLnInst(), getPrefix() );
String mess3 = "LN( lnClass = " + getLnClass() + ", inst = " + getLnInst() + " )";
String mess3 = "LN( lnClass = " + getLnClass();
if( getLnInst() != null ) {
mess3 += ", inst = " + getLnInst();
if( getPrefix() != "" ) mess3 += ", prefix = " + getPrefix();
}
mess3 += " )";
if( anyLN.getLeft() == null ) {
SclUtilities.displayNotFoundError( console, messagePrefix, mess3, anyLN.getRight() );
SclUtilities.displayNotFoundWarning( console, messagePrefix, mess3, anyLN.getRight() );
return;
}
setRefersToAnyLN( anyLN.getLeft() );
......
......@@ -1085,20 +1085,33 @@ public class ClientLNImpl extends SclObjectImpl implements ClientLN {
// lnInst The instance id of this LN instance of below LN class in the IED
// desc optional descriptive text, e.g. about purpose of the client
if( getIedName() == null ) return;
if( getLdInst() == null ) return;
if( getLnClass() == null ) return;
// If the reference is to an LN at a pure client access point, then the value of ldInst shall be LD0
if( getLdInst().equals( "LD0" )) return;
String messagePrefix = "while resolving link from ClientLN on line " + getLineNumber() + ": ";
if(( getIedName() == null ) || getIedName().isEmpty() ) {
console.warning( messagePrefix + "iedName is missing" );
return;
}
if(( getLdInst() == null ) || getLdInst().isEmpty() ) {
console.warning( messagePrefix + "ldInst is missing" );
return;
}
if(( getLnClass() == null ) || getLnClass().isEmpty() ) {
console.warning( messagePrefix + "lnClass is missing" );
return;
}
// If the reference is to an LN at a pure client access point, then the value of ldInst shall be LD0
if( "LD0".equals( getLdInst() )) {
console.verbose( messagePrefix + "ldInst is LD0: pure client access point, therefore no link" );
return;
}
// find an IED with
// IED.name == ClientLN.iedName
Pair< IED, Integer > ied = SclUtilities.getIED( SclUtilities.getSCL( this ), getIedName() );
String mess1 = "IED( name = " + getIedName() + " )";
if( ied.getLeft() == null ) {
SclUtilities.displayNotFoundError( console, messagePrefix, mess1, ied.getRight() );
SclUtilities.displayNotFoundWarning( console, messagePrefix, mess1, ied.getRight() );
return;
}
console.verbose( messagePrefix + "found " + mess1 + " on line " + ied.getLeft().getLineNumber() );
......@@ -1106,11 +1119,11 @@ public class ClientLNImpl extends SclObjectImpl implements ClientLN {
Pair< AccessPoint, Integer > ap = null;
if(( getApRef() == null ) || getApRef().isEmpty() ) {
if( ied.getLeft().getAccessPoint().size() == 0 ) {
console.error( messagePrefix + "no AccessPoint found in ied ( name = " + ied.getLeft().getName() + " )" );
console.warning( messagePrefix + "no AccessPoint found in ied ( name = " + ied.getLeft().getName() + " )" );
return;
}
if( ied.getLeft().getAccessPoint().size() > 1 ) {
console.error( messagePrefix + "found several AccessPoint in ied ( name = " + ied.getLeft().getName() + " ) but apRef not specified" );
console.warning( messagePrefix + "found several AccessPoint in ied ( name = " + ied.getLeft().getName() + " ) but apRef not specified" );
return;
}
ap = Pair.of( ied.getLeft().getAccessPoint().get( 0 ), 1 );
......@@ -1119,7 +1132,7 @@ public class ClientLNImpl extends SclObjectImpl implements ClientLN {
ap = SclUtilities.getAccessPoint( ied.getLeft(), getApRef() );
String mess2 = "AccessPoint( name = " + getApRef() + " )";
if( ap.getLeft() == null ) {
SclUtilities.displayNotFoundError( console, messagePrefix, mess2, ap.getRight() );
SclUtilities.displayNotFoundWarning( console, messagePrefix, mess2, ap.getRight() );
return;
}
console.verbose( messagePrefix + "found " + mess2 + " on line " + ap.getLeft().getLineNumber() );
......@@ -1128,15 +1141,20 @@ public class ClientLNImpl extends SclObjectImpl implements ClientLN {
Pair< LDevice, Integer > lDevice = SclUtilities.getLDevice( ap.getLeft(), getLdInst() );
String mess3 = "LDevice( inst = " + getLdInst() + " )";
if( lDevice.getLeft() == null ) {
SclUtilities.displayNotFoundError( console, messagePrefix, mess3, lDevice.getRight() );
SclUtilities.displayNotFoundWarning( console, messagePrefix, mess3, lDevice.getRight() );
return;
}
console.verbose( messagePrefix + "found " + mess3 + " on line " + lDevice.getLeft().getLineNumber() );
Pair< AnyLN,Integer > anyLN = SclUtilities.getAnyLN( lDevice.getLeft(), getLnClass(), getLnInst(), getPrefix() );
String mess4 = "LN( lnClass = " + getLnClass() + ", inst = " + getLnInst() + " )";
String mess4 = "LN( lnClass = " + getLnClass();
if( getLnInst() != null ) {
mess4 += ", inst = " + getLnInst();
if( getPrefix() != "" ) mess4 += ", prefix = " + getPrefix();
}
mess4 += " )";
if( anyLN.getLeft() == null ) {
SclUtilities.displayNotFoundError( console, messagePrefix, mess4, anyLN.getRight() );
SclUtilities.displayNotFoundWarning( console, messagePrefix, mess4, anyLN.getRight() );
return;
}
setRefersToAnyLN( anyLN.getLeft() );
......
......@@ -983,24 +983,30 @@ public class ConnectedAPImpl extends UnNamingImpl implements ConnectedAP {
// apName a name identifying this access point within the IED
// desc some descriptive text for this access point at this subnetwork
if( getIedName() == null ) return;
if( getApName() == null ) return;
String messagePrefix = "while resolving link from ConnectedAP on line " + getLineNumber() + ": ";
if(( getIedName() == null ) || getIedName().isEmpty() ) {
console.warning( messagePrefix + "iedName is missing" );
return;
}
if(( getApName() == null ) || getApName().isEmpty() ) {
console.warning( messagePrefix + "apName is missing" );
return;
}
// find an IED with
// IED.name == ConnectedAP.iedName
Pair< IED, Integer > ied = SclUtilities.getIED( SclUtilities.getSCL( this ), getIedName() );
String mess1 = "IED( name = " + getIedName() + " )";
if( ied.getLeft() == null ) {
SclUtilities.displayNotFoundError( console, messagePrefix, mess1, ied.getRight() );
SclUtilities.displayNotFoundWarning( console, messagePrefix, mess1, ied.getRight() );
return;
}
console.verbose( messagePrefix + "found " + mess1 + " on line " + ied.getLeft().getLineNumber() );
Pair< AccessPoint, Integer > ap = SclUtilities.getAccessPoint( ied.getLeft(), getApName() );
String mess2 = "AccessPoint( name = " + getApName() + " )";
if( ap.getLeft() == null ) {
SclUtilities.displayNotFoundError( console, messagePrefix, mess2, ap.getRight() );
SclUtilities.displayNotFoundWarning( console, messagePrefix, mess2, ap.getRight() );
return;
}
setRefersToAccessPoint( ap.getLeft() );
......
......@@ -650,15 +650,22 @@ public abstract class ControlBlockImpl extends UnNamingImpl implements ControlBl
// An LN is not necessary, as these control blocks are only in LLN0.
// cbName The name of the control block within the LLN0 of the LD ldInst.
// TODO: update comment
// TODO: validate assumption
// Assumption : we need both an ied name and a ld instance to uniquely identify a LDevice.
// We will use the iedName provided by the enclosing connectedAP.
if( getLdInst() == null ) return;
if( getCbName() == null ) return;
String messagePrefix = "while resolving link from ControlBlock on line " + getLineNumber() + ": ";
if(( getLdInst() == null ) || getLdInst().isEmpty() ) {
console.warning( messagePrefix + "ldInst is missing" );
return;
}
if(( getCbName() == null ) || getCbName().isEmpty() ) {
console.warning( messagePrefix + "cbName is missing" );
return;
}
// No error or warning messages here: if this happens, error should have been detected before
if( getParentConnectedAP() == null ) return;
if( getParentConnectedAP().getRefersToAccessPoint() == null ) return;
IED ied = getParentConnectedAP().getRefersToAccessPoint().getParentIED();
......@@ -669,14 +676,17 @@ public abstract class ControlBlockImpl extends UnNamingImpl implements ControlBl
Pair< LDevice, Integer > lDevice = SclUtilities.getLDevice( ied, getLdInst() );
String mess1 = "LDevice( inst = " + getLdInst() + " )";
if( lDevice.getLeft() == null ) {
SclUtilities.displayNotFoundError( console, messagePrefix, mess1, lDevice.getRight() );
SclUtilities.displayNotFoundWarning( console, messagePrefix, mess1, lDevice.getRight() );
return;
}
console.verbose( messagePrefix + "found " + mess1 + " on line " + lDevice.getLeft().getLineNumber() );
// Find a ControlWithIEDName inside LN0 of LDevice with
// ControlWithIEDName.name == ControlBlock.bName
if( lDevice.getLeft().getLN0() == null ) return;
if( lDevice.getLeft().getLN0() == null ) {
console.warning( messagePrefix + "LN0 is missing" );
return;
}
List< ControlWithIEDName > l2 = new ArrayList< ControlWithIEDName >();
l2.addAll( lDevice.getLeft().getLN0().getGSEControl() );
......@@ -690,7 +700,7 @@ public abstract class ControlBlockImpl extends UnNamingImpl implements ControlBl
String mess2 = "ControlWithIEDName( name = " + getCbName() + " )";
if( res2.size() != 1 ) {
SclUtilities.displayNotFoundError( console, messagePrefix, mess2, res2.size() );
SclUtilities.displayNotFoundWarning( console, messagePrefix, mess2, res2.size() );
return;
}
setRefersToControlWithIEDName( res2.get( 0 ));
......
......@@ -573,11 +573,16 @@ public abstract class ControlImpl extends UnNamingImpl implements Control {
// datSet The name of the data set to be sent by the report control block; datSet should only be missing within an ICD-File,
// or to indicate an unused control block. The referenced data set must be in the same LN as the control block.
if( getDatSet() == null ) return;
if( getParentAnyLN() == null ) return;
String messagePrefix = "while resolving link from Control on line " + getLineNumber() + ": ";
if(( getDatSet() == null ) || getDatSet().isEmpty() ) {
console.warning( messagePrefix + "datSet is missing" );
return;
}
// No error or warning message here: if this happens, error should have been detected before
if( getParentAnyLN() == null ) return;
// find an DataSet with
// DataSet.name == Control.datSet
List< DataSet > res =
......@@ -589,7 +594,7 @@ public abstract class ControlImpl extends UnNamingImpl implements Control {
String mess = "DataSet( name = " + getDatSet() + " )";
if( res.size() != 1 ) {
SclUtilities.displayNotFoundError( console, messagePrefix, mess, res.size() );
SclUtilities.displayNotFoundWarning( console, messagePrefix, mess, res.size() );
return;
}
setRefersToDataSet( res.get( 0 ));
......
......@@ -963,27 +963,34 @@ public class DAIImpl extends UnNamingImpl implements DAI {
// see Issue #13
super.doBuildExplicitLinks( console );
if(( getName() == null ) || getName().isEmpty() ) return;
String messagePrefix = "while resolving link from DAI on line " + getLineNumber() + ": ";
if( ! doBuildExplicitLinkWithParentDOI( console )) {
if( ! doBuildExplicitLinkWithParentSDI( console )) {
//
if(( getName() == null ) || getName().isEmpty() ) {
console.warning( messagePrefix + "name is missing" );
return;
}
if( getParentDOI() != null ) {
doBuildExplicitLinkWithParentDOI( console, messagePrefix );
}
else if( getParentSDI() != null ) {
doBuildExplicitLinkWithParentSDI( console, messagePrefix );
}
else {
// Unexpected
}
}
private boolean doBuildExplicitLinkWithParentDOI( IRiseClipseConsole console ) {
if( getParentDOI() == null ) return false;
String messagePrefix = "while resolving link from DAI on line " + getLineNumber() + ": ";
private void doBuildExplicitLinkWithParentDOI( IRiseClipseConsole console, String messagePrefix ) {
// No error or warning messages here: if this happens, error should have been detected before
DO do_ = getParentDOI().getRefersToDO();
if( do_ == null ) return false;
if( do_ == null ) return;
console.verbose( messagePrefix + "found DO on line " + do_.getLineNumber() );
do_.buildExplicitLinks( console, false );
DOType dot = do_.getRefersToDOType();
if( dot == null ) return false;
// No error or warning message here: if this happens, error should have been detected before
if( dot == null ) return;
console.verbose( messagePrefix + "found DOType on line " + dot.getLineNumber() );
List< DA > res =
......@@ -994,34 +1001,24 @@ public class DAIImpl extends UnNamingImpl implements DAI {
.collect( Collectors.toList() );
String mess = "DA( name = " + getName() + " )";
if( res.isEmpty() ) {
// Not an error : will look for using ParentSDI
// TODO: must validate
//console.error( messagePrefix + "cannot find " + mess );
return false;
}
if( res.size() > 1 ) {
console.error( messagePrefix + "found several " + mess );
return false;
if( res.size() != 1 ) {
SclUtilities.displayNotFoundWarning( console, messagePrefix, mess, res.size() );
return;
}
setRefersToAbstractDataAttribute( res.get( 0 ) );
console.info( "DAI on line " + getLineNumber() + " refers to " + mess + " on line " + getRefersToAbstractDataAttribute().getLineNumber() );
return true;
}
private boolean doBuildExplicitLinkWithParentSDI( IRiseClipseConsole console ) {
if( getParentSDI() == null ) return false;
String messagePrefix = "while resolving link from DAI on line " + getLineNumber() + ": ";
private void doBuildExplicitLinkWithParentSDI( IRiseClipseConsole console, String messagePrefix ) {
// No error or warning messages here: if this happens, error should have been detected before
AbstractDataAttribute att = getParentSDI().getRefersToAbstractDataAttribute();
if( att == null ) return false;
if( att == null ) return;
att.buildExplicitLinks( console, false );
console.verbose( messagePrefix + "found AbstractDataAttribute on line " + att.getLineNumber() );
DAType dat = att.getRefersToDAType();
if( dat == null ) return false;
// No error or warning message here: if this happens, error should have been detected before
if( dat == null ) return;
console.verbose( messagePrefix + "found DAType on line " + dat.getLineNumber() );
List< BDA > res =
......@@ -1033,12 +1030,11 @@ public class DAIImpl extends UnNamingImpl implements DAI {
String mess = "BDA( name = " + getName() + " )";
if( res.size() != 1 ) {
SclUtilities.displayNotFoundError( console, messagePrefix, mess, res.size() );
return false;
SclUtilities.displayNotFoundWarning( console, messagePrefix, mess, res.size() );
return;
}
setRefersToAbstractDataAttribute( res.get( 0 ));
console.info( "DAI on line " + getLineNumber() + " refers to " + mess + " on line " + getRefersToAbstractDataAttribute().getLineNumber() );
return true;
}
} //DAIImpl
......@@ -771,8 +771,13 @@ public class DOIImpl extends UnNamingImpl implements DOI {
String messagePrefix = "while resolving link from DOI on line " + getLineNumber() + ": ";
if(( getName() == null ) || getName().isEmpty() ) return;
if(( getName() == null ) || getName().isEmpty() ) {
console.warning( messagePrefix + "name is missing" );
return;
}
// No error or warning message here: if this happens, error should have been detected before
if( getParentAnyLN() == null ) return;
if( getParentAnyLN().getRefersToLNodeType() == null ) return;
console.verbose( messagePrefix + "found LNodeType on line " + getParentAnyLN().getRefersToLNodeType().getLineNumber() );
......@@ -786,7 +791,7 @@ public class DOIImpl extends UnNamingImpl implements DOI {
String mess = "DO( name = " + getName() + " )";
if( res.size() != 1 ) {
SclUtilities.displayNotFoundError( console, messagePrefix, mess, res.size() );
SclUtilities.displayNotFoundWarning( console, messagePrefix, mess, res.size() );
return;
}
setRefersToDO( res.get( 0 ) );
......
......@@ -489,12 +489,16 @@ public class DOImpl extends AbstractDataObjectImpl implements DO {
// access control definition applies
// transient If set to true, it indicates that the Transient definition from IEC 61850-7-4 applies
if( getType() == null ) return;
String messagePrefix = "while resolving link from DO on line " + getLineNumber() + ": ";
if(( getType() == null ) || getType().isEmpty() ) {
console.warning( messagePrefix + "type is missing" );
return;
}
// No error or warning message here: if this happens, error should have been detected before
DataTypeTemplates dtt = SclUtilities.getSCL( this ).getDataTypeTemplates();
if( dtt == null ) return;
String messagePrefix = "while resolving link from DO on line " + getLineNumber() + ": ";
List< DOType > res =
dtt
.getDOType()
......@@ -504,7 +508,7 @@ public class DOImpl extends AbstractDataObjectImpl implements DO {
String mess = "DOType( id = " + getType() + " )";
if( res.size() != 1 ) {
SclUtilities.displayNotFoundError( console, messagePrefix, mess, res.size() );
SclUtilities.displayNotFoundWarning( console, messagePrefix, mess, res.size() );
return;
}
setRefersToDOType( res.get( 0 ));
......
......@@ -1062,19 +1062,28 @@ public class FCDAImpl extends SclObjectImpl implements FCDA {
// ix An index to select an array element in case that one of the data elements is an array. The ix value shall be identical to the
// ArrayElementNumber value in the doName or daName part.
if( getLdInst() == null ) return;
if( getLnClass() == null ) return;
if( getDoName() == null ) return;
String messagePrefix = "while resolving link from FCDA on line " + getLineNumber() + ": ";
if(( getLdInst() == null ) || getLdInst().isEmpty() ) {
console.warning( messagePrefix + "ldInst is missing" );
return;
}
if(( getLnClass() == null ) || getLnClass().isEmpty() ) {
console.warning( messagePrefix + "lnClass is missing" );
return;
}
if(( getDoName() == null ) || getDoName().isEmpty() ) {
console.warning( messagePrefix + "doName is missing" );
return;
}
// The LN we are looking for is in the same IED/Server
EObject object = this;
while(( object != null ) && !( object instanceof AccessPoint ) ) {
object = object.eContainer();
}
if( object == null ) {
console.verbose( messagePrefix + "AccessPoint not found" );
console.warning( messagePrefix + "AccessPoint not found" );
return;
}
AccessPoint ap = ( AccessPoint ) object;
......@@ -1083,15 +1092,20 @@ public class FCDAImpl extends SclObjectImpl implements FCDA {
Pair< LDevice, Integer > lDevice = SclUtilities.getLDevice( ap, getLdInst() );
String mess1 = "LDevice( inst = " + getLdInst() + " )";
if( lDevice.getLeft() == null ) {
SclUtilities.displayNotFoundError( console, messagePrefix, mess1, lDevice.getRight() );
SclUtilities.displayNotFoundWarning( console, messagePrefix, mess1, lDevice.getRight() );
return;
}
console.verbose( messagePrefix + "found " + mess1 + " on line " + lDevice.getLeft().getLineNumber() );
Pair< AnyLN, Integer > anyLN = SclUtilities.getAnyLN( lDevice.getLeft(), getLnClass(), getLnInst(), getPrefix() );
String mess2 = "LN( lnClass = " + getLnClass() + ", inst = " + getLnInst() + " )";
String mess2 = "LN( lnClass = " + getLnClass();
if( getLnInst() != null ) {
mess2 += ", inst = " + getLnInst();
if( getPrefix() != "" ) mess2 += ", prefix = " + getPrefix();
}
mess2 += " )";
if( anyLN.getLeft() == null ) {
SclUtilities.displayNotFoundError( console, messagePrefix, mess2, anyLN.getRight() );
SclUtilities.displayNotFoundWarning( console, messagePrefix, mess2, anyLN.getRight() );
return;
}
console.verbose( messagePrefix + "found " + mess2 + " on line " + anyLN.getLeft().getLineNumber() );
......@@ -1119,13 +1133,14 @@ public class FCDAImpl extends SclObjectImpl implements FCDA {
String mess3a = "DO ( name = " + doNames[0] + " )";
if( res3a.size() != 1 ) {
SclUtilities.displayNotFoundError( console, messagePrefix, mess3a, res3a.size() );
SclUtilities.displayNotFoundWarning( console, messagePrefix, mess3a, res3a.size() );
return;
}
console.verbose( messagePrefix + "found " + mess3a + " on line " + res3a.get( 0 ).getLineNumber() );
res3a.get( 0 ).buildExplicitLinks( console, false );
DOType doType = res3a.get( 0 ).getRefersToDOType();
// No error or warning message here: if this happens, error should have been detected before
if( doType == null ) return;
console.verbose( messagePrefix + "found DOType on line " + doType.getLineNumber() );
......@@ -1140,7 +1155,7 @@ public class FCDAImpl extends SclObjectImpl implements FCDA {
String mess3b = "SDO ( name = " + name + " ) in DOType on line " + doType.getLineNumber();
if( res3b.size() != 1 ) {
SclUtilities.displayNotFoundError( console, messagePrefix, mess3b, res3b.size() );
SclUtilities.displayNotFoundWarning( console, messagePrefix, mess3b, res3b.size() );
return;
}
console.verbose( messagePrefix + "found " + mess3b + " on line " + res3b.get( 0 ).getLineNumber() );
......@@ -1165,7 +1180,7 @@ public class FCDAImpl extends SclObjectImpl implements FCDA {
String mess4a = "DA ( name = " + daNames[0] + " ) in DOType";
if( res4a.size() != 1 ) {