cancel
Showing results for 
Search instead for 
Did you mean: 

Accessing custom BPMN 2.0-attributes during execution

sebastian_s
Champ in-the-making
Champ in-the-making
Hello Activiti Community,

the tasks in my process definition have custom attributes (which is allowed by the BPMN 2.0) spec. Is there way in Activiti to access these attributes during execution of the task? Or are custom attributes in the process definition simply ignored and stored nowhere?

In jBPM 3.2 there was a similar feature where you could list key-value-pairs under the <configuration>-element of a task. These values were then injected into the attributes/member variables whose names matched the keys. At runtime you were able to access the values stored in the member variables of the Java Delegation Class.

Cheers
Sebastian
2 REPLIES 2

sebastian_s
Champ in-the-making
Champ in-the-making
Digging around in the source code a bit I found out that I can access properties - but only if I implement the ActivityBehavior-Interface instead of the JavaDelegate. Furthermore it seems that custom attributes are ignored while the parsing is done.

Is there a reason against exposing the properties to the JavaDelegate-Interface? I would not want to implement the ActivityBehavior-Interface since this is too close too the PVM and not the public API.

sebastian_s
Champ in-the-making
Champ in-the-making
I just found a post with the relevant information for me:

http://forums.activiti.org/en/viewtopic.php?t=371&p=11539

Check out class ParseListener. You can configure a list of those that in the BpmnDeployer in the ProcessEngineConfiguration.
You can add an implementation that reads your extension elements and custom attributes and store the information in the generic properties map in the PvmActivity. Then it is available during runtime.

Is that the kind of pluggability your looking for?

So I should be fine with implementing a ParseListener. The only thing bothering me is that this generic properties map does not seem to be available via the JavaDelegate interface.