com.ibm.workflow.portlet.client
Class MQWFInterportletCommunication

java.lang.Object
  |
  +--com.ibm.workflow.portlet.client.MQWFInterportletCommunication
All Implemented Interfaces:
MQWFPortletConstants

public class MQWFInterportletCommunication
extends java.lang.Object
implements MQWFPortletConstants

This class deals with the interportlet communication. Apart from the Random number generater does this class only contain logic. All methods get an ApplicationContextImpl and a PortletContext object as first arguments. The only exception to this rule is getUserPortletInstanceId. Another method that could qualify is dumpParameter because it is only used in this class.


Fields inherited from interface com.ibm.workflow.portlet.client.MQWFPortletConstants
ACTION, ACTION_NAME, COMMAND, DONE, ID, LIST_ITEM_ID, MAX_NUMBER, MQWFPORTLETMESSAGE, nameOfAbstractActionPortlet, nameOfAbstractListPortlet, nameOfJSP, NO_FREE_ACTION_INSTANCE, PAGE, PORTLET_DATA, PREFERENCES, REG_MAP, REQUEST_PREFERENCES, UseCredentialVault, USER_DEFINED_COMMANDS, WORKFLOW_REQUEST
 
Constructor Summary
MQWFInterportletCommunication()
           
 
Method Summary
 java.util.Enumeration getAvailablePortlets(com.ibm.workflow.portlet.client.ApplicationContextImpl context, org.apache.jetspeed.portlet.PortletContext portletContext, org.apache.jetspeed.portlet.PortletSession session, int type)
          Returns an enumeration of RegistrationMap.Entry objects of all action type portlets that have status FREE.
 RegistrationMap.Entry getEntry(com.ibm.workflow.portlet.client.ApplicationContextImpl context, org.apache.jetspeed.portlet.PortletContext portletContext, org.apache.jetspeed.portlet.PortletSession session)
          Returns the Entry in the registration map for this user portlet instance
 RegistrationMap.Entry getEntry(com.ibm.workflow.portlet.client.ApplicationContextImpl context, org.apache.jetspeed.portlet.PortletContext portletContext, org.apache.jetspeed.portlet.PortletSession session, java.lang.String userPortletId)
          Returns the Entry in the registration map for this user portlet instance
 java.lang.String getFirstAvailablePortlet(com.ibm.workflow.portlet.client.ApplicationContextImpl context, org.apache.jetspeed.portlet.PortletContext portletContext, org.apache.jetspeed.portlet.PortletSession session, int type, java.lang.String actionType)
          Returns a String ith the ID of the first action type portlet that have status FREE.
 java.lang.String getUserPortletInstanceId(org.apache.jetspeed.portlet.PortletSession session)
          Returns the User Portlet Instance Id for this user portlet instance
 boolean pageIdentification(com.ibm.workflow.portlet.client.ApplicationContextImpl context, org.apache.jetspeed.portlet.PortletContext portletContext, org.apache.jetspeed.portlet.PortletRequest requestOfThisInstance)
          Triggers the page identification process by sending an echo message to all action type portlets which will be ansWering by replying with an echo message by all action type portlet instances on this page.
 void receivedEchoPageMessage(com.ibm.workflow.portlet.client.ApplicationContextImpl context, org.apache.jetspeed.portlet.PortletContext portletContext, int type, EchoPageMessage message, org.apache.jetspeed.portlet.PortletRequest requestOfThisInstance)
          Processing for EchoPageMessages.
 MQWFPortletMessage receiveMQWFPortletMsg(com.ibm.workflow.portlet.client.ApplicationContextImpl context, org.apache.jetspeed.portlet.PortletContext portletContext, org.apache.jetspeed.portlet.event.MessageEvent event)
          Does check whether an incoming MQWFPortletMessage is addressed to this instance.
 void sendCommand(com.ibm.workflow.portlet.client.ApplicationContextImpl context, org.apache.jetspeed.portlet.PortletContext portletContext, org.apache.jetspeed.portlet.PortletAction incomingAction, org.apache.jetspeed.portlet.PortletRequest request)
          Triggers the execution of a workflow request in a action type portlet.
 void sendToActionPortlet(com.ibm.workflow.portlet.client.ApplicationContextImpl context, org.apache.jetspeed.portlet.PortletContext portletContext, org.apache.jetspeed.portlet.PortletRequest request, java.lang.String actionType, java.lang.String wfOID)
          Send a MQWFPortletMessage to the first MQWF Action portlet with a free status
 void sendToListPortlet(com.ibm.workflow.portlet.client.ApplicationContextImpl context, org.apache.jetspeed.portlet.PortletContext portletContext, org.apache.jetspeed.portlet.PortletRequest request, java.lang.String targetID)
          Send Message to a list-type portlet
 void sendToPortlet(com.ibm.workflow.portlet.client.ApplicationContextImpl context, org.apache.jetspeed.portlet.PortletContext portletContext, java.lang.String abstractPortletName, MQWFPortletMessage message)
          Send message to abstractPortletName on this page.
 void setStatusUserPortletInstance(com.ibm.workflow.portlet.client.ApplicationContextImpl context, org.apache.jetspeed.portlet.PortletContext portletContext, org.apache.jetspeed.portlet.PortletSession session, java.lang.String userPortletInstanceId, int status)
          Set the status of this user portlet instance to active.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MQWFInterportletCommunication

public MQWFInterportletCommunication()
Method Detail

getUserPortletInstanceId

public java.lang.String getUserPortletInstanceId(org.apache.jetspeed.portlet.PortletSession session)
Returns the User Portlet Instance Id for this user portlet instance
Parameters:
session - The PortletSession object

getEntry

public RegistrationMap.Entry getEntry(com.ibm.workflow.portlet.client.ApplicationContextImpl context,
                                      org.apache.jetspeed.portlet.PortletContext portletContext,
                                      org.apache.jetspeed.portlet.PortletSession session,
                                      java.lang.String userPortletId)
Returns the Entry in the registration map for this user portlet instance
Parameters:
context - The ApplicationContextImpl object
portletConfig - The PortletConfig object
session -  
userPortletId -  
Returns:
Entry for this user portlet instance

getEntry

public RegistrationMap.Entry getEntry(com.ibm.workflow.portlet.client.ApplicationContextImpl context,
                                      org.apache.jetspeed.portlet.PortletContext portletContext,
                                      org.apache.jetspeed.portlet.PortletSession session)
Returns the Entry in the registration map for this user portlet instance
Parameters:
context - The ApplicationContextImpl object
portletContext - The PortletContext object
session - The PortletSession object
Returns:
Entry for this user portlet instance

getAvailablePortlets

public java.util.Enumeration getAvailablePortlets(com.ibm.workflow.portlet.client.ApplicationContextImpl context,
                                                  org.apache.jetspeed.portlet.PortletContext portletContext,
                                                  org.apache.jetspeed.portlet.PortletSession session,
                                                  int type)
Returns an enumeration of RegistrationMap.Entry objects of all action type portlets that have status FREE.
Parameters:
context - The ApplicationContextImpl object
portletContext - The PortletContext object
session - the PortletSession object

getFirstAvailablePortlet

public java.lang.String getFirstAvailablePortlet(com.ibm.workflow.portlet.client.ApplicationContextImpl context,
                                                 org.apache.jetspeed.portlet.PortletContext portletContext,
                                                 org.apache.jetspeed.portlet.PortletSession session,
                                                 int type,
                                                 java.lang.String actionType)
Returns a String ith the ID of the first action type portlet that have status FREE.
Parameters:
context - The ApplicationContextImpl object
logger - The PortletContext object
session - the PortletSession object
type - The type according to the integer constants in RegistrationMap

setStatusUserPortletInstance

public void setStatusUserPortletInstance(com.ibm.workflow.portlet.client.ApplicationContextImpl context,
                                         org.apache.jetspeed.portlet.PortletContext portletContext,
                                         org.apache.jetspeed.portlet.PortletSession session,
                                         java.lang.String userPortletInstanceId,
                                         int status)
Set the status of this user portlet instance to active.
Parameters:
context - The ApplicationContextImpl object
portletContext - The PortletContext object
session - - the PortletSession object.
userPortletInstanceId - - the unique Id of the entry in the Registration map
status - - the status of the entry which will be set

sendToActionPortlet

public void sendToActionPortlet(com.ibm.workflow.portlet.client.ApplicationContextImpl context,
                                org.apache.jetspeed.portlet.PortletContext portletContext,
                                org.apache.jetspeed.portlet.PortletRequest request,
                                java.lang.String actionType,
                                java.lang.String wfOID)
                         throws org.apache.jetspeed.portlet.AccessDeniedException,
                                MQWFPortletException
Send a MQWFPortletMessage to the first MQWF Action portlet with a free status
Parameters:
context - The ApplicationContextImpl object
portletContext - The PortletContext object
portletConfig - The PortletConfig object necessary for sending the message.
context - The ApplicationContextImpl object
logger - The PortletLog object
session - - the PortletSession object. actionType - the MQWF action Type wfOID - the MQWF Object ID

sendToListPortlet

public void sendToListPortlet(com.ibm.workflow.portlet.client.ApplicationContextImpl context,
                              org.apache.jetspeed.portlet.PortletContext portletContext,
                              org.apache.jetspeed.portlet.PortletRequest request,
                              java.lang.String targetID)
                       throws org.apache.jetspeed.portlet.AccessDeniedException
Send Message to a list-type portlet
Parameters:
context - The ApplicationContextImpl object
portletContext - The PortletContext object
request - The PortletRequest object
targetID - The target id of the instance to which the message is sent.

sendToPortlet

public void sendToPortlet(com.ibm.workflow.portlet.client.ApplicationContextImpl context,
                          org.apache.jetspeed.portlet.PortletContext portletContext,
                          java.lang.String abstractPortletName,
                          MQWFPortletMessage message)
                   throws org.apache.jetspeed.portlet.AccessDeniedException
Send message to abstractPortletName on this page. The portal frame will send a message to portlets belonging to the same application which are on the same page as the used massages are extended from PortletMessage

receiveMQWFPortletMsg

public MQWFPortletMessage receiveMQWFPortletMsg(com.ibm.workflow.portlet.client.ApplicationContextImpl context,
                                                org.apache.jetspeed.portlet.PortletContext portletContext,
                                                org.apache.jetspeed.portlet.event.MessageEvent event)
Does check whether an incoming MQWFPortletMessage is addressed to this instance. The instance is determined by the user instance id written into the Portlet session (= event.getRequest().getPortletSession()). Will return the MQWFMessage for the right instance and null otherwise.
Parameters:
context - The ApplicationContextImpl object
portletContext - The PortletContext object
event - - the MessageEvent object.
Returns:
The MQWFPortletMessage or null

pageIdentification

public boolean pageIdentification(com.ibm.workflow.portlet.client.ApplicationContextImpl context,
                                  org.apache.jetspeed.portlet.PortletContext portletContext,
                                  org.apache.jetspeed.portlet.PortletRequest requestOfThisInstance)
Triggers the page identification process by sending an echo message to all action type portlets which will be ansWering by replying with an echo message by all action type portlet instances on this page. Attention: Methods called out of the actionPerformed method deal always with the request of their instance
Parameters:
context - The ApplicationContextImpl object
portletContext - The PortletContext object
requestOfThisInstance - The PortletRequest
Returns:
true if message has been sent

receivedEchoPageMessage

public void receivedEchoPageMessage(com.ibm.workflow.portlet.client.ApplicationContextImpl context,
                                    org.apache.jetspeed.portlet.PortletContext portletContext,
                                    int type,
                                    EchoPageMessage message,
                                    org.apache.jetspeed.portlet.PortletRequest requestOfThisInstance)
Processing for EchoPageMessages. Attention: Methods for processing received message deal always with a request accessed by event.getRequest and therefore are dealing with the request from the sending instance.
Parameters:
context - The ApplicationContextImpl object
portletContext - The PortletContext object
workflow - The MQWFWorkflowCommunication object needed for executing the request
type - The type of the instance according to RegistrationMap
message - The received message
requestOfThisInstance - The request of this instance

sendCommand

public void sendCommand(com.ibm.workflow.portlet.client.ApplicationContextImpl context,
                        org.apache.jetspeed.portlet.PortletContext portletContext,
                        org.apache.jetspeed.portlet.PortletAction incomingAction,
                        org.apache.jetspeed.portlet.PortletRequest request)
                 throws MQWFPortletException
Triggers the execution of a workflow request in a action type portlet.
Parameters:
context - The ApplicationContextImpl object
portletContext - The PortletContext
incomingAction - Action that triggers the request.
request - Current request.


© Copyright IBM Corporation 2002, 2008. All Rights Reserved.