public virtual object Execute(CommandContext commandContext) { EnsureUtil.EnsureNotNull("taskId", TaskId); ITaskManager taskManager = commandContext.TaskManager; TaskEntity task = taskManager.FindTaskById(TaskId); EnsureUtil.EnsureNotNull("Cannot find ITask with id " + TaskId, "ITask", task); foreach (var checker in commandContext.ProcessEngineConfiguration.CommandCheckers) { checker.CheckTaskWork(task); } TaskDefinition taskDefinition = task.TaskDefinition; if (taskDefinition != null) { var taskFormHandler = taskDefinition.TaskFormHandler; taskFormHandler.SubmitFormVariables(Properties, task); } else { // set variables on standalone ITask task.Variables = Properties; } // complete or resolve the ITask if (DelegationState.Pending.Equals(task.DelegationState)) { task.Resolve(); task.CreateHistoricTaskDetails(UserOperationLogEntryFields.OperationTypeResolve); } else { task.Complete(); task.CreateHistoricTaskDetails(UserOperationLogEntryFields.OperationTypeComplete); } return(null); }
protected internal virtual void CompleteTask(TaskEntity task) { task.Complete(); }