@Override
protected boolean restrictionIsValid(String leafName,
List<ValidationError> errors) {
if (getRestriction() == null || "".equals(getRestriction())) {
errors.add(new ValidationError("Please enter a restriction for the scale of type 'Ordinal' at leaf '" + leafName + "'", this));
return false;
}
List<String> values = this.getList();
if (values.size() < 2) {
errors.add(new ValidationError("At least 2 possible ordinal values have to be defined for leaf \""+ leafName + "\"", this));
return false;
}
for (int i = 0; i < values.size(); i++) {
if (values.get(i).length() == 0) {
errors.add(new ValidationError("The empty String is not a valid value for an Ordinal Scale (used in leaf \""
+ leafName + "\")", this));
return false;
} else if (values.lastIndexOf(values.get(i)) > i) {
errors.add(new ValidationError("\""
+ values.get(i)
+ "\" is specified as a possible Ordinal Value of leaf \""
+ leafName + "\" more than once!", this));
return false;
}