コード例 #1
0
 public void OnUpdate(ICoreVariableInstance variableInstance, AbstractVariableScope sourceScope)
 {
     if (HistoryLevel.IsHistoryEventProduced(HistoryEventTypes.VariableInstanceUpdate, variableInstance))
     {
         HistoryEventProcessor.ProcessHistoryEvents(new HistoryEventCreatorAnonymousInnerClassHelper3(this, variableInstance, sourceScope));
     }
 }
コード例 #2
0
        public virtual void testHistoricCaseVariableInstanceQuery()
        {
            // start case instance with variables
            IDictionary <string, object> variables = new Dictionary <string, object>();

            variables["foo"] = "bar";
            string caseInstanceId = caseService.createCaseInstanceByKey("oneTaskCase", variables).Id;

            string caseExecutionId = caseService.createCaseExecutionQuery().activityId("CasePlanModel_1").singleResult().Id;
            string taskExecutionId = caseService.createCaseExecutionQuery().activityId("PI_HumanTask_1").singleResult().Id;

            // set variable on both executions
            caseService.setVariableLocal(caseExecutionId, "case", "execution");
            caseService.setVariableLocal(taskExecutionId, "task", "execution");

            // update variable on both executions
            caseService.setVariableLocal(caseExecutionId, "case", "update");
            caseService.setVariableLocal(taskExecutionId, "task", "update");

            assertEquals(3, historyService.createHistoricVariableInstanceQuery().count());
            assertEquals(3, historyService.createHistoricVariableInstanceQuery().caseInstanceId(caseInstanceId).count());
            assertEquals(3, historyService.createHistoricVariableInstanceQuery().caseExecutionIdIn(caseExecutionId, taskExecutionId).count());
            assertEquals(2, historyService.createHistoricVariableInstanceQuery().caseExecutionIdIn(caseExecutionId).count());
            assertEquals(1, historyService.createHistoricVariableInstanceQuery().caseExecutionIdIn(taskExecutionId).count());

            HistoryLevel historyLevel = processEngineConfiguration.HistoryLevel;

            if (historyLevel.Equals(org.camunda.bpm.engine.impl.history.HistoryLevel_Fields.HISTORY_LEVEL_FULL))
            {
                assertEquals(5, historyService.createHistoricDetailQuery().count());
                assertEquals(5, historyService.createHistoricDetailQuery().caseInstanceId(caseInstanceId).count());
                assertEquals(3, historyService.createHistoricDetailQuery().caseExecutionId(caseExecutionId).count());
                assertEquals(2, historyService.createHistoricDetailQuery().caseExecutionId(taskExecutionId).count());
            }
        }
コード例 #3
0
        public Void execute(CommandContext commandContext)
        {
            ProcessEngineConfigurationImpl processEngineConfiguration = Context.ProcessEngineConfiguration;

            checkStartupLockExists(commandContext);

            HistoryLevel databaseHistoryLevel = (new DetermineHistoryLevelCmd(processEngineConfiguration.HistoryLevels)).execute(commandContext);

            determineAutoHistoryLevel(processEngineConfiguration, databaseHistoryLevel);

            HistoryLevel configuredHistoryLevel = processEngineConfiguration.HistoryLevel;

            if (databaseHistoryLevel == null)
            {
                commandContext.PropertyManager.acquireExclusiveLockForStartup();
                databaseHistoryLevel = (new DetermineHistoryLevelCmd(processEngineConfiguration.HistoryLevels)).execute(commandContext);

                if (databaseHistoryLevel == null)
                {
                    LOG.noHistoryLevelPropertyFound();
                    dbCreateHistoryLevel(commandContext);
                }
            }
            else
            {
                if (configuredHistoryLevel.Id != databaseHistoryLevel.Id)
                {
                    throw new ProcessEngineException("historyLevel mismatch: configuration says " + configuredHistoryLevel + " and database says " + databaseHistoryLevel);
                }
            }

            return(null);
        }
コード例 #4
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void test() throws InterruptedException
        public virtual void test()
        {
            ThreadControl thread1 = executeControllableCommand(new ControllableUpdateHistoryLevelCommand());

            thread1.waitForSync();

            ThreadControl thread2 = executeControllableCommand(new ControllableUpdateHistoryLevelCommand());

            thread2.waitForSync();

            thread1.makeContinue();
            thread1.waitForSync();

            thread2.makeContinue();

            Thread.Sleep(2000);

            thread1.waitUntilDone();

            thread2.waitForSync();
            thread2.waitUntilDone();

            assertNull(thread1.exception);
            assertNull(thread2.exception);
            HistoryLevel historyLevel = processEngineConfiguration.HistoryLevel;

            assertEquals("full", historyLevel.Name);
        }
コード例 #5
0
 protected internal override HistoryEvent CreateHistoryEvent(IDelegateTask task, ExecutionEntity execution)
 {
     if (HistoryLevel.IsHistoryEventProduced(HistoryEventTypes.ActivityInstanceUpdate, execution))
     {
         return(EventProducer.CreateActivityInstanceUpdateEvt(execution, task));
     }
     return(null);
 }
コード例 #6
0
        public static void dbCreateHistoryLevel(CommandContext commandContext)
        {
            ProcessEngineConfigurationImpl processEngineConfiguration = Context.ProcessEngineConfiguration;
            HistoryLevel   configuredHistoryLevel = processEngineConfiguration.HistoryLevel;
            PropertyEntity property = new PropertyEntity("historyLevel", Convert.ToString(configuredHistoryLevel.Id));

            commandContext.getSession(typeof(DbEntityManager)).insert(property);
            LOG.creatingHistoryLevelPropertyInDatabase(configuredHistoryLevel);
        }
コード例 #7
0
        private static bool historyLevelCheck(ProcessEngine processEngine, RequiredHistoryLevel annotation)
        {
            ProcessEngineConfigurationImpl processEngineConfiguration = (ProcessEngineConfigurationImpl)processEngine.ProcessEngineConfiguration;

            HistoryLevel requiredHistoryLevel = getHistoryLevelForName(processEngineConfiguration.HistoryLevels, annotation.value());
            HistoryLevel currentHistoryLevel  = processEngineConfiguration.HistoryLevel;

            return(currentHistoryLevel.Id >= requiredHistoryLevel.Id);
        }
コード例 #8
0
        public ProcessEngineImpl(ProcessEngineConfigurationImpl processEngineConfiguration)
        {
            this.processEngineConfiguration = processEngineConfiguration;
            this.name = processEngineConfiguration.ProcessEngineName;

            this.repositoryService    = processEngineConfiguration.RepositoryService;
            this.runtimeService       = processEngineConfiguration.RuntimeService;
            this.historicDataService  = processEngineConfiguration.HistoryService;
            this.identityService      = processEngineConfiguration.IdentityService;
            this.taskService          = processEngineConfiguration.TaskService;
            this.formService          = processEngineConfiguration.FormService;
            this.managementService    = processEngineConfiguration.ManagementService;
            this.authorizationService = processEngineConfiguration.AuthorizationService;
            this.caseService          = processEngineConfiguration.CaseService;
            this.filterService        = processEngineConfiguration.FilterService;
            this.externalTaskService  = processEngineConfiguration.ExternalTaskService;
            this.decisionService      = processEngineConfiguration.DecisionService;

            this.databaseSchemaUpdate       = processEngineConfiguration.DatabaseSchemaUpdate;
            this.jobExecutor                = processEngineConfiguration.JobExecutor;
            this.commandExecutor            = processEngineConfiguration.CommandExecutorTxRequired;
            commandExecutorSchemaOperations = processEngineConfiguration.CommandExecutorSchemaOperations;
            this.sessionFactories           = processEngineConfiguration.SessionFactories;
            this.historyLevel               = processEngineConfiguration.HistoryLevel;
            this.transactionContextFactory  = processEngineConfiguration.TransactionContextFactory;

            executeSchemaOperations();

            if (string.ReferenceEquals(name, null))
            {
                LOG.processEngineCreated(ProcessEngines.NAME_DEFAULT);
            }
            else
            {
                LOG.processEngineCreated(name);
            }

            ProcessEngines.registerProcessEngine(this);

            if ((jobExecutor != null))
            {
                // register process engine with Job Executor
                jobExecutor.registerProcessEngine(this);
            }

            if (processEngineConfiguration.MetricsEnabled)
            {
                string            reporterId        = processEngineConfiguration.MetricsReporterIdProvider.provideId(this);
                DbMetricsReporter dbMetricsReporter = processEngineConfiguration.DbMetricsReporter;
                dbMetricsReporter.ReporterId = reporterId;

                if (processEngineConfiguration.DbMetricsReporterActivate)
                {
                    dbMetricsReporter.start();
                }
            }
        }
コード例 #9
0
        public virtual void dbSchemaCreate()
        {
            ProcessEngineConfigurationImpl processEngineConfiguration = Context.ProcessEngineConfiguration;

            HistoryLevel configuredHistoryLevel = processEngineConfiguration.HistoryLevel;

            if ((!processEngineConfiguration.DbHistoryUsed) && (!configuredHistoryLevel.Equals(org.camunda.bpm.engine.impl.history.HistoryLevel_Fields.HISTORY_LEVEL_NONE)))
            {
                throw LOG.databaseHistoryLevelException(configuredHistoryLevel.Name);
            }

            if (EngineTablePresent)
            {
                string dbVersion = DbVersion;
                if (!org.camunda.bpm.engine.ProcessEngine_Fields.VERSION.Equals(dbVersion))
                {
                    throw LOG.wrongDbVersionException(org.camunda.bpm.engine.ProcessEngine_Fields.VERSION, dbVersion);
                }
            }
            else
            {
                dbSchemaCreateEngine();
            }

            if (processEngineConfiguration.DbHistoryUsed)
            {
                dbSchemaCreateHistory();
            }

            if (processEngineConfiguration.DbIdentityUsed)
            {
                dbSchemaCreateIdentity();
            }

            if (processEngineConfiguration.CmmnEnabled)
            {
                dbSchemaCreateCmmn();
            }

            if (processEngineConfiguration.CmmnEnabled && processEngineConfiguration.DbHistoryUsed)
            {
                dbSchemaCreateCmmnHistory();
            }

            if (processEngineConfiguration.DmnEnabled)
            {
                dbSchemaCreateDmn();

                if (processEngineConfiguration.DbHistoryUsed)
                {
                    dbSchemaCreateDmnHistory();
                }
            }
        }
コード例 #10
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(DelegateExecution execution)
        {
            HistoryLevel historyLevel = Context.ProcessEngineConfiguration.HistoryLevel;

            if (!historyLevel.isHistoryEventProduced(HistoryEventTypes.ACTIVITY_INSTANCE_MIGRATE, this))
            {
                return;
            }

            HistoryEventProcessor.processHistoryEvents(new HistoryEventCreatorAnonymousInnerClass2(this));
        }
コード例 #11
0
//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available 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.ProcessEngineConfiguration;

            HistoryLevel historyLevel = configuration.HistoryLevel;

            if (historyLevel.isHistoryEventProduced(HistoryEventTypes.BATCH_END, batch))
            {
                HistoryEventProcessor.processHistoryEvents(new HistoryEventCreatorAnonymousInnerClass2(this, batch));
            }
        }
コード例 #12
0
//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET:
//ORIGINAL LINE: public void createHistoricTask(final TaskEntity task)
        public virtual void createHistoricTask(TaskEntity task)
        {
            ProcessEngineConfigurationImpl configuration = Context.ProcessEngineConfiguration;

            HistoryLevel historyLevel = configuration.HistoryLevel;

            if (historyLevel.isHistoryEventProduced(HistoryEventTypes.TASK_INSTANCE_CREATE, task))
            {
                HistoryEventProcessor.processHistoryEvents(new HistoryEventCreatorAnonymousInnerClass3(this, task));
            }
        }
コード例 #13
0
        public virtual void fireHistoricCaseActivityInstanceUpdate()
        {
            ProcessEngineConfigurationImpl configuration = Context.ProcessEngineConfiguration;
            HistoryLevel historyLevel = configuration.HistoryLevel;

            if (historyLevel.isHistoryEventProduced(HistoryEventTypes.CASE_ACTIVITY_INSTANCE_UPDATE, this))
            {
                CmmnHistoryEventProducer eventProducer = configuration.CmmnHistoryEventProducer;
                HistoryEventHandler      eventHandler  = configuration.HistoryEventHandler;

                HistoryEvent @event = eventProducer.createCaseActivityInstanceUpdateEvt(this);
                eventHandler.handleEvent(@event);
            }
        }
コード例 #14
0
//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET:
//ORIGINAL LINE: public void markTaskInstanceEnded(String taskId, final String deleteReason)
        public virtual void markTaskInstanceEnded(string taskId, string deleteReason)
        {
            ProcessEngineConfigurationImpl configuration = 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.CommandContext.DbEntityManager.selectById(typeof(TaskEntity), taskId);

            HistoryLevel historyLevel = configuration.HistoryLevel;

            if (historyLevel.isHistoryEventProduced(HistoryEventTypes.TASK_INSTANCE_COMPLETE, taskEntity))
            {
                HistoryEventProcessor.processHistoryEvents(new HistoryEventCreatorAnonymousInnerClass2(this, deleteReason, taskEntity));
            }
        }
コード例 #15
0
        public virtual void triggerHistoryEvent(IList <ProcessInstance> subProcesslist)
        {
            ProcessEngineConfigurationImpl configuration = Context.ProcessEngineConfiguration;
            HistoryLevel historyLevel = configuration.HistoryLevel;

            foreach (ProcessInstance processInstance in subProcesslist)
            {
                // TODO: This smells bad, as the rest of the history is done via the
                // ParseListener
                if (historyLevel.isHistoryEventProduced(HistoryEventTypes.PROCESS_INSTANCE_UPDATE, processInstance))
                {
                    HistoryEventProcessor.processHistoryEvents(new HistoryEventCreatorAnonymousInnerClass(this));
                }
            }
        }
コード例 #16
0
            public object execute(CommandContext commandContext)
            {
                HistoryLevel historyLevel = Context.ProcessEngineConfiguration.HistoryLevel;

                if (historyLevel.Equals(org.camunda.bpm.engine.impl.history.HistoryLevel_Fields.HISTORY_LEVEL_FULL))
                {
                    commandContext.HistoricJobLogManager.deleteHistoricJobLogsByHandlerType(TimerSuspendProcessDefinitionHandler.TYPE);
                    IList <HistoricIncident> incidents = Context.ProcessEngineConfiguration.HistoryService.createHistoricIncidentQuery().list();
                    foreach (HistoricIncident incident in incidents)
                    {
                        commandContext.HistoricIncidentManager.delete((HistoricIncidentEntity)incident);
                    }
                }

                return(null);
            }
コード例 #17
0
        protected internal override void triggerHistoryEvent(CommandContext commandContext)
        {
            HistoryLevel            historyLevel            = commandContext.ProcessEngineConfiguration.HistoryLevel;
            IList <ProcessInstance> updatedProcessInstances = obtainProcessInstances(commandContext);

            //suspension state is not updated synchronously
            if (NewSuspensionState != null && updatedProcessInstances != null)
            {
                foreach (ProcessInstance processInstance in updatedProcessInstances)
                {
                    if (historyLevel.isHistoryEventProduced(HistoryEventTypes.PROCESS_INSTANCE_UPDATE, processInstance))
                    {
                        HistoryEventProcessor.processHistoryEvents(new HistoryEventCreatorAnonymousInnerClass(this));
                    }
                }
            }
        }
コード例 #18
0
        protected internal void determineAutoHistoryLevel(ProcessEngineConfigurationImpl engineConfiguration, HistoryLevel databaseHistoryLevel)
        {
            HistoryLevel configuredHistoryLevel = engineConfiguration.HistoryLevel;

            if (configuredHistoryLevel == null && ProcessEngineConfiguration.HISTORY_AUTO.Equals(engineConfiguration.History))
            {
                // automatically determine history level or use default AUDIT
                if (databaseHistoryLevel != null)
                {
                    engineConfiguration.HistoryLevel = databaseHistoryLevel;
                }
                else
                {
                    engineConfiguration.HistoryLevel = engineConfiguration.DefaultHistoryLevel;
                }
            }
        }
コード例 #19
0
 public HistoryDecisionEvaluationListener(DmnHistoryEventProducer historyEventProducer, HistoryLevel historyLevel)
 {
     this.eventProducer = historyEventProducer;
     this.historyLevel  = historyLevel;
 }
コード例 #20
0
 public HistoryCaseExecutionListener(CmmnHistoryEventProducer historyEventProducer, HistoryLevel historyLevel)
 {
     eventProducer     = historyEventProducer;
     this.historyLevel = historyLevel;
 }