AnsweredAssumed Answered

How to recall an activity from the first activity

Question asked by chandanmb1 on Dec 26, 2016
Latest reply on Jan 11, 2017 by thuynh

Hello,

 

I am following these steps

What's the best way to design a process which allows user to recall back to his task.  

 

I am able to jump to specific activities mentioned in the sample code.

Observation :

 

Start -> FirstTask ->SecondTask ->ThirdTask ->End

If i want to jump to first task, i am setting activity Id to executionentity. But it is going for second Task.

If i set the Id of the start event, and then do signal for runtimservice. This is not allowed.

Start event is not associated with signal event. Please correct me where i am going wrong.

 

Below is my code :

CommandExecutor commandExecutor = processEngineConfiguration.getCommandExecutor();
commandExecutor.execute(new DeleteTaskWithoutCheckCommand((TaskEntity) userTask));
commandExecutor.execute(new RestartInstanceActivitiCommand("60005", "start_event_0")); //startevent id
runtimeService.signal("60005");

 

RestartInstanceActivitiCommand.class

public class RestartInstanceActivitiCommand implements Command<Void> {

private final String executionId;
private final String activityId;

public RestartInstanceActivitiCommand(String executionId, String activityId) {
this.executionId = executionId;
this.activityId = activityId;
}

public Void execute(CommandContext commandContext) {

ExecutionEntity execution = commandContext.getExecutionEntityManager().findExecutionById(this.executionId);
execution.setActivity(new ActivityImpl(this.activityId, execution.getProcessDefinition()));

return null;
}


}

 

Outcomes