Exemplo n.º 1
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());
            }
        }
Exemplo n.º 2
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();
                }
            }
        }
Exemplo n.º 3
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);
            }