Retrieving Tasks Assigned to Users

You can retrieve tasks that are assigned to users using the Java API. That is, you can determine what tasks are located in a user’s queue. By retrieving tasks assigned to users, you can determine information related to the task such as the task’s identifier, the task’s description, the task’s start date, the task’s status, and so on.

Note: You cannot search for tasks assigned to users by using the web service API. The reason is because you cannot invoke the taskList method, which is a necessary method call to perform this task.
Important: When invoking the TaskManagerQueryService object’s TaskSearch and the TaskManager object’s TerminateTask method in the same transaction and the database that LiveCycle uses is DB2, you will cause a run-time error. Instead, make these calls in different transactions. The issue is related to how DB2 handles transactions.

Summary of steps

To retrieve tasks assigned to users, perform the following tasks:

  1. Include project files.

  2. Create a TaskManagerQueryService Client API object.

  3. Specify search criteria.

  4. Perform the search.

  5. Iterate through the returned tasks.

Include project files

Include necessary files into your development project. Because you are creating a client application using Java, include the necessary JAR files.

Create a TaskManagerQueryService Client API object

Before you can programmatically search for process instances, you must create a TaskManagerQueryService object.

To determine the tasks that are assigned to a specific user, specify the user name and the password value of the user for whom tasks are retrieved when setting connection properties. For example, to retrieve all tasks assigned to tony blue, use tony blue’s user name and password.

Specify search criteria

You can search for tasks based on the following states:

  • Assigned : Retrieve tasks that are assigned to a specific user.

  • Assigned_saved : Retrieve tasks that are assigned to a user and saved.

  • Completed : Retrieve tasks that are completed.

  • Created : Retrieve tasks that are completed.

  • Created_saved : Retrieve tasks that are created and saved.

  • Deadlined : Retrieve tasks that are past the deadline.

  • Terminated : Retrieve tasks that were terminated.

To retrieve tasks that are assigned to a specific user, perform your search based on the Assigned state.

Perform the search

After you define search criteria, you can search for tasks. All tasks that conform to the search criteria are returned in a list.

Iterate through the returned tasks

Iterate through the list of tasks to determine information about each task. You can, for example, determine a task’s identifier value.

Retrieve tasks assigned to users using the Java API

Retrieve tasks assigned to a user by using the Java API:

  1. Include project files

    Include client JAR files, such as adobe-taskmanager-client-sdk.jar, in your Java project’s class path.

  2. Create a TaskManagerQueryService Client API object

    • Create a ServiceClientFactory object that contains connection properties.

    • Create a TaskManagerQueryService object by invoking the TaskManagerClientFactory object’s static getQueryManager method and passing the ServiceClientFactory object.

  3. Specify search criteria

    • Create a TaskFilter object by invoking the TaskManagerQueryService object’s newTaskFilter method.

    • Create a StatusFilter object by invoking the TaskFilter object’s newStatusFilter method.

    • Specify the status of the tasks to search for by invoking the StatusFilter object’s addStatus method and passing a static data member that belongs to StatusFilter . For example, pass StatusFilter.assigned to retrieve tasks that are assigned to a specific user.

    • Invoke the TaskFilter object’s setStatusFiltering method and pass the StatusFilter object.

  4. Perform the search

    Search for tasks by invoking the TaskManagerQueryServiceService object’s taskList method and passing the TaskFilter object. This method returns a java.util.List object where each element is a TaskRow object that represents a task that conforms to the specified search criteria.

  5. Iterate through the returned tasks

    • Create a java.util.Iterator object by invoking the java.util.List object’s iterator method. This object enables you to iterate through the java.util.List instance to retrieve tasks.

    • Iterate through the java.util.List object to determine if there are tasks. If so, each element is a TaskRow instance.

    • Retrieve information about a task by invoking an appropriate method that belongs to the TaskRow object. For example, to get the task identifier value, invoke the TaskRow object’s getTaskId method.

// Ethnio survey code removed