IBM WebSphere Multichannel Bank Transformation Toolkit Javadoc

com.ibm.btt.automaton.html
Class DSEHtmlProcessorOperation

java.lang.Object
  extended by com.ibm.btt.base.BTTOperation
      extended by com.ibm.btt.base.BTTServerOperation
          extended by com.ibm.btt.automaton.html.DSEHtmlProcessorOperation
All Implemented Interfaces:
ProcessorOperation, Cacheable, Operation, ServerOperation, java.io.Externalizable, java.io.Serializable

public class DSEHtmlProcessorOperation
extends BTTServerOperation
implements ProcessorOperation

This class represents a virtual processor manager for the Homebanking HTML Client. It enables processes to be run over multiple invocations across the HTML C/S Mechanism without having to maintain the processor object on the server machine. This class provides for persistence of a processor object so that it can be reinstantiated in the state it was in on the last CS invocation. The class also provides for updating the processor context with data obtained on each invocation across the CS mechanism.

See Also:
Serialized Form

Field Summary
static java.lang.String ILLEGALSWITCH
           
static java.lang.String NORMAL
           
 
Fields inherited from class com.ibm.btt.base.BTTOperation
aOperationRepliedListener, COMPID, externalizer
 
Constructor Summary
DSEHtmlProcessorOperation()
          DSEHtmlProcessorOperation constructor.
DSEHtmlProcessorOperation(java.lang.String anOperationName)
          DSEHtmlProcessorOperation constructor.
DSEHtmlProcessorOperation(java.lang.String anOperationName, Context aParentContext)
          DSEHtmlProcessorOperation constructor.
DSEHtmlProcessorOperation(java.lang.String anOperationName, java.lang.String aParentContext)
          DSEHtmlProcessorOperation constructor.
 
Method Summary
static void chainToApplicationSessionContext(Context context, java.lang.String sessionId, java.lang.String applicationId)
          This utility method chains the supplied context to the session context identified by the sessionId argument.
static void chainToSessionContext(Context context, java.lang.String sessionId)
          This utility method chains the supplied context to the session context identified by the sessionId argument.
protected  boolean checkBackClick(java.lang.String currentPageId, java.lang.String previousPageId)
          This utility method checks to see if this invocation of the processor operation has occured as a result of a back click by the user (either by using the browser navigation bar, or browser history or by typing a previously viewed URL in the location bar).
protected  boolean checkLegalSwitch(Processor processor, java.lang.String processorState)
          This is a utility method that checks to see whether it is legal (from the point of view of consequentiality) for this processor to be put in the state specified by the supplied state name.
 void close()
          Closes the processor operation.
 void closeProcessor(Processor processor)
          This is equivalent of calling closeProcessor(Processor, false)
 void closeProcessor(Processor processor, boolean removeParents)
          Closes the processor supplied to it as argument.
 void closeWithoutCleanProcessor()
          Closes the processor operation.
protected  Processor createProcessor(java.lang.String processorName)
          Creates a processor object of the type specified by the name argument supplied to it.
 Processor createSubProcessor(java.lang.String procName, Processor parent)
          Creates a sub processor for the supplied processor object using the supplied processor name.
protected  void doDataMapping(DataMapperFormat format, Context sourceCtx, Context targetCtx)
          This utility method maps data from the source context to the target context using the supplied DataMapperFormat.
protected  void doDataMapping(Tag formatTag, Context sourceCtx, Context targetCtx)
          This utility method maps data from the source context to the target context using the supplied DataMapperFormat.
 void execute(java.lang.String eventName)
          Serves as the entry point for executing the processor object currently being managed by the processor operation.
 Context getContext()
           Overrided the getContext() method to return the processor context
protected  java.lang.String getCurrentStateTypeIdInfo(java.lang.String aTypeIdInfo)
          Change the typeIdInfo for some special or internal use.
protected  Processor getParent(Processor processor)
          Obtains the parent processor, if it exists, for the processor supplied as argument.
 Processor getProcessor()
          Returns the processor object currently being managed.
 java.lang.String getResponseId()
          Returns the current response ID existing in the toolkit.
 java.lang.String getStatus()
          Returns the status attributes of this object.
protected  java.lang.String getValidEventName(Processor currentProcessor, Processor parentProcessor, java.lang.String currentEventName)
          Returns a valid notifier name.
protected  java.lang.Object getValueFromContext(Context context, java.lang.String name, boolean required)
          This utility method attempts to obtain the value corresponding to the supplied name from the supplied context.
protected  java.lang.Object getValueFromKColl(KeyedCollection coll, java.lang.String name, boolean required)
          This utility method attempts to obtain the value corresponding to the supplied name from the supplied collection.
 void initializeProcessor(KeyedCollection coll)
          Creates or restores a processor object.
protected  boolean isEmpty(java.lang.String s)
          Checks for an empty string by first checking if the string is null and then checking if it contains any characters.
protected  boolean isEmpty(java.lang.String string, boolean trim)
          Checks for an empty string by first checking if the string is null then checking if it contains any characters.
 boolean isProcessorSaved()
          Returns the processorSaved.
protected  void mapDataFromChild(Processor child, Processor parent, java.lang.String exitEventName)
          This utility method maps data from a child processor to its parent upon the child processor's completion.
protected  boolean processorHasParent(DSEHtmlProcessor processor)
          Checks to see if the processor supplied as argument has a parent.
protected  boolean processorHasParent(Processor processor)
          Checks to see if the processor supplied as argument has a parent.
 boolean replaceCtxIfNeeded()
          Gets the transition context from the processor context (which is only stored there if there is a skipValidation transition), chains the transition context to the processor context, and removes the transition context from the processor context.
 void setFinalResponseId(java.lang.String id)
          Sets the reply page.
 void setProcessor(Processor processor)
          Sets the processor object to be managed.
 void setProcessorSaved(boolean processorSaved)
          Sets the processorSaved.
 void setResponseId(java.lang.String id)
          Sets the response ID to be set into the HTML Client toolkit.
 void setStatus(java.lang.String newStatus)
          Sets the status of this object.
 void startSubProcessor(java.lang.String processorName)
          This is a utility method for creating and executing a subprocessor.
 boolean updateContext(KeyedCollection collection)
          Requests that the processor (which this processor operation is handling) update its context with the data supplied in the collection supplied as argument.
 boolean updateContext(KeyedCollection collection, java.lang.String convType)
          Requests that the processor (which this processor operation is handling) update its context with the data supplied in the collection supplied as argument.
 void updateLocale(java.lang.String localeString)
           
 
Methods inherited from class com.ibm.btt.base.BTTServerOperation
createOperation, execute, fireExitEvent, getCSReplyFormat, getCSRequestFormat, getOriginWorkstation, runInSession, setCSReplyFormat, setCSRequestFormat, setOriginWorkstation, validate, validate
 
Methods inherited from class com.ibm.btt.base.BTTOperation
addElement, addOperationRepliedListener, chainTo, clearKeyedCollection, externalizer, fireHandleOperationRepliedEvent, getApplicationId, getContextByType, getContextName, getContextNamed, getElementAt, getExternalizer, getFormat, getFormats, getHostReceiveFormat, getHostSendFormat, getInstanceOfOperationStep, getKeyedCollection, getName, getOperationStep, getOperationStepRC, getOperationSteps, getParent, getSelfDefinedOpTagInputStream, getService, getSessionId, getSgmlSelfDefinedOpFileName, getType, getValueAt, getXValidator, initializeFormatFrom, initializeFrom, initializeKeyedCollectionValueFrom, initializeOpStep, initializeOpStepsFrom, isCacheable, isChained, postExecute, preExecute, prune, readExternal, readExternal, readObject, reinitialize, removeAt, removeExternal, removeOperationRepliedListener, setApplicationId, setContext, setContextName, setDefinedContext, setExternalizer, setHostReceiveFormat, setHostSendFormat, setKeyedCollection, setName, setSessionId, setType, setValueAt, setXValidator, stopExecution, toString, toStrings, toTags, unchain, writeExternal, writeExternal, xValidate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.ibm.btt.base.Operation
addElement, addOperationRepliedListener, chainTo, getApplicationId, getContextName, getElementAt, getFormat, getFormats, getKeyedCollection, getName, getParent, getService, getType, getValueAt, isChained, prune, removeAt, removeOperationRepliedListener, setApplicationId, setContext, setContextName, setKeyedCollection, setName, setType, setValueAt, unchain, xValidate
 
Methods inherited from interface com.ibm.btt.base.Cacheable
isCacheable, reinitialize
 

Field Detail

NORMAL

public static final java.lang.String NORMAL
See Also:
Constant Field Values

ILLEGALSWITCH

public static final java.lang.String ILLEGALSWITCH
See Also:
Constant Field Values
Constructor Detail

DSEHtmlProcessorOperation

public DSEHtmlProcessorOperation()
DSEHtmlProcessorOperation constructor.


DSEHtmlProcessorOperation

public DSEHtmlProcessorOperation(java.lang.String anOperationName)
                          throws java.io.IOException
DSEHtmlProcessorOperation constructor.

Parameters:
anOperationName - java.lang.String
Throws:
java.io.IOException

DSEHtmlProcessorOperation

public DSEHtmlProcessorOperation(java.lang.String anOperationName,
                                 java.lang.String aParentContext)
                          throws java.io.IOException,
                                 DSEObjectNotFoundException,
                                 DSEInvalidRequestException
DSEHtmlProcessorOperation constructor.

Parameters:
anOperationName - java.lang.String
aParentContext - java.lang.String
Throws:
java.io.IOException
DSEObjectNotFoundException
DSEInvalidRequestException

DSEHtmlProcessorOperation

public DSEHtmlProcessorOperation(java.lang.String anOperationName,
                                 Context aParentContext)
                          throws java.io.IOException,
                                 DSEInvalidRequestException
DSEHtmlProcessorOperation constructor.

Parameters:
anOperationName - java.lang.String
aParentContext - com.ibm.btt.base.Context
Throws:
java.io.IOException
DSEInvalidRequestException
Method Detail

chainToApplicationSessionContext

public static void chainToApplicationSessionContext(Context context,
                                                    java.lang.String sessionId,
                                                    java.lang.String applicationId)
                                             throws DSEException
This utility method chains the supplied context to the session context identified by the sessionId argument. This method first ensures that the supplied context is not already chained to the session context.

Parameters:
processor - com.ibm.btt.base.Context
sessionId - java.lang.String
Throws:
DSEException

chainToSessionContext

public static void chainToSessionContext(Context context,
                                         java.lang.String sessionId)
                                  throws DSEException
This utility method chains the supplied context to the session context identified by the sessionId argument. This method first ensures that the supplied context is not already chained to the session context.

Parameters:
processor - com.ibm.btt.base.Context
sessionId - java.lang.String
Throws:
DSEException

checkBackClick

protected boolean checkBackClick(java.lang.String currentPageId,
                                 java.lang.String previousPageId)
This utility method checks to see if this invocation of the processor operation has occured as a result of a back click by the user (either by using the browser navigation bar, or browser history or by typing a previously viewed URL in the location bar). This method relies on system values defined for the HTML client to determine whether such a back click has occured.

Parameters:
pageId - java.lang.String
lastPageId - java.lang.String
Returns:
boolean - True if the back click occured

checkLegalSwitch

protected boolean checkLegalSwitch(Processor processor,
                                   java.lang.String processorState)
This is a utility method that checks to see whether it is legal (from the point of view of consequentiality) for this processor to be put in the state specified by the supplied state name.

Parameters:
processor - com.ibm.btt.automaton.Processor
processorState - java.lang.String
Returns:
boolean

close

public void close()
           throws DSEInvalidRequestException,
                  DSEObjectNotFoundException
Closes the processor operation. This method closes the processor currently being managed and releases its hold on the instance.

Specified by:
close in interface ProcessorOperation
Specified by:
close in interface Operation
Overrides:
close in class BTTOperation
Throws:
DSEInvalidRequestException
com.ibm.btt.base.DSEDSEObjectNotFoundException
DSEObjectNotFoundException

closeProcessor

public void closeProcessor(Processor processor)
This is equivalent of calling closeProcessor(Processor, false)

Specified by:
closeProcessor in interface ProcessorOperation
Parameters:
processor - com.ibm.btt.automaton.Processor

closeProcessor

public void closeProcessor(Processor processor,
                           boolean removeParents)
Closes the processor supplied to it as argument. If the boolean argument is true, any parent processor is also closed.

Parameters:
processor - com.ibm.btt.automaton.Processor
removeParents - boolean

closeWithoutCleanProcessor

public void closeWithoutCleanProcessor()
                                throws DSEInvalidRequestException,
                                       DSEObjectNotFoundException
Closes the processor operation. This method only will unchain the context and clean the event queue.

Throws:
DSEInvalidRequestException
com.ibm.btt.base.DSEDSEObjectNotFoundException
DSEObjectNotFoundException

createProcessor

protected Processor createProcessor(java.lang.String processorName)
                             throws DSEHtmlCreateProcessorException
Creates a processor object of the type specified by the name argument supplied to it.

Parameters:
processorName - java.lang.String
Returns:
com.ibm.btt.automaton.Processor
Throws:
DSEHtmlCreateProcessorException

createSubProcessor

public Processor createSubProcessor(java.lang.String procName,
                                    Processor parent)
                             throws DSEHtmlCreateProcessorException
Creates a sub processor for the supplied processor object using the supplied processor name. The new processor object is chained to its parent.

Parameters:
procName - java.lang.String
parent - com.ibm.btt.automaton.Processor
Returns:
com.ibm.btt.automaton.Processor
Throws:
DSEHtmlCreateProcessorException

doDataMapping

protected void doDataMapping(DataMapperFormat format,
                             Context sourceCtx,
                             Context targetCtx)
                      throws DSEException
This utility method maps data from the source context to the target context using the supplied DataMapperFormat.

Parameters:
format - com.ibm.btt.base.DataMapperFormat
sourceCtx - com.ibm.btt.base.Context
targetCtx - com.ibm.btt.base.Context
Throws:
DSEException

doDataMapping

protected void doDataMapping(Tag formatTag,
                             Context sourceCtx,
                             Context targetCtx)
                      throws DSEException
This utility method maps data from the source context to the target context using the supplied DataMapperFormat.

Parameters:
format - com.ibm.btt.base.DataMapperFormat
sourceCtx - com.ibm.btt.base.Context
targetCtx - com.ibm.btt.base.Context
Throws:
DSEException

execute

public void execute(java.lang.String eventName)
             throws DSEException,
                    DSEInvalidArgumentException
Serves as the entry point for executing the processor object currently being managed by the processor operation. This method first ensures that consequentiality has not been violated for the processor object being managed. If it has, execution is terminated. If not, this method passes control over to the processor to carry on execution using the event name supplied as argument to this method. Upon return of control from the processor, the processor operation examines its status to determine the next course of action. These are the possible course of action:

Specified by:
execute in interface ProcessorOperation
Parameters:
eventName - java.lang.String
Throws:
DSEException
DSEInvalidArgumentException

getContext

public Context getContext()
Overrided the getContext() method to return the processor context

Specified by:
getContext in interface Operation
Overrides:
getContext in class BTTOperation
Returns:
boolean com.ibm.btt.base.Context

getParent

protected Processor getParent(Processor processor)
Obtains the parent processor, if it exists, for the processor supplied as argument.

Parameters:
processor - com.ibm.btt.automaton.Processor
Returns:
com.ibm.btt.automaton.Processor

getProcessor

public Processor getProcessor()
Returns the processor object currently being managed.

Specified by:
getProcessor in interface ProcessorOperation
Returns:
com.ibm.btt.automaton.Processor

getResponseId

public java.lang.String getResponseId()
                               throws DSEException
Returns the current response ID existing in the toolkit.

Specified by:
getResponseId in interface ProcessorOperation
Returns:
java.lang.String
Throws:
DSEException

getStatus

public java.lang.String getStatus()
Returns the status attributes of this object.

Specified by:
getStatus in interface ProcessorOperation
Returns:
java.lang.String

getValidEventName

protected java.lang.String getValidEventName(Processor currentProcessor,
                                             Processor parentProcessor,
                                             java.lang.String currentEventName)
Returns a valid notifier name. The name of the notifier is very important because the transitions must be defined as notifierName.eventName. This method creates a dummy notifier name only when the event name does not include a notifier name. The convention is when the event comes from a page, the notifier is constructed using the name of the state. If the event is the "start" event of the processor, the notifier is built using the processor name. If the event comes from a subFlow's final state, the notifier is built from the name of the subFlow.

Parameters:
eventName - java.lang.String
typePage - boolean
Returns:
java.lang.String

getValueFromContext

protected java.lang.Object getValueFromContext(Context context,
                                               java.lang.String name,
                                               boolean required)
                                        throws DSEException
This utility method attempts to obtain the value corresponding to the supplied name from the supplied context. If the value cannot be obtained and the boolean required attribute is true, an exception is generated. If the attribute is false, this method returns a null.

Parameters:
context - com.ibm.btt.base.Context
name - java.lang.String
required - boolean
Returns:
java.lang.Object
Throws:
DSEException

getValueFromKColl

protected java.lang.Object getValueFromKColl(KeyedCollection coll,
                                             java.lang.String name,
                                             boolean required)
                                      throws DSEException
This utility method attempts to obtain the value corresponding to the supplied name from the supplied collection. If the value cannot be obtained and the boolean required attribute is true, an exception is generated. If the attribute is false, this method returns a null.

Parameters:
coll - com.ibm.btt.base.KeyedCollection
name - java.lang.String
required - boolean
Returns:
java.lang.Object
Throws:
DSEException

initializeProcessor

public void initializeProcessor(KeyedCollection coll)
                         throws DSEException
Creates or restores a processor object. The data required to carry this out is supplied within the collection supplied as argument to the method:
  • processor ID - keyed by HtmlConstants.PROCESSORID, or
  • processor name - keyed by HtmlConstants.OPERATIONNAME
  • processor state - keyed by HtmlConstants.PROCESSORSTATE
  • If a processor id is supplied, this method makes an attempt to load the processor from storage. If the processor ID is not supplied and the processor name is, this method creates a new processor object corresponding to the name. An error results if neither the processor ID nor processor name are supplied. Once the method obtains a processor object, its state is changed to the one specified in the keyed collection.

    Specified by:
    initializeProcessor in interface ProcessorOperation
    Parameters:
    coll - com.ibm.btt.base.KeyedCollection
    Throws:
    DSEException

isEmpty

protected boolean isEmpty(java.lang.String s)
Checks for an empty string by first checking if the string is null and then checking if it contains any characters. If the boolean argument is true, the method trims space characters from the beginning and end of the string before it is checked for characters. Trimming the string is the default behavior.

Parameters:
s - java.lang.String
Returns:
boolean

isEmpty

protected boolean isEmpty(java.lang.String string,
                          boolean trim)
Checks for an empty string by first checking if the string is null then checking if it contains any characters. If the boolean argument is true, the method trims the space characters from the beginning and end of the string before it is checked for characters. Trimming the string is the default behavior.

Parameters:
string - java.lang.String
trim - boolean
Returns:
boolean

mapDataFromChild

protected void mapDataFromChild(Processor child,
                                Processor parent,
                                java.lang.String exitEventName)
                         throws DSEException
This utility method maps data from a child processor to its parent upon the child processor's completion.

Parameters:
child - com.ibm.btt.automaton.Processor
parent - com.ibm.btt.automaton.Processor
exitEventName - java.lang.String
Throws:
DSEException

processorHasParent

protected boolean processorHasParent(DSEHtmlProcessor processor)
Checks to see if the processor supplied as argument has a parent.

Parameters:
processor - com.ibm.btt.automaton.html.DSEHtmlProcessor
Returns:
boolean

processorHasParent

protected boolean processorHasParent(Processor processor)
Checks to see if the processor supplied as argument has a parent.

Parameters:
processor - com.ibm.btt.automaton.html.DSEHtmlProcessor
Returns:
boolean

replaceCtxIfNeeded

public boolean replaceCtxIfNeeded()
Gets the transition context from the processor context (which is only stored there if there is a skipValidation transition), chains the transition context to the processor context, and removes the transition context from the processor context. This method is used only when a HtmlTransition with a true skipValidation value is executed.

Returns:
boolean

setFinalResponseId

public void setFinalResponseId(java.lang.String id)
                        throws DSEInvalidArgumentException,
                               DSEObjectNotFoundException,
                               DSEInvalidRequestException
Sets the reply page. This method does not need to add any automaton-specific information because the processor is ended. If the application wants to begin a new processor from this page, it must add the state field itself.

Parameters:
id - java.lang.String
Throws:
DSEInvalidArgumentException
DSEObjectNotFoundException
DSEInvalidRequestException

setProcessor

public void setProcessor(Processor processor)
Sets the processor object to be managed.

Specified by:
setProcessor in interface ProcessorOperation
Parameters:
processor - com.ibm.btt.automaton.Processor

setResponseId

public void setResponseId(java.lang.String id)
                   throws DSEInvalidArgumentException,
                          DSEObjectNotFoundException
Sets the response ID to be set into the HTML Client toolkit.

Specified by:
setResponseId in interface ProcessorOperation
Parameters:
id - java.lang.String
Throws:
DSEInvalidArgumentException
DSEObjectNotFoundException

setStatus

public void setStatus(java.lang.String newStatus)
Sets the status of this object.

Specified by:
setStatus in interface ProcessorOperation
Parameters:
newStatus - java.lang.String

startSubProcessor

public void startSubProcessor(java.lang.String processorName)
                       throws DSEException
This is a utility method for creating and executing a subprocessor. A processor object is created and initialized based on the processor name supplied as argument to this function. The current processor being managed by the processor operation is saved, then replaced with the sub processor. Data is optionally passed from the parent processor to the subprocessor using data mapping formats defined in the current state of the parent processor. Execution is then passed off to the subprocessor, with an event that corresponds to its start state.

Parameters:
processName - java.lang.String
Throws:
DSEException

updateContext

public boolean updateContext(KeyedCollection collection)
                      throws DSETypeException,
                             DSEObjectNotFoundException,
                             DSEInvalidArgumentException
Requests that the processor (which this processor operation is handling) update its context with the data supplied in the collection supplied as argument. It returns a boolean indicating whether the update was successful or not. Before updating the context, this method checks if the request is legal according to consequentiality (back button support).

Specified by:
updateContext in interface ProcessorOperation
Overrides:
updateContext in class BTTServerOperation
Parameters:
collection - com.ibm.btt.base.KeyedCollection
Returns:
boolean
Throws:
DSETypeException
DSEObjectNotFoundException
DSEInvalidArgumentException

updateContext

public boolean updateContext(KeyedCollection collection,
                             java.lang.String convType)
                      throws DSETypeException,
                             DSEObjectNotFoundException,
                             DSEInvalidArgumentException
Requests that the processor (which this processor operation is handling) update its context with the data supplied in the collection supplied as argument. It returns a boolean indicating whether the update was successful or not. Before updating the context, this methodchecks if the request is legal according to consequentiality (back button support).

Overrides:
updateContext in class BTTServerOperation
Parameters:
kcReqData - com.ibm.btt.base.KeyedCollection
convType - java.lang.String
Returns:
boolean
Throws:
DSETypeException
DSEObjectNotFoundException
DSEInvalidArgumentException

updateLocale

public void updateLocale(java.lang.String localeString)
                  throws DSEObjectNotFoundException,
                         DSEInvalidArgumentException
Throws:
DSEObjectNotFoundException
DSEInvalidArgumentException

isProcessorSaved

public boolean isProcessorSaved()
Returns the processorSaved.

Returns:
boolean

setProcessorSaved

public void setProcessorSaved(boolean processorSaved)
Sets the processorSaved.

Parameters:
processorSaved - The processorSaved to set

getCurrentStateTypeIdInfo

protected java.lang.String getCurrentStateTypeIdInfo(java.lang.String aTypeIdInfo)
Change the typeIdInfo for some special or internal use.


IBM WebSphere Multichannel Bank Transformation Toolkit Javadoc

(c) Copyright IBM Corporation 1998, 2011