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

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

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

Flow.setInputMapper介绍

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

代码示例

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

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

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

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

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

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

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

public void buildInputMapper() throws FlowBuilderException {
  getFlow().setInputMapper(parseInputMapper(getDocumentElement()));
}

代码示例来源: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

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

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

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

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

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

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

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

相关文章