Calling a versioned call activity in Activiti

When you call a ‘call activity’ inside a versioned process you would call a versioned call activity too. By default activiti calls always the last deployed key of call activity perhaps if it is called by a versioned process. To call a versioned call activity you must customize the activiti framework extending the following classes:

org.activiti.engine.impl.bpmn.parser.factory.DefaultActivityBehaviorFactory

org.activiti.engine.impl.bpmn.behavior.CallActivityBehavior.

Then configure the activiti.cfg.xml configuration file adding the new activity behavior factory in the process engine configuration:

<bean id=”processEngineConfiguration” class=….

<property name=”activityBehaviorFactory” ref=”activityBehaviorFactory” />

Add the new bean:

<bean id=”activityBehaviorFactory”

class=“${my new DefaultActivityBehaviorFactory}”>

</bean>

In this new class you must add the new call activity reference using the new extended class. In the CallActivityBehavior class, update the ‘execute’ method instead of:

ProcessDefinitionImpl processDefinition = Context

.getProcessEngineConfiguration()

.getDeploymentManager()

.findDeployedLatestProcessDefinitionByKey(processDefinitonKey);

write:

ProcessDefinitionImpl processDefinition = Context

.getProcessEngineConfiguration()

.getDeploymentManager()

.findDeployedProcessDefinitionById(processDefinitionId);