com.ibm.workflow.sample.xml
Class CreditApprovalSampleListener

java.lang.Object
  |
  +--com.ibm.workflow.sample.xml.CreditApprovalSampleListener
All Implemented Interfaces:
com.ibm.workflow.upes.UPESListener

class CreditApprovalSampleListener
extends java.lang.Object
implements com.ibm.workflow.upes.UPESListener

The CreditApprovalSampleListener class is a sample implemenation of the UPESListener interface. It accepts InvokeProgram messages when the program name is either 'RequestCreditApproval' or 'CreditApproval'. It then brings up an 'ApprovalView' with the given message information. While this listener is processing a message the _ready field is set to false. This means that IsActive() will return false in order to indicate that the listener is busy. This class supports a log to which entries are made each time somthing is processed.


Field Summary
protected  java.util.Vector _aChangeListener
          While the listener is processing a message _u contains the UPES from which the call came.
private  boolean _approve
           
private  boolean _asyncWait
           
private  javax.swing.DefaultListModel _fieldLogListing
          _fieldLogListing contains the log entries which where generated during the livetime of the object.
protected  java.beans.PropertyChangeSupport _propertyChange
           
private  boolean _ready
          _ready is set to true if the listener is ready to receive and process messages.
 
Constructor Summary
CreditApprovalSampleListener()
          CreditApprovalSampleListener contructor of the listener.
 
Method Summary
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
           
 void AppendLogEntry(java.lang.String append)
          AppendLogEntry appends a log entry to the end of the log.
 void firePropertyChange(java.lang.String propertyName, java.lang.Object oldValue, java.lang.Object newValue)
           
 boolean getApprove()
           
 javax.swing.DefaultListModel getLogListing()
           
 java.lang.String getName()
          getName returns the Name of the listener and is hardcoded.
protected  java.beans.PropertyChangeSupport getPropertyChange()
           
 boolean IsActive()
          IsActive returns whether the listener is ready to receive and process incoming messages.
 boolean IsResponsibleFor(com.ibm.workflow.upes.InvokeProgramData msg)
          IsResponsibleFor returns whether the listener is responsible for a given message It is responsible for message in which the program name is either 'RequestCreditApproval' or 'CreditApproval'.
 void ProcessMessage(com.ibm.workflow.upes.UPES upes, com.ibm.workflow.upes.MQHandler MQH, com.ibm.workflow.upes.InvokeProgramData msg)
          ProcessMessage processes the handed over message.
 void ProcessResponse(com.ibm.workflow.upes.UPES upes, com.ibm.workflow.upes.InvokeProgramData msg, com.ibm.workflow.upes.MQHandler MQH)
          ProcessResponse sends the response back to the UPES for a given message.
 void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
           
 void setApprove(boolean approve)
           
 void setLogListing(javax.swing.DefaultListModel logListing)
           
 void TerminateAsyncWait()
           
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

_aChangeListener

protected transient java.util.Vector _aChangeListener
While the listener is processing a message _u contains the UPES from which the call came. There are no accessors for this datamember.
See Also:
UPES

_propertyChange

protected transient java.beans.PropertyChangeSupport _propertyChange

_fieldLogListing

private javax.swing.DefaultListModel _fieldLogListing
_fieldLogListing contains the log entries which where generated during the livetime of the object.
See Also:
AppendLogEntry(java.lang.String), getLogListing(), setLogListing(javax.swing.DefaultListModel)

_ready

private boolean _ready
_ready is set to true if the listener is ready to receive and process messages. This flag can be tested with the IsActive method.
See Also:
IsActive()

_asyncWait

private boolean _asyncWait

_approve

private boolean _approve
Constructor Detail

CreditApprovalSampleListener

public CreditApprovalSampleListener()
CreditApprovalSampleListener contructor of the listener.
Method Detail

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)

AppendLogEntry

public void AppendLogEntry(java.lang.String append)
AppendLogEntry appends a log entry to the end of the log.

firePropertyChange

public void firePropertyChange(java.lang.String propertyName,
                               java.lang.Object oldValue,
                               java.lang.Object newValue)

getLogListing

public javax.swing.DefaultListModel getLogListing()

getName

public java.lang.String getName()
getName returns the Name of the listener and is hardcoded.
Specified by:
getName in interface com.ibm.workflow.upes.UPESListener
Returns:
returns "CreditApprovalSampleListener" the Name of the listener and is hardcoded.

getPropertyChange

protected java.beans.PropertyChangeSupport getPropertyChange()

IsActive

public boolean IsActive()
IsActive returns whether the listener is ready to receive and process incoming messages.
Specified by:
IsActive in interface com.ibm.workflow.upes.UPESListener
Returns:
true, if the listener is ready to receive and process incoming messages.

false, if the listener is not ready to receive and process incoming messages.


IsResponsibleFor

public boolean IsResponsibleFor(com.ibm.workflow.upes.InvokeProgramData msg)
IsResponsibleFor returns whether the listener is responsible for a given message It is responsible for message in which the program name is either 'RequestCreditApproval' or 'CreditApproval'.
Specified by:
IsResponsibleFor in interface com.ibm.workflow.upes.UPESListener
Returns:
true, if the program name of msg is either 'RequestCreditApproval' or 'CreditApproval'.

false otherwise


ProcessMessage

public void ProcessMessage(com.ibm.workflow.upes.UPES upes,
                           com.ibm.workflow.upes.MQHandler MQH,
                           com.ibm.workflow.upes.InvokeProgramData msg)
ProcessMessage processes the handed over message. During the processing _ready is set to false in order to signal that the listener is busy. During the process a view will be brought up (ApprovalView). The view when ready itself calls back the ProcessResponse method of the class in order to send back the response message to the workflow system.
Specified by:
ProcessMessage in interface com.ibm.workflow.upes.UPESListener
See Also:
UPES, InvokeProgramData

ProcessResponse

public void ProcessResponse(com.ibm.workflow.upes.UPES upes,
                            com.ibm.workflow.upes.InvokeProgramData msg,
                            com.ibm.workflow.upes.MQHandler MQH)
ProcessResponse sends the response back to the UPES for a given message. The input container from the input message is taken some information is put in and then it is used as output container for the response message. For this purpose the _ACTIVITY member must be set to "".

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)

setLogListing

public void setLogListing(javax.swing.DefaultListModel logListing)

TerminateAsyncWait

public void TerminateAsyncWait()

getApprove

public boolean getApprove()

setApprove

public void setApprove(boolean approve)