Search in sources :

Example 1 with ErrorList

use of org.superbiz.webapp2.messages.ErrorList in project tomee by apache.

the class ConstraintViolationExceptionMapper method getConstraintViolationErrors.

private static Object getConstraintViolationErrors(final ConstraintViolationException ex) {
    final List<ErrorResponse> errors = new ArrayList<ErrorResponse>();
    for (final ConstraintViolation violation : ex.getConstraintViolations()) {
        final ErrorResponse error = new ErrorResponse();
        error.setMessage(violation.getMessage());
        errors.add(error);
    }
    return new ErrorList<ErrorResponse>(errors);
}
Also used : ErrorList(org.superbiz.webapp1.messages.ErrorList) ConstraintViolation(javax.validation.ConstraintViolation) ArrayList(java.util.ArrayList) ErrorResponse(org.superbiz.webapp1.messages.ErrorResponse)

Example 2 with ErrorList

use of org.superbiz.webapp2.messages.ErrorList in project tomee by apache.

the class ConstraintViolationExceptionMapper method getConstraintViolationErrors.

private static Object getConstraintViolationErrors(final ConstraintViolationException ex) {
    final List<ErrorResponse> errors = new ArrayList<ErrorResponse>();
    for (final ConstraintViolation violation : ex.getConstraintViolations()) {
        final ErrorResponse error = new ErrorResponse();
        error.setMessage(violation.getMessage());
        errors.add(error);
    }
    return new ErrorList<ErrorResponse>(errors);
}
Also used : ErrorList(org.superbiz.webapp2.messages.ErrorList) ConstraintViolation(javax.validation.ConstraintViolation) ArrayList(java.util.ArrayList) ErrorResponse(org.superbiz.webapp2.messages.ErrorResponse)

Aggregations

ArrayList (java.util.ArrayList)2 ConstraintViolation (javax.validation.ConstraintViolation)2 ErrorList (org.superbiz.webapp1.messages.ErrorList)1 ErrorResponse (org.superbiz.webapp1.messages.ErrorResponse)1 ErrorList (org.superbiz.webapp2.messages.ErrorList)1 ErrorResponse (org.superbiz.webapp2.messages.ErrorResponse)1