use of org.camunda.bpm.engine.impl.history.event.HistoricScopeInstanceEvent in project camunda-bpm-platform by camunda.
the class DbHistoryEventHandler method insertOrUpdate.
/**
* general history event insert behavior
*/
protected void insertOrUpdate(HistoryEvent historyEvent) {
final DbEntityManager dbEntityManager = getDbEntityManager();
if (isInitialEvent(historyEvent)) {
dbEntityManager.insert(historyEvent);
} else {
if (dbEntityManager.getCachedEntity(historyEvent.getClass(), historyEvent.getId()) == null) {
if (historyEvent instanceof HistoricScopeInstanceEvent) {
// if this is a scope, get start time from existing event in DB
HistoricScopeInstanceEvent existingEvent = (HistoricScopeInstanceEvent) dbEntityManager.selectById(historyEvent.getClass(), historyEvent.getId());
if (existingEvent != null) {
HistoricScopeInstanceEvent historicScopeInstanceEvent = (HistoricScopeInstanceEvent) historyEvent;
historicScopeInstanceEvent.setStartTime(existingEvent.getStartTime());
}
}
if (historyEvent.getId() == null) {
// dbSqlSession.insert(historyEvent);
} else {
dbEntityManager.merge(historyEvent);
}
}
}
}
Aggregations