Commit c0839273 authored by Dominique Marcadet's avatar Dominique Marcadet

factorize common code of doBuildExplicitLinks()

This common code is in SclUtilities
parent 01eb3f41
......@@ -1396,7 +1396,7 @@ public abstract class AbstractDataAttributeImpl extends UnNamingImpl implements
// valKind Determines how the value shall be interpreted if any is given
if( getType() == null ) return;
DataTypeTemplates dtt = SclUtilities.get_DataTypeTemplates( this );
DataTypeTemplates dtt = SclUtilities.getSCL( this ).getDataTypeTemplates();
if( dtt == null ) return;
String messagePrefix = "while resolving link from AbstractDataAttribute on line " + getLineNumber() + ": ";
......@@ -1413,12 +1413,8 @@ public abstract class AbstractDataAttributeImpl extends UnNamingImpl implements
.collect( Collectors.toList() );
String mess = "EnumType( id = " + getType() + " )";
if( res.isEmpty() ) {
console.error( messagePrefix + "cannot find " + mess );
return;
}
if( res.size() > 1 ) {
console.error( messagePrefix + "found several " + mess );
if( res.size() != 1 ) {
SclUtilities.displayNotFoundError( console, messagePrefix, mess, res.size() );
return;
}
setRefersToEnumType( res.get( 0 ) );
......@@ -1436,12 +1432,8 @@ public abstract class AbstractDataAttributeImpl extends UnNamingImpl implements
.collect( Collectors.toList() );
String mess = "DAType( id = " + getType() + " )";
if( res.isEmpty() ) {
console.error( messagePrefix + "cannot find " + mess );
return;
}
if( res.size() > 1 ) {
console.error( messagePrefix + "found several " + mess );
if( res.size() != 1 ) {
SclUtilities.displayNotFoundError( console, messagePrefix, mess, res.size() );
return;
}
setRefersToDAType( res.get( 0 ) );
......
......@@ -1421,7 +1421,7 @@ public abstract class AnyLNImpl extends UnNamingImpl implements AnyLN {
// inst The LN instance number identifying this LN – an unsigned integer
if( getLnType() == null ) return;
DataTypeTemplates dtt = SclUtilities.get_DataTypeTemplates( this );
DataTypeTemplates dtt = SclUtilities.getSCL( this ).getDataTypeTemplates();
if( dtt == null ) return;
String messagePrefix = "while resolving link from AnyLN on line " + getLineNumber() + ": ";
......@@ -1434,12 +1434,8 @@ public abstract class AnyLNImpl extends UnNamingImpl implements AnyLN {
.collect( Collectors.toList() );
String mess = "LNodeType( id = " + getLnType() + " )";
if( res.isEmpty() ) {
console.error( messagePrefix + "cannot find " + mess );
return;
}
if( res.size() > 1 ) {
console.error( messagePrefix + "found several " + mess );
if( res.size() != 1 ) {
SclUtilities.displayNotFoundError( console, messagePrefix, mess, res.size() );
return;
}
setRefersToLNodeType( res.get( 0 ) );
......
......@@ -21,20 +21,17 @@ package fr.centralesupelec.edf.riseclipse.iec61850.scl.impl;
import fr.centralesupelec.edf.riseclipse.iec61850.scl.AgDesc;
import fr.centralesupelec.edf.riseclipse.iec61850.scl.AgLDRef;
import fr.centralesupelec.edf.riseclipse.iec61850.scl.AgLNRef;
import java.util.List;
import java.util.stream.Collectors;
import fr.centralesupelec.edf.riseclipse.iec61850.scl.AnyLN;
import fr.centralesupelec.edf.riseclipse.iec61850.scl.Association;
import fr.centralesupelec.edf.riseclipse.iec61850.scl.AssociationKindEnum;
import fr.centralesupelec.edf.riseclipse.iec61850.scl.IED;
import fr.centralesupelec.edf.riseclipse.iec61850.scl.LDevice;
import fr.centralesupelec.edf.riseclipse.iec61850.scl.LN;
import fr.centralesupelec.edf.riseclipse.iec61850.scl.SclPackage;
import fr.centralesupelec.edf.riseclipse.iec61850.scl.Server;
import fr.centralesupelec.edf.riseclipse.iec61850.scl.util.SclUtilities;
import fr.centralesupelec.edf.riseclipse.util.IRiseClipseConsole;
import org.apache.commons.lang3.tuple.Pair;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.ecore.EClass;
......@@ -1187,87 +1184,32 @@ public class AssociationImpl extends BaseElementImpl implements Association {
// find an IED with
// IED.name == Association.iedName
List< IED > res1 =
SclUtilities
.get_IEDs( this )
.stream()
.filter( ied -> getIedName().equals( ied.getName() ))
.collect( Collectors.toList() );
IED ied = null;
Pair< IED, Integer > ied = SclUtilities.getIED( SclUtilities.getSCL( this ), getIedName() );
String mess1 = "IED( name = " + getIedName() + " )";
if( res1.isEmpty() ) {
console.error( messagePrefix + "cannot find " + mess1 );
return;
}
if( res1.size() > 1 ) {
console.error( messagePrefix + "found several " + mess1 );
if( ied.getLeft() == null ) {
SclUtilities.displayNotFoundError( console, messagePrefix, mess1, ied.getRight() );
return;
}
ied = res1.get( 0 );
console.verbose( messagePrefix + "found " + mess1 + " on line " + ied.getLineNumber() );
// The following is copy/paste from ExtRef/FCDA
// TODO: factor out ?
console.verbose( messagePrefix + "found " + mess1 + " on line " + ied.getLeft().getLineNumber() );
// find inside an LDevice with
// LDevice.name == Association.ldInst
List< LDevice > res2 =
ied
.getAccessPoint()
.stream()
.map( ap -> ap.getServer() )
.filter( s -> s != null )
.map( s -> s.getLDevice() )
.filter( ld -> ld != null )
.flatMap( ld -> ld.stream() )
.filter( ld -> getLdInst().equals( ld.getInst() ))
.collect( Collectors.toList() );
Pair< LDevice, Integer > lDevice = SclUtilities.getLDevice( ied.getLeft(), getLdInst() );
String mess2 = "LDevice( inst = " + getLdInst() + " )";
if( res2.isEmpty() ) {
console.error( messagePrefix + "cannot find " + mess2 );
return;
}
if( res2.size() > 1 ) {
console.error( messagePrefix + "found several " + mess2 );
if( lDevice.getLeft() == null ) {
SclUtilities.displayNotFoundError( console, messagePrefix, mess2, lDevice.getRight() );
return;
}
LDevice lDevice = res2.get( 0 );
console.verbose( messagePrefix + "found " + mess2 + " on line " + lDevice.getLineNumber() );
console.verbose( messagePrefix + "found " + mess2 + " on line " + lDevice.getLeft().getLineNumber() );
if( "LLN0".equals( getLnClass() )) {
if( lDevice.getLN0() == null ) {
console.error( messagePrefix + "cannot find LN0" );
return;
}
setRefersToAnyLN( lDevice.getLN0() );
console.info( "Association on line " + getLineNumber() + " refers to LN0 on line " + getRefersToAnyLN().getLineNumber() );
}
else {
if( getLnInst() == null ) return;
// find inside an LN with
// LN.lnClass == FCDA.lnClass
// LN.prefix == FCDA.prefix
// LN.inst == FCDA.lnInst
List< LN > res3 = lDevice
.getLN()
.stream()
.filter( ln -> getLnClass().equals( ln.getLnClass() ) && getLnInst().equals( ln.getInst() ) && getPrefix().equals( ln.getPrefix() ))
.collect( Collectors.toList() );
String mess3 = "LN( lnClass = " + getLnClass() + ", inst = " + getLnInst() + " )";
if( res3.isEmpty() ) {
console.error( messagePrefix + "cannot find " + mess3 );
return;
}
if( res3.size() > 1 ) {
console.error( messagePrefix + "found several " + mess3 );
return;
}
setRefersToAnyLN( res3.get( 0 ));
console.info( "Association on line " + getLineNumber() + " refers to " + mess3 + " on line " + getRefersToAnyLN().getLineNumber() );
Pair< AnyLN, Integer > anyLN = SclUtilities.getAnyLN( lDevice.getLeft(), getLnClass(), getLnInst(), getPrefix() );
String mess3 = "LN( lnClass = " + getLnClass() + ", inst = " + getLnInst() + " )";
if( anyLN.getLeft() == null ) {
SclUtilities.displayNotFoundError( console, messagePrefix, mess3, anyLN.getRight() );
return;
}
setRefersToAnyLN( anyLN.getLeft() );
console.info( "Association on line " + getLineNumber() + " refers to " + mess3 + " on line " + getRefersToAnyLN().getLineNumber() );
}
} //AssociationImpl
......@@ -22,19 +22,16 @@ import fr.centralesupelec.edf.riseclipse.iec61850.scl.AccessPoint;
import fr.centralesupelec.edf.riseclipse.iec61850.scl.AgDesc;
import fr.centralesupelec.edf.riseclipse.iec61850.scl.AgLDRef;
import fr.centralesupelec.edf.riseclipse.iec61850.scl.AgLNRef;
import java.util.List;
import java.util.stream.Collectors;
import fr.centralesupelec.edf.riseclipse.iec61850.scl.AnyLN;
import fr.centralesupelec.edf.riseclipse.iec61850.scl.ClientLN;
import fr.centralesupelec.edf.riseclipse.iec61850.scl.IED;
import fr.centralesupelec.edf.riseclipse.iec61850.scl.LDevice;
import fr.centralesupelec.edf.riseclipse.iec61850.scl.LN;
import fr.centralesupelec.edf.riseclipse.iec61850.scl.RptEnabled;
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 org.apache.commons.lang3.tuple.Pair;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.ecore.EClass;
......@@ -1098,117 +1095,52 @@ public class ClientLNImpl extends SclObjectImpl implements ClientLN {
// find an IED with
// IED.name == ClientLN.iedName
List< IED > res1 =
SclUtilities
.get_IEDs( this )
.stream()
.filter( ied -> getIedName().equals( ied.getName() ))
.collect( Collectors.toList() );
IED ied = null;
Pair< IED, Integer > ied = SclUtilities.getIED( SclUtilities.getSCL( this ), getIedName() );
String mess1 = "IED( name = " + getIedName() + " )";
if( res1.isEmpty() ) {
console.error( messagePrefix + "cannot find " + mess1 );
return;
}
if( res1.size() > 1 ) {
console.error( messagePrefix + "found several " + mess1 );
if( ied.getLeft() == null ) {
SclUtilities.displayNotFoundError( console, messagePrefix, mess1, ied.getRight() );
return;
}
ied = res1.get( 0 );
console.verbose( messagePrefix + "found " + mess1 + " on line " + ied.getLineNumber() );
console.verbose( messagePrefix + "found " + mess1 + " on line " + ied.getLeft().getLineNumber() );
AccessPoint ap = null;
Pair< AccessPoint, Integer > ap = null;
if(( getApRef() == null ) || getApRef().isEmpty() ) {
if( ied.getAccessPoint().size() == 0 ) {
console.error( messagePrefix + "no AccessPoint found in ied ( name = " + ied.getName() + " )" );
if( ied.getLeft().getAccessPoint().size() == 0 ) {
console.error( messagePrefix + "no AccessPoint found in ied ( name = " + ied.getLeft().getName() + " )" );
return;
}
if( ied.getAccessPoint().size() > 1 ) {
console.error( messagePrefix + "found several AccessPoint in ied ( name = " + ied.getName() + " ) but apRef not specified" );
if( ied.getLeft().getAccessPoint().size() > 1 ) {
console.error( messagePrefix + "found several AccessPoint in ied ( name = " + ied.getLeft().getName() + " ) but apRef not specified" );
return;
}
ap = ied.getAccessPoint().get( 0 );
ap = Pair.of( ied.getLeft().getAccessPoint().get( 0 ), 1 );
}
else {
List< AccessPoint > res2 =
ied
.getAccessPoint()
.stream()
.filter( a -> getApRef().equals( a.getName() ))
.collect( Collectors.toList() );
ap = SclUtilities.getAccessPoint( ied.getLeft(), getApRef() );
String mess2 = "AccessPoint( name = " + getApRef() + " )";
if( res2.isEmpty() ) {
console.error( messagePrefix + "cannot find " + mess2 );
return;
}
if( res2.size() > 1 ) {
console.error( messagePrefix + "found several " + mess2 );
if( ap.getLeft() == null ) {
SclUtilities.displayNotFoundError( console, messagePrefix, mess2, ap.getRight() );
return;
}
ap = res2.get( 0 );
console.verbose( messagePrefix + "found " + mess2 + " on line " + ap.getLineNumber() );
console.verbose( messagePrefix + "found " + mess2 + " on line " + ap.getLeft().getLineNumber() );
}
// The following is copy/paste from ExtRef/FCDA
// TODO: factor out ?
// find inside an LDevice with
// LDevice.name == ClientLN.ldInst
if( ap.getServer() == null ) return;
List< LDevice > res3 =
ap
.getServer()
.getLDevice()
.stream()
.filter( ld -> getLdInst().equals( ld.getInst() ))
.collect( Collectors.toList() );
Pair< LDevice, Integer > lDevice = SclUtilities.getLDevice( ap.getLeft(), getLdInst() );
String mess3 = "LDevice( inst = " + getLdInst() + " )";
if( res3.isEmpty() ) {
console.error( messagePrefix + "cannot find " + mess3 );
if( lDevice.getLeft() == null ) {
SclUtilities.displayNotFoundError( console, messagePrefix, mess3, lDevice.getRight() );
return;
}
if( res3.size() > 1 ) {
console.error( messagePrefix + "found several " + mess3 );
return;
}
LDevice lDevice = res3.get( 0 );
console.verbose( messagePrefix + "found " + mess3 + " on line " + lDevice.getLineNumber() );
}
console.verbose( messagePrefix + "found " + mess3 + " on line " + lDevice.getLeft().getLineNumber() );
if( "LLN0".equals( getLnClass() )) {
if( lDevice.getLN0() == null ) {
console.error( messagePrefix + "cannot find LN0" );
return;
}
setRefersToAnyLN( lDevice.getLN0() );
console.info( "ClientLN on line " + getLineNumber() + " refers to LN0 on line " + getRefersToAnyLN().getLineNumber() );
}
else {
if( getLnInst() == null ) return;
// find inside an LN with
// LN.lnClass == ClientLN.lnClass
// LN.prefix == ClientLN.prefix
// LN.inst == ClientLN.lnInst
List< LN > res4 =
lDevice
.getLN()
.stream()
.filter( ln -> getLnClass().equals( ln.getLnClass() ) && getLnInst().equals( ln.getInst() ) && getPrefix().equals( ln.getPrefix() ))
.collect( Collectors.toList() );
String mess4 = "LN( lnClass = " + getLnClass() + ", inst = " + getLnInst() + " )";
if( res4.isEmpty() ) {
console.error( messagePrefix + "cannot find " + mess4 );
return;
}
if( res4.size() > 1 ) {
console.error( messagePrefix + "found several " + mess4 );
return;
}
setRefersToAnyLN( res4.get( 0 ));
console.info( "ClientLN on line " + getLineNumber() + " refers to " + mess4 + " on line " + getRefersToAnyLN().getLineNumber() );
Pair< AnyLN,Integer > anyLN = SclUtilities.getAnyLN( lDevice.getLeft(), getLnClass(), getLnInst(), getPrefix() );
String mess4 = "LN( lnClass = " + getLnClass() + ", inst = " + getLnInst() + " )";
if( anyLN.getLeft() == null ) {
SclUtilities.displayNotFoundError( console, messagePrefix, mess4, anyLN.getRight() );
return;
}
setRefersToAnyLN( anyLN.getLeft() );
console.info( "ClientLN on line " + getLineNumber() + " refers to " + mess4 + " on line " + getRefersToAnyLN().getLineNumber() );
}
} //ClientLNImpl
......@@ -31,9 +31,7 @@ import fr.centralesupelec.edf.riseclipse.iec61850.scl.util.SclUtilities;
import fr.centralesupelec.edf.riseclipse.util.IRiseClipseConsole;
import java.util.Collection;
import java.util.List;
import java.util.stream.Collectors;
import org.apache.commons.lang3.tuple.Pair;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.common.util.EList;
......@@ -992,42 +990,20 @@ public class ConnectedAPImpl extends UnNamingImpl implements ConnectedAP {
// find an IED with
// IED.name == ConnectedAP.iedName
List< IED > res1 =
SclUtilities
.get_IEDs( this )
.stream()
.filter( ied -> getIedName().equals( ied.getName() ))
.collect( Collectors.toList() );
IED ied = null;
Pair< IED, Integer > ied = SclUtilities.getIED( SclUtilities.getSCL( this ), getIedName() );
String mess1 = "IED( name = " + getIedName() + " )";
if( res1.isEmpty() ) {
console.error( messagePrefix + "cannot find " + mess1 );
return;
}
if( res1.size() > 1 ) {
console.error( messagePrefix + "found several " + mess1 );
if( ied.getLeft() == null ) {
SclUtilities.displayNotFoundError( console, messagePrefix, mess1, ied.getRight() );
return;
}
ied = res1.get( 0 );
console.verbose( messagePrefix + "found " + mess1 + " on line " + ied.getLineNumber() );
List< AccessPoint > res2 =
ied
.getAccessPoint()
.stream()
.filter( a -> getApName().equals( a.getName() ))
.collect( Collectors.toList() );
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( res2.isEmpty() ) {
console.error( messagePrefix + "cannot find " + mess2 );
return;
}
if( res2.size() > 1 ) {
console.error( messagePrefix + "found several " + mess2 );
if( ap.getLeft() == null ) {
SclUtilities.displayNotFoundError( console, messagePrefix, mess2, ap.getRight() );
return;
}
setRefersToAccessPoint( res2.get( 0 ));
setRefersToAccessPoint( ap.getLeft() );
console.info( "ConnectedAP on line " + getLineNumber() + " refers to " + mess2 + " on line " + getRefersToAccessPoint().getLineNumber() );
}
......
......@@ -29,10 +29,13 @@ import fr.centralesupelec.edf.riseclipse.iec61850.scl.ControlWithIEDName;
import fr.centralesupelec.edf.riseclipse.iec61850.scl.IED;
import fr.centralesupelec.edf.riseclipse.iec61850.scl.LDevice;
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 fr.centralesupelec.edf.riseclipse.util.RiseClipseFatalException;
import java.lang.reflect.InvocationTargetException;
import org.apache.commons.lang3.tuple.Pair;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.common.util.EList;
......@@ -663,37 +666,21 @@ public abstract class ControlBlockImpl extends UnNamingImpl implements ControlBl
// find an LDevice with
// LDevice.inst == ControlBlock.ldInst
List< LDevice > res1 =
ied
.getAccessPoint()
.stream()
.map( ap -> ap.getServer() )
.filter( s -> s != null )
.map( s -> s.getLDevice() )
.filter( ld -> ld != null )
.flatMap( ld -> ld.stream() )
.filter( ld -> getLdInst().equals( ld.getInst() ))
.collect( Collectors.toList() );
Pair< LDevice, Integer > lDevice = SclUtilities.getLDevice( ied, getLdInst() );
String mess1 = "LDevice( inst = " + getLdInst() + " )";
if( res1.isEmpty() ) {
console.error( messagePrefix + "cannot find " + mess1 );
if( lDevice.getLeft() == null ) {
SclUtilities.displayNotFoundError( console, messagePrefix, mess1, lDevice.getRight() );
return;
}
if( res1.size() > 1 ) {
console.error( messagePrefix + "found several " + mess1 );
return;
}
LDevice lDevice = res1.get( 0 );
console.verbose( messagePrefix + "found " + mess1 + " on line " + lDevice.getLineNumber() );
console.verbose( messagePrefix + "found " + mess1 + " on line " + lDevice.getLeft().getLineNumber() );
// Find a ControlWithIEDName inside LN0 of LDevice with
// ControlWithIEDName.name == ControlBlock.bName
if( lDevice.getLN0() == null ) return;
if( lDevice.getLeft().getLN0() == null ) return;
List< ControlWithIEDName > l2 = new ArrayList< ControlWithIEDName >();
l2.addAll( lDevice.getLN0().getGSEControl() );
l2.addAll( lDevice.getLN0().getSampledValueControl() );
l2.addAll( lDevice.getLeft().getLN0().getGSEControl() );
l2.addAll( lDevice.getLeft().getLN0().getSampledValueControl() );
List< ControlWithIEDName > res2 =
l2
......@@ -702,12 +689,8 @@ public abstract class ControlBlockImpl extends UnNamingImpl implements ControlBl
.collect( Collectors.toList() );
String mess2 = "ControlWithIEDName( name = " + getCbName() + " )";
if( res2.isEmpty() ) {
console.error( messagePrefix + "cannot find " + mess2 );
return;
}
if( res2.size() > 1 ) {
console.error( messagePrefix + "found several " + mess2 );
if( res2.size() != 1 ) {
SclUtilities.displayNotFoundError( console, messagePrefix, mess2, res2.size() );
return;
}
setRefersToControlWithIEDName( res2.get( 0 ));
......
......@@ -26,6 +26,7 @@ import fr.centralesupelec.edf.riseclipse.iec61850.scl.Control;
import fr.centralesupelec.edf.riseclipse.iec61850.scl.DataSet;
import fr.centralesupelec.edf.riseclipse.iec61850.scl.ExtRef;
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 fr.centralesupelec.edf.riseclipse.util.RiseClipseFatalException;
......@@ -587,15 +588,11 @@ public abstract class ControlImpl extends UnNamingImpl implements Control {
.collect( Collectors.toList() );
String mess = "DataSet( name = " + getDatSet() + " )";
if( res.isEmpty() ) {
console.error( messagePrefix + "cannot find " + mess );
if( res.size() != 1 ) {
SclUtilities.displayNotFoundError( console, messagePrefix, mess, res.size() );
return;
}
if( res.size() > 1 ) {
console.error( messagePrefix + "found several " + mess );
return;
}
setRefersToDataSet( res.get( 0 ) );
setRefersToDataSet( res.get( 0 ));
console.info( "Control on line " + getLineNumber() + " refers to " + mess + " on line " + getRefersToDataSet().getLineNumber() );
}
......
......@@ -45,6 +45,7 @@ import fr.centralesupelec.edf.riseclipse.iec61850.scl.SDI;
import fr.centralesupelec.edf.riseclipse.iec61850.scl.SclPackage;
import fr.centralesupelec.edf.riseclipse.iec61850.scl.Val;
import fr.centralesupelec.edf.riseclipse.iec61850.scl.ValKindEnum;
import fr.centralesupelec.edf.riseclipse.iec61850.scl.util.SclUtilities;
import fr.centralesupelec.edf.riseclipse.util.IRiseClipseConsole;
/**
......@@ -1031,12 +1032,8 @@ public class DAIImpl extends UnNamingImpl implements DAI {
.collect( Collectors.toList() );
String mess = "BDA( name = " + getName() + " )";
if( res.isEmpty() ) {
console.error( messagePrefix + "cannot find " + mess );
return false;
}
if( res.size() > 1 ) {
console.error( messagePrefix + "found several " + mess );
if( res.size() != 1 ) {
SclUtilities.displayNotFoundError( console, messagePrefix, mess, res.size() );
return false;
}
setRefersToAbstractDataAttribute( res.get( 0 ));
......
......@@ -38,6 +38,7 @@ import fr.centralesupelec.edf.riseclipse.iec61850.scl.DO;
import fr.centralesupelec.edf.riseclipse.iec61850.scl.DOI;
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;
/**
......@@ -780,16 +781,12 @@ public class DOIImpl extends UnNamingImpl implements DOI {
.getRefersToLNodeType()
.getDO()
.stream()
.filter( d -> getName().equals( d.getName() ))
.filter( d -> getName().equals( d.getName() ))
.collect( Collectors.toList() );
String mess = "DO( name = " + getName() + " )";
if( res.isEmpty() ) {
console.error( messagePrefix + "cannot find " + mess );
return;
}
if( res.size() > 1 ) {
console.error( messagePrefix + "found several " + mess );
if( res.size() != 1 ) {
SclUtilities.displayNotFoundError( console, messagePrefix, mess, res.size() );
return;
}
setRefersToDO( res.get( 0 ) );
......
......@@ -490,7 +490,7 @@ public class DOImpl extends AbstractDataObjectImpl implements DO {
// transient If set to true, it indicates that the Transient definition from IEC 61850-7-4 applies
if( getType() == null ) return;
DataTypeTemplates dtt = SclUtilities.get_DataTypeTemplates( this );
DataTypeTemplates dtt = SclUtilities.getSCL( this ).getDataTypeTemplates();
if( dtt == null ) return;
String messagePrefix = "while resolving link from DO on line " + getLineNumber() + ": ";
......@@ -503,12 +503,8 @@ public class DOImpl extends AbstractDataObjectImpl implements DO {
.collect( Collectors.toList() );
String mess = "DOType( id = " + getType() + " )";
if( res.isEmpty() ) {
console.error( messagePrefix + "cannot find " + mess );
return;
}
if( res.size() > 1 ) {
console.error( messagePrefix + "found several " + mess );
if( res.size() != 1 ) {
SclUtilities.displayNotFoundError( console, messagePrefix, mess, res.size() );
return;
}
setRefersToDOType( res.get( 0 ));
......
......@@ -19,6 +19,7 @@
package fr.centralesupelec.edf.riseclipse.iec61850.scl.impl;
import fr.centralesupelec.edf.riseclipse.iec61850.scl.AbstractDataAttribute;
import fr.centralesupelec.edf.riseclipse.iec61850.scl.AccessPoint;
import fr.centralesupelec.edf.riseclipse.iec61850.scl.AnyLN;
import java.util.List;
......@@ -32,13 +33,14 @@ import fr.centralesupelec.edf.riseclipse.iec61850.scl.DataSet;