cancel
Showing results for 
Search instead for 
Did you mean: 

Custom extension - access properties in definition

steve1
Champ on-the-rise
Champ on-the-rise
This is my first post,
so first, thanks to JBPM4 and now Activiti5 developers.

I made a custom extension with the aid of the user guide, and works well.

Now, how can I access these properties in the process definition?

I can use activity definition via getDeployedProcessDefinition and getActivities,
but there is no custom properties in the ActivityImpl.getProperties.

I investigated source code, and found some.

1. ActivityImpl.getActivityBehavior returns ClassDelegate (MultiInstanceActivityBehavior in case of multi-instance).

2. ClassDelegate has internal field of fieldDeclarations which have custom properties, but no getter.

3. MultiInstanceActivityBehavior has internal field of innerActivityBehavior which has original ActivityBehavior (=ClassDelegate), but no getter.

If these getters are added, I can access and use custom properties in the process definition.

Is this correct approach?

Thanks.
11 REPLIES 11

steve1
Champ on-the-rise
Champ on-the-rise
Hi,

I reopen this toipc, because I have some problems implementing BpmnParseListener.


I tried saving custom properties on my application's database by implementing parseServiceTask().

The parameter of activity gives all informations about that activity's XML definition.

But activity.getProcessDefinition() returns null.

Implementation of parseProcess() is called after the parseServiceTask() ends, so I can't use this,
more over, processDefinition in the parseProcess() has null ID.

I think because these methods are called on parsing phase, so not fully initialized yet.


This is where my problem arises.

How can I save custom properties related to the process definition that I'm deploying.

If I can't relate custom properties to the process definition, I can not use this properties at all.


Can you help me?

Thanks.

steve1
Champ on-the-rise
Champ on-the-rise
Hi,

I made a mistake in the above post.

I only checked with printing activity.getProcessDefinition(), and it printed like ProcessDefinitionEntity[null], so I mis-understood that process definition was null.

Process definition is not null in the parseServiceTask(), but geiId() returns null.

I can get process definition, so I think I can manage custom properties with the process key.

Sorry for confusion.