Search in sources :

Example 11 with HistoryLevel

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

the class IncidentEntity method fireHistoricIncidentEvent.

protected void fireHistoricIncidentEvent(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.INCIDENT_CREATE.equals(eventType.getEventName())) {
                    event = producer.createHistoricIncidentCreateEvt(IncidentEntity.this);
                } else if (HistoryEvent.INCIDENT_RESOLVE.equals(eventType.getEventName())) {
                    event = producer.createHistoricIncidentResolveEvt(IncidentEntity.this);
                } else if (HistoryEvent.INCIDENT_DELETE.equals(eventType.getEventName())) {
                    event = producer.createHistoricIncidentDeleteEvt(IncidentEntity.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 12 with HistoryLevel

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

the class HistoricExternalTaskLogManager method isHistoryEventProduced.

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

Example 13 with HistoryLevel

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

the class TestHelper method historyLevelCheck.

private static boolean historyLevelCheck(ProcessEngine processEngine, RequiredHistoryLevel annotation) {
    ProcessEngineConfigurationImpl processEngineConfiguration = (ProcessEngineConfigurationImpl) processEngine.getProcessEngineConfiguration();
    HistoryLevel requiredHistoryLevel = getHistoryLevelForName(processEngineConfiguration.getHistoryLevels(), annotation.value());
    HistoryLevel currentHistoryLevel = processEngineConfiguration.getHistoryLevel();
    return currentHistoryLevel.getId() >= requiredHistoryLevel.getId();
}
Also used : RequiredHistoryLevel(org.camunda.bpm.engine.test.RequiredHistoryLevel) HistoryLevel(org.camunda.bpm.engine.impl.history.HistoryLevel) ProcessEngineConfigurationImpl(org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl)

Example 14 with HistoryLevel

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

the class DetermineHistoryLevelCmdTest method failWhenExistingHistoryLevelIsNotRegistered.

@Test
public void failWhenExistingHistoryLevelIsNotRegistered() {
    // init the db with custom level
    HistoryLevel customLevel = new HistoryLevel() {

        @Override
        public int getId() {
            return 99;
        }

        @Override
        public String getName() {
            return "custom";
        }

        @Override
        public boolean isHistoryEventProduced(HistoryEventType eventType, Object entity) {
            return false;
        }
    };
    ProcessEngineConfigurationImpl config = config("true", "custom");
    config.setCustomHistoryLevels(Arrays.asList(customLevel));
    processEngineImpl = (ProcessEngineImpl) config.buildProcessEngine();
    thrown.expect(ProcessEngineException.class);
    thrown.expectMessage("The configured history level with id='99' is not registered in this config.");
    config.getCommandExecutorSchemaOperations().execute(new DetermineHistoryLevelCmd(Collections.<HistoryLevel>emptyList()));
}
Also used : DetermineHistoryLevelCmd(org.camunda.bpm.engine.impl.cmd.DetermineHistoryLevelCmd) HistoryLevel(org.camunda.bpm.engine.impl.history.HistoryLevel) HistoryEventType(org.camunda.bpm.engine.impl.history.event.HistoryEventType) ProcessEngineConfigurationImpl(org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl) Test(org.junit.Test)

Example 15 with HistoryLevel

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

the class DetermineHistoryLevelCmdTest method readLevelFullfromDB.

@Test
public void readLevelFullfromDB() throws Exception {
    final ProcessEngineConfigurationImpl config = config("true", ProcessEngineConfiguration.HISTORY_FULL);
    // init the db with level=full
    processEngineImpl = (ProcessEngineImpl) config.buildProcessEngine();
    HistoryLevel historyLevel = config.getCommandExecutorSchemaOperations().execute(new DetermineHistoryLevelCmd(config.getHistoryLevels()));
    assertThat(historyLevel, CoreMatchers.equalTo(HistoryLevel.HISTORY_LEVEL_FULL));
}
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)

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