If you want access to the Task resources in your Service / Message Delegates, the Variables
class will
provide methods which return certain kinds of Task resources. The most commonly used ones are
the start Task, referring to the Task / Message Start Event responsible for starting the process,
and the latest Task, referring to most recently received Task / Message.
In principle, this is sufficient to access all information in a Task resource, since you have
the Task resource's Java object, but very cumbersome.
Instead of navigating the Task resource's element tree,
you should first try to use the ProcessPluginApi's TaskHelper
in conjunction with the method above. The TaskHelper
class
offers specific methods related to Task resources.
The most common use case for this is retrieving data from a Task's Input Parameter or creating a new Input Parameter
for a Message Delegate's getAdditionalInputParameters
method.
When retrieving data from a Task's Input Parameter you first have to get to the Input Parameter you are looking to extract
data from. You can use one of the TaskHelper's
getters for Input Parameters to find the right one. The methods will try to match
the provided CodeSystem and Code to any Input Parameter of the provided Task resource.
Depending on the method you chose you will for example receive all matches or just the first one.
To create new Input Parameters to attach to a Task resource, you may invoke the TaskHelper#createInput
method. This
is most often used when overriding the getAdditionalInputParamters
method of you Message Delegate.