Assigning Tasks

You can assign an existing task to a user by using the Java API and web service API. When a task is assigned to a user, the task is placed in the user’s queue and the user can view and complete the task in Workspace. If the task was previously assigned to another user, it is moved from one user queue and placed into the user queue to whom the task is assigned.

Remarque : The name of the service that is invoked when assigning tasks is TaskManagerService. To create a proxy object that lets you invoke its operations using a web service, specify this WSDL definition: http://localhost:8080/soap/services/TaskManagerService?WSDL. (See Invoking LiveCycle using Web Services.)

Summary of steps

To assign a task to a user, perform the following tasks:

  1. Include project files.

  2. Create a TaskManager Client API object.

  3. Get the identifier of the user to whom the task is sent.

  4. Forward the task to the user.

Include project files

Include necessary files into your development project. If you are creating a client application by using Java, include the necessary JAR files. If you are using web services, make sure that you include the proxy files.

Create a TaskManager Client API object

Before you can programmatically assign a task to a user, you must create a TaskManager object.

Get the identifier of the user to whom the task is assigned

To assign a task to a user, you require the identifier of the user to whom the task is assigned. To obtain the user identifier, use the User Manager API.

Forward the task to a user

After you obtain the user identifier, you can assign the task to the user.

Assign tasks using the Java API

Assign tasks 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 TaskManager Client API object

    • Create a ServiceClientFactory object that contains connection properties.

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

  3. Get the identifier of the user to whom the task is assigned

    • Create a DirectoryManagerServiceClient object by using its constructor and passing the ServiceClientFactory object that contains connection properties (the DirectoryManagerServiceClient belongs to the User Manager API).

    • Create a PrincipalSearchFilter object by using its constructor.

    • Set the user name by invoking the PrincipalSearchFilter object’s setUserId method and passing a string value that specifies the user name.

    • Find the user that corresponds to the user name by invoking the DirectoryManagerServiceClient object’s findPrincipals method and passing the PrincipalSearchFilter object. This method returns a java.util.List object where each element is a User object.

    • Create a java.util.Iterator object by invoking the java.util.List object’s iterator method. This object lets you iterate through the java.util.List instance to retrieve User objects (in this situation, there is only one User object).

    • Iterate through the java.util.List object to determine where there are users. If so, each element is a User object.

    • Get the user identifier by invoking the User object’s getOid method. This method returns a string value that represents the user identifier. The format of a user identifier is a GUID.

  4. Forward the task to a user

    Forward the task to a user by invoking the TaskManager object’s forwardTask method and passing the task identifier and the user identifier value. You can determine the task identifier by retrieving tasks that are assigned to a specific user.

Assigning tasks using the web service API

To assign a task by using the web service API, perform the following steps:

  1. Include project files

    • Create a Microsoft .NET client assembly that consumes the TaskManager service WSDL. To create a proxy object that lets you invoke its operations by using Base64 encoding, specify this WSDL definition:

      http://localhost:8080/soap/services/TaskManagerService?WSDL
    • Reference the Microsoft .NET client assembly.

  2. Create a TaskManager Client API object

    • Using the Microsoft .NET client assembly, create a TaskManagerServiceService object by invoking its default constructor.

    • Set the TaskManagerServiceService object’s Credentials data member with a System.Net.NetworkCredential value that specifies the user name and password value.

  3. Get the identifier of the user to whom the task is assigned

    • Using the Microsoft .NET client assembly, create a DirectoryManagerServiceService object by invoking its default constructor.

    • Set the DirectoryManagerServiceService object’s Credentials data member with a System.Net.NetworkCredential value that specifies the user name and password value.

    • Create a PrincipalSearchFilter object by using its constructor.

    • Set the user name by assigning a string value to the PrincipalSearchFilter object’s userId data member.

    • Find the user that corresponds to the user name by invoking the DirectoryManagerServiceClient object’s findPrincipalsWithFilter method and passing the PrincipalSearchFilter object. This method returns an Object array where each element is a User object (in this situation, only one User object corresponds to the specified userId value).

    • Iterate through the Object array to determine whether there are users. If so, each element is a User object.

    • Get the user identifier by getting the value of the User object’s oid data member. The format of a user identifier is a GUID.

  4. Forward the task to a user

    Forward the task to a user by invoking the TaskManagerServiceService object’s forwardTask method and passing the task identifier and the user identifier value. You can determine the task identifier by retrieving tasks that are assigned to a specific user. (See Retrieving Tasks Assigned to Users.)