Show TOC

Building a Task Worklist with the BPM APILocate this document in the navigation structure

Prerequisites

  • You have added the necessary dependencies to development component tc/bpem/facade/ear (public part api ) in software component BPEM-FACADE and tc/je/sdo21/api in software component ENGFACADE .

Context

With the Business Process Management (BPM) application programming interfaces (APIs), you can customize and enhance the way you use business processes and execute tasks.

This document describes how you use the BPM APIs to build your own task worklist while still using the Web Dynpro task execution UI to work on tasks.

For a detailed description of the BPM public APIs, see http://help.sap.com/javadocs.

Procedure

  1. Retrieve the TaskInstanceManager.
                      TaskInstanceManager taskInstanceManager = BPMFactory.getTaskInstanceManager();
                   
  2. Build the set of statuses to query.

    Typically, you use READY , RESERVED and IN_PROGRESS statuses, which mean that the tasks are ready to work on and the user is a potential or actual owner of the task.

                      HashSet<Status> statuses = new HashSet<Status>();
                      statuses.add(Status.READY);
                      statuses.add(Status.RESERVED);
                      statuses.add(Status.IN_PROGRESS);
                   
  3. Query those statuses.

    The returned set contains TaskAbstracts, which are basic descriptions of a task instance and thus contain the required information to build up the task worklist. The method always executes the query for the user who is currently logged in and returns texts in the locale which is set for the user.

                      Set<TaskAbstract> myTasks = taskInstanceManager.getMyTaskAbstracts(statuses);
                   
  4. Use the ID of a task instance to generate the URL of the task execution UI. This can then be opened as an action, for example when the user clicks the task.
                      URI taskInstanceId = myTask.getId();
                      URL taskExecutionURL = taskInstanceManager.generateTaskExecutionUrl(taskInstanceId);