[jboss-user] [jBPM] - Re: Question to process instance migration
km wen
do-not-reply at jboss.com
Thu Nov 11 15:38:34 EST 2010
km wen [http://community.jboss.org/people/kmwen] created the discussion
"Re: Question to process instance migration"
To view the discussion, visit: http://community.jboss.org/message/570852#570852
--------------------------------------------------------------
thanks, michael,
it works, if i deploy new process definition from the same .xml file with different version as following:
ProcessDefinition pd1 = deployProcessDefinitionFromClasspath("org/jbpm/testMigration/a.jpdl.xml");
ProcessInstance pi1 = startAndSignal(pd1, "aa");
ProcessInstance pi2 = startAndSignal(pd1,"b");
ProcessInstance pi3 = startAndSignal(pd1,"c");
assertTrue(pi3.isActive("c"));
// here get new process definition
ProcessDefinition pd2 = deployProcessDefinitionFromClasspath("org/jbpm/testMigration/a.jpdl.xml");
assertEquals(pd2.getId(),"a-2");
pi3 = executionService.findProcessInstanceById(pi3.getId());
assertEquals(pd2.getId(),pi3.getProcessDefinitionId());
// here the instances of the previously deployed process definition
//that are waiting in node "c" will be placed in the node "b".
assertTrue(pi3.isActive("b"));
__________________________________________________________________________________________
I have wrote following code, but it's failed. I want to get the new definition from another process .xml file.
ProcessDefinition pd1 = deployProcessDefinitionFromClasspath("org/jbpm/testMigration/a.jpdl.xml");
ProcessInstance pi1 = startAndSignal(pd1, "aa");
ProcessInstance pi2 = startAndSignal(pd1,"b");
final ProcessInstance pi3 = startAndSignal(pd1,"c");
assertTrue(pi3.isActive("c"));
// here get new process definition
final ProcessDefinition pd2 = deployProcessDefinitionFromClasspath("org/jbpm/testMigration/a1.jpdl.xml");
new DefaultMigrationHandler().migrateInstance(pd2, pi3, new MigrationDescriptor());
processEngine.execute(new Command() {
public Object execute(Environment env) {
new DefaultMigrationHandler().migrateInstance(pd2,
pi3, new MigrationDescriptor());
env.get(Session.class).update(pi3);
return null;
}
});
assertTrue(pi3.isActive("b"));
}
following is process definition .xml file:
<?xml version="1.0" encoding="UTF-8"?>
<process name="a" xmlns=" http://jbpm.org/4.4/jpdl http://jbpm.org/4.4/jpdl">
<start g="33,107,48,48" name="s">
<transition to="aa"/>
</start>
<task g="138,107,92,52" name="aa">
<transition to="b"/>
</task>
<task g="274,108,92,52" name="b">
<transition to="c"/>
</task>
<task g="407,107,92,52" name="c">
<transition to="e"/>
</task>
<end g="549,109,48,48" name="e"/>
<migrate-instances>
<activity-mapping old-name="c" new-name="b"/>
</migrate-instances>
</process>
________________________________-
<?xml version="1.0" encoding="UTF-8"?>
<process name="a1" xmlns=" http://jbpm.org/4.4/jpdl http://jbpm.org/4.4/jpdl">
<start g="11,99,48,48" name="s">
<transition to="aa"/>
</start>
<state g="106,94,110,52" name="aa">
<transition to="x"/>
</state>
<state g="290,96,110,52" name="x">
<transition to="e"/>
</state>
<end g="499,99,48,48" name="e"/>
</process>
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/570852#570852]
Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20101111/012425d9/attachment-0001.html
More information about the jboss-user
mailing list