AnsweredAssumed Answered

Process instance migration issues

Question asked by pgadecki on Mar 8, 2012
I'm writing a command that would switch process definition version for active process instances. I want it to be more sophisticated than org.activiti.engine.impl.cmd.SetProcessDefinitionVersionCmd in the way that it would perform migration only if it's really possible meaning that process could be finished after it.
Here is some pseudo-code of it:
  1. take all executions which have process definition with old version (one that we're migrating from) that are process instances

  2. for each such execution check if new process definition contains activity newProcessDefinition.contains(execution.getActivity())

  3. if so take all child executions and also check if their activities are in new process definition

  4. if all children are OK change process definitition to the new one for children, parent execution(process instance) and also for the historic process instance of this process instance
It seems that this is not enough when it comes to situations where between versions flow has changed from parallel to sequential or vice versa. Like in this example:
In this situation if during migration from version 1 to version 2 active process nodes are task1 and task4 result of such migration would be doubled node of task4 - one in upper and one in lower branch?

I would like to examine if the migrated node is going to be moved to a different branch of parallel flow (or different branch at all) and also if any of the other migrated active nodes would get migrated to the same branch(execution in new process definition).

Did you have similar problems? How did you solve it? Or maybe you'd do migration some other way around? I'd be glad to hear about it :)