Commit f0a7f615 authored by Dominique Marcadet's avatar Dominique Marcadet

apply changes of AtLeastOne to other affected presence conditions

parent c673e648
......@@ -142,6 +142,10 @@ public class DataObjectPresenceConditionValidator {
// and duplicate it in each sub-LNClass for adding specific elements
if( base == null ) {
atLeastOne = new HashMap<>();
atMostOne = new HashSet<>();
allOrNonePerGroup = new HashMap<>();
allOnlyOneGroup = new HashMap<>();
allAtLeastOneGroup = new HashMap<>();
}
else {
atLeastOne = ( HashMap< Integer, HashSet< String > > ) base.atLeastOne.clone();
......@@ -152,6 +156,31 @@ public class DataObjectPresenceConditionValidator {
}
}
atMostOne = ( HashSet< String > ) base.atMostOne.clone();
for( String name : atMostOne ) {
presentDO.put( name, null );
}
allOrNonePerGroup = ( HashMap< Integer, HashSet< String > > ) base.allOrNonePerGroup.clone();
for( Integer group : allOrNonePerGroup.keySet() ) {
for( String name : allOrNonePerGroup.get( group )) {
presentDO.put( name, null );
}
}
allOnlyOneGroup = ( HashMap< Integer, HashSet< String > > ) base.allOnlyOneGroup.clone();
for( Integer group : allOnlyOneGroup.keySet() ) {
for( String name : allOnlyOneGroup.get( group )) {
presentDO.put( name, null );
}
}
allAtLeastOneGroup = ( HashMap< Integer, HashSet< String > > ) base.allAtLeastOneGroup.clone();
for( Integer group : allAtLeastOneGroup.keySet() ) {
for( String name : allAtLeastOneGroup.get( group )) {
presentDO.put( name, null );
}
}
}
anyLNClass
......@@ -235,13 +264,13 @@ public class DataObjectPresenceConditionValidator {
}
case "AtMostOne" :
// At most one of marked elements shall be present
if( atMostOne == null ) atMostOne = new HashSet<>();
//if( atMostOne == null ) atMostOne = new HashSet<>();
atMostOne.add( name );
break;
case "AllOrNonePerGroup" :
// Parameter n: group number (> 0).
// All or none of the elements of a group n shall be present
if( allOrNonePerGroup == null ) allOrNonePerGroup = new HashMap<>();
//if( allOrNonePerGroup == null ) allOrNonePerGroup = new HashMap<>();
try {
Integer arg = Integer.valueOf( presCondArgs );
if( arg <= 0 ) {
......@@ -261,7 +290,7 @@ public class DataObjectPresenceConditionValidator {
case "AllOnlyOneGroup" :
// Parameter n: group number (> 0).
// All elements of only one group n shall be present
if( allOnlyOneGroup == null ) allOnlyOneGroup = new HashMap<>();
//if( allOnlyOneGroup == null ) allOnlyOneGroup = new HashMap<>();
try {
Integer arg = Integer.valueOf( presCondArgs );
if( arg <= 0 ) {
......@@ -281,7 +310,7 @@ public class DataObjectPresenceConditionValidator {
case "AllAtLeastOneGroup" :
// Parameter n: group number (> 0).
// All elements of at least one group n shall be present
if( allAtLeastOneGroup == null ) allAtLeastOneGroup = new HashMap<>();
//if( allAtLeastOneGroup == null ) allAtLeastOneGroup = new HashMap<>();
try {
Integer arg = Integer.valueOf( presCondArgs );
if( arg <= 0 ) {
......@@ -860,6 +889,7 @@ public class DataObjectPresenceConditionValidator {
// Parameter n: group number (> 0).
// At least one of marked elements of a group n shall be present
// Usage in standard NSD files (version 2007B): DataObject and SubDataObject and DataAttribute and SubDataAttribute
//if( atLeastOne != null ) {
if( ! asSuperclass ) {
AbstractRiseClipseConsole.getConsole().verbose( "[NSD validation] validation of presence condition \"AtLeastOne\" on LNodeType (id=" + lNodeType.getId() + ") at line " + lNodeType.getLineNumber() );
for( Entry< Integer, HashSet< String > > e1 : atLeastOne.entrySet() ) {
......@@ -885,7 +915,8 @@ public class DataObjectPresenceConditionValidator {
// presCond: "AtMostOne" :
// At most one of marked elements shall be present
// Usage in standard NSD files (version 2007B): DataObject
if( atMostOne != null ) {
//if( atMostOne != null ) {
if( ! asSuperclass ) {
AbstractRiseClipseConsole.getConsole().verbose( "[NSD validation] validation of presence condition \"AtMostOne\" on LNodeType (id=" + lNodeType.getId() + ") at line " + lNodeType.getLineNumber() );
int count = 0;
for( String s : atMostOne ) {
......@@ -908,7 +939,8 @@ public class DataObjectPresenceConditionValidator {
// Parameter n: group number (> 0).
// All or none of the elements of a group n shall be present
// Usage in standard NSD files (version 2007B): DataAttribute
if( allOrNonePerGroup != null ) {
//if( allOrNonePerGroup != null ) {
if( ! asSuperclass ) {
AbstractRiseClipseConsole.getConsole().verbose( "[NSD validation] validation of presence condition \"AllOrNonePerGroup\" on LNodeType (id=" + lNodeType.getId() + ") at line " + lNodeType.getLineNumber() );
for( Entry< Integer, HashSet< String > > e1 : allOrNonePerGroup.entrySet() ) {
int groupCount = 0;
......@@ -933,7 +965,8 @@ public class DataObjectPresenceConditionValidator {
// Parameter n: group number (> 0).
// All elements of only one group n shall be present
// Usage in standard NSD files (version 2007B): DataObject and SubDataAttribute
if( allOnlyOneGroup != null ) {
//if( allOnlyOneGroup != null ) {
if(( ! asSuperclass ) && ( allOnlyOneGroup.size() != 0 )) { // groupNumber == 0 not an error if empty
AbstractRiseClipseConsole.getConsole().verbose( "[NSD validation] validation of presence condition \"AllOnlyOneGroup\" on LNodeType (id=" + lNodeType.getId() + ") at line " + lNodeType.getLineNumber() );
int groupNumber = 0;
for( Entry< Integer, HashSet< String > > e1 : allOnlyOneGroup.entrySet() ) {
......@@ -982,7 +1015,8 @@ public class DataObjectPresenceConditionValidator {
// Parameter n: group number (> 0).
// All elements of at least one group n shall be present
// Usage in standard NSD files (version 2007B): DataAttribute
if( allAtLeastOneGroup != null ) {
//if( allAtLeastOneGroup != null ) {
if(( ! asSuperclass ) && ( allAtLeastOneGroup.size() != 0 )) { // groupNumber == 0 not an error if empty
AbstractRiseClipseConsole.getConsole().verbose( "[NSD validation] validation of presence condition \"AllAtLeastOneGroup\" on LNodeType (id=" + lNodeType.getId() + ") at line " + lNodeType.getLineNumber() );
int groupNumber = 0;
for( Entry< Integer, HashSet< String > > e1 : allAtLeastOneGroup.entrySet() ) {
......
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