Polish samples logging

- Add logging of internal transitions which makes things
  a bit more clear with showcase sample.
- Update showcase docs with clarification of use of
  nested states.
This commit is contained in:
Janne Valkealahti
2015-11-18 11:52:06 +00:00
parent 56abfab4f8
commit 07e6076e0b
2 changed files with 68 additions and 1 deletions

View File

@@ -27,7 +27,9 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.ClassPathResource;
import org.springframework.statemachine.event.OnStateEntryEvent;
import org.springframework.statemachine.event.OnStateExitEvent;
import org.springframework.statemachine.event.OnTransitionEvent;
import org.springframework.statemachine.event.StateMachineEvent;
import org.springframework.statemachine.transition.TransitionKind;
@Configuration
public class CommonConfiguration {
@@ -64,6 +66,11 @@ public class CommonConfiguration {
} else if (event instanceof OnStateExitEvent) {
OnStateExitEvent e = (OnStateExitEvent)event;
log.info("Exit state " + e.getState().getId());
} else if (event instanceof OnTransitionEvent) {
OnTransitionEvent e = (OnTransitionEvent)event;
if (e.getTransition().getKind() == TransitionKind.INTERNAL) {
log.info("Internal transition source=" + e.getTransition().getSource().getId());
}
}
}