Search in sources :

Example 21 with HistoryLevel

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

the class DetermineHistoryLevelCmdTest method useDefaultLevelAudit.

@Test
public void useDefaultLevelAudit() throws Exception {
    ProcessEngineConfigurationImpl config = config("true", ProcessEngineConfiguration.HISTORY_AUTO);
    // init the db with level=auto -> audit
    processEngineImpl = (ProcessEngineImpl) config.buildProcessEngine();
    // the history Level has been overwritten with audit
    assertThat(config.getHistoryLevel(), CoreMatchers.equalTo(HistoryLevel.HISTORY_LEVEL_AUDIT));
    // and this is written to the database
    HistoryLevel databaseLevel = config.getCommandExecutorSchemaOperations().execute(new DetermineHistoryLevelCmd(config.getHistoryLevels()));
    assertThat(databaseLevel, CoreMatchers.equalTo(HistoryLevel.HISTORY_LEVEL_AUDIT));
}
Also used : DetermineHistoryLevelCmd(org.camunda.bpm.engine.impl.cmd.DetermineHistoryLevelCmd) HistoryLevel(org.camunda.bpm.engine.impl.history.HistoryLevel) ProcessEngineConfigurationImpl(org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl) Test(org.junit.Test)

Example 22 with HistoryLevel

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

the class CaseExecutionEntity method fireHistoricCaseActivityInstanceUpdate.

public void fireHistoricCaseActivityInstanceUpdate() {
    ProcessEngineConfigurationImpl configuration = Context.getProcessEngineConfiguration();
    HistoryLevel historyLevel = configuration.getHistoryLevel();
    if (historyLevel.isHistoryEventProduced(HistoryEventTypes.CASE_ACTIVITY_INSTANCE_UPDATE, this)) {
        CmmnHistoryEventProducer eventProducer = configuration.getCmmnHistoryEventProducer();
        HistoryEventHandler eventHandler = configuration.getHistoryEventHandler();
        HistoryEvent event = eventProducer.createCaseActivityInstanceUpdateEvt(this);
        eventHandler.handleEvent(event);
    }
}
Also used : HistoryEventHandler(org.camunda.bpm.engine.impl.history.handler.HistoryEventHandler) HistoryLevel(org.camunda.bpm.engine.impl.history.HistoryLevel) CmmnHistoryEventProducer(org.camunda.bpm.engine.impl.history.producer.CmmnHistoryEventProducer) HistoryEvent(org.camunda.bpm.engine.impl.history.event.HistoryEvent) ProcessEngineConfigurationImpl(org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl)

Example 23 with HistoryLevel

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

the class ConcurrentHistoryLevelTest method test.

public void test() throws InterruptedException {
    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.getHistoryLevel();
    assertEquals("full", historyLevel.getName());
}
Also used : HistoryLevel(org.camunda.bpm.engine.impl.history.HistoryLevel)

Example 24 with HistoryLevel

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

the class ExecutionEntity method fireHistoricProcessStartEvent.

@Override
public void fireHistoricProcessStartEvent() {
    ProcessEngineConfigurationImpl configuration = Context.getProcessEngineConfiguration();
    HistoryLevel historyLevel = configuration.getHistoryLevel();
    // ParseListener
    if (historyLevel.isHistoryEventProduced(HistoryEventTypes.PROCESS_INSTANCE_START, processInstance)) {
        HistoryEventProcessor.processHistoryEvents(new HistoryEventProcessor.HistoryEventCreator() {

            @Override
            public HistoryEvent createHistoryEvent(HistoryEventProducer producer) {
                return producer.createProcessInstanceStartEvt(processInstance);
            }
        });
    }
}
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 25 with HistoryLevel

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

the class HistoricTaskInstanceManager method createHistoricTask.

public void createHistoricTask(final TaskEntity task) {
    ProcessEngineConfigurationImpl configuration = Context.getProcessEngineConfiguration();
    HistoryLevel historyLevel = configuration.getHistoryLevel();
    if (historyLevel.isHistoryEventProduced(HistoryEventTypes.TASK_INSTANCE_CREATE, task)) {
        HistoryEventProcessor.processHistoryEvents(new HistoryEventProcessor.HistoryEventCreator() {

            @Override
            public HistoryEvent createHistoryEvent(HistoryEventProducer producer) {
                return producer.createTaskInstanceCreateEvt(task);
            }
        });
    }
}
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)

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