Search in sources :

Example 26 with HistoryLevel

use of org.camunda.bpm.engine.impl.history.HistoryLevel in project camunda-bpm-platform by camunda.

the class HistoricTaskInstanceManager method markTaskInstanceEnded.

public void markTaskInstanceEnded(String taskId, final String deleteReason) {
    ProcessEngineConfigurationImpl configuration = Context.getProcessEngineConfiguration();
    final TaskEntity taskEntity = Context.getCommandContext().getDbEntityManager().selectById(TaskEntity.class, taskId);
    HistoryLevel historyLevel = configuration.getHistoryLevel();
    if (historyLevel.isHistoryEventProduced(HistoryEventTypes.TASK_INSTANCE_COMPLETE, taskEntity)) {
        HistoryEventProcessor.processHistoryEvents(new HistoryEventProcessor.HistoryEventCreator() {

            @Override
            public HistoryEvent createHistoryEvent(HistoryEventProducer producer) {
                return producer.createTaskInstanceCompleteEvt(taskEntity, deleteReason);
            }
        });
    }
}
Also used : HistoryLevel(org.camunda.bpm.engine.impl.history.HistoryLevel) HistoryEventProcessor(org.camunda.bpm.engine.impl.history.event.HistoryEventProcessor) HistoryEventProducer(org.camunda.bpm.engine.impl.history.producer.HistoryEventProducer) HistoryEvent(org.camunda.bpm.engine.impl.history.event.HistoryEvent) ProcessEngineConfigurationImpl(org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl)

Example 27 with HistoryLevel

use of org.camunda.bpm.engine.impl.history.HistoryLevel in project camunda-bpm-platform by camunda.

the class IdentityLinkEntity method fireHistoricIdentityLinkEvent.

public void fireHistoricIdentityLinkEvent(final HistoryEventType eventType) {
    ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration();
    HistoryLevel historyLevel = processEngineConfiguration.getHistoryLevel();
    if (historyLevel.isHistoryEventProduced(eventType, this)) {
        HistoryEventProcessor.processHistoryEvents(new HistoryEventProcessor.HistoryEventCreator() {

            @Override
            public HistoryEvent createHistoryEvent(HistoryEventProducer producer) {
                HistoryEvent event = null;
                if (HistoryEvent.IDENTITY_LINK_ADD.equals(eventType.getEventName())) {
                    event = producer.createHistoricIdentityLinkAddEvent(IdentityLinkEntity.this);
                } else if (HistoryEvent.IDENTITY_LINK_DELETE.equals(eventType.getEventName())) {
                    event = producer.createHistoricIdentityLinkDeleteEvent(IdentityLinkEntity.this);
                }
                return event;
            }
        });
    }
}
Also used : HistoryLevel(org.camunda.bpm.engine.impl.history.HistoryLevel) HistoryEventProcessor(org.camunda.bpm.engine.impl.history.event.HistoryEventProcessor) HistoryEventProducer(org.camunda.bpm.engine.impl.history.producer.HistoryEventProducer) HistoryEvent(org.camunda.bpm.engine.impl.history.event.HistoryEvent) ProcessEngineConfigurationImpl(org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl)

Example 28 with HistoryLevel

use of org.camunda.bpm.engine.impl.history.HistoryLevel in project camunda-bpm-platform by camunda.

the class HistoricJobLogManager method isHistoryEventProduced.

// helper /////////////////////////////////////////////////////////
protected boolean isHistoryEventProduced(HistoryEventType eventType, Job job) {
    ProcessEngineConfigurationImpl configuration = Context.getProcessEngineConfiguration();
    HistoryLevel historyLevel = configuration.getHistoryLevel();
    return historyLevel.isHistoryEventProduced(eventType, job);
}
Also used : HistoryLevel(org.camunda.bpm.engine.impl.history.HistoryLevel) ProcessEngineConfigurationImpl(org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl)

Example 29 with HistoryLevel

use of org.camunda.bpm.engine.impl.history.HistoryLevel in project camunda-bpm-platform by camunda.

the class AbstractPersistenceSession method dbSchemaCreate.

public void dbSchemaCreate() {
    ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration();
    HistoryLevel configuredHistoryLevel = processEngineConfiguration.getHistoryLevel();
    if ((!processEngineConfiguration.isDbHistoryUsed()) && (!configuredHistoryLevel.equals(HistoryLevel.HISTORY_LEVEL_NONE))) {
        throw LOG.databaseHistoryLevelException(configuredHistoryLevel.getName());
    }
    if (isEngineTablePresent()) {
        String dbVersion = getDbVersion();
        if (!ProcessEngine.VERSION.equals(dbVersion)) {
            throw LOG.wrongDbVersionException(ProcessEngine.VERSION, dbVersion);
        }
    } else {
        dbSchemaCreateEngine();
    }
    if (processEngineConfiguration.isDbHistoryUsed()) {
        dbSchemaCreateHistory();
    }
    if (processEngineConfiguration.isDbIdentityUsed()) {
        dbSchemaCreateIdentity();
    }
    if (processEngineConfiguration.isCmmnEnabled()) {
        dbSchemaCreateCmmn();
    }
    if (processEngineConfiguration.isCmmnEnabled() && processEngineConfiguration.isDbHistoryUsed()) {
        dbSchemaCreateCmmnHistory();
    }
    if (processEngineConfiguration.isDmnEnabled()) {
        dbSchemaCreateDmn();
        if (processEngineConfiguration.isDbHistoryUsed()) {
            dbSchemaCreateDmnHistory();
        }
    }
}
Also used : HistoryLevel(org.camunda.bpm.engine.impl.history.HistoryLevel) ProcessEngineConfigurationImpl(org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl)

Example 30 with HistoryLevel

use of org.camunda.bpm.engine.impl.history.HistoryLevel in project camunda-bpm-platform by camunda.

the class HistoricVariableInstanceScopeTest method testHistoricCaseVariableInstanceQuery.

@Deployment(resources = { "org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn" })
public void testHistoricCaseVariableInstanceQuery() {
    // start case instance with variables
    Map<String, Object> variables = new HashMap<String, Object>();
    variables.put("foo", "bar");
    String caseInstanceId = caseService.createCaseInstanceByKey("oneTaskCase", variables).getId();
    String caseExecutionId = caseService.createCaseExecutionQuery().activityId("CasePlanModel_1").singleResult().getId();
    String taskExecutionId = caseService.createCaseExecutionQuery().activityId("PI_HumanTask_1").singleResult().getId();
    // 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.getHistoryLevel();
    if (historyLevel.equals(HistoryLevel.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());
    }
}
Also used : HashMap(java.util.HashMap) HistoryLevel(org.camunda.bpm.engine.impl.history.HistoryLevel) RequiredHistoryLevel(org.camunda.bpm.engine.test.RequiredHistoryLevel) Deployment(org.camunda.bpm.engine.test.Deployment)

Aggregations

HistoryLevel (org.camunda.bpm.engine.impl.history.HistoryLevel)30 ProcessEngineConfigurationImpl (org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl)22 HistoryEvent (org.camunda.bpm.engine.impl.history.event.HistoryEvent)16 HistoryEventProcessor (org.camunda.bpm.engine.impl.history.event.HistoryEventProcessor)15 HistoryEventProducer (org.camunda.bpm.engine.impl.history.producer.HistoryEventProducer)15 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)4 DetermineHistoryLevelCmd (org.camunda.bpm.engine.impl.cmd.DetermineHistoryLevelCmd)4 Test (org.junit.Test)3 ExecutionEntity (org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity)2 ProcessInstance (org.camunda.bpm.engine.runtime.ProcessInstance)2 RequiredHistoryLevel (org.camunda.bpm.engine.test.RequiredHistoryLevel)2 HashMap (java.util.HashMap)1 List (java.util.List)1 DelegateExecution (org.camunda.bpm.engine.delegate.DelegateExecution)1 HistoricIncident (org.camunda.bpm.engine.history.HistoricIncident)1 HistoricProcessInstance (org.camunda.bpm.engine.history.HistoricProcessInstance)1 DbEntityManager (org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager)1 HistoricProcessInstanceEventEntity (org.camunda.bpm.engine.impl.history.event.HistoricProcessInstanceEventEntity)1 HistoryEventType (org.camunda.bpm.engine.impl.history.event.HistoryEventType)1 HistoryEventHandler (org.camunda.bpm.engine.impl.history.handler.HistoryEventHandler)1