![]() |
![]() |
|
|
Managing Tasks
Tasks are defined as part of the template definition creation process, as described in Creating a Template Definition.
This section describes how to manage tasks, including the following topics:
For more information about the methods described in this section, see the com.bea.server.admin.Admin Javadoc. For information about managing tasks using the WebLogic Integration Studio, see Defining Workflow Templates in Using the WebLogic Integration Studio.
Getting Tasks
To get a list of the tasks defined for a particular workflow template, use the following com.bea.wlpi.server.admin.Admin method:
public java.util.List getTasks(
java.lang.String assigneeId,
java.lang.String orgId,
boolean role
) throws java.rmi.RemoteException,
com.bea.wlpi.common.WorkflowException
The following table describes the parameters for the getTasks() method for which you must specify values.
Table 15-1 getTasks() Method Parameters
Each method returns a list of com.bea.wlpi.common.TaskInfo objects. To access information about each task, use the TaskInfo object methods described in TaskInfo Object.
For example, the following code gets a list of the tasks for the ROLE1 role (notice that the role parameter is set to true) in the ORG1 organization. In this example, admin represents the EJBObject reference to the Admin EJB.
List taskList = admin.getTasks("ORG1", "ROLE1", true);
For more information about the getTasks() method, see the com.bea.wlpi.server.admin.Admin Javadoc.
Assigning a Task
To change the user or role to which a task is assigned, or to unassign a task, use the following com.bea.wlpi.server.admin.Admin methods, respectively:
public void taskAssign(
java.lang.String templateDefinitionId,
java.lang.String instanceId,
java.lang.String taskId,
java.lang.String assignTo,
boolean bRole,
boolean bLoadBalance
) throws java.rmi.RemoteException,
com.bea.wlpi.common.WorkflowException
public void taskUnassign(
java.lang.String templateDefinitionId,
java.lang.String instanceId,
java.lang.String taskId
) throws java.rmi.RemoteException,
com.bea.wlpi.common.WorkflowException
The following table describes the parameters required by the taskAssign() and taskUnassign() methods for which you must specify values.
Table 15-2 taskAssign() and taskUnassign() Method Parameters
The actual assignee to whom the task is assigned depends on the following:
For example, the following code assigns a task to the user joe. In this example, admin represents the EJBObject reference to the Admin EJB.
admin.taskAssign(
task.getTemplateDefinitionId(),
task.getInstanceId(),
task.getTaskId(),
"joe",
false,
false
);
The following code unassigns the same task.
admin.taskUnassign(
task.getTemplateDefinitionId(),
task.getInstanceId(),
task.getTaskId(),
"joe",
false,
false
);
The template definition, workflow instance, and task IDs are obtained using the methods associated with the com.bea.wlpi.common.TaskInfo object, task. The task object can be obtained using the methods described in Getting Tasks.
For more information about the com.bea.wlpi.common.TaskInfo methods, see TaskInfo Object, or the com.bea.wlpi.common.TaskInfo Javadoc.
For more information about the taskAssign() and taskUnassign() methods, see the com.bea.wlpi.server.admin.Admin Javadoc.
Marking a Task Complete or Incomplete
To mark a task as complete (done) or incomplete (undone), use the following com.bea.wlpi.server.admin.Admin methods, respectively:
public void taskMarkDone(
java.lang.String templateDefinitionId,
java.lang.String instanceId,
java.lang.String taskId
) throws java.rmi.RemoteException,
com.bea.wlpi.common.WorkflowException
public void taskUnmarkDone(
java.lang.String templateDefinitionId,
java.lang.String instanceId,
java.lang.String taskId
) throws java.rmi.RemoteException,
com.bea.wlpi.common.WorkflowException
The following table describes the taskMarkDone() and taskUnmarkDone() method parameters for which you must specify values.
Table 15-3 taskMarkDone() and taskUnmarkDone() Method Parameters
The taskMarkDone() method sets the task Completed value to the current date and time, and results in the sequential execution of all the actions associated with the specified task's Marked Done event. The taskMarkDone() method, however, has no effect on a task that has already been marked complete. For information about defining the Marked Done event for a task, see "Working with Nodes" in Defining Workflow Templates in Using the WebLogic Integration Studio.
The taskUnmarkDone() method clears the Completed date. The method does not result in the execution of the actions associated with the specified task's Activated event.
For example, the following code marks the specified task as complete, sets the Completed value to the current date and time, and executes the actions associated with the specified task's Marked Done event. In this example, admin represents the EJBObject reference to the Admin EJB.
admin.taskMarkDone(
task.getTemplateDefinitionId(),
task.getInstanceId(),
task.getTaskId()
);
The following code marks the same task as incomplete, and clears the Completed date:
admin.taskMarkUndone(
task.getTemplateDefinitionId(),
task.getInstanceId(),
task.getTaskId()
);
The template definition, workflow instance, and task IDs are obtained using the methods associated with the com.bea.wlpi.common.TaskInfo object, task. The task object can be obtained using the methods described in Getting Tasks.
For more information about the com.bea.wlpi.common.TaskInfo methods, see TaskInfo Object, or the com.bea.wlpi.common.TaskInfo Javadoc.
For more information about the taskMarkDone() and taskMarkUndone() methods, see the com.bea.wlpi.server.admin.Admin Javadoc.
Setting Task Properties
To set task properties, use following com.bea.wlpi.server.admin.Admin method:
public void taskSetProperties(
java.lang.String templateDefinitionId,
java.lang.String instanceId,
java.lang.String taskId,
int priority,
boolean doneWithoutDoit,
boolean doitIfDone,
boolean unmarkDone,
boolean modify,
boolean reassign
) throws java.rmi.RemoteException,
com.bea.wlpi.common.WorkflowException
The following table describes the taskSetProperties() method parameters for which you must specify values.
Table 15-4 taskSetProperties() Method Parameters
For example, the following code sets the default task priority to medium (1) and enables (sets to true) all other task properties. In this example, admin represents the EJBObject reference to the Admin EJB.
admin.taskSetProperties(
task.getTemplateDefinitionId(),
task.getInstanceId(),
task.getTaskId(),
1,
true,
true,
true,
true,
true
);
The template definition, workflow instance, and task IDs are obtained using the methods associated with the com.bea.wlpi.common.TaskInfo object, task. The task object can be obtained using the methods described in Getting Tasks.
For more information about the com.bea.wlpi.common.TaskInfo methods, see TaskInfo Object, or the com.bea.wlpi.common.TaskInfo Javadoc.
For more information about the taskSetProperties() method, see the com.bea.wlpi.server.admin.Admin Javadoc.
![]() |
![]() |
![]() |
|
Copyright © 2001 BEA Systems, Inc. All rights reserved.
|