Using Worklist

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

Using Worklist Controls

Java Controls are server-side components managed by the Workshop framework. Controls expose Java interfaces that can be invoked directly from business processes. In other words, controls are the interfaces between your business processes and other resources.

This section describes the built-in controls provided for Worklist that support the integration of business users with business processes. It includes the following topics:

 


About Worklist Controls

Worklist provides two Java controls: TaskControl and TaskBatchControl. You can use JPDs and these Worklist controls to support the integration of human actors and automated actors. Automated actors interact with the JPD and human actors interact with the Worklist User Portal.

As with other built-in controls in Workshop for WebLogic Platform, you use the controls by adding instances of the controls to your business process. Subsequently, you invoke operations on the controls at the point in the business process at which you want to integrate the business-user logic.

The underlying control implementation takes care of most of the details of the interaction for you. Business processes invoke operations on the controls using Control Send and Control Send with Return nodes. Business processes can block at Control Receive nodes waiting for events to be returned from controls. In other words, Control Receive nodes are triggered by control callbacks. Business processes can use a TaskControl or TaskBatchControl to change a task and also wait for a task (via a TaskControl) to be changed by a human actor. You can extend Worklist controls through Java annotations. Common extensions include implementing callback functions and performing system queries.

Worklist provides the following controls:

These controls provide simplified construction and initialization of Worklist API resources. These controls are extensible controls that allow you to define extension interfaces containing new methods beyond those on the generic control interface. The new methods of these controls can be annotated to attach Worklist behaviors to them.

TaskBaseControl

TaskControl and TaskBatchControl extend from TaskBaseControl, which provides the built-in control methods and annotations that are common to both TaskControl and TaskBatchControl. It provides the following built-in methods:

TaskBaseControl does not allow any control-level annotations. However, it provides the following method-level annotations, which allow you to assign one or more Worklist behaviors to the methods on a control extension:

Method-level Annotations for TaskBaseControl

The various annotations are:

Annotation Name
Description
Fields that Support Parameters
TaskCreate Annotation
Causes the method attached to this annotation to create a new task using the configuration values in this annotation. This annotation causes the setTaskId() method to be called if the control is a TaskControl extension (giving the ID of the newly created task).
name, comment, description, priority, owner, timeEstimate
TaskPlanID Annotation
The ID of the application hosting the Worklist system instance whose registry contains the task plan for the new task. If not specified, this will default to the name of the application that contains this control instance.
path, version, worklistHostApplicationId
TaskUpdate81x Annotation
Backward compatibility for 81x use only.
Causes the method attached to this annotation to update a task using the configuration values in this annotation.
 
ContainerHandleAnno Annotation
 
type, subtype, instance
DateTimeSpec Annotation
Absolute date/time in the default date/time format for the current locale (will be parsed with DateFormat.getDateTimeInstance().parse(). Mutually exclusive with businessTime. If businessTime is specified, this is ignored.

Note: This field supports parameters so you can specify a method parameter that holds a pre-parsed or calculated java.util.Date or java.util.Calendar instance.

absoluteTime
BusinessTimeAnno Annotation
Represents an abstract business date and time by defining a time duration from a (as yet unknown) reference time. This duration may optionally be calculated using a business calendar thus allowing a discontinuous set of time segments to be calculated whose total duration matches the given duration. The end time of the last such segment is taken as the effective business date/time for this BusinessTime. The time segments are placed such that they fall within the boundaries of 'available' time on the business calendar.
duration, calendarName
StepTimeEstimate Annotation
Estimate in Interval string format, such as 3d4h5m
stepName, estimate
AssignmentInstructionsAnno Annotation
Describes instructions for assigning a task to human actors.
 
AssignmentInstructions81x Annotation
Describes instructions for assigning a task to human actors in 8.1.x terms.
 
AssigneeDefinitionAnno Annotation
Used from within AssignmentInstructionsAnno to define the list of assignees.
name
PropertyValue Annotation
Provides a single value for a single property with a given name.
name, value
TaskAssign Annotation
Causes the method for this annotation to stimulate the assignment of one or more task instances given the defined assignment instructions
 
TaskAssign81x Annotation
Backward compatibility for 81x only.
Causes the method for this annotation to stimulate the assignment of the task instances given the defined assignment instructions.
 
TaskStart81x Annotation
Backward compatibility for 81x only.
Causes the method for this annotation to take the Start action on the CLAIMED step of a task based on the Compatibility 8.1.x task plan.
 
TaskStop81x Annotation
Backward compatibility for 81x only.
Causes the method for this annotation to take the Stop action on the STARTED step of a task based on the Compatibility 8.1.x task plan.
 
TaskTakeAction Annotation
Causes the method for this annotation to take the given action on the current step of this task instance. The named action may be a Work action, an Assign action, or a Return action.
name
TaskGetData Annotation
Causes the method for this annotation to retrieve the TaskData from one or more task instances for this control. The method attached to this annotation will return a TaskData object.
Do not use this annotation in conjunction with other annotations that return values, as annotations will compete and collide in returning values; only one return value can be provided from the method.
If the return type of the method attached to this annotation is not assignment compatible with TaskData a ClassCastException will be thrown at runtime.
If this control manages more than one task instance, the method attached to this annotation will return an array of type TaskData[].
 
TaskGetInfo Annotation
Backward compatibility for 81x only.
Causes the method for this annotation to retrieve the TaskInfo from one or more task instances for this control. The method attached to this annotation will return a TaskInfo object.
Do not use this annotation in conjunction with other annotations that return values, as annotations will compete and collide in returning values; only one return value can be provided from the method.
If the return type of the method attached to this annotation is not assignment compatible with TaskInfo a ClassCastException will be thrown at runtime.
If this control manages more than one task instance, the method attached to this annotation will return an array of type TaskInfo[].
 
TaskGetPropertyNames81x Annotation
Backward compatibility for 81x use only.
Causes the method for this annotation to retrieve the names of all properties set on the task instances for this control. The method attached to this annotation will return an array of String containing names of properties.
Do not use this annotation in conjunction with other annotations that return values, as annotations will compete and collide in returning values; only one return value can be provided from the method.
If the return type of the method attached to this annotation is not assignment compatible with String[] a ClassCastException will be thrown at runtime.
If this control manages more than one task instance, the method attached to this annotation will return a two-dimensional array where the first dimension indicates the task ID (as a String) of each individual task instance. The second dimension represents the property names array described above.
 
TaskGetProperties Annotation
Causes the method for this annotation to retrieve the value of the named properties from the task instance(s) for this control. The method attached to this annotation will return an array of PropertyInstance objects, one per property specified. If the property was not found, the array element corresponding to the unknown property will be null.
In the special case where only one property name is given, and if the return type of the method is not an array type, the single property value will be returned (not an array) according to the rules below.
This annotation should not be used in conjunction with other annotations that return values, as only one return value can be provided from the method (and annotations will compete and collide in returning values).
If the return type of the method attached to this annotation is not assignment compatible with PropertyInstance, this annotation will cause the value object of the PropertyInstance to be extracted. The value object (if assignment compatible) will be stored in the return value. If not, a ClassCastException will be thrown at runtime.
If this control manages more than one task instance, the method attached to this annotation will return an array of TaskProperties objects indicating the task ID (as a String) of each individual task instance. The TaskProperties object represents the property value array described above (for a single task).

Note: For tasks based on the Compatibility 8.1.x task plan, the names given in propertyNames will not be represented in the task plan. This is allowed for compatibility reasons only with this task plan. All properties are assumed to be of type String.

propertyNames, sysProperties
TaskGetRequest81x Annotation
Backward compatibility for 81x use only.
Causes the method for this annotation to retrieve the value of the request property from the task instance(s) for this control. The method attached to this annotation will return an object representing the given property. The type of that object will be (in precedence order):
  • A TaskMessage if the method return type is assign-compatible with TaskMessage
  • A byte[] containing the byte data of the property if the return type is byte[]
  • An XMLBean if the return type is assign-compatible with XmlObject
  • A Java object
Do not use this annotation in conjunction with other annotations that return values, as annotations will compete and collide in returning values; only one return value can be provided from the method.
If this control manages more than one task instance, the method attached to this annotation will return a two-dimensional array where the first dimension indicates the task ID (as a String) of each individual task instance. The second dimension represents the indicated property described above.
 
TaskGetResponse81x Annotation
Backward compatibility for 81x use only.
Causes the method for this annotation to retrieve the value of the response property from the task instance(s) for this control. The method attached to this annotation will return an object representing the given property. The type of that object will be (in precedence order):
  • A TaskMessage if the method return type is assign-compatible with TaskMessage
  • A byte[] containing the byte data of the property if the return type is byte[]
  • An XMLBean if the return type is assign-compatible with XmlObject
  • A Java object
Do not use this annotation in conjunction with other annotations that return values, as annotations will compete and collide in returning values; only one return value can be provided from the method.
If this control manages more than one task instance, the method attached to this annotation will return a two-dimensional array where the first dimension indicates the task ID (as a String) of each individual task instance. The second dimension represents the indicated property described above.
 
TaskSetProperties Annotation
Causes the method for this annotation to set the value of the given properties onto the task instance(s) for this control. The method attached to this annotation will take arguments that can be combined with annotation values to form the effective runtime property value. If the effective runtime value is assignment compatible with the value class of the data type for the property, it will be taken as the new property value. If not, and it is of type String, it will be treated as a serialized default value for the data type, and de-serialized to get the actual runtime value for the property. If this fails, or the original runtime value was not a String, then a DataTypeException is thrown at runtime. If the method declares it can throw DataTypeException, the exception will be thrown directly. Otherwise, it will be wrapped in an IllegalArgumentException and thrown that way.
 
TaskSetProperty81x Annotation
Backward compatibility for 81x use only.
Causes the method for this annotation to set the value of the given property onto the task instance(s) for this control. The method attached to this annotation will take arguments that can be combined with annotation values to form the effective runtime property value.

Note: For tasks based on the Compatibility 8.1.x task plan, the name given in name will not be represented in the task plan. This is allowed for compatibility reasons only with this task plan. All properties are assumed to be of type String.

 
TaskSetRequest81x Annotation
For 81x backwards compatibility only.
Causes the method for this annotation to set the value of the indicated property onto the task instance(s) for this control. The method attached to this annotation will take arguments that can be combined with annotation values to form the effective runtime property value. The effective runtime value will be taken as the data for the TaskMessageValue value for the indicated property. If the method declares it can throw DataTypeException, any DataTypeException that might occur when trying to serialize or store the value will be thrown directly. Otherwise, it will be wrapped in an IllegalArgumentException and thrown that way.
 
TaskSetResponse81x Annotation
For 81x backwards compatibility only.
Causes the method for this annotation to set the value of the indicated property onto the task instance(s) for this control. The method attached to this annotation will take arguments that can be combined with annotation values to form the effective runtime property value. The effective runtime value will be taken as the data for the TaskMessageValue value for the indicated property. If the method declares it can throw DataTypeException, any DataTypeException that might occur when trying to serialize or store the value will be thrown directly. Otherwise, it will be wrapped in an IllegalArgumentException and thrown that way.
 
TaskRemoveProperties81x Annotation
For 8.1/8.5 backwards compatibility only.
Causes the method for this annotation to unset the named properties from one or more task instances for this control.
 
TaskSetError Annotation
Causes the method for this annotation to set an error condition on one or more task instances for this control. Methods with this annotation should only be used to indicate technical errors in the processing of a task. Business errors should be accounted for in the step and action model of the task type for this task.
message
TaskClaim Annotation
Causes the method for this annotation to claim one or more task instances for this control.
claimant
TaskClaim81x Annotation
For 8.1/8.5 backwards compatibility only.
Causes the method for this annotation to claim one or more task instances for this control, and then take the Claim action on the ASSIGNED step of the task.
This has been deprecated. Use custom task plan and TaskTakeAction annotation instead.
 
TaskReturn Annotation
Causes the method for this annotation to return one or more task instances for this control.
 
TaskReturn81x Annotation
For 8.1 and 8.5 backwards compatibility only.
Causes the method for this annotation to return one or more task instances for this control, and then take the Return action on the CLAIMED or STARTED step of the task.
This has been deprecated. Use custom task plan and TaskTakeAction annotation instead.
 
TaskSuspend Annotation
Causes the method for this annotation to suspend one or more task instances for this control.
 
TaskResume Annotation
Causes the method for this annotation to resume one or more task instances for this control.
 
TaskComplete Annotation
Causes the method for this annotation to complete one or more task instances for this control.
 
TaskAbort Annotation
Causes the method for this annotation to abort one or more task instances for this control.
 
TaskDelete Annotation
Causes the method for this annotation to delete one or more task instances for this control.
 

Task Control

TaskControl encapsulates low-level access to a single task instance throughout its life cycle. It provides methods to set user-defined and system properties of the task, as well as taking actions on a task.

TaskControl provides programmatic and declarative event services as described in the Beehive Controls Development Guide. Control extensions of the TaskControl can define their own event methods, and attach listener configuration attributes to them via annotations.

TaskControl extends TaskBaseControl (thus providing all its methods). TaskControl also provides methods for the following:

Method-level Annotations for TaskControl

The TaskControl control interface is not intended to be a fully functional replacement for the Worklist API. It is expected that users will define extensions of TaskControl, adding any appropriate methods to meet their needs for managing the task.

A TaskControl extension can define any number of methods with any legal Java name. Worklist does not assign any special meaning to a method name. Instead, annotations added to the methods of a TaskControl extension attach behaviors to those methods. A given method can have multiple annotations, and thus accomplish multiple operations on a task in a single method call. In addition, annotations may be placed at the top-level of a control extension (before the interface declaration) that sets behavior (default or otherwise) for all methods in the extension.

TaskControl extensions can be annotated with:

TaskControl allows all the method-level annotations from TaskBaseControl.

TaskControl defines the following additional method-level annotations:

Table 4-1 Method-level Annotations for TaskControl
Annotation Name
Description
TaskPlanAnno Annotation
Defines the task plan to be associated with a control. Either this or the TaskCreate annotation is required on a TaskControl.
TaskEventAnno Annotation
Callback methods only. Allows a callback method to describe subscriptions to events of a given type, and to define the method signature of that callback to the Worklist event framework. Event header information can be passed to individual parameters in the callback method based on the configuration provided in this annotation. In addition, a full TaskEvent instance can also be passed.

TaskBatch Control

The TaskBatchControl encapsulates low-level access to a batch of task instances. It does not provide event services (for these, you must use TaskControl). Methods on a control extension of TaskBatchControl can define custom task selectors that define the batch or group of task instances upon which the method will act.

The TaskBatchControl extends TaskBaseControl, and thus provides all system methods from TaskBaseControl. It does not define any additional system methods.

Control-level Annotations for TaskBatchControl

The TaskBatchControl supports the select control-level annotations. This acts as a default selector for methods on the control extension.

Method-level Annotations for TaskBatchControl

TaskBatchControl supports the following method-level annotation:

Annotation Name
Description
Fields That Support Parameters
TaskQueryAnno Annotation
Defines the query used to fetch the task instances to be manipulated in the batch
All except queryParamName and propertyValue

Merging Parameter Values with Annotation Values

Some annotations support parameter markers within them that can be replaced at runtime with the values of parameters provided in a method invocation. This allows dynamic data to be combined with static data from the annotation.

Annotations that support runtime parameter markers are marked with the @SupportsParameters annotation.

public @interface @SupportsParameters {
    String markerBegin() default "{";
    String markerEnd() default "}";
}

Any annotation field of type String can be annotated with the @SupportsParameters annotation. Any unescaped parameter markers in the annotation string value will be interpreted as replaceable parameters. For example:

public @interface TestAnno {
    @SupportsParameters
    String hasParams();
    String noParams();
}

and

public interface MyTest {
    @TestAnno(hasParams="Param1 has value {param1} and param2 = {param2}")
    public void testHasParams(int param1, String param2);
    @TestAnno(noParams="Param1 has value {param1} and param2 = {param2}")
    public void testNoParams(int param1, String param2);
}

In this case, a call to testHasParams with param1=1 and param2="Two" yields an effective runtime value for hasParams of:

Param1 has value 1 and param2 = Two

whereas a call to noParams with param1=1 and param2="Two" yields an effective runtime value for noParams of:

Param1 has value {param1} and param2 = {param2}

Note: Javadoc does not show meta-annotations such as the @SupportsParameters annotation. Refer to the method-level annotations table for the worklist controls for an indication if a given field supports parameters.

 


Creating Worklist Controls

You can create Task Control and Task Batch Controls and use these controls in a business process.

Creating a Task Control

You can create a task control using any of the following methods:

Creating a Task Control from the Select a Wizard Dialog

To create a Task Control that will trigger the creation of a task instance:

  1. Select the <web project name>/src folder and click Ctrl+N. The Select a Wizard dialog appears.
  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.
  3. Click the Business Process in Test Form Page next to WebLogic Integration Controls and select Task. Click Next. The Create Control page of the Insert Control: Task dialog appears.
  4. Figure 4-1 Creating a Task Control


    Creating a Task Control

  5. Enter the name of the Task Control in the Name field.
  6. Click Next. The Task Plan page of the Insert Control: Task dialog appears.
  7. Click Browse to locate the task plan. The Task Plan Selection dialog appears.
  8. Figure 4-2 Selecting the Task Plan


    Selecting the Task Plan

  9. Select the plan and click OK to continue.
  10. Click Finish to add the new Task Control to the business process.
  11. Select File Arrow symbol Save or use Ctrl+S to save the JPD file.

The task control is created based on the selected task plan. You can see the <task control name>.java file in the Package Explorer View.

Note: To use the methods in this control, drag and drop the .java file from the Package Explorer View into the Data palette View.

Creating a Task Control from the Data Palette in Process Perspective

To create a task control:

  1. Make sure that the Process perspective is available. For more information, see Selecting a Perspective.
  2. Select the business process file in <web project name>/src/<process folder name> and open it with the Process Editor.
  3. 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.
  4. Click the down arrow in the Data Palette View.
  5. Figure 4-3 Data Palette View


    Data Palette View

  6. Select Integration Controls Æ Task.
  7. Figure 4-4 Integration Controls


    Integration Controls

    The Insert Control : Task dialog appears.

    Figure 4-5 Insert Worklist Control


    Insert Worklist Control

  8. Enter the field name and specify the point at which the control should be inserted in the business process. If required, select the Make this a control factory that can create multiple instances at runtime check box and click Next. The Create Control dialog (Figure 4-1) appears.
  9. Enter the name of the Task Control in the Name field.
  10. Click Next. The Task Plan page of the Insert Control: Task dialog appears.
  11. Click Browse and locate the task plan, and then click OK to continue.
  12. Click Finish to add the new Task Control to the business process.
  13. Select File Arrow symbol Save or use Ctrl+S to save the JPD file.

The task control is created based on the selected task plan. You can see the <task control name>.java file in the Package Explorer View. You can also see the new control listed in the Data Palette View.

Figure 4-6 Worklist Controls listed in Data Palette View

Worklist Controls listed in Data Palette View

Creating a Task Batch Control

You can create a task batch control using any of the following methods.

Creating a Task Batch Control from the Select a Wizard Dialog

To create a Task Batch Control:

  1. Select the <web project name>/src folder and click Ctrl+N. The Select a Wizard dialog appears.
  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.
  3. Click the Worklist Controls listed in Data Palette View next to WebLogic Integration Controls and select Task Batch. Click Next. The Create Control page of the Insert Control: Task Batch dialog appears.
  4. Enter the name of the Task Batch Control in the Name field.
  5. Click Next. The Task Plan Selection page of the Insert Control: Task Batch dialog appears.
  6. Figure 4-7 Select Task Plans


    Select Task Plans

  7. Select the required task plan and click Finish.
  8. Select File Arrow symbol Save or use Ctrl+S to save the JPD file.

The task batch control is created. You can view the <task batch control name>.java file in the Package Explorer View.

Note: To use the methods in this control, drag and drop the .java file from the Package Explorer View into the Data palette View.

Creating a Task Batch Control from the Data Palette in Process Perspective

To create a task batch control:

  1. Make sure that the Process perspective is available. For more information, see Selecting a Perspective.
  2. Select the business process file in <web project name> / src / <process folder name> and open it with the Process Editor.
  3. Click the down arrow in the Data Palette View (Figure 4-3).
  4. Select Integration Controls Arrow symbol Task Batch (Figure 4-4). The Insert Control : Task Batch dialog appears.
  5. Enter the field name and specify the point at which the control should be inserted in the business process. If required, select the Make this a control factory that can create multiple instances at runtime check box and click Next. The Create Control dialog appears.
  6. Enter the name of the Task Batch Control in the Name field.
  7. Click Next. The Task Plan Selection dialog appears.
  8. Select the required task plans.
  9. Click Finish to add the new Task Batch Control to the business process.
  10. Select File Arrow symbol Save or use Ctrl+S to save the JPD file.

The task batch control is created based on the selected task plan. You can see the <task control name>.java file in the Package Explorer View. You can also see the new control listed in the Data Palette View.

Creating a Worklist Control Using Task Control Generator

You can use TaskControlGenTask, the Task Control Generator, to create an Apache Beehive control for a task plan. The generated control uses the TaskControl. A developer can change the annotations of the generated controls as required.

For generic information about custom controls, see Developing Custom Controls in Workshop for WebLogic Platform Programmer's Guide.

Generated controls take into account the constructors, steps, and actions defined in the task plan. They contain appropriate methods for creating tasks, taking actions on them, responding to events on them, and getting/setting system and user-defined property information for them.

Design the control interface to ensure that it contains:

Running the Task Control Generator

You can run the Task Control Generator:

Running the Task Control Generator from a Java Client or Command Line

The Java class name is com.bea.wli.worklist.build.TaskControlGen in the WL_HOME/integration/lib/worklist-client.jar file.

To run the generator from a Java client of the command line, type:

java com.bea.wli.worklist.build.TaskControlGen <options>

where options are listed in the following table:

Table 4-2 Command line options for running the task control generator
Option Name
Description
-taskPlan
The file location of the .task file that should be compiled. Required.
-outputDir
The directory where the generated control source should be output. Required.
-hostAppRootDir
The root directory of EAR holding the .task file. Optional.
Can be the EARContent directory of a Java EE EAR project in Workshop. This root is used to calculate a relative path for the task plan relative to the root of the EAR. This relative path in turn is used in the default calculation of the package name for the generated control interface file. If you specify the parent directory of the .task file as the hostAppRootDir, the control interface will be placed in the default Java package. If not specified, the absolute path of the task type is used (potentially in the calculation of the Java package name for the generated control interface)
-packageName
The package name of the generated source. Optional.
If the package name is not specified, the package name is derived from the task plan path. The package is calculated by replacing "/" in the path with ".", removing spaces, and replacing invalid package characters with "_".
-interfaceName
The name of the interface. Optional.
If this value is not specified, the interface name is derived from the task plan path. The control interface name is taken from the last step in the task plan path, where spaces are removed, and invalid class name characters are replaced with '_'.

Running the Task Control Generator from Ant

The Ant task class name is com.bea.wli.worklist.build.TaskControlGenTask in the WL_HOME/integration/lib/worklist-client.jar file.

Note: We recommend that you import the task with a taskdef named task-control-gen.

The following Ant script describes how to use TaskControlGenTask:

<!-- Set some initial properties -->
<property environment="env"/>
<property name="wl.home" value="${env.WL_HOME}"/> 
<property name="worklist-client.jar"
location="${wl.home}/integration/lib/worklist-client.jar"/>
<property name="build.dir" value="<some dir to hold build output>"/>
<!-- Define the task to Ant -->
<taskdef name="task-control-gen"
classname="com.bea.wli.worklist.build.TaskControlGenTask"
classpath="${worklist-client.jar}"/>
<!-- Give us a place to build control source files into -->
<mkdir dir="${build.dir}/controlsrc"/>
<task-control-gen
taskPlanFile="<see command-line section -taskPlan arg>"
outputDir="${build.dir}/controlsrc"
hostAppRootDir="<see command-line section -hostAppRootDir arg>"
packageName="<see command-line section -packageName arg">
interfaceName="<see command-line section -interfaceName arg">
<classpath>
<!-- Add this so TaskControlGen can see the needed classes. You can also add your own classes (e.g. XMLBeans classes as needed) -->
<pathelement location="${worklist-client.jar}"/>
</classpath>
</task-control-gen>

Manually Creating Task Control and Task Batch Control

The Task Control Generator and the Worklist Control wizards should be viewed as shortcuts to creating Worklist controls in ways that users commonly need. However, you may create TaskControl and TaskBatchControl extensions manually if they like. The only requirement for these extensions is that they extend TaskControl or TaskBatchControl and are marked with @ControlExtension at the interface level.

You may add any number of methods to these control extensions and mark them up using any of the annotations supported for the given type of control. It may be appropriate to create your own custom control extensions in the following cases (and possibly others as well)

In all these cases, you can start with a control as generated by the Worklist tools, and then manually update the control interface as desired.

 


Using Task and Task Batch Controls in Business Processes

This section provides information about using business process files (JPDs) and Worklist Controls to support the integration of human actors and automated actors. Automated actors interact with the JPD and human actors interact with Worklist User Portal.

As with other built-in controls in Workshop for WebLogic Platform, you use the controls by adding instances of the controls to your business process. Subsequently, you invoke operations on the controls at the point in the business process at which you want to integrate the business-user logic.

To design the interaction of a Task or Task Batch control with a business process, you must decide which methods on the control you want to call from the business process to support the business logic.

In the same way that you design the interactions between business processes and other controls in WebLogic Workshop, you can bind the Worklist control method to the appropriate control node in your business process (Control Send, Control Receive, and Control Send with Return). You do this in the Design View by simply dragging a control method from the Data Palette onto the business process at the point in your business process at which you want to design the logic. After you create an instance of a Task or Task Batch control, you can invoke its methods from within your business processes to perform operations on task instances. Your business processes can also wait to receive callbacks from task instances. Note that the Task and Task Batch controls can be extended to add customized methods and additional callbacks.

You can create a task instance using a Task Control or Task Batch Control in a JPD. During this process, you need to create a business process file and a Task Control or Task Batch Control, deploy the process. If required, you can create a sample task to validate the task instance creation.

You can use worklist controls in your business process by:

Creating a Business Process

To create a business process that will use the worklist controls:

  1. In the Package Explorer view, right-click the <web project name>\src folder, and select NewArrow symbolFolder. The New Folder dialog appears.
  2. Enter the name of the folder in which the business process files are stored.
  3. Click Finish.
  4. Select the project folder and press Ctrl+N. The Select a Wizard dialog appears.
  5. Select WebLogic Integration Arrow symbol Process and click Next. The New Process File dialog appears.
  6. Enter a name for the business process file. This creates a JPD process file <process name>.java under the process folder.
  7. Click Finish to complete the process. The new JPD in design view is displayed in the IDE browser.
  8. Figure 4-8 New JPD Using Worklist Control


    New JPD Using Worklist Control

  9. Double-click Select Start Event (Start node). A screen that allows you to select the manner in which the business process should be invoked appears.
  10. Figure 4-9 Invoking a business process


    Invoking a business process

  11. Select the manner in which the business process is invoked and click Close. For example, select Invoked via a Client Request. The JPD design view is refreshed and the Start node is named Client Request.
  12. Double-click Client Request node to configure it.
  13. Figure 4-10 Configuring Client Request


    Configuring Client Request

  14. In the General Settings tab, click Add to display a dialog box for defining parameters. Create parameters and configure their types based on the user properties required for the task.
  15. Figure 4-11 Add Parameters


    Add Parameters

  16. Click the Receive Data tab to create new variables and assign them the respective parameters created in the previous step.
  17. Figure 4-12 Assigning Variables to Parameters


    Assigning Variables to Parameters

  18. Click Close to continue.

Invoking the Task Plan Constructor from the Business Process

To invoke the task instance creation constructor to the business process.

  1. Right click the <worklist business process name>.java file in the Package Explorer pane and select Open With Æ Process Editor option. Ensure the JPD is displayed in the Design tab and that you are using the Process Perspective.
  2. From the Data Palette View on the bottom right corner of the IDE, navigate to <control name> folder in the Controls folder and select the method that you want to invoke in the business process.
  3. Constructor methods on the control will have the name of the constructor defined in the task plan, and will take a task name as the first argument in the method signature. Constructor methods also return the step interface for the start step designated by the constructor in the task plan.

    Figure 4-13 Selecting the Control Method


    Selecting the Control Method

  4. Drag and drop the selected method into the JPD, between the Client Request and the Finish nodes.
  5. Double click the method (displayed as a node in the Design View) and configure the Send Data properties.
  6. Figure 4-14 Map the Send Data Variables with the Control Parameters


    Map the Send Data Variables with the Control Parameters

  7. Map the receive data variables for the method to variables in the business process. Click Receive Data, accept the given data type of the return value from the control method invocation, and then give a variable name, which will hold the returned step interface.
  8. Figure 4-15 Map Receive Data Variable


    Map Receive Data Variable

  9. Optionally, take actions on the task using the returned step interface from step 5. Note that the process designer does not treat the step interface as a separate control. Because of this, you will need to use perform nodes to invoke the methods of the step interface. You must write the code manually to invoke these methods. You may choose to have one perform node for each method you call, or you can group many method calls into a single perform node. The benefit of the "one method per perform node" approach is that you will get a graphical representation of the methods being called on the task just by looking at the process flow graph.
  10. Click Close and save the JPD.

Deploying and Validating the Business Process

To deploy and validate the business process:

  1. Select the JPD is selected in the Package Explorer View and select the Run Arrow symbol Run menu option.
  2. After successful deployment the JPD process page is launched in the IDE browser.

  3. Click the Test Form tab of the process browser.
  4. Figure 4-16 Business Process in Test Form Page


    Business Process in Test Form Page

  5. Enter the test values in their respective fields.
  6. Click ClientRequest to execute the process with the test values. After a successful execution, the TestForm tab is refreshed
  7. Start a Worklist User Portal session and log in using the user credentials.

The Assigned Tasks portlet box displays the task instance created by a JPD using a Control.


  Back to Top       Previous  Next