protected List<ErrorDetail> buildErrorDetails(ValidationErrorContext errorContext,PersistenceContext persistenceContext)
{
List<ErrorDetail> errorDetails = new ArrayList<ErrorDetail>();
for (ValidationErrorHolder holder : errorContext.getValidationErrors())
{
ErrorDetail errorDetail = new ErrorDetail();
errorDetail.setCode(holder.getResourceCode());
errorDetail.setMessage(messageSource.getMessage(holder.getResourceCode(), holder.getParameters(), persistenceContext.getLocale()));
errorDetails.add(errorDetail);
}
return errorDetails;
}