ITeye博客

activiti 任意跳转

subject · 2015-07-21 13:58 · activiti · 行业应用 · Markdown

public class JumpTaskCmd implements Command<Comment> {  
  
    protected String executionId;  
    protected String activityId;  
      
      
    public JumpTaskCmd(String executionId, String activityId) {  
        this.executionId = executionId;  
        this.activityId = activityId;  
    }  
      
    public Comment execute(CommandContext commandContext) {  
        for (TaskEntity taskEntity : Context.getCommandContext().getTaskEntityManager().findTasksByExecutionId(executionId)) {  
            Context.getCommandContext().getTaskEntityManager().deleteTask(taskEntity, "jump", false);  
        }  
        ExecutionEntity executionEntity = Context.getCommandContext().getExecutionEntityManager().findExecutionById(executionId);  
        ProcessDefinitionImpl processDefinition = executionEntity.getProcessDefinition();  
        ActivityImpl activity = processDefinition.findActivity(activityId);  
        executionEntity.executeActivity(activity);  
        return null;  
    }  
  
}  

调用:

TaskServiceImpl taskServiceImpl=(TaskServiceImpl)taskService;  
taskServiceImpl.getCommandExecutor().execute(new JumpTaskCmd(executionId, activityId));

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。