use of org.springframework.binding.message.MessageResolver in project uPortal by Jasig.
the class AttributeSwapRequestValidator method checkAttributesMap.
/**
* Checks the keys in the Map on the model against a Set to ensure there are no values in the
* Map that aren't also in the Set
*/
protected void checkAttributesMap(MessageContext context, String basePath, Set<String> swappableAttributes, Map<String, Attribute> attributesToCopy) {
for (final String attribute : attributesToCopy.keySet()) {
if (!swappableAttributes.contains(attribute)) {
final MessageBuilder messageBuilder = new MessageBuilder();
messageBuilder.error();
messageBuilder.source(basePath + "[" + attribute + "].value");
messageBuilder.code("x.is.not.a.valid.attribute");
messageBuilder.arg(attribute);
final MessageResolver errorMessage = messageBuilder.build();
context.addMessage(errorMessage);
}
}
}
Aggregations