Skip to content
Snippets Groups Projects
Commit b68d3494 authored by Dominique Marcadet's avatar Dominique Marcadet
Browse files

give value of lnNs if present

parent d6b554e3
No related branches found
No related tags found
1 merge request!11Resolve "complete validation by NSD"
......@@ -35,6 +35,7 @@ import fr.centralesupelec.edf.riseclipse.iec61850.scl.AnyLN;
import fr.centralesupelec.edf.riseclipse.iec61850.scl.DA;
import fr.centralesupelec.edf.riseclipse.iec61850.scl.DOType;
import fr.centralesupelec.edf.riseclipse.iec61850.scl.LNodeType;
import fr.centralesupelec.edf.riseclipse.iec61850.scl.Val;
import fr.centralesupelec.edf.riseclipse.iec61850.scl.util.SclSwitch;
import fr.centralesupelec.edf.riseclipse.iec61850.scl.validator.RiseClipseValidatorSCL;
import fr.centralesupelec.edf.riseclipse.util.AbstractRiseClipseConsole;
......@@ -120,7 +121,7 @@ public class NsdEObjectValidator implements EValidator {
@Override
public boolean validate( EDataType eDataType, Object value, DiagnosticChain diagnostics, Map< Object, Object > context ) {
AbstractRiseClipseConsole.getConsole().info( "NOT IMPLEMENTED: NsdEObjectValidator.validate( " + eDataType.getName() + " )" );
AbstractRiseClipseConsole.getConsole().info( "[NSD validation] NOT IMPLEMENTED: NsdEObjectValidator.validate( " + eDataType.getName() + " )" );
// TODO: use nsdResource to validate value
......@@ -128,7 +129,7 @@ public class NsdEObjectValidator implements EValidator {
}
private boolean validateAnyLN( AnyLN ln, DiagnosticChain diagnostics ) {
AbstractRiseClipseConsole.getConsole().verbose( "[NSD validate] NsdEObjectValidator.validateAnyLN( " + ln.getLnClass() + " )" );
AbstractRiseClipseConsole.getConsole().verbose( "[NSD validation] NsdEObjectValidator.validateAnyLN( " + ln.getLnClass() + " )" );
// Check that LN has valid LNClass
if( ! this.anyLNValidatorMap.containsKey( ln.getLnClass() )) {
......@@ -136,22 +137,23 @@ public class NsdEObjectValidator implements EValidator {
Diagnostic.ERROR,
RiseClipseValidatorSCL.DIAGNOSTIC_SOURCE,
0,
"[NSD validate] LNClass " + ln.getLnClass() + " not found for AnyLN at line " + ln.getLineNumber(),
"[NSD validation] LNClass " + ln.getLnClass() + " not found for AnyLN at line " + ln.getLineNumber(),
new Object[] { ln } ));
return false;
}
AbstractRiseClipseConsole.getConsole().verbose( "[NSD validate] found LNClass " + ln.getLnClass() + " for AnyLN at line " + ln.getLineNumber() );
AbstractRiseClipseConsole.getConsole().verbose( "[NSD validation] found LNClass " + ln.getLnClass() + " for AnyLN at line " + ln.getLineNumber() );
// AnyLNValidator validates LN content
return anyLNValidatorMap.get( ln.getLnClass() ).validateAnyLN( ln, diagnostics );
}
protected Boolean validateLNodeType( LNodeType lNodeType, DiagnosticChain diagnostics ) {
AbstractRiseClipseConsole.getConsole().verbose( "[NSD validate] NsdEObjectValidator.validateLNodeType( " + lNodeType.getLnClass() + " )" );
AbstractRiseClipseConsole.getConsole().verbose( "[NSD validation] NsdEObjectValidator.validateLNodeType( " + lNodeType.getLnClass() + " )" );
// Check that LNodeType has valid LNClass
if( this.anyLNValidatorMap.containsKey( lNodeType.getLnClass() )) {
AbstractRiseClipseConsole.getConsole().verbose( "[NSD validate] LNClass " + lNodeType.getLnClass() + " found for LNodeType at line " + lNodeType.getLineNumber() );
AbstractRiseClipseConsole.getConsole().verbose( "[NSD validation] LNClass " + lNodeType.getLnClass()
+ " found for LNodeType at line " + lNodeType.getLineNumber() );
// LNodeTypeValidator validates LNodeType content
return lNodeTypeValidatorMap.get( lNodeType.getLnClass() ).validateLNodeType( lNodeType, diagnostics );
......@@ -176,11 +178,20 @@ public class NsdEObjectValidator implements EValidator {
.filter( d -> "lnNs".equals( d.getName() ))
.findAny();
if( da.isPresent() ) {
String value = " without value";
if( da.get().getVal().size() > 0 ) {
value = " with value [";
for( Val v : da.get().getVal() ) {
value += " " + v.getValue();
}
value += " ]";
}
diagnostics.add( new BasicDiagnostic(
Diagnostic.INFO,
RiseClipseValidatorSCL.DIAGNOSTIC_SOURCE,
0,
"[NSD validate] LNodeType at line " + lNodeType.getLineNumber() + " with lnClass " + lNodeType.getLnClass() + " is specific and has DA \"lnNs\" in DO \"NamPlt\"",
"[NSD validation] LNodeType at line " + lNodeType.getLineNumber() + " with lnClass " + lNodeType.getLnClass()
+ " is specific and has DA \"lnNs\" in DO \"NamPlt\"" + value,
new Object[] { lNodeType } ));
return true;
}
......@@ -191,7 +202,7 @@ public class NsdEObjectValidator implements EValidator {
Diagnostic.ERROR,
RiseClipseValidatorSCL.DIAGNOSTIC_SOURCE,
0,
"[NSD validate] LNClass " + lNodeType.getLnClass() + " not found for LNodeType at line " + lNodeType.getLineNumber()
"[NSD validation] LNClass " + lNodeType.getLnClass() + " not found for LNodeType at line " + lNodeType.getLineNumber()
+ " and DA \"lnNs\" in DO \"NamPlt\" not found",
new Object[] { lNodeType } ));
return false;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment