protected void addActionError(Object object) { validatorContext.addActionError(getMessage(object)); }
protected void addFieldError(String propertyName, Object object) { validatorContext.addFieldError(propertyName, getMessage(object)); }
/** * Translates a simple field name into a full field name in Ognl syntax * * @param fieldName field name in OGNL syntax * @return full field name in OGNL syntax */ @Override public String getFullFieldName(String fieldName) { if (parent instanceof VisitorFieldValidator.AppendingValidatorContext) { return parent.getFullFieldName(field + "." + fieldName); } return field + "." + fieldName; }
fullFieldName = fValidator.getValidatorContext().getFullFieldName(fValidator.getFieldName()); if (validatorContext.hasFieldErrors()) { Collection<String> fieldErrors = validatorContext.getFieldErrors().get(fullFieldName); } else if (validatorContext.hasActionErrors()) { Collection<String> actionErrors = validatorContext.getActionErrors(); if (validatorContext.hasFieldErrors()) { Collection<String> errCol = validatorContext.getFieldErrors().get(fullFieldName); } else if (validatorContext.hasActionErrors()) { Collection<String> errCol = validatorContext.getActionErrors();
message = validatorContext.getText(messageKey, defaultMessage, parsedMessageParameters);
fullFieldName = fValidator.getValidatorContext().getFullFieldName(fValidator.getFieldName()); if (validatorContext.hasFieldErrors()) { Collection<String> fieldErrors = validatorContext.getFieldErrors().get(fullFieldName); } else if (validatorContext.hasActionErrors()) { Collection<String> actionErrors = validatorContext.getActionErrors(); if (validatorContext.hasFieldErrors()) { Collection<String> errCol = validatorContext.getFieldErrors().get(fullFieldName); } else if (validatorContext.hasActionErrors()) { Collection<String> errCol = validatorContext.getActionErrors();
/** * The validation implementation must guarantee that setValidatorContext will * be called with a non-null ValidatorContext before validate is called. * * @param object * @throws ValidationException */ @Override public void doValidate(Object object) throws ValidationException { String fieldName = getFieldName(); String fullFieldName = getValidatorContext().getFullFieldName(fieldName); ActionContext context = ActionContext.getContext(); Map<String, Object> conversionErrors = context.getConversionErrors(); if (conversionErrors.containsKey(fullFieldName)) { if ((defaultMessage == null) || ("".equals(defaultMessage.trim()))) { defaultMessage = XWorkConverter.getConversionErrorMessage(fullFieldName, context.getValueStack()); } addFieldError(fieldName, object); } }
String fullFieldName = getValidatorContext().getFullFieldName(fieldName); if (conversionErrors.containsKey(fullFieldName)) { Object value = conversionErrors.get(fullFieldName);