/** * Builds the input mapper responsible for mapping flow input on start. * @throws FlowBuilderException an exception occurred building the flow */ public void buildInputMapper() throws FlowBuilderException { getFlow().setInputMapper(parseFlowInputMapper(flowModel.getInputs())); }
/** * Builds the input mapper responsible for mapping flow input on start. * @throws FlowBuilderException an exception occurred building the flow */ public void buildInputMapper() throws FlowBuilderException { getFlow().setInputMapper(parseFlowInputMapper(flowModel.getInputs())); }
/** * Builds the input mapper responsible for mapping flow input on start. * @throws FlowBuilderException an exception occurred building the flow */ public void buildInputMapper() throws FlowBuilderException { getFlow().setInputMapper(parseFlowInputMapper(flowModel.getInputs())); }
public void buildInputMapper() throws FlowBuilderException { getFlow().setInputMapper(parseInputMapper(getDocumentElement())); }
private void buildInlineFlow(Element flowElement, Flow inlineFlow) { parseAndAddFlowVariables(flowElement, inlineFlow); inlineFlow.setInputMapper(parseInputMapper(flowElement)); parseAndAddStartActions(flowElement, inlineFlow); parseAndAddInlineFlowDefinitions(flowElement, inlineFlow); parseAndAddStateDefinitions(flowElement, inlineFlow); parseAndAddGlobalTransitions(flowElement, inlineFlow); parseAndAddEndActions(flowElement, inlineFlow); inlineFlow.setOutputMapper(parseOutputMapper(flowElement)); inlineFlow.getExceptionHandlerSet().addAll(parseExceptionHandlers(flowElement)); destroyLocalServiceRegistry(); }
protected void configureFlowBuilderContext(MockFlowBuilderContext builderContext) { Flow mockDetailFlow = new Flow("detail-flow"); mockDetailFlow.setInputMapper((source, target) -> { assertEquals("id of value 1 not provided as input by calling search flow", 1L, ((AttributeMap<?>) source).get("id")); return null; }); // test responding to finish result new EndState(mockDetailFlow, "finish"); builderContext.registerSubflow(mockDetailFlow); builderContext.registerBean("phonebook", new TestPhoneBook()); }
@SuppressWarnings("unchecked") public void testEnterWithInput() { subflowState.setAttributeMapper(new SubflowAttributeMapper() { public MutableAttributeMap<Object> createSubflowInput(RequestContext context) { return new LocalAttributeMap<>("foo", "bar"); } public void mapSubflowOutput(AttributeMap<?> flowOutput, RequestContext context) { } }); subflow.setInputMapper((source, target) -> { MutableAttributeMap<Object> map = (MutableAttributeMap<Object>) source; assertEquals("bar", map.get("foo")); return new DefaultMappingResults(source, target, Collections.emptyList()); }); new State(subflow, "whatev") { protected void doEnter(RequestControlContext context) throws FlowExecutionException { } }; subflowState.enter(context); assertEquals("child", context.getActiveFlow().getId()); }
public void testStartWithMapper() { DefaultMapper attributeMapper = new DefaultMapper(); ExpressionParser parser = new WebFlowSpringELExpressionParser(new SpelExpressionParser()); Expression x = parser.parseExpression("attr", new FluentParserContext().evaluate(AttributeMap.class)); Expression y = parser.parseExpression("flowScope.attr", new FluentParserContext().evaluate(RequestContext.class)); attributeMapper.addMapping(new DefaultMapping(x, y)); flow.setInputMapper(attributeMapper); MockRequestControlContext context = new MockRequestControlContext(flow); LocalAttributeMap<Object> sessionInput = new LocalAttributeMap<>(); sessionInput.put("attr", "foo"); flow.start(context, sessionInput); assertEquals("foo", context.getFlowScope().get("attr")); }
public void testStartWithMapperButNoInput() { DefaultMapper attributeMapper = new DefaultMapper(); ExpressionParser parser = new WebFlowSpringELExpressionParser(new SpelExpressionParser()); Expression x = parser.parseExpression("attr", new FluentParserContext().evaluate(AttributeMap.class)); Expression y = parser.parseExpression("flowScope.attr", new FluentParserContext().evaluate(RequestContext.class)); attributeMapper.addMapping(new DefaultMapping(x, y)); flow.setInputMapper(attributeMapper); MockRequestControlContext context = new MockRequestControlContext(flow); LocalAttributeMap<Object> sessionInput = new LocalAttributeMap<>(); flow.start(context, sessionInput); assertTrue(context.getFlowScope().contains("attr")); assertNull(context.getFlowScope().get("attr")); }