Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        public override IVariableMap Execute(CommandContext commandContext)
        {
            IStartFormData startFormData = commandContext.RunWithoutAuthorization(() => new GetStartFormCmd(ResourceId).Execute(commandContext));

            IProcessDefinition definition = startFormData.ProcessDefinition;

            CheckGetStartFormVariables((ProcessDefinitionEntity)definition, commandContext);

            IVariableMap result = new VariableMapImpl();

            foreach (IFormField formField in startFormData.FormFields)
            {
                if (FormVariableNames == null || FormVariableNames.Contains(formField.Id))
                {
                    result.PutValue(formField.Id, CreateVariable(formField, null));
                }
            }

            return(result);
        }