Hi,
I am currently trying to find a clean solution to change the strategy of the version counting. In fact, If you deploy the same workflow twice, Activiti will add +1 to the current version. I would like to change this behavior to the workflow definition and the process instance definition.
I saw that we can change SetProcessDefinitionVersionCmd changes the process definition version of an existing process instance. I am looking for the equivalent to change the workflow definition during the deployment.
Is there a possibility to solve this issue?
Thank you in advance,
Med
Ok, a really interesting question.
So I haven't actually done this myself, but I believe you can add your own custom Deployer in the Process Engine Configuration (setCustomPreDeployers) based on a method I found therein.
So on searching the forums I then found the following topic which confirms my belief:
Setting deployers on the ProcessEngineConfiguration
That said, if you set a custom pre deployer, it can be used to override the default deployer for say a BPMN file:
protected Collection< ? extends Deployer> getDefaultDeployers() {
List<Deployer> defaultDeployers = new ArrayList<Deployer>();if (bpmnDeployer == null) {
bpmnDeployer = new BpmnDeployer();
}
Ok, so now that we know all we have to do is override the default BPMN Deployer you should implement a class that extends org.activiti.engine.impl.bpmn.deployer.BpmnDeployer.
You would override the deploy() method and modify the processDefinitionVersion logic (default is below):
if (latestProcessDefinition != null) {
processDefinitionVersion = latestProcessDefinition.getVersion() + 1;
} else {
processDefinitionVersion = 1;
}processDefinition.setVersion(processDefinitionVersion);
Like I said, this is all theory as I haven't actually implemented this, but it looks pretty straight forward.
Would love to see what you come up with.
Greg
Ask for and offer help to other Alfresco Process Services and Activiti Users and members of the Alfresco team.
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.