Added constraint to detect issue before saving wrong data.
FEA: ItEr70S04BugFixing
This commit is contained in:
parent
a02fbd3817
commit
6d80c72ab9
1 changed files with 14 additions and 0 deletions
|
|
@ -36,6 +36,7 @@ import java.util.SortedSet;
|
|||
import java.util.TreeSet;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.hibernate.validator.AssertTrue;
|
||||
import org.hibernate.validator.Valid;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.navalplanner.business.advance.bootstrap.PredefinedAdvancedTypes;
|
||||
|
|
@ -1048,4 +1049,17 @@ public class OrderLineGroup extends OrderElement implements
|
|||
return result;
|
||||
}
|
||||
|
||||
@AssertTrue(message = "indirect advance assignments should have different types")
|
||||
public boolean checkConstraintIndirectAdvanceAssignmentsWithDifferentType() {
|
||||
Set<String> types = new HashSet<String>();
|
||||
for (IndirectAdvanceAssignment each : indirectAdvanceAssignments) {
|
||||
String type = each.getAdvanceType().getUnitName();
|
||||
if (types.contains(type)) {
|
||||
return false;
|
||||
}
|
||||
types.add(type);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue