@SuppressWarnings({ "unchecked", "rawtypes" }) @Override public Object postProcessAfterInitialization(Object bean, String beanName) { if (bean instanceof ActionHandler<?, ?>) { ActionHandler<?, ?> actionHandler = (ActionHandler<?, ?>) bean; RegisterActionHandler registerHandler = bean.getClass().getAnnotation(RegisterActionHandler.class); if (registerHandler != null) { ActionHandlerValidatorClass actionHandlerValidatorClass = new ActionHandlerValidatorClass( actionHandler.getClass(),registerHandler.validator()); SpringUtils.registerBean(applicationContext, new ActionHandlerValidatorMapImpl( actionHandler.getActionType(), actionHandlerValidatorClass)); if (actionHandlerValidatorRegistry instanceof LazyActionHandlerValidatorRegistry) { ((LazyActionHandlerValidatorRegistry) actionHandlerValidatorRegistry) .addActionHandlerValidatorClass(actionHandler.getActionType(), actionHandlerValidatorClass); } } } return bean; }
private <A extends Action<R>, R extends Result> void doUndo(A action, R result, ExecutionContext ctx) throws ActionException, ServiceException { ActionValidator actionValidator = findActionValidator(action); ActionHandler<A, R> handler = findHandler(action); try { if (actionValidator.isValid(action)) { handler.undo(action, result, ctx); } else { throw new ServiceException(actionValidator.getClass().getName() + actionValidatorMessage + action .getClass().getName()); } } catch (ActionException e) { throw e; } catch (Exception cause) { throw new ServiceException(cause); } }
return handler.execute(action, ctx); } else { throw new ServiceException(actionValidator.getClass().getName() + actionValidatorMessage + action
return handler.execute(action, ctx); } else { throw new ServiceException(actionValidator.getClass().getName() + actionValidatorMessage + action
private <A extends Action<R>, R extends Result> void doUndo(A action, R result, ExecutionContext ctx) throws ActionException, ServiceException { ActionValidator actionValidator = findActionValidator(action); ActionHandler<A, R> handler = findHandler(action); try { if (actionValidator.isValid(action)) { handler.undo(action, result, ctx); } else { throw new ServiceException(actionValidator.getClass().getName() + actionValidatorMessage + action .getClass().getName()); } } catch (ActionException e) { throw e; } catch (Exception cause) { throw new ServiceException(cause); } }
@SuppressWarnings({ "unchecked", "rawtypes" }) @Override public Object postProcessAfterInitialization(Object bean, String beanName) { if (bean instanceof ActionHandler<?, ?>) { ActionHandler<?, ?> actionHandler = (ActionHandler<?, ?>) bean; RegisterActionHandler registerHandler = bean.getClass().getAnnotation(RegisterActionHandler.class); if (registerHandler != null) { ActionHandlerValidatorClass actionHandlerValidatorClass = new ActionHandlerValidatorClass( actionHandler.getClass(),registerHandler.validator()); SpringUtils.registerBean(applicationContext, new ActionHandlerValidatorMapImpl( actionHandler.getActionType(), actionHandlerValidatorClass)); if (actionHandlerValidatorRegistry instanceof LazyActionHandlerValidatorRegistry) { ((LazyActionHandlerValidatorRegistry) actionHandlerValidatorRegistry) .addActionHandlerValidatorClass(actionHandler.getActionType(), actionHandlerValidatorClass); } } } return bean; }