+

Search Tips   |   Advanced Search


Retrieve properties from the Task List portlet

Specify how the Task Processing portlet retrieves task and task page properties from the Task List. Refer to the code samples for developing a standard portlet. You should have experience developing portlets, including cooperative portlets, using either the standard portlet API, the Task UI Manager API, the Property Broker API, and the Task API. The Task Processing portlet retrieves the following properties once from the Task List and keeps these properties in the portlet session until the task is completed and removed from the Task List:

TaskID

String

Unique identifier of the task

ReturnPageID

com.ibm.portal.ObjectID

The object ID of the page to which the user should be returned when the task is completed.

TaskUIHandle

com.ibm.portal.taskui.TaskUiHandle

Identifies the current task page and is used to close the task page.

To specify the properties that the Task Processing portlet must retrieve from the Task List, follow these steps and the code samples provided:

  1. In the portlet.xml of the Task Processing portlet, enable the portal page context by setting the portlet preference.

        <portlet_preferences>
    
        ...
       <preference>
          <name>com.ibm.portal.pagecontext.enable</name>
          <value>true</value>
       </preference>
    
        ...
        </portlet_preferences>
        
    

  2. Specify how the Task Processing portlet obtains the properties:

    1. Standard portlets receive page context parameters on the method processAction() using the request attribute com.ibm.portal.action.name.

    2. The value of this attribute is a Map storing the context entries.

    3. Each property value is obtained by name.

       public void processAction (ActionRequest request, ActionResponse response) 
                    throws PortletException, java.io.IOException
       {
           
          // perform application specific action handling
          ...
              
          // perform page context processing
       
          String specialAction = request.getParameter("com.ibm.portal.action");
     
          if (specialAction != null &&
             specialAction.equals("com.ibm.portal.pagecontext.receive")) 
          {
             //this indicates context was passed to the launched page
             java.util.Map contextMap = (java.util.Map)
                           request.getAttribute("com.ibm.portal.pagecontext.context");
    
             TaskUIHandle taskUIHandle =  (TaskUIHandle) contextMap.get("TaskUIHandle");
       
             ObjectID returnPageID = (ObjectID) contextMap.get("ReturnPageID");
    
             String taskID = (String) contextMap.get("TaskID");
    
             portletSession.setAttribute("TaskUIHandle", taskUIHandle);
             portletSession.setAttribute("ReturnPageID", returnPageID);
             portletSession.setAttribute("TaskID", taskID);
    
          }
    
       }
       
       
    


Parent topic:

Creating Task Processing portlets


Next topic:

Process the input and output messages of the task


Related tasks


Develop portlets for cooperation
Receiving property values between cooperative portlets