OnStateChange
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
OnStateChange(attrib:String; oldstate:String; newstate:String). | |||
Any class with this method signature will get called for each trigger call that is made on the statemachine. | |||
The main intended use is audit and logging functionality. When you use statemachines heavily to track important events in your business, this becomes important. | |||
The main intended use is audit and logging functionality. When you use | |||
The event method is NOT for stopping transitions – use guards for that. | The event method is NOT for stopping transitions – use guards for that. | ||
You can solve logging by implementing state effects or entry actions as well – but the OnStateChange method helps you pull out generic logging from the | You can solve logging by implementing state effects or entry actions as well – but the ''OnStateChange'' method helps you pull out generic logging from the statemachines. If your class has multiple state machines, state changes from all of these will go through this method. | ||
[[Category:OCL]] | [[Category:OCL]] | ||
[[Category:OCLOperators]] | [[Category:OCLOperators]] |
Revision as of 06:54, 16 August 2023
OnStateChange(attrib:String; oldstate:String; newstate:String).
Any class with this method signature will get called for each trigger call that is made on the statemachine.
The main intended use is audit and logging functionality. When you use statemachines heavily to track important events in your business, this becomes important.
The event method is NOT for stopping transitions – use guards for that.
You can solve logging by implementing state effects or entry actions as well – but the OnStateChange method helps you pull out generic logging from the statemachines. If your class has multiple state machines, state changes from all of these will go through this method.
This page was edited more than 11 months ago on 02/10/2024. What links here