Iterables.concat(Iterables.transform(sameNameAttributes, GET_VALUES)));
attribute =
Optional.of(IAttribute.build(new Attribute(constraint.getName(), attributeValues)));
}
ITaskConstraint taskConstraint = constraint.getConstraint();
switch (taskConstraint.getSetField()) {
case VALUE:
boolean matches = AttributeFilter.matches(
attribute.transform(GET_VALUES).or(ImmutableSet.<String>of()),
taskConstraint.getValue());
return matches
? Optional.<Veto>absent()
: Optional.of(mismatchVeto(constraint.getName()));
case LIMIT:
if (!attribute.isPresent()) {
return Optional.of(mismatchVeto(constraint.getName()));
}
boolean satisfied = AttributeFilter.matches(
attribute.get(),
taskConstraint.getLimit().getLimit(),
cachedjobState);
return satisfied
? Optional.<Veto>absent()
: Optional.of(limitVeto(constraint.getName()));
default:
throw new SchedulerException("Failed to recognize the constraint type: "
+ taskConstraint.getSetField());
}
}