コード例 #1
0
 public void validate(HttpRequest httpRequest) throws CWValidationException {
   Validator validator = new Validator(resources, "ValidateBean");
   validator.setParameter(Validator.BEAN_PARAM, httpRequest);
   ValidatorResults results = null;
   try {
     results = validator.validate();
   } catch (ValidatorException e) {
     throw new CWValidationException(e.getLocalizedMessage(), IMFResponseCodes.SYSTEM_ERROR);
   }
   checkResults(null, results, resources, form);
 }
コード例 #2
0
 /**
  * Validate the given bean and throws Exception if some validation get fails. Given bean is type
  * casted in RadicaPojo. Validator's validate method is invoked to validate the given bean.
  *
  * <p>Appropriate IRC is being set if validation fails, which is used to track the actual problem
  * in the request data. If Exception occur while executing validate method, SYSTEM_ERROR is being
  * set in IRC and error is reported.
  *
  * @param bean - Bean to be validated
  * @throws CWValidationException - if validation gets fail.
  */
 private void checkValidation(Serializable bean) throws CWValidationException {
   RequestPojo radicalPojo = (RequestPojo) bean;
   TransactionType txnType = getTransactionType(radicalPojo);
   Validator validator = new Validator(resources, "ValidateBean");
   validator.setParameter(Validator.BEAN_PARAM, bean);
   ValidatorResults results = null;
   try {
     results = validator.validate();
   } catch (ValidatorException e) {
     throw new CWValidationException(e.getLocalizedMessage(), IMFResponseCodes.SYSTEM_ERROR);
   }
   checkResults(bean, results, resources, form);
 }