Runtime components : Channels components : HTML Channel : Reference : HTML flow processor example with subflow
  
HTML flow processor example with subflow
The first step to defining a flow processor is to understand the dialog that is needed by the business process. A use case analysis can be used to create a state diagram, which in turn may be used as a guide to defining the flow processor. This example uses the following use case:
Credit Card Application use case
1 The user selects an option from the main menu to obtain a credit card.
2 The system attempts to obtain the financial parametric data from the customer credit history.
3 If the system cannot find enough information, the "Request Financial Information" dialog is executed.
4 When the financial information is obtained, the system selects all the credit cards for which the customer is qualified.
5 The system presents a page with the list of credit cards that allows the user to select one of them. A "cancel" action is available to end the operation. The user selects a credit card.
6 The system presents a confirmation page, which includes a summary of the operation that the user wants to perform and information about the credit card selected by the customer. A "cancel" action is available to cancel the operation, and a "back" action is available to return to the page that presents the list of credit cards. An "OK" action is available to accept the terms and conditions. The user presses the "OK" action.
7 The system presents a page informing the user that the operation has been executed successfully. The user presses the "OK" action.
8 The system presents the home page, which presents the main operations menu.
Subcase: Request Financial Information
9 The system presents a page with entry fields that requests all the financial information required for a credit card application. An "OK" action is available to submit the request, and a "cancel" action is available to end the operation. The user selects one of these buttons.
10 The system validates the data and stores it in the database.
State diagram
Each of the processes described in the use case has its own initial state and ends with a final state. The following diagram illustrates both processes and how they are related:
State diagram showing the Credit Card Application flow
The "Gather Info" subflow process exits have returning arrows with the eventNames underlined. This is to differentiate them from regular events between states of the same flow. States with a type of "final" have an exitEventName in the typeIdInfo attribute. They are used as the eventNames to be passed to the parent process.
HTML flow processor definition
The HTML Channel flow processor is configured in the toolkit configuration file (DSE.INI) as follows:
<kColl id="processors">
<field id="htmlProcessor" value="com.ibm.btt.automaton.html.DSEHtmlProcessor"
description="compound"/>
<field id="htmlState" value="com.ibm.btt.automaton.html.DSEHtmlState"
description="compound"/>
<field id="htmlTransition" value="com.ibm.btt.automaton.html.HtmlTransitionDescriptor"
description="compound"/>
</kColl>
The main-flow flow processor for this example is defined as the HTML Channel processor. The "Gather Info" state from the state diagram is defined as a subflow state, and is linked to the subflow definition by the "financialInfoState" id value. This flow processor is defined in the flow processor definition file (DSEPROC.XML) as follows:
<htmlProcessor id="creditCardsProc" context="creditCardsCtx"
conseqErrorPage="creditCardsConseqError.jsp">
<htmlState id="initial" type="initial">
<transitions>
<htmlTransition id="creditCards.start" targetState="creditHistoryOpState">
</htmlTransition>
</transitions>
</htmlState>
</htmlProcessor>
<htmlProcessor id="financialInfo" context="financialInfoCtx"
xValidation="com.ibm.btt.samples.html.FinancialInfoXVal">
<htmlState id="initial" type="initial">
<transitions>
<htmlTransition id="requestData.start" targetState="requestDataState">
</htmlTransition>
</transitions>
</htmlState>
<htmlState id="requestDataState" type="page" typeIdInfo="requestDataPage.JSP">
<transitions>
<htmlTransition id="OK" targetState="saveInfoOpState"
context="RequestDataState.OK.Ctx">
</htmlTransition>
<htmlTransition id="cancel" targetState="finalNotOK">
</htmlTransition>
</transitions>
</htmlState>
<htmlState id="saveInfoOpState">
<entryActions>
<executeOperationAct id="execOperAct" operationName="saveInfoOp"
linkContextTo="processor">
</executeOperationAct>
</entryActions>
<transitions>
<htmlTransition id="execOperAct.OK" targetState="finalOK">
</htmlTransition>
<htmlTransition id="execOperAct.error" targetState="errorInformationPage">
</htmlTransition>
</transitions>
</htmlState>
<htmlState id="errorInformationPage" type="page"
typeIdInfo="errorInformationPage.JSP">
<transitions>
<htmlTransition id="OK" targetState="finalNotOK">
</htmlTransition>
</transitions>
</htmlState>
<htmlState id="finalNotOK" type="final" typeIdInfo="notOK">
</htmlState>
<htmlState id="finalOK" type="final" typeIdInfo="OK">
</htmlState>
</htmlProcessor>
<htmlState id="creditHistoryOpState" conseq="false">
<entryActions>
<executeOperationAct id="execOperAct" operationName="creditHistoryOp"
contextToLinkTo="processor">
</executeOperationAct>
</entryActions>
<transitions>
<htmlTransition id="execOperAct.OK" targetState="selectCardsOpState">
</htmlTransition>
<htmlTransition id="execOperAct.notOK" targetState="financialInfoState">
</htmlTransition>
</transitions>
</htmlState>
<htmlState id="selectCardsOpState">
<entryActions>
<executeOperationAct id="execOperAct" operationName="selectCardsOp"
contextToLinkTo="processor">
</executeOperationAct>
</entryActions>
<transitions>
<htmlTransition id="execOperAct.OK" targetState="creditCardsPage">
</htmlTransition>
<htmlTransition id="execOperAct.error" targetState="errorInformationPage">
</htmlTransition>
</transitions>
</htmlState>
<htmlState id="financialInfoState" type="subFlow" typeIdInfo="finantialInfo">
<transitions>
<htmlTransition id="OK" targetState="selectCardsOpState">
</htmlTransition>
<htmlTransition id="notOK" targetState="finalNotOK">
</htmlTransition>
</transitions>
</htmlState>
<htmlState id="creditCardsPage" type="page" typeIdInfo="creditCardsPage.JSP">
<transitions>
<htmlTransition id="OK" targetState="creditCardConfirmationPage">
</htmlTransition>
<htmlTransition id="cancel" targetState="finalNotOK">
</htmlTransition>
</transitions>
</htmlState>
<htmlState id="creditCardConfirmationPage" type="page"
typeIdInfo="creditCardConfirmationPage.JSP">
<transitions>
<htmlTransition id="OK" targetState="creditCardProcessingOpState" conseq="true">
</htmlTransition>
<htmlTransition id="cancel" targetState="finalNotOK">
</htmlTransition>
</transitions>
</htmlState>
<htmlState id="creditCardProcessingOpState" type="page"
typeIdInfo="creditCardConfirmationPage.JSP">
<entryActions>
<executeOperationAct id="execOperAct" operationName="creditCardProcessingOp"
contextToLinkTo="processor">
</executeOperationAct>
</entryActions>
<transitions>
<htmlTransition id="execOperAct.OK" targetState="creditCardProcessingOp">
</htmlTransition>
<htmlTransition id="execOperAct.error" targetState="finalNotOK">
</htmlTransition>
</transitions>
</htmlState>
<htmlState id="errorInformationPage" type="page" typeIdInfo="errorInformationPage.JSP">
<transitions>
<htmlTransition id="OK" targetState="finalNotOK">
</htmlTransition>
</transitions>
</htmlState>
<htmlState id="finalNotOK" type="final" typeIdInfo="notOK">
</htmlState>
<htmlState id="finalOK" type="final" typeIdInfo="OK">
</htmlState>
</htmlProcessor>
The sub-flow flow processor for this example is defined as the HTML Channel processor and defined in the flow processor definition file (DSEPROC.XML) as follows:
<htmlProcessor id="financialInfo" context="financialInfoCtx"
xValidation="com.ibm.btt.samples.html.FinancialInfoXVal">
<htmlState id="initial" type="initial">
<transitions>
<htmlTransition id="requestData.start" targetState="requestDataState">
</htmlTransition>
</transitions>
</htmlState>
<htmlState id="requestDataState" type="page" typeIdInfo="requestDataPage.JSP">
<transitions>
<htmlTransition id="OK" targetState="saveInfoOpState"
context="RequestDataState.OK.Ctx">
</htmlTransition>
<htmlTransition id="cancel" targetState="finalNotOK">
</htmlTransition>
</transitions>
</htmlState>
<htmlState id="saveInfoOpState">
<entryActions>
<executeOperationAct id="execOperAct" operationName="saveInfoOp"
linkContextTo="processor">
</executeOperationAct>
</entryActions>
<transitions>
<htmlTransition id="execOperAct.OK" targetState="finalOK">
</htmlTransition>
<htmlTransition id="execOperAct.error"
targetState="errorInformationPage">
</htmlTransition>
</transitions>
</htmlState>
<htmlState id="errorInformationPage" type="page"
typeIdInfo="errorInformationPage.JSP">
<transitions>
<htmlTransition id="OK" targetState="finalNotOK">
</htmlTransition>
</transitions>
</htmlState>
<htmlState id="finalNotOK" type="final" typeIdInfo="notOK">
</htmlState>
<htmlState id="finalOK" type="final" typeIdInfo="OK">
</htmlState>
</htmlProcessor>
Go up to
Reference