Exemplo n.º 1
0
        public virtual object Execute(CommandContext commandContext)
        {
            EnsureUtil.EnsureNotNull("Task", Task);

            string operation = string.Empty;

            if (Task.Revision == 0)
            {
                try
                {
                    CheckCreateTask(Task, commandContext);
                    Task.SaveTask(null);
                    Task.Update();
                    commandContext.HistoricTaskInstanceManager.CreateHistoricTask(Task);
                    operation = UserOperationLogEntryFields.OperationTypeCreate;
                    Task.ExecuteMetrics(ESS.FW.Bpm.Engine.Management.Metrics.ActivtyInstanceStart);
                }
                catch (NullValueException e)
                {
                    throw new NotValidException(e.Message, e);
                }
            }
            else
            {
                CheckTaskAssign(Task, commandContext);
                Task.Update();
                operation = UserOperationLogEntryFields.OperationTypeUpdate;
            }


            Task.FireAuthorizationProvider();
            Task.FireEvent();
            Task.CreateHistoricTaskDetails(operation);

            return(null);
        }