protected void initHistoryEventHandler() { if (historyEventHandler == null) { historyEventHandler = new DbHistoryEventHandler(); } }
public void handleEvents(List<HistoryEvent> historyEvents) { for (HistoryEvent historyEvent : historyEvents) { handleEvent(historyEvent); } }
public void handleEvent(HistoryEvent historyEvent) { if (historyEvent instanceof HistoricVariableUpdateEventEntity) { insertHistoricVariableUpdateEntity((HistoricVariableUpdateEventEntity) historyEvent); } else if(historyEvent instanceof HistoricDecisionEvaluationEvent) { insertHistoricDecisionEvaluationEvent((HistoricDecisionEvaluationEvent) historyEvent); } else { insertOrUpdate(historyEvent); } }
/** 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); } } } }
DbEntityManager dbEntityManager = getDbEntityManager(); if(shouldWriteHistoricDetail(historyEvent)) {
protected boolean isInitialEvent(HistoryEvent historyEvent) { String isInitialEvent = "isInitialEvent"; return Api.feature(DbHistoryEventHandler.class, isInitialEvent, HistoryEvent.class).isSupported() ? super.isInitialEvent(historyEvent): (Boolean) Api.feature(DbHistoryEventHandler.class, isInitialEvent, String.class).invoke(this, historyEvent.getEventType()); }
/** 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); } } } }
DbEntityManager dbEntityManager = getDbEntityManager(); if(shouldWriteHistoricDetail(historyEvent)) {
protected void initHistoryEventHandler() { if (historyEventHandler == null) { historyEventHandler = new DbHistoryEventHandler(); } }
public void handleEvent(HistoryEvent historyEvent) { if (historyEvent instanceof HistoricVariableUpdateEventEntity) { insertHistoricVariableUpdateEntity((HistoricVariableUpdateEventEntity) historyEvent); } else if(historyEvent instanceof HistoricDecisionEvaluationEvent) { insertHistoricDecisionEvaluationEvent((HistoricDecisionEvaluationEvent) historyEvent); } else { insertOrUpdate(historyEvent); } }
/** 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); } } } }
DbEntityManager dbEntityManager = getDbEntityManager(); if(shouldWriteHistoricDetail(historyEvent)) {
public void handleEvents(List<HistoryEvent> historyEvents) { for (HistoryEvent historyEvent : historyEvents) { handleEvent(historyEvent); } }
/** * Add {@link DbHistoryEventHandler} to the list of * {@link HistoryEventHandler}. */ private void addDefaultDbHistoryEventHandler() { historyEventHandlers.add(new DbHistoryEventHandler()); }
public void handleEvent(HistoryEvent historyEvent) { if (historyEvent instanceof HistoricVariableUpdateEventEntity) { insertHistoricVariableUpdateEntity((HistoricVariableUpdateEventEntity) historyEvent); } else if(historyEvent instanceof HistoricDecisionEvaluationEvent) { insertHistoricDecisionEvaluationEvent((HistoricDecisionEvaluationEvent) historyEvent); } else { insertOrUpdate(historyEvent); } }
public void handleEvents(List<HistoryEvent> historyEvents) { for (HistoryEvent historyEvent : historyEvents) { handleEvent(historyEvent); } }
/** * Add {@link DbHistoryEventHandler} to the list of * {@link HistoryEventHandler}. */ private void addDefaultDbHistoryEventHandler() { historyEventHandlers.add(new DbHistoryEventHandler()); }
@Override public void handleEvent(HistoryEvent historyEvent) { super.handleEvent(historyEvent); if (coverageTestRunState == null) { logger.warning("Coverage history event listener in use but no coverage run state assigned!"); return; } if (historyEvent instanceof HistoricActivityInstanceEventEntity) { HistoricActivityInstanceEventEntity activityEvent = (HistoricActivityInstanceEventEntity) historyEvent; if (activityEvent.getActivityType().equals("multiInstanceBody")) return; final CoveredFlowNode coveredActivity = new CoveredFlowNode(historyEvent.getProcessDefinitionKey(), activityEvent.getActivityId()); // Cover event start if (isInitialEvent(historyEvent)) { coverageTestRunState.addCoveredElement(coveredActivity); } // Cover event end else if (isEndEvent(historyEvent)) { coverageTestRunState.endCoveredElement(coveredActivity); } } }
@Deployment(resources = { "org/camunda/bpm/engine/test/history/HistoryLevelTest.bpmn20.xml" }) public void testCompositeHistoryEventHandlerArgumentConstructorWithNotEmptyListNotNullTwoEvents() { // prepare the list with two events List<HistoryEventHandler> historyEventHandlers = new ArrayList<HistoryEventHandler>(); historyEventHandlers.add(new CustomDbHistoryEventHandler()); historyEventHandlers.add(new DbHistoryEventHandler()); CompositeHistoryEventHandler compositeHistoryEventHandler = new CompositeHistoryEventHandler(historyEventHandlers); processEngineConfiguration.setHistoryEventHandler(compositeHistoryEventHandler); startProcessAndCompleteUserTask(); assertEquals(2, countCustomHistoryEventHandler); assertEquals(2, historyService.createHistoricDetailQuery().count()); }
protected void initHistoryEventHandler() { if (historyEventHandler == null) { historyEventHandler = new DbHistoryEventHandler(); } }