Using Worklist User Portal

     Previous  Next    Open TOC in new window    View as PDF - New Window  Get Adobe Reader - New Window
Content starts here

Customizing Worklist User Portal

Worklist provides Worklist User Portal, a web-based user portal for interacting with tasks. This portal allows users to see the details of a task, and take actions on a task to move it through its life cycle. Each step in a task plan can define unique actions and thus present its own unique considerations to the user.

Worklist User Portal is an all-purpose user interface that uses the metadata for steps and actions to render a usable interface at each step. The user interface for a given step and action will differ from the user interface for other steps and actions by virtue of the differences in the metadata for those steps and actions. For example, when rendering the user interface at a given step, the Worklist User Portal shows the description and actions the task plan designer defined for that step. Worklist User Portal has only this information to work on when rendering the user interface, and cannot account for any more subtle needs a user may have with regard to this step (For example, summary information that would be needed to enter a value for an action's required properties, or calculations that may be applied to individual task properties to derive the result value for a property)

In some cases, like the previous examples, a given step or the actions that can be taken on that step may require a customized user interface. Worklist accounts for this need for extensibility by allowing a web developer to design a custom web user interface to be used for a given step, or an entire task plan. This custom web user interface is called a Custom Task User Interface. Custom Task UI allows a web developer to design custom pages only where needed, and still use the facilities of the default Worklist User Portal everywhere else. This allows a gradual investment in the customization of the user portal, instead of requiring a wholesale replacement of the Worklist User Portal interface.

A custom interface can be designed for just a step in a task plan or for the entire task plan.

This document provides the following information:

Typical Workflow

Typical workflow in creating a custom task user interface:

  1. Mock-up the web pages you want to show the user at the steps for which the custom task UI will be registered. Define the flow from page to page, and the links and buttons that connect the pages together. Also define the links or buttons that represent step actions that can be taken on this step.
  2. Create a Beehive NetUI Page Flow Controller in the web application that hosts the Worklist user portal.
  3. Define a data structure (called a Form Bean) for each page you mocked up in step 1.
  4. Define actions on the Page Flow Controller from step 2 that represent the transitions between pages, and the step actions that can be taken.
  5. Define the JSP pages for the mocked-up web pages you defined in step 1. Each page will be bound to the Form Bean you defined for the page in step 3, and refer to the actions you defined in step 4.

For a sample scenario, see Adding a Customized User Interface in Tutorial: Building a Worklist Application.

Implementing the Custom Task UI Page Flow

The custom task UI page flow can be implemented in one of two ways:

Note: http://download.oracle.com/docs/cd/E13214_01/wli/docs92/worklist.javadoc/index.html

Task UI Page Flow Requirements

If you do not extend the custom controller using TaskUIPageFlowController, you must manually meet the following requirements of a task UI PageFlowController. These requirements allow a calling task work page flow to call into the task UI page flow and have that page flow return to it via actions the caller is guaranteed to have implemented.

Creating a Page Flow

After determining the look and feel of the customized user interface pages, you need to define the logic and use of these pages by creating a Beehive Page Flow. Page Flows allow the design of an user interface on which actions can be defined. Page Flows control the actions and navigation of the web pages in the custom task interface.

To create a page flow:

  1. In the Package Explorer pane, right-click the <web project name>\src folder, and select New Arrow symbol Other. The Select a Wizard dialog appears.
  2. The Web project corresponds to the Web application of Worklist that acts as the user interface for the system. For more information, see "Worklist Application" in Creating and Managing Worklist Task Plans in Using Worklist.

    Figure 3-1 Creating a Page Flow


    Creating a Page Flow

  3. Click Creating a Page Flow next to Web, select Page Flow, and click Next. The New Page Flow dialog appears.
  4. Figure 3-2 Specify Page Flow Details


    Specify Page Flow Details

  5. Enter the name of the Page Flow folder.
  6. Specify the parent folder of the Page Flow.
  7. Enter the name of the Page Flow controller.
  8. Select the Make this a nested page flow check box and click Finish.
  9. The Open Associated Perspective dialog appears. Click Yes.
  10. Figure 3-3 Open Associated Perspective


    Open Associated Perspective

    The Page Flow Editor appears.

    Figure 3-4 Page Flow Editor


    Page Flow Editor

  11. Replace the following code in the <page flow controller>.java file
  12. @Jpf.Controller(nested = true, simpleActions = { @Jpf.SimpleAction(name = "begin", path = "index.jsp") })
    public class <page flow controller> extends PageFlowController

    with

    @Jpf.Controller(nested = true)
    public class <page flow controller> extends com.bea.wli.worklist.TaskUIPageFlowController {
    Note: This change will result in some compilation errors saying `Action "begin" was not found.' This error will be resolved after you define the begin action. For information about the begin action, see Defining Actions on a Page Flow. To see a list of errors, warnings and information messages in the Problems View, select WindowArrow symbolShow ViewArrow symbolProblems.

Creating Form Beans

For each web page that you need in the custom task UI, you need to create a Form Bean. These form beans can be represented as inner java classes of the Page Flow Controller, or they can be standalone java classes. Form Beans should implement java.io.Serializable as described in the JDK Javadoc.

To create form beans:

  1. In the Page Flow Explorer, right-click Form Beans and select New Inner Class Form Bean.
  2. Figure 3-5 New Inner Class Form Bean


    New Inner Class Form Bean

  3. A new form bean with the default name NewFormBean is created.
  4. Right-click NewFormBeanArrow symboland select Rename to give a more meaningful name to the Form Bean.
  5. Repeat step 1 to step 3 to create Form Beans for all the web pages required for your custom task UI.

Generating Setter and Getters Methods for Properties

Form Beans are the basis for the data handling done in the web pages for the custom task UI. The Form Bean is a JavaBean object with a number of properties. You need to generate the Setter and Getter methods for each of these properties.

To generate the setter and getter methods:

  1. Double-click on the Form Bean in the Page Flow Explorer View.
  2. Declare the variables in the Form Bean.
  3. Select the variables and right-click. Select Source Arrow symbolGenerate Getters and Setters. The Generate Getters and Setters dialog appears.
  4. Figure 3-6 Generate Getter and Setter Methods


    Generate Getter and Setter Methods

  5. Select the variables and click OK.
  6. Repeat the above steps for properties in all the Form Beans required for your custom task UI.

The Getter and Setter methods for all properties are now generated.

Defining Actions on a Page Flow

You define actions on the page flow to move between the web pages in your custom task interface and to take appropriate actions on the task. Page Flow actions are methods on the Page Flow Controller that allow navigation within the interface and optionally, calculate results and pass Form Beans to the required web pages.

Form Beans are passed from an action to a web page to populate display fields on the page. These field values are collected and placed into properties on the Form Bean when the web page is submitted back to the server for processing.

Action methods can accept a Form Bean populated as the result of clicking a Submit button on a web page by defining the Form Bean as a parameter to the action method. Action methods can also pass a Form Bean on to a target web page to which the action is forwarding. This is done by passing a Forward Object that has a Form Bean Object set on it.

Define page flow actions for all actions that are designed and required for your custom task interface. In addition, you need to define the begin action for initializing the Page Flow Controller. The begin action initializes this controller and calls the super class helper (beginActionhelper) to initialize task context, standard form beans for a task and action, and property editing support.

Note: begin() has to call the super class helper only if the custom page controller extends TaskUIPageFlowController.

Action Methods and Form Beans

Action methods can accept Form Beans and forward to pages using Form Beans. When submitting a web page and in the process of calling the action associated with a Submit, the NetUI framework creates a new form bean instance by default (using the no-arg public constructor for the Form Bean class). This new bean instance is then populated via Java reflection with data from data binding tags in the submitted web page form.

This process has some limitations. For example, if your Form Bean contains transient, hidden information that is not represented in the web page JSP tags, the Form Bean that actually gets passed to the action method (the bean that is created by the NetUI framework) will not have this information.

To avoid the overhead and possible behavioral problems of creating new beans each time an action method is called, you can specify a useFormBean field on the @Jpf.Action annotation for an action method. This allows to hold a single copy of the Form Bean in the Page Flow Controller's state and the action method then just fetches the object from that state instead of creating a new form bean object.

Worklist Property Editors and Actions

Worklist provides some built-in support for editing properties in your custom task UI. It includes a JSP tag, default editors, and some helper methods in the base TaskUIPageFlowController. These facilities allow you to easily edit the following types of properties using out-of-box UI:

In addition, the Property Editor facility allows human users using the custom task UI to easily edit properties using an inline editor (simple form field) as well as a standalone editor for the complex types mentioned above. This facility makes robust editing of properties a fairly simple matter.

Create the following actions in your custom page flow controller to handle task's user property editor:

Creating Actions on a Page Flow

To create actions on a page flow:

  1. In Page Flow Explorer View, right-click Actions and select New Action. The New Action dialog appears.
  2. Figure 3-7 Create New Action


    Create New Action

  3. Select any existing action templates. For example, create Basic Method Action to create an empty action method.
  4. Enter a name for the action.
  5. Specify the Form Bean associated with this action. If required, click Add to select a Form Bean.
  6. If required, specify the Form Bean to which this action should be forwarded.
  7. Click Finish.
  8. Repeat the above steps for all the actions required for the Page Flow.

All the actions for the Page Flow are created. You should see code that is similar to the following:

	@Jpf.Action()
	public Forward newAction1(test_pageflow.Test_pageflowController.NewFormBean form) {
		Forward forward = new Forward("success");
		return forward;
	}

Defining JSP Pages

Based on the interface mock ups that you designed, define JSP pages for the custom task UI using Beehive NetUI data binding JSP tags to render web forms that can read data from and write data into form beans. The use of these tags greatly simplifies the process of writing a data-driven JSP page.

Creating JSP Files

You can create JSP files in the Page Flow perspective as follows:

  1. In the Page Flow Explorer, right-click Pages and select New JSP Page.
  2. Note: In the Page Flow Controller, if there is a reference to a unavailable JSP, grayed out JSP pages are automatically listed under the Pages node in the Page Flow Explorer View. You can right-click on these JSPs and select Create to create the JSP file.
  3. Open the JSP file to view the following code:
  4. <%@ page language="java" contentType="text/html;charset=UTF-8"%>
    <%@taglib uri="http://beehive.apache.org/netui/tags-html-1.0" prefix="netui"%>
    <%@taglib uri="http://beehive.apache.org/netui/tags-databinding-1.0" prefix="netui-data"%>
    <%@taglib uri="http://beehive.apache.org/netui/tags-template-1.0" prefix="netui-template"%>
    <netui:html>
        <head>
            <netui:base/>
        </head>
        <netui:body>
           <p>Beehive NetUI JavaServer Page - ${pageContext.request.requestURI}</p>
        
        </netui:body>
    </netui:html>
  5. To create the JSP page, delete the following code from the JSP:
  6. <p>Beehive NetUI JavaServer Page - ${pageContext.request.requestURI}</p>

    and insert the text form in between the <netui:body> and the </netui:body> tag.

  7. To design the interface that should appear on the web page, drag and drop required elements from the NetUI folder in JSP Design Palette View into the JSP.
  8. Figure 3-8 JSP Design Palette


    JSP Design Palette

  9. Use the NetUI form element to design the form for all the required actions.
  10. Use the NetUI button element to enable navigation between forms and to take actions on the task.
  11. Repeat the above steps for all the JSP pages required for your custom task UI.

The JSP pages are created.

Registering the Custom Task UI

After designing the custom task UI for a step in a task plan or for an entire task plan, you need to register the custom task UI. To register the custom task UI, you need to add mapping entries to <Web project name>/WebContent/WEB-INF/task-ui-registry.xml registry file.

Note: The Web project corresponds to the Web application of Worklist that acts as the user interface for the system. For more information, see "Worklist Application" in Creating and Managing Worklist Task Plans in Using Worklist.

This XML registry file is associated with the schema for the Worklist Task UI Registry, and this schema is registered with Workshop.

Open the file to edit it. In the Source tab, the initial contents of this XML file should look something like this:

<task-ui-registry xmlns="http://www.bea.com/wli/worklist/taskuiregistry">
</task-ui-registry>

In the Design tab, you can right-click any node in the tree view to act on it. You can delete nodes, and add children to nodes.

To register the custom task UI, you need the following information:

Note: Step name is not required if you are registering the custom task UI designed for the entire task plan and not just a step in the task plan.

To edit task-ui-registry.xml first switch to the Package Explorer view and then do the following in the Design tab of the editor:

  1. In the Package Explorer, navigate to the <Web project name>/WebContent/WEB-INF/ folder and select task-ui-registry.xml.
  2. Note: The Web project corresponds to the Web application of Worklist that acts as the user interface for the system. For more information, see "Worklist Application" in Creating and Managing Worklist Task Plans in Using Worklist.
  3. Double-click the file to open it in the XML Editor.
  4. In the editor, right-click task-ui-registry.xml, and select Add Child.Arrow symbolSelectArrow symbolstep-override or task-plan override based on whether you created the custom task UI for a step or the entire task plan. This adds a new override element under the root element.
  5. Figure 3-9 Adding Child Override Element


    Adding Child Override Element

  6. Expand the newly added step-override or task-plan-override element and specify the task plan ID, step name, and custom task UI URI.
  7. Note: Step name is not required if you are registering the custom task UI designed for the entire task plan and not just a step in the task plan.
  8. For each of these elements, click on the right-hand value column, and replace the default values with the actual values.
  9. Figure 3-10 Map entries in registry file


    Map entries in registry file

Deploying the Custom Task UI

To deploy the custom task user interface:

  1. On the Package Explorer View, select and right-click <web project name>.
  2. Note: The Web project corresponds to the Web application of Worklist that acts as the user interface for the system. For more information, see "Worklist Application" in Creating and Managing Worklist Task Plans in Using Worklist.
  3. Click Run AsArrow symbolRun On Server. The Define a New Server dialog appears.
  4. Accept the default settings and click Next.
  5. Browse and select the required domain.
  6. Click Finish.

The custom Task UI is deployed on the server.


  Back to Top       Previous  Next