use of com.serotonin.m2m2.web.mvc.rest.v1.message.RestValidationMessage in project ma-modules-public by infiniteautomation.
the class UserModel method validate.
/*
* (non-Javadoc)
* @see com.serotonin.m2m2.web.mvc.rest.v1.model.AbstractRestModel#validate(com.serotonin.m2m2.web.mvc.rest.v1.message.RestProcessResult)
*/
@Override
public boolean validate() {
ProcessResult validation = new ProcessResult();
this.data.validate(validation);
if (validation.getHasMessages()) {
if (this.messages == null)
this.messages = new ArrayList<RestValidationMessage>();
// Add our messages to the list
for (ProcessMessage message : validation.getMessages()) {
this.messages.add(new RestValidationMessage(message.getContextualMessage(), RestMessageLevel.ERROR, message.getContextKey()));
}
return false;
} else {
// Validated ok
return true;
}
}
Aggregations