本文整理了Java中org.springframework.webflow.engine.Flow.start()
方法的一些代码示例,展示了Flow.start()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Flow.start()
方法的具体详情如下:
包路径:org.springframework.webflow.engine.Flow
类名称:Flow
方法名:start
[英]Start a new session for this flow in its start state. This boils down to the following:
代码示例来源:origin: org.springframework.webflow/spring-webflow
public void start(Flow flow, MutableAttributeMap<?> input) throws IllegalStateException {
MockFlowSession session = new MockFlowSession(flow, input);
if (getFlowExecutionContext().isActive()) {
session.setParent(getFlowExecutionContext().getActiveSession());
}
getMockFlowExecutionContext().setActiveSession(session);
flow.start(this, input);
}
代码示例来源:origin: org.springframework.webflow/spring-webflow
void start(Flow flow, MutableAttributeMap<?> input, RequestControlContext context) {
listeners.fireSessionCreating(context, flow);
FlowSessionImpl session = activateSession(flow);
if (session.isRoot()) {
status = FlowExecutionStatus.ACTIVE;
}
if (input == null) {
input = new LocalAttributeMap<>();
}
if (hasEmbeddedModeAttribute(input)) {
session.setEmbeddedMode();
}
StateManageableMessageContext messageContext = (StateManageableMessageContext) context.getMessageContext();
messageContext.setMessageSource(flow.getApplicationContext());
listeners.fireSessionStarting(context, session, input);
flow.start(context, input);
listeners.fireSessionStarted(context, session);
}
代码示例来源:origin: org.springframework/spring-webflow
public ViewSelection start(Flow flow, MutableAttributeMap input) throws IllegalStateException {
getMockFlowExecutionContext().setActiveSession(new MockFlowSession(flow, input));
getMockFlowExecutionContext().getMockActiveSession().setStatus(FlowSessionStatus.STARTING);
ViewSelection selectedView = flow.start(this, input);
return selectedView;
}
代码示例来源:origin: spring-projects/spring-webflow
public void testStartWithoutStartState() {
MockRequestControlContext context = new MockRequestControlContext(flow);
try {
Flow empty = new Flow("empty");
empty.start(context, null);
fail("should have failed");
} catch (IllegalStateException e) {
}
}
代码示例来源:origin: org.springframework/spring-webflow
public ViewSelection start(Flow flow, MutableAttributeMap input) throws FlowExecutionException {
if (input == null) {
// create a mutable map so entries can be added by listeners!
input = new LocalAttributeMap();
}
if (logger.isDebugEnabled()) {
logger.debug("Activating new session for flow '" + flow.getId() + "' in state '"
+ flow.getStartState().getId() + "' with input " + input);
}
getExecutionListeners().fireSessionStarting(this, flow, input);
FlowSession session = flowExecution.activateSession(flow);
getExecutionListeners().fireSessionCreated(this, session);
ViewSelection selectedView = flow.start(this, input);
getExecutionListeners().fireSessionStarted(this, session);
return selectedView;
}
代码示例来源:origin: spring-projects/spring-webflow
public void start(Flow flow, MutableAttributeMap<?> input) throws IllegalStateException {
MockFlowSession session = new MockFlowSession(flow, input);
if (getFlowExecutionContext().isActive()) {
session.setParent(getFlowExecutionContext().getActiveSession());
}
getMockFlowExecutionContext().setActiveSession(session);
flow.start(this, input);
}
代码示例来源:origin: org.springframework.webflow/org.springframework.webflow
public void start(Flow flow, MutableAttributeMap input) throws IllegalStateException {
MockFlowSession session = new MockFlowSession(flow, input);
if (getFlowExecutionContext().isActive()) {
session.setParent(getFlowExecutionContext().getActiveSession());
}
getMockFlowExecutionContext().setActiveSession(session);
flow.start(this, input);
}
代码示例来源:origin: org.springframework.webflow/org.springframework.webflow
void start(Flow flow, MutableAttributeMap input, RequestControlContext context) {
listeners.fireSessionCreating(context, flow);
FlowSession session = activateSession(flow);
if (input == null) {
input = new LocalAttributeMap();
}
StateManageableMessageContext messageContext = (StateManageableMessageContext) context.getMessageContext();
messageContext.setMessageSource(flow.getApplicationContext());
listeners.fireSessionStarting(context, session, input);
flow.start(context, input);
listeners.fireSessionStarted(context, session);
}
代码示例来源:origin: spring-projects/spring-webflow
public void testStart() {
MockRequestControlContext context = new MockRequestControlContext(flow);
flow.start(context, new LocalAttributeMap<>());
assertEquals("Wrong start state", "myState1", context.getCurrentState().getId());
}
代码示例来源:origin: spring-projects/spring-webflow
public void testStartWithVariables() {
MockRequestControlContext context = new MockRequestControlContext(flow);
flow.addVariable(new FlowVariable("var1", new VariableValueFactory() {
public Object createInitialValue(RequestContext context) {
return new ArrayList<>();
}
public void restoreReferences(Object value, RequestContext context) {
}
}));
flow.start(context, new LocalAttributeMap<>());
context.getFlowScope().getRequired("var1", ArrayList.class);
}
代码示例来源:origin: spring-projects/spring-webflow
void start(Flow flow, MutableAttributeMap<?> input, RequestControlContext context) {
listeners.fireSessionCreating(context, flow);
FlowSessionImpl session = activateSession(flow);
if (session.isRoot()) {
status = FlowExecutionStatus.ACTIVE;
}
if (input == null) {
input = new LocalAttributeMap<>();
}
if (hasEmbeddedModeAttribute(input)) {
session.setEmbeddedMode();
}
StateManageableMessageContext messageContext = (StateManageableMessageContext) context.getMessageContext();
messageContext.setMessageSource(flow.getApplicationContext());
listeners.fireSessionStarting(context, session, input);
flow.start(context, input);
listeners.fireSessionStarted(context, session);
}
代码示例来源:origin: spring-projects/spring-webflow
public void testStartWithAction() {
MockRequestControlContext context = new MockRequestControlContext(flow);
TestAction action = new TestAction();
flow.getStartActionList().add(action);
flow.start(context, new LocalAttributeMap<>());
assertEquals("Wrong start state", "myState1", context.getCurrentState().getId());
assertEquals(1, action.getExecutionCount());
}
代码示例来源: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"));
}
内容来源于网络,如有侵权,请联系作者删除!