2 Replies Latest reply on Jan 11, 2010 4:43 AM by shilpa.kumar

    [jbpm4] Move execution to arbitrary activity

      Hi all,
      I'm trying to move the execution of a processInstance to an arbitrary activity.

      I'm using the following code:

      org.jbpm.api.ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionName("processTest").uniqueResult();
       ExecutionService executionService = processEngine.getExecutionService();
       ProcessInstance instance = executionService.startProcessInstanceByKey("processTest");
       String newName = "Verified";
       Activity newActivity = ((ProcessDefinitionImpl) processDefinition).getActivity(newName);
       ExecutionImpl execution = (ExecutionImpl) instance;
       if (newActivity != null) {
       ((ExecutionImpl) execution).setActivity(newActivity);
       }


      but when I then signal the execution, the activity ran is not the one I've yet set, but the old one.

      I've also tried to use

      execution.moveTo(activity);


      but with the same result.

      It seems that the change is not persisted on the DB....

      Is it a bug or am I making any mistake?

      BR

      Luca Tagliani