cancel
Showing results for 
Search instead for 
Did you mean: 

Call activity with version

ajv
Champ in-the-making
Champ in-the-making
Hi all!

Is it possible to call an activity with a specific version of the process definition?

Something like this:
<code><callActivity id="callCheckCreditProcess" name="Check credit" calledElement="checkCreditProcess" version="2"/><code>

Best Regards,
Adrian
6 REPLIES 6

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi Adrian.

Call activiti gets the latest process definition version.

    ProcessDefinitionImpl processDefinition = Context
      .getProcessEngineConfiguration()
      .getDeploymentManager()
      .findDeployedLatestProcessDefinitionByKey(processDefinitonKey);
There is no attribute like version. TO achieve this you have to implement your own call activity behavior.
Regards
Martin

zze_one
Champ on-the-rise
Champ on-the-rise
Hi guys.

is there a way to modify the XML Schema in order to add this additional attribute (version="2") ?

Thanks

frederikherema1
Star Contributor
Star Contributor
You can always add custom attributes to the parsing behaviour if you want. These will be available in the extensionElements and attributes properties of all the parsed XML (see org.activiti.bpmn.model.BaseElement). Implement a custom org.activiti.engine.impl.bpmn.parser.factory.ActivityBehaviorFactory (better, extend org.activiti.engine.impl.bpmn.parser.factory.DefaultActivityBehaviorFactory) that returns an extended version of the org.activiti.engine.impl.bpmn.behavior.CallActivityBehavior which uses that custom attribute to determine the version to use for the called element.

This is it ! Thank you Frederik !!!
I just need to figure out now how to inject the Customized ActivityBehaviorFactory in the process engine configuration now. If you have any hints, please feel free to direct me. I'll investigate by my side.

zze_one
Champ on-the-rise
Champ on-the-rise
GOT IT ! It's so good when it works : )

in activiti.cfg.xml
<code>
        <bean id="customedActivityBehaviorFactory" class="com.yo.poc.util.CustomedActivityBehaviorFactory">
   </bean>
  
   <bean id="processEngineConfiguration" class="org.activiti.spring.SpringProcessEngineConfiguration">
  <property name="dataSource" ref="dataSource" />
     <property name="transactionManager" ref="transactionManager" />
     <property name="databaseSchemaUpdate" value="true" />
     <property name="jobExecutorActivate" value="false" />
     <property name="activityBehaviorFactory" ref="customedActivityBehaviorFactory" />
</bean>
</code>

Thanks again, and good job by the way to the entire team !

jbarrez
Star Contributor
Star Contributor
That's indeed how to do it! Glad you found it.