snaker-core/src/main/java/org/snaker/engine/core/TaskService.java
public Task complete(String taskId, String operator, Map<String, Object> args) {
		Task task = access().getTask(taskId);
		AssertHelper.notNull(task, "指定的任务[id=" + taskId + "]不存在");
		task.setVariable(JsonHelper.toJson(args));
		if(!isAllowed(task, operator)) {
			throw new SnakerException("当前参与者[" + operator + "]不允许执行任务[taskId=" + taskId + "]");
		}
		HistoryTask history = new HistoryTask(task);
		history.setFinishTime(DateHelper.getTime());
		history.setTaskState(STATE_FINISH);
		history.setOperator(operator);
		if(history.getActorIds() == null) {
			List<TaskActor> actors = access().getTaskActorsByTaskId(task.getId());
			String[] actorIds = new String[actors.size()];
			for(int i = 0; i < actors.size(); i++) {
				actorIds[i] = actors.get(i).getActorId();
			}
			history.setActorIds(actorIds);
		}
		access().saveHistory(history);
		access().deleteTask(task);
        Completion completion = getCompletion();
        if(completion != null) {
            completion.complete(history);
        }
		return task;
	}
public Task complete(String taskId, String operator, Map<String, Object> args) {
		Task task = access().getTask(taskId);
		AssertHelper.notNull(task, "指定的任务[id=" + taskId + "]不存在");
		task.setVariable(JsonHelper.toJson(args));
		if(!isAllowed(task, operator)) {
			throw new SnakerException("当前参与者[" + operator + "]不允许执行任务[taskId=" + taskId + "]");
		}
		HistoryTask history = new HistoryTask(task);
		history.setFinishTime(DateHelper.getTime());
		history.setTaskState(STATE_FINISH);
		history.setOperator(operator);
		if(history.getActorIds() == null) {
			List<TaskActor> actors = access().getTaskActorsByTaskId(task.getId());
			String[] actorIds = new String[actors.size()];
			for(int i = 0; i < actors.size(); i++) {
				actorIds[i] = actors.get(i).getActorId();
			}
			history.setActorIds(actorIds);
		}
		access().saveHistory(history);
		access().deleteTask(task);
        Completion completion = getCompletion();
        if(completion != null) {
            completion.complete(history);
        }
		return task;
	}
public Task complete ( String taskId , String operator , Map < String , Object > args ) { Task task = access ( ) . getTask ( taskId ) ; AssertHelper . notNull ( task , "指定的任务[id=" + taskId  ]不存在") task . setVariable ( JsonHelper . toJson ( args ) ) ; if ( ! isAllowed ( task , operator ) ) { throw new SnakerException ( "当前参与者[" + operato  "]不允许执行 务 taskId=" + taskId + "]"); } HistoryTask history = new HistoryTask ( task ) ; history . setFinishTime ( DateHelper . getTime ( ) ) ; history . setTaskState ( STATE_FINISH ) ; history . setOperator ( operator ) ; if ( history . getActorIds ( ) == null ) { List < TaskActor > actors = access ( ) . getTaskActorsByTaskId ( task . getId ( ) ) ; String [ ] actorIds = new String [ actors . size ( ) ] ; for ( int i = 0 ; i < actors . size ( ) ; i ++ ) { actorIds [ i ] = actors . get ( i ) . getActorId ( ) ; } history . setActorIds ( actorIds ) ; } access ( ) . saveHistory ( history ) ; access ( ) . deleteTask ( task ) ; Completion completion = getCompletion ( ) ; if ( completion != null ) { completion . complete ( history ) ; } return task ; }
完成指定任务
该方法仅仅结束活动任务，并不能驱动流程继续执行
@see SnakerEngineImpl#executeTask(String, String, java.util.Map)
完成指定任务 该方法仅仅结束活动任务，并不能驱动流程继续执行