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