Show TOC

Building an Execution UI 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 the 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 execution UI.

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. Claim and execute the task.

    Typically, before displaying a start execution UI, the task should be claimed and its execution should be started.

                      taskInstanceManager.claim(taskInstanceId);
                      taskInstanceManager.start(taskInstanceId);
                   
  5. Get the detailed task information.

    To create a task execution UI, more data is needed than is provided by a TaskAbstract. You need to get the TaskDetail. This can be done by using the ID of a task instance. The TaskDetail contains thorough information about the task.

                      URI taskInstanceId = myTask.getId();
                      TaskDetail taskDetail = taskInstanceManager.getTaskDetail(taskInstanceId);
                   
  6. Get the input data.

    The TaskDetail can be used to obtain the input and output data of the task. The input and output data is represented by a data object.

                      DataObject taskInput = taskDetail.getInputDataObject();
                      DataObject taskOutput = taskDetail.getOutputDataObject();
                   
  7. Create the UI

    The taskInput data object can now be used to read the initial task data and the taskOutput data object to write the result of the task execution. For more information about accessing the data objects, refer to the Service Data Objects (SDO) standard. An arbitrary UI Technology can be used for the task execution UI.

  8. Complete the task.

    After the execution of the task, it can be completed with the (modified) output data.

                      taskInstanceManager.complete(taskInstanceId, taskOutput);