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;
}
});
}
}
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);
}
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();
}
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()));
}
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));
}
Aggregations