With the business process of the Apply for a Mortgage use case described
as a statechart diagram, you can then define the process as a sequence of
states guided by a flow processor. The following example is how you would
define the flow processor within the toolkit processor definition file:
<processor id="mortgageAppl" context="mortgageOpCtx">
<state id="initial" type="initial">
<entryActions>
<startAct id="startAct" />
</entryActions>
<transitions>
<transition id="startAct.start" targetState="dataEntryView1">
</transition>
</transitions>
</state>
<state id="dataEntryView1" type="view">
<entryActions>
<!--open the view indicated as parameter-->
<openView id="openView" viewName="MortgageData1View" linkContextTo="processor">
</openView>
</entryActions>
<transitions>
<!--a new view has been opened from the MortgageData1View, may be using a next
view button-->
<transition id="NavController.MortgageData2View.viewOpened"
targetState="dataEntryView2">
</transition>
<transition id="NavController.MortgageData1View.viewClosed"
targetState="finalNotOK">
</transition>
</transitions>
</state>
<state id="dataEntryView2" type="view">
<transitions>
<transition id="NavController.OKButton.actionPerformed"
targetState="mortgageOperation">
</transition>
<transition id="NavController.MortgageData2View.viewClosed"
targetState="finalNotOK">
</transition>
</transitions>
</state>
<state id="mortgageOperation" type="operation">
<entryActions>
<ejbAction id="mortgageProcAct" requestID="key1"/>
</entryActions>
<transitions>
<transition id="execOper.ok" targetState="resultsView">
</transition>
<transition id="execOper.error" targetState="errorInfoView">
</transition>
</transitions>
</state>
<state id="resultsView" type="view">
<entryActions>
<openView id="openView" viewName="MortgageResultsView"
linkContextTo="processor">
</openView>
</entryActions>
<transitions>
<transition
id="NavController.MortgageResultsView.viewClosed"
targetState="finalOK">
<actions>
<closeView id="closeView" /> <! Closes the
active panel (second view)>
<closeView id="closeView" /> <! Closes the
active panel (first view)>
</actions>
</transition>
</transitions>
</state>
<state id="errorInfoView" type="view">
<entryActions>
<openView id="openView" viewName="ErrorInfoView
linkContextTo="processor">
</openView>
</entryActions>
<transitions>
<transition id="NavController.ErrorInfoView.viewClosed"
targetState="finalNotOK">
<actions>
<closeView id="closeView" /> <! Closes the
active panel (second view)>
<closeView id="closeView" /> <! Closes the
active panel (first view)>
</actions>
</transition>
</transitions>
</state>
<state id="finalNotOK" type="final" typeIdInfo="notOK">
</state>
<state id="finalOK" type="final" typeIdInfo="OK">
</state>
</processor>