public override IVariableMap Execute(CommandContext commandContext) { ITaskManager taskManager = commandContext.TaskManager; TaskEntity task = taskManager.FindTaskById(ResourceId); EnsureUtil.EnsureNotNull(typeof(BadUserRequestException), "Cannot find ITask with id '" + ResourceId + "'.", "ITask", task); CheckGetTaskFormVariables(task, commandContext); VariableMapImpl result = new VariableMapImpl(); // first, evaluate form fields TaskDefinition taskDefinition = task.TaskDefinition; if (taskDefinition != null) { ITaskFormData taskFormData = taskDefinition.TaskFormHandler.CreateTaskForm(task); foreach (IFormField formField in taskFormData.FormFields) { if (FormVariableNames == null || FormVariableNames.Contains(formField.Id)) { result.PutValue(formField.Id, CreateVariable(formField, task)); } } } // collect remaining variables from ITask scope and parent scopes task.CollectVariables(result, FormVariableNames, false, DeserializeObjectValues); return(result); }
public virtual IVariableMap Execute(CommandContext commandContext) { EnsureUtil.EnsureNotNull("taskId", TaskId); TaskEntity task = context.Impl.Context.CommandContext.TaskManager.FindTaskById(TaskId); EnsureUtil.EnsureNotNull("ITask " + TaskId + " doesn't exist", "ITask", task); CheckGetTaskVariables(task, commandContext); var variables = new VariableMapImpl(); //collect variables from ITask task.CollectVariables(variables, VariableNames, IsLocal, DeserializeValues); return(variables); }