cancel
Showing results for 
Search instead for 
Did you mean: 

how to move process instance from old process definiton into new process definiton

suseno
Champ on-the-rise
Champ on-the-rise
Dear all,

I already generate a lot of process instance . For example 100 runtime process instance (not completed)  from process definition  id -> tes:1:1
.
There is situation when i have to modified the process definition.
i upload the modified process definition to server.
the proses definition id  generate  -> tes:2:56

Is it posible   100 runtime process  instance from old process definiton  executed using the modified process definiton ?


1 REPLY 1

frederikherema1
Star Contributor
Star Contributor
Take a look at the org.activiti.engine.impl.cmd.SetProcessDefinitionVersionCmd, this does what you need. Take into consideration the dangers that come with it:


/**
* {@link Command} that changes the process definition version of an existing
* process instance.
*
* Warning: This command will NOT perform any migration magic and simply set the
* process definition version in the database, assuming that the user knows,
* what he or she is doing.
*
* This is only useful for simple migrations. The new process definition MUST
* have the exact same activity id to make it still run.
*
* Furthermore, activities referenced by sub-executions and jobs that belong to
* the process instance MUST exist in the new process definition version.
*
* The command will fail, if there is already a {@link ProcessInstance} or
* {@link HistoricProcessInstance} using the new process definition version and
* the same business key as the {@link ProcessInstance} that is to be migrated.
*
* If the process instance is not currently waiting but actively running, then
* this would be a case for optimistic locking, meaning either the version
* update or the "real work" wins, i.e., this is a race condition.
*
* @see http://forums.activiti.org/en/viewtopic.php?t=2918
* @author Falko Menge
*/