 |
Rule Engine
Rule Engine is the heart of Easy Wizard. In other products the similar component can be called Flow Engine or Flow Map. Rule Engine receives command and data from Wizard Manager, applies input data to the underlying domain model, generates error messages if needed, and selects next step.
Rule Engine is defined with three interfaces: IWizardStep, IWizardTransition and IWizard. These interfaces are implemented in WizardStep, WizardTransition and Wizard classes, respectively.
IWizardStep defines a wizard step or, in other terms, a state of wizard's Finite State Machine (FSM). Wizard step either refers to main application domain model, or directly stores domain data relevant to the step. Besides that, a step refers to preceding and succeeding steps using transition objects, which linkes step in a sequence of steps. IWizardStep defines the following important methods:
-
addOutgoingTransition defines an outgoing transition for a step; a step can have several outgoing transitions.
-
getOutgoingTransition returns the outgoing transition which was chosen for forward traversal.
-
getIncomingTransition returns the transition object that was used to reach current step during course of action; this is used for backward traversal.
IWizardTransition defines a path or, it other terms, a transition from one wizard step to another and holds the references to its source and target steps. IWizardTransition defines following important methods:
-
getSource and getTarget return the source and target step objects for the transition, respectively; this information is used for traversal.
-
validate returns true if transition object considers itself valid; it permits to move along the path, defined by the transition.
IWizard defines a wizard controller, which holds the references to the source and current steps, and provides traversal functions. It also may store or reference domain data in the same manner, like steps do. IWizard defines following important methods:
-
getSourceNode and getCurrentNode return the first and the current node of a wizard, respectively.
-
traverseForward and traverseBackward move to the next or to the previous node.
These three interfaces is enough to define wizard rules.
|