02-08-2017 08:37 AM
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
02-09-2017 12:29 PM
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
Explore our Alfresco products with the links below. Use labels to filter content by product module.