// ----------------------------------------------------- // Reset Method // ------------ protected void doSetupResetMethod( S2ExecuteConfig executeConfig, S2ActionMapping actionMapping, Execute execute) { final String reset = execute.reset(); if (!StringUtil.isEmpty(reset)) { Method resetMethod = null; if ("reset".equals(reset)) { resetMethod = actionMapping.getActionFormBeanDesc().getMethodNoException(reset); } else { resetMethod = actionMapping.getActionFormBeanDesc().getMethod(reset); } if (resetMethod != null) { executeConfig.setResetMethod(resetMethod); } } }
// ----------------------------------------------------- // Validation // ---------- protected void doSetupValidationConfig( S2ExecuteConfig executeConfig, S2ActionMapping actionMapping, Class<?> actionClass, Method method, Execute execute, String input) { final List<S2ValidationConfig> validationConfigs = new ArrayList<S2ValidationConfig>(); final String validate = execute.validate(); boolean validator = false; if (!StringUtil.isEmpty(validate)) { final BeanDesc actionBeanDesc = actionMapping.getActionBeanDesc(); final BeanDesc actionFormBeanDesc = actionMapping.getActionFormBeanDesc(); for (String name : StringUtil.split(validate, ", ")) { if (VALIDATOR.equals(name)) { if (!execute.validator()) { throw new UnmatchValidatorAndValidateRuntimeException(actionClass, method.getName()); } validationConfigs.add(createValidationConfig()); validator = true; } else if (actionFormBeanDesc.hasMethod(name)) { final Method validateMethod = actionFormBeanDesc.getMethod(name); checkValidateMethod(actionClass, validateMethod); validationConfigs.add(createValidationConfig(validateMethod)); } else { final Method validateMethod = actionBeanDesc.getMethod(name); checkValidateMethod(actionClass, validateMethod); validationConfigs.add(createValidationConfig(validateMethod)); } } } if (!validator && execute.validator()) { validationConfigs.add(0, createValidationConfig()); } if (!validationConfigs.isEmpty() && input == null) { throw new IllegalValidatorOfExecuteMethodRuntimeException(actionClass, method.getName()); } executeConfig.setValidationConfigs(validationConfigs); }
protected void checkDuplicateExecute( S2ActionMapping actionMapping, Class<?> actionClass, Method m) { if (actionMapping.getActionFormBeanDesc().hasPropertyDesc(m.getName())) { throw new DuplicateExecuteMethodAndPropertyRuntimeException(actionClass, m.getName()); } }