コード例 #1
0
 public virtual void FireJobFailedEvent(IJob job, System.Exception exception)
 {
     if (IsHistoryEventProduced(HistoryEventTypes.JobFail, job))
     {
         HistoryEventProcessor.ProcessHistoryEvents(new HistoryEventCreatorAnonymousInnerClassHelper2(this, job, exception));
     }
 }
コード例 #2
0
 public virtual void FireJobSuccessfulEvent(IJob job)
 {
     if (IsHistoryEventProduced(HistoryEventTypes.JobSuccess, job))
     {
         HistoryEventProcessor.ProcessHistoryEvents(new HistoryEventCreatorAnonymousInnerClassHelper3(this, job));
     }
 }
コード例 #3
0
 public void OnUpdate(ICoreVariableInstance variableInstance, AbstractVariableScope sourceScope)
 {
     if (HistoryLevel.IsHistoryEventProduced(HistoryEventTypes.VariableInstanceUpdate, variableInstance))
     {
         HistoryEventProcessor.ProcessHistoryEvents(new HistoryEventCreatorAnonymousInnerClassHelper3(this, variableInstance, sourceScope));
     }
 }
コード例 #4
0
        // fire history events ///////////////////////////////////////////////////////

        //JAVA TO C# CONVERTER WARNING: 'final' parameters are not allowed in .NET:
        //ORIGINAL LINE: public void fireExternalTaskCreatedEvent(final org.camunda.bpm.engine.externaltask.ExternalTask externalTask)
        public virtual void FireExternalTaskCreatedEvent(IExternalTask externalTask)
        {
            if (IsHistoryEventProduced(HistoryEventTypes.ExternalTaskCreate, externalTask))
            {
                HistoryEventProcessor.ProcessHistoryEvents(new HistoryEventCreatorAnonymousInnerClassHelper(this, externalTask));
            }
        }
コード例 #5
0
 //JAVA TO C# CONVERTER WARNING: 'final' parameters are not allowed in .NET:
 //ORIGINAL LINE: public void fireJobDeletedEvent(final org.camunda.bpm.engine.runtime.Job job)
 public virtual void FireJobDeletedEvent(IJob job)
 {
     // throw new NotImplementedException();
     if (IsHistoryEventProduced(HistoryEventTypes.JobDelete, job))
     {
         HistoryEventProcessor.ProcessHistoryEvents(new HistoryEventCreatorAnonymousInnerClassHelper4(this, job));
     }
 }
コード例 #6
0
        protected internal virtual void MigrateHistory()
        {
            var historyLevel = Context.ProcessEngineConfiguration.HistoryLevel;

            if (historyLevel.IsHistoryEventProduced(HistoryEventTypes.IncidentMigrate, this))
            {
                HistoryEventProcessor.ProcessHistoryEvents(new HistoryEventCreatorAnonymousInnerClass(this));
            }
        }
コード例 #7
0
        //JAVA TO C# CONVERTER WARNING: 'final' parameters are not allowed in .NET:
        //ORIGINAL LINE: protected void fireUserOperationLog(final org.camunda.bpm.engine.impl.oplog.UserOperationLogContext context)
        protected void FireUserOperationLog(UserOperationLogContext context)
        {
            if (context.UserId == null)
            {
                context.UserId = AuthenticatedUserId;
            }

            HistoryEventProcessor.ProcessHistoryEvents(new HistoryEventCreatorAnonymousInnerClassHelper(this, context));
        }
コード例 #8
0
//JAVA TO C# CONVERTER WARNING: 'final' parameters are not allowed in .NET:
//ORIGINAL LINE: public void createHistoricTask(final TaskEntity task)
        public virtual void CreateHistoricTask(TaskEntity task)
        {
            ProcessEngineConfigurationImpl configuration = context.Impl.Context.ProcessEngineConfiguration;

            IHistoryLevel historyLevel = configuration.HistoryLevel;

            if (historyLevel.IsHistoryEventProduced(HistoryEventTypes.TaskInstanceCreate, task))
            {
                HistoryEventProcessor.ProcessHistoryEvents(new HistoryEventCreatorAnonymousInnerClassHelper3(this, task));
            }
        }
コード例 #9
0
//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET:
//ORIGINAL LINE: protected void migrateActivityInstanceHistory(final org.camunda.bpm.engine.delegate.DelegateExecution execution)
        protected internal virtual void MigrateActivityInstanceHistory(IDelegateExecution execution)
        {
            var historyLevel = Context.ProcessEngineConfiguration.HistoryLevel;

            if (!historyLevel.IsHistoryEventProduced(HistoryEventTypes.ActivityInstanceMigrate, this))
            {
                return;
            }

            HistoryEventProcessor.ProcessHistoryEvents(new HistoryEventCreatorAnonymousInnerClass2(this));
        }
コード例 #10
0
        protected internal virtual void FireHistoricIncidentEvent(HistoryEventTypes eventType)
        {
            ProcessEngineConfigurationImpl processEngineConfiguration = context.Impl.Context.ProcessEngineConfiguration;

            IHistoryLevel historyLevel = processEngineConfiguration.HistoryLevel;

            if (historyLevel.IsHistoryEventProduced(eventType, this))
            {
                HistoryEventProcessor.ProcessHistoryEvents(new HistoryEventCreatorAnonymousInnerClassHelper(this, eventType));
            }
        }
コード例 #11
0
        //JAVA TO C# CONVERTER WARNING: 'final' parameters are not allowed in .NET:
        //ORIGINAL LINE: public void completeHistoricBatch(final org.camunda.bpm.engine.impl.batch.BatchEntity batch)
        public virtual void CompleteHistoricBatch(BatchEntity batch)
        {
            ProcessEngineConfigurationImpl configuration = context.Impl.Context.ProcessEngineConfiguration;

            IHistoryLevel historyLevel = configuration.HistoryLevel;

            if (historyLevel.IsHistoryEventProduced(HistoryEventTypes.BatchEnd, batch))
            {
                HistoryEventProcessor.ProcessHistoryEvents(new HistoryEventCreatorAnonymousInnerClassHelper2(this, batch));
            }
        }
コード例 #12
0
        public virtual void FireHistoricIdentityLinkEvent(HistoryEventTypes eventType)
        {
            var processEngineConfiguration = Context.ProcessEngineConfiguration;

            var historyLevel = processEngineConfiguration.HistoryLevel;

            if (historyLevel.IsHistoryEventProduced(eventType, this))
            {
                HistoryEventProcessor.ProcessHistoryEvents(new HistoryEventCreatorAnonymousInnerClassHelper(this,
                                                                                                            eventType));
            }
        }
コード例 #13
0
//JAVA TO C# CONVERTER WARNING: 'final' parameters are not allowed in .NET:
//ORIGINAL LINE: public void markTaskInstanceEnded(String taskId, final String deleteReason)
        public virtual void MarkTaskInstanceEnded(string taskId, string deleteReason)
        {
            ProcessEngineConfigurationImpl configuration = context.Impl.Context.ProcessEngineConfiguration;

            //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
            //ORIGINAL LINE: final TaskEntity taskEntity = org.camunda.bpm.engine.impl.context.Context.getCommandContext().getDbEntityManager().selectById(TaskEntity.class, taskId);
            //TaskEntity taskEntity = context.Impl.Context.CommandContext.DbEntityManager.SelectById< TaskEntity>(typeof(TaskEntity), taskId);
            TaskEntity    taskEntity   = taskManager.FindTaskById(taskId);
            IHistoryLevel historyLevel = configuration.HistoryLevel;

            if (historyLevel.IsHistoryEventProduced(HistoryEventTypes.TaskInstanceComplete, taskEntity))
            {
                HistoryEventProcessor.ProcessHistoryEvents(new HistoryEventCreatorAnonymousInnerClassHelper2(this, deleteReason, taskEntity));
            }
        }
コード例 #14
0
        protected internal override void TriggerHistoryEvent(CommandContext commandContext)
        {
            var historyLevel            = commandContext.ProcessEngineConfiguration.HistoryLevel;
            var updatedProcessInstances = ObtainProcessInstances(commandContext);

            //suspension state is not updated synchronously
            if (NewSuspensionState != null && updatedProcessInstances != null)
            {
                foreach (IProcessInstance processInstance in updatedProcessInstances)
                {
                    if (historyLevel.IsHistoryEventProduced(HistoryEventTypes.ProcessInstanceUpdate, processInstance))
                    {
                        HistoryEventProcessor.ProcessHistoryEvents(new HistoryEventCreatorAnonymousInnerClass(this, processInstance));
                    }
                }
            }
        }
コード例 #15
0
        protected internal virtual void FireFormPropertyHistoryEvents(IVariableMap properties,
                                                                      IVariableScope variableScope)
        {
            var processEngineConfiguration = Context.ProcessEngineConfiguration;
            var historyLevel = processEngineConfiguration.HistoryLevel;

            if (historyLevel.IsHistoryEventProduced(HistoryEventTypes.FormPropertyUpdate, variableScope))
            {
                // fire history events
                ExecutionEntity executionEntity;
                string          taskId;
                if (variableScope is ExecutionEntity)
                {
                    executionEntity = (ExecutionEntity)variableScope;
                    taskId          = null;
                }
                else if (variableScope is TaskEntity)
                {
                    var task = (TaskEntity)variableScope;
                    executionEntity = task.GetExecution();
                    taskId          = task.Id;
                }
                else
                {
                    executionEntity = null;
                    taskId          = null;
                }

                if (executionEntity != null)
                {
                    foreach (var variableName in properties.Keys)
                    {
                        string stringValue = (String)variableName;

                        HistoryEventProcessor.ProcessHistoryEvents(new HistoryEventCreatorAnonymousInnerClass(this, executionEntity, taskId, stringValue));
                    }
                }
            }
        }
コード例 #16
0
        public virtual object Execute(CommandContext commandContext)
        {
            var configuration = commandContext.ProcessEngineConfiguration;

            //check that the new process definition is just another version of the same
            //process definition that the process instance is using

            IExecutionManager executionManager = commandContext.ExecutionManager;
            ExecutionEntity   processInstance  = executionManager.FindExecutionById(_processInstanceId);

            if (processInstance == null)
            {
                throw new ProcessEngineException("No process instance found for id = '" + _processInstanceId + "'.");
            }
            else if (!processInstance.IsProcessInstanceExecution)
            {
                throw new ProcessEngineException("A process instance id is required, but the provided id " + "'" + _processInstanceId + "' " + "points to a child execution of process instance " + "'" + processInstance.ProcessInstanceId + "'. " + "Please invoke the " + this.GetType().Name + " with a root execution id.");
            }
            ProcessDefinitionImpl currentProcessDefinitionImpl = processInstance.ProcessDefinition;

            DeploymentCache         deploymentCache = configuration.DeploymentCache;
            ProcessDefinitionEntity currentProcessDefinition;

            if (currentProcessDefinitionImpl is ProcessDefinitionEntity)
            {
                currentProcessDefinition = (ProcessDefinitionEntity)currentProcessDefinitionImpl;
            }
            else
            {
                currentProcessDefinition = deploymentCache.FindDeployedProcessDefinitionById(currentProcessDefinitionImpl.Id);
            }

            ProcessDefinitionEntity newProcessDefinition = deploymentCache.FindDeployedProcessDefinitionByKeyVersionAndTenantId(currentProcessDefinition.Key, _processDefinitionVersion, currentProcessDefinition.TenantId);

            ValidateAndSwitchVersionOfExecution(commandContext, processInstance, newProcessDefinition);

            IHistoryLevel historyLevel = configuration.HistoryLevel;

            if (historyLevel.IsHistoryEventProduced(HistoryEventTypes.ProcessInstanceUpdate, processInstance))
            {
                HistoryEventProcessor.ProcessHistoryEvents(new HistoryEventCreatorAnonymousInnerClass(this, processInstance));
            }

            // switch all sub-executions of the process instance to the new process definition version
            IList <ExecutionEntity> childExecutions = executionManager.FindExecutionsByProcessInstanceId(_processInstanceId);

            foreach (ExecutionEntity executionEntity in childExecutions)
            {
                ValidateAndSwitchVersionOfExecution(commandContext, executionEntity, newProcessDefinition);
            }

            // switch all jobs to the new process definition version
            IList <JobEntity>           jobs = commandContext.JobManager.FindJobsByProcessInstanceId(_processInstanceId);
            IList <JobDefinitionEntity> currentJobDefinitions    = commandContext.JobDefinitionManager.FindByProcessDefinitionId(currentProcessDefinition.Id);
            IList <JobDefinitionEntity> newVersionJobDefinitions = commandContext.JobDefinitionManager.FindByProcessDefinitionId(newProcessDefinition.Id);

            IDictionary <string, string> jobDefinitionMapping = GetJobDefinitionMapping(currentJobDefinitions, newVersionJobDefinitions);

            foreach (JobEntity jobEntity in jobs)
            {
                SwitchVersionOfJob(jobEntity, newProcessDefinition, jobDefinitionMapping);
            }

            // switch all incidents to the new process definition version
            IList <IncidentEntity> incidents = commandContext.IncidentManager.FindIncidentsByProcessInstance(_processInstanceId);

            foreach (IncidentEntity incidentEntity in incidents)
            {
                SwitchVersionOfIncident(commandContext, incidentEntity, newProcessDefinition);
            }

            // add an entry to the op log
            PropertyChange change = new PropertyChange("processDefinitionVersion", currentProcessDefinition.Version, _processDefinitionVersion);

            commandContext.OperationLogManager.LogProcessInstanceOperation(UserOperationLogEntryFields.OperationTypeModifyProcessInstance, _processInstanceId, null, null, new List <PropertyChange>()
            {
                change
            });
            return(null);
        }