/** * Builds the output mapper responsible for mapping flow output on end. * @throws FlowBuilderException an exception occurred building the flow */ public void buildOutputMapper() throws FlowBuilderException { if (flowModel.getOutputs() != null) { getFlow().setOutputMapper(parseFlowOutputMapper(flowModel.getOutputs())); } }
public void buildOutputMapper() throws FlowBuilderException { getFlow().setOutputMapper(parseOutputMapper(getDocumentElement())); }
/** * Builds the output mapper responsible for mapping flow output on end. * @throws FlowBuilderException an exception occurred building the flow */ public void buildOutputMapper() throws FlowBuilderException { if (flowModel.getOutputs() != null) { getFlow().setOutputMapper(parseFlowOutputMapper(flowModel.getOutputs())); } }
/** * Builds the output mapper responsible for mapping flow output on end. * @throws FlowBuilderException an exception occurred building the flow */ public void buildOutputMapper() throws FlowBuilderException { if (flowModel.getOutputs() != null) { getFlow().setOutputMapper(parseFlowOutputMapper(flowModel.getOutputs())); } }
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(); }
@SuppressWarnings("unchecked") public void testReturnWithOutput() { subflowState.setAttributeMapper(new SubflowAttributeMapper() { public MutableAttributeMap<Object> createSubflowInput(RequestContext context) { return new LocalAttributeMap<>(); } public void mapSubflowOutput(AttributeMap<?> flowOutput, RequestContext context) { assertEquals("bar", flowOutput.get("foo")); } }); subflowState.getTransitionSet().add(new Transition(on("end"), to("whatev"))); new State(parentFlow, "whatev") { protected void doEnter(RequestControlContext context) throws FlowExecutionException { } }; new EndState(subflow, "end"); subflow.setOutputMapper((source, target) -> { MutableAttributeMap<Object> map = (MutableAttributeMap<Object>) target; map.put("foo", "bar"); return new DefaultMappingResults(source, target, Collections.emptyList()); }); subflowState.enter(context); assertEquals("parent", context.getActiveFlow().getId()); }
public void testEndWithOutputMapper() { DefaultMapper attributeMapper = new DefaultMapper(); ExpressionParser parser = new WebFlowSpringELExpressionParser(new SpelExpressionParser()); Expression x = parser.parseExpression("flowScope.attr", new FluentParserContext().evaluate(RequestContext.class)); Expression y = parser.parseExpression("attr", new FluentParserContext().evaluate(MutableAttributeMap.class)); attributeMapper.addMapping(new DefaultMapping(x, y)); flow.setOutputMapper(attributeMapper); MockRequestControlContext context = new MockRequestControlContext(flow); context.getFlowScope().put("attr", "foo"); LocalAttributeMap<Object> sessionOutput = new LocalAttributeMap<>(); flow.end(context, "finish", sessionOutput); assertEquals("foo", sessionOutput.get("attr")); }