eDocs Home > BEA WebLogic Integration 8.1 Documentation > Solution Samples >Worklist Sample

Worklist Sample

This sample consists of two distinct though interrelated use cases:

  • Use Case 1 - Create and Assign Tasks
  • Use Case 2 - Custom Worklist Queries

The data created by the Create and Assign Tasks use case can be queried using the Custom Worklist Queries use case. It is also possible to run either of the use cases in isolation.

Note: This sample is provided on dev2dev for your convenience and is not supported by BEA.

What the Sample Does

Use Case 1 - Create and Assign Tasks

This use case illustrates the typical process pattern and best practices for synchronously creating worklist task items. This pattern also assigns the task to a user in the same step as the task creation. All data needed to create a worklist task is passed in as an XML document. The JPD does an XML transformation and then creates the task in the database using a Task Control. The task is created and assigned to the user in a single step. The process (a JPD) also handles lifecycle events of the created task, such as when the task is completed or aborted or is overdue.

Use Case 2 - Custom Worklist Queries

This use case illustrates the best practices when using the WorklistScrollableResultManager API for retrieving information for a large number of worklist tasks. This API is exposed via a stateless session bean (SLSB) interface.

The WorklistScrollableResultManager API uses a cursor-like interface that allows the user to select a batch size. The maximum batch size supported out of the box is 1000. This API scales better than the older WorklistManager API in terms of number of concurrent clients. Hence, we recommend using this API for WebLogic Integration 8.1 SP4, or later.

The sample works in two modes—batch and interactive. In batch mode, the cursor batch size is set to the maximum value of 1000. Setting a higher cursor results in fewer round trips to the database while increasing the time for each round trip. Batch mode is suitable when retrieving a large number of tasks in a single client call. Interactive mode is optimized to support a UI such as a web page. In this mode, the user can fetch the tasks in manageable batch sizes.

How the Sample Works

The following figure illustrates the architecture for Use Case 1 and Use Case 2:


      Worklist Sample

Use Case 1 - Create and Assign Tasks

An external Java client (standalone or another server) invokes the JPD (TaskCreation.jpd) using a JPD proxy. The JPD transforms the input XML to the required format and calls the Task Control to create and assign a task. The JPD then returns. Even though the client call has returned, the JPD is kept alive and waits for events occurring on the created task. Once an event occurs on the task, the JPD processes the same and it is only then that the process ends.

Use Case 2 - Custom Worklist Queries

The client is a standalone Java class that makes synchronous remote calls to the RemoteWorklistManager SLSB. The client obtains a TaskInfoCursor by invoking getTaskInfoCursor with a TaskSelector and batch size as input parameters.

The TaskSelector is a class that is part of the Worklist API that allows the client to specify constraints on task attributes. Thus, the client can create and execute custom queries by setting different attributes on the TaskSelector. In this sample, this client uses a TaskSelectorFactory (not a part of the Worklist API) to instantiate a TaskSelector and set attributes on it. The attributes are read from a properties file. It is also possible to set these properties via a web interface or a thick client.

The cursor represents a scrollable iterator for the results of the query and contains an array of TaskInfo objects. The size of the array is equal to the batch size or 1000, whichever is smaller. The user can scroll forward to retrieve the next batch.

Required Software

This sample requires the following software:

  • WebLogic Integration 8.1, SP4 or later (includes Jython 2.1). You can download WebLogic Integration 8.1 from the download page on dev2dev.
  • WLI Common Utilities, version 2.5. You can download WLI Common Utilities from the download page.
  • WebLogic Server Scripting Tool (WLST) (included with WLI Common Utilities). You can also download WLST from the download page.
  •  
  • Note: WLST Offline and WLST Online are available for download and evaluation from BEA's dev2dev site, but have not been formally included in the WebLogic Platform 8.1 product. WLST is supported through BEA newsgroups only, and the utility and APIs are subject to change. BEA intends to formally support this capability in a future release of WebLogic Platform.

Supporting Materials

In addition to providing application code, the sample includes the following items:

  • Instructions and scripts for configuring a BEA WebLogic Integration cluster to support the application.
  • Instructions and scripts for deploying the application to an appropriately configured cluster.
  • Instructions, guidelines, and caveats for creating and assigning worklist tasks.

How to Download

You can download the Worklist sample and WLI Common Utilities from the download page on dev2dev.