@@ -265,6 +265,7 @@ Otherwise configuration is ill-formed.
|
||||
include::samples/DocsConfigurationSampleTests.java[tags=snippetS]
|
||||
----
|
||||
|
||||
[[statemachine-config-states-junction]]
|
||||
==== Junction State
|
||||
Junction needs to be defined in both states and transitions to work
|
||||
properly. Mark particular state as choice state by using `junction()`
|
||||
@@ -325,6 +326,21 @@ states from a regions.
|
||||
include::samples/DocsConfigurationSampleTests.java[tags=snippetU]
|
||||
----
|
||||
|
||||
[[statemachine-config-states-exitentry]]
|
||||
==== Exit/Entry Point States
|
||||
Exit and Entry Points can be used to do more controlled exit and entry
|
||||
from and into a submachines.
|
||||
|
||||
[source,java,indent=0]
|
||||
----
|
||||
include::samples/DocsConfigurationSampleTests.java[tags=snippetUU]
|
||||
----
|
||||
|
||||
As shown above you need to mark particular states as _exit_ and
|
||||
_entry_ states. Then you create a normal transitions into those states
|
||||
and also specify _withExit()_ and _withEntry()_ where those states
|
||||
will exit and entry respectively.
|
||||
|
||||
[[statemachine-config-commonsettings]]
|
||||
=== Configuring Common Settings
|
||||
Some of a common state machine configuration can be set via a
|
||||
|
||||
@@ -16,6 +16,8 @@ interoperability with web applications.
|
||||
<<sm-persist-statemachinepersister>>.
|
||||
* Configuration model classes are now a public API.
|
||||
* New features in timer based events.
|
||||
* New _Junction_ pseudostate <<statemachine-config-states-junction>>.
|
||||
* New _Exit Point_ and _Entry Point_ pseudostates <<statemachine-config-states-exitentry>>.
|
||||
* Configuration model verifier.
|
||||
* New samples, <<statemachine-examples-security>>, <<statemachine-examples-eventservice>>.
|
||||
* UI modeling support using Eclipse Papyrus, <<sm-papyrus>>.
|
||||
|
||||
@@ -753,6 +753,54 @@ public class DocsConfigurationSampleTests extends AbstractStateMachineTests {
|
||||
}
|
||||
// end::snippetU[]
|
||||
|
||||
// tag::snippetUU[]
|
||||
@Configuration
|
||||
@EnableStateMachine
|
||||
static class Config21 extends StateMachineConfigurerAdapter<String, String> {
|
||||
|
||||
@Override
|
||||
public void configure(StateMachineStateConfigurer<String, String> states)
|
||||
throws Exception {
|
||||
states
|
||||
.withStates()
|
||||
.initial("S1")
|
||||
.state("S2")
|
||||
.state("S3")
|
||||
.and()
|
||||
.withStates()
|
||||
.parent("S2")
|
||||
.initial("S21")
|
||||
.entry("S2ENTRY")
|
||||
.exit("S2EXIT")
|
||||
.state("S22");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void configure(StateMachineTransitionConfigurer<String, String> transitions)
|
||||
throws Exception {
|
||||
transitions
|
||||
.withExternal()
|
||||
.source("S1").target("S2")
|
||||
.event("E1")
|
||||
.and()
|
||||
.withExternal()
|
||||
.source("S1").target("S2ENTRY")
|
||||
.event("ENTRY")
|
||||
.and()
|
||||
.withExternal()
|
||||
.source("S22").target("S2EXIT")
|
||||
.event("EXIT")
|
||||
.and()
|
||||
.withEntry()
|
||||
.source("S2ENTRY").target("S22")
|
||||
.and()
|
||||
.withExit()
|
||||
.source("S2EXIT").target("S3");
|
||||
}
|
||||
}
|
||||
|
||||
// end::snippetUU[]
|
||||
|
||||
@Configuration
|
||||
@EnableStateMachine
|
||||
public class Config16
|
||||
|
||||
Reference in New Issue
Block a user