本文整理汇总了Java中org.springframework.statemachine.config.builders.StateMachineTransitionConfigurer类的典型用法代码示例。如果您正苦于以下问题:Java StateMachineTransitionConfigurer类的具体用法?Java StateMachineTransitionConfigurer怎么用?Java StateMachineTransitionConfigurer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StateMachineTransitionConfigurer类属于org.springframework.statemachine.config.builders包,在下文中一共展示了StateMachineTransitionConfigurer类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: configure
import org.springframework.statemachine.config.builders.StateMachineTransitionConfigurer; //导入依赖的package包/类
private void configure(StateMachineStateConfigurer<S, E> stateConfig, StateMachineTransitionConfigurer<S, E> transitionConfig,
FlowEdgeConfig<S, E> flowEdgeConfig, List<Transition<S, E>> transitions) throws Exception {
StateConfigurer<S, E> stateConfigurer = stateConfig.withStates().initial(flowEdgeConfig.initState).end(flowEdgeConfig.finalState);
ExternalTransitionConfigurer<S, E> transitionConfigurer = null;
Set<S> failHandled = new HashSet<>();
for (Transition<S, E> transition : transitions) {
transitionConfigurer = transitionConfigurer == null ? transitionConfig.withExternal() : transitionConfigurer.and().withExternal();
AbstractAction<S, E, ?, ?> action = getAction(transition.source);
if (action != null) {
stateConfigurer.state(transition.source, action, null);
}
transitionConfigurer.source(transition.source).target(transition.target).event(transition.event);
if (action != null && transition.getFailureEvent() != null && transition.target != flowEdgeConfig.defaultFailureState) {
action.setFailureEvent(transition.getFailureEvent());
S failureState = Optional.ofNullable(transition.getFailureState()).orElse(flowEdgeConfig.defaultFailureState);
stateConfigurer.state(failureState, getAction(failureState), null);
transitionConfigurer.and().withExternal().source(transition.source).target(failureState).event(transition.getFailureEvent());
if (!failHandled.contains(failureState)) {
failHandled.add(failureState);
transitionConfigurer.and().withExternal().source(failureState).target(flowEdgeConfig.finalState).event(flowEdgeConfig.failureHandled);
}
}
}
stateConfigurer.state(flowEdgeConfig.finalState, getAction(FlowFinalizeAction.class), null);
}
开发者ID:hortonworks,项目名称:cloudbreak,代码行数:26,代码来源:AbstractFlowConfiguration.java
示例2: configure
import org.springframework.statemachine.config.builders.StateMachineTransitionConfigurer; //导入依赖的package包/类
@Override
public void configure(StateMachineTransitionConfigurer<States, Events> transitions)
throws Exception {
transitions
.withExternal()
.source(States.UNPAID).target(States.WAITING_FOR_RECEIVE)
.event(Events.PAY)
.and()
.withExternal()
.source(States.WAITING_FOR_RECEIVE).target(States.DONE)
.event(Events.RECEIVE);
}
开发者ID:nellochen,项目名称:springboot-start,代码行数:13,代码来源:StateMachineConfig.java
示例3: configure
import org.springframework.statemachine.config.builders.StateMachineTransitionConfigurer; //导入依赖的package包/类
@Override
public void configure(StateMachineTransitionConfigurer<States, Events> transitions)
throws Exception {
transitions
.withExternal()
.source(States.STATE1).target(States.STATE2)
.event(Events.EVENT1)
.and()
.withExternal()
.source(States.STATE2).target(States.STATE1)
.event(Events.EVENT2);
}
开发者ID:AgainstWind,项目名称:spring-cloud-demos,代码行数:13,代码来源:ServiceAApplication.java
示例4: configure
import org.springframework.statemachine.config.builders.StateMachineTransitionConfigurer; //导入依赖的package包/类
@Override
public void configure(StateMachineTransitionConfigurer<States, Events> transitions) throws Exception {
super.configure(transitions);
transitions
.withChoice()
.source(States.S1)
.first(States.S2, s2Guard())
.then(States.S3, s3Guard())
.last(States.S4);
transitions
.withExternal()
.source(States.SI).target(States.S1)
.event(Events.SI__S1)
.and()
.withExternal()
.source(States.S2).target(States.SF)
.event(Events.S2__SF)
.and()
.withExternal()
.source(States.S3).target(States.SF)
.event(Events.S3__SF)
.and()
.withExternal()
.source(States.S4).target(States.SF)
.event(Events.S4__SF)
;
}
开发者ID:WorkingDevelopers,项目名称:spring-state-machine-chart-dumper,代码行数:28,代码来源:ChoiceJunctionSSM.java
示例5: configure
import org.springframework.statemachine.config.builders.StateMachineTransitionConfigurer; //导入依赖的package包/类
@Override
public void configure(StateMachineTransitionConfigurer<States2, Events> transitions)
throws Exception {
transitions
.withJoin()
.source(States2.S2F)
.source(States2.S3F)
.target(States2.S4); //this is wrong in doc, there is S5, that is not declared in states
transitions
.withExternal()
.source(States2.S1).target(States2.S3)
.event(Events.E_S1__S3)
.action(new Action<States2, Events>() {
@Override
public void execute(StateContext<States2, Events> context) {
;
}
public String getName() {
return "testTransition";
}
})
.and()
.withExternal()
.source(States2.S3).target(States2.S4)
.event(Events.E_S3__S4)
.and()
.withExternal()
.source(States2.S4).target(States2.S5)
.event(Events.E_S4__S5)
.and()
.withExternal()
.source(States2.S5).target(States2.S6)
.event(Events.E_S5__S6)
;
transitions
.withExternal()
.source(States2.S2I).target(States2.S21)
.event(Events.E_S2I__S21)
.and()
.withExternal()
.source(States2.S21).target(States2.S22)
.event(Events.E_S21__S22)
.and()
.withExternal()
.source(States2.S22).target(States2.S2F)
.event(Events.E_S22__S2F)
;
transitions
.withExternal()
.source(States2.S3I).target(States2.S31)
.event(Events.E_S3I__S31)
.and()
.withExternal()
.source(States2.S31).target(States2.S32)
.event(Events.E_S31__S32)
.and()
.withExternal()
.source(States2.S32).target(States2.S3F)
.event(Events.E_S32__S3F)
;
}
开发者ID:WorkingDevelopers,项目名称:spring-state-machine-chart-dumper,代码行数:63,代码来源:JoinSM.java
注:本文中的org.springframework.statemachine.config.builders.StateMachineTransitionConfigurer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论