org.springframework.webflow.engine.Flow.setOutputMapper()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(4.1k)|赞(0)|评价(0)|浏览(102)

本文整理了Java中org.springframework.webflow.engine.Flow.setOutputMapper()方法的一些代码示例,展示了Flow.setOutputMapper()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Flow.setOutputMapper()方法的具体详情如下:
包路径:org.springframework.webflow.engine.Flow
类名称:Flow
方法名:setOutputMapper

Flow.setOutputMapper介绍

[英]Sets the mapper to map flow output attributes.
[中]将映射器设置为映射流输出属性。

代码示例

代码示例来源:origin: org.springframework.webflow/spring-webflow

/**
 * 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()));
  }
}

代码示例来源:origin: org.springframework/spring-webflow

public void buildOutputMapper() throws FlowBuilderException {
  getFlow().setOutputMapper(parseOutputMapper(getDocumentElement()));
}

代码示例来源:origin: spring-projects/spring-webflow

/**
 * 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()));
  }
}

代码示例来源:origin: org.springframework.webflow/org.springframework.webflow

/**
 * 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()));
  }
}

代码示例来源:origin: org.springframework/spring-webflow

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();
}

代码示例来源:origin: spring-projects/spring-webflow

@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());
}

代码示例来源:origin: spring-projects/spring-webflow

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"));
}

相关文章