public Model createCopy() { return new ExceptionHandlerModel(bean); }
private FlowExecutionExceptionHandler parseCustomExceptionHandler(ExceptionHandlerModel exceptionHandler) { return getLocalContext().getApplicationContext().getBean(exceptionHandler.getBean(), FlowExecutionExceptionHandler.class); }
/** * Create an exception handler model * @param bean the name of the bean to handle exceptions */ public ExceptionHandlerModel(String bean) { setBean(bean); }
eh.add(new ExceptionHandlerModel("foo")); parent.setExceptionHandlers(eh); assertEquals("foo.bar", ((EvaluateModel) child.getOnRenderActions().get(0)).getExpression()); assertEquals("foo", child.getVars().get(0).getName()); assertEquals("foo", child.getExceptionHandlers().get(0).getBean());
public void testNotMergeable() { ExceptionHandlerModel child = new ExceptionHandlerModel("child"); assertFalse(child.isMergeableWith(child)); }
private ExceptionHandlerModel parseExceptionHandler(Element element) { return new ExceptionHandlerModel(element.getAttribute("bean")); }
private FlowExecutionExceptionHandler parseCustomExceptionHandler(ExceptionHandlerModel exceptionHandler) { return getLocalContext().getApplicationContext().getBean(exceptionHandler.getBean(), FlowExecutionExceptionHandler.class); }
/** * Create an exception handler model * @param bean the name of the bean to handle exceptions */ public ExceptionHandlerModel(String bean) { setBean(bean); }
public Model createCopy() { return new ExceptionHandlerModel(bean); }
private FlowExecutionExceptionHandler parseCustomExceptionHandler(ExceptionHandlerModel exceptionHandler) { return (FlowExecutionExceptionHandler) getLocalContext().getApplicationContext().getBean( exceptionHandler.getBean(), FlowExecutionExceptionHandler.class); }
/** * Create an exception handler model * @param bean the name of the bean to handle exceptions */ public ExceptionHandlerModel(String bean) { setBean(bean); }
private ExceptionHandlerModel parseExceptionHandler(Element element) { return new ExceptionHandlerModel(element.getAttribute("bean")); }
public void testParseFlowExceptionHandler() { ClassPathResource res = new ClassPathResource("flow-exception-handler.xml", getClass()); XmlFlowModelBuilder builder = new XmlFlowModelBuilder(res); DefaultFlowModelHolder holder = new DefaultFlowModelHolder(builder); FlowModel model = holder.getFlowModel(); assertEquals("foo1", model.getExceptionHandlers().get(0).getBean()); assertEquals("foo2", model.getStateById("state1").getExceptionHandlers().get(0).getBean()); assertEquals("foo3", model.getStateById("state2").getExceptionHandlers().get(0).getBean()); assertEquals("foo4", model.getStateById("state3").getExceptionHandlers().get(0).getBean()); assertEquals("foo5", model.getStateById("state4").getExceptionHandlers().get(0).getBean()); assertEquals("foo6", model.getStateById("state5").getExceptionHandlers().get(0).getBean()); }
private ExceptionHandlerModel parseExceptionHandler(Element element) { return new ExceptionHandlerModel(element.getAttribute("bean")); }
public void testMergeExceptionHandlers() { FlowModel child = new FlowModel(); child.setExceptionHandlers(asList(new ExceptionHandlerModel("bean1"), new ExceptionHandlerModel("bean2"))); FlowModel parent = new FlowModel(); parent.setExceptionHandlers(asList(new ExceptionHandlerModel("bean2"), new ExceptionHandlerModel("bean3"))); child.merge(parent); assertEquals(4, child.getExceptionHandlers().size()); }
public void testExceptionHandlers() { FlowModel model = new FlowModel(); model.setStates(asList(new EndStateModel("state"))); model.setExceptionHandlers(asList(new ExceptionHandlerModel("exceptionHandler"))); FlowExecutionExceptionHandler handler = new FlowExecutionExceptionHandler() { public boolean canHandle(FlowExecutionException exception) { return true; } public void handle(FlowExecutionException exception, RequestControlContext context) { } }; FlowModelFlowBuilder builder = new FlowModelFlowBuilder(new StaticFlowModelHolder(model)); MockFlowBuilderContext context = new MockFlowBuilderContext("foo"); context.registerBean("exceptionHandler", handler); FlowAssembler assembler = new FlowAssembler(builder, context); Flow flow = assembler.assembleFlow(); assertEquals(1, flow.getExceptionHandlerSet().size()); }