use of org.camunda.bpm.engine.impl.history.event.HistoricCaseActivityInstanceEventEntity in project camunda-bpm-platform by camunda.
the class CacheAwareCmmnHistoryEventProducer method loadCaseActivityInstanceEventEntity.
@Override
protected HistoricCaseActivityInstanceEventEntity loadCaseActivityInstanceEventEntity(CaseExecutionEntity caseExecutionEntity) {
final String caseActivityInstanceId = caseExecutionEntity.getId();
HistoricCaseActivityInstanceEventEntity cachedEntity = findInCache(HistoricCaseActivityInstanceEventEntity.class, caseActivityInstanceId);
if (cachedEntity != null) {
return cachedEntity;
} else {
return newCaseActivityInstanceEventEntity(caseExecutionEntity);
}
}
use of org.camunda.bpm.engine.impl.history.event.HistoricCaseActivityInstanceEventEntity in project camunda-bpm-platform by camunda.
the class DefaultCmmnHistoryEventProducer method createCaseActivityInstanceCreateEvt.
public HistoryEvent createCaseActivityInstanceCreateEvt(DelegateCaseExecution caseExecution) {
final CaseExecutionEntity caseExecutionEntity = (CaseExecutionEntity) caseExecution;
// create event instance
HistoricCaseActivityInstanceEventEntity evt = newCaseActivityInstanceEventEntity(caseExecutionEntity);
// initialize event
initCaseActivityInstanceEvent(evt, caseExecutionEntity, HistoryEventTypes.CASE_ACTIVITY_INSTANCE_CREATE);
// set start time
evt.setCreateTime(ClockUtil.getCurrentTime());
return evt;
}
use of org.camunda.bpm.engine.impl.history.event.HistoricCaseActivityInstanceEventEntity in project camunda-bpm-platform by camunda.
the class DefaultCmmnHistoryEventProducer method createCaseActivityInstanceEndEvt.
public HistoryEvent createCaseActivityInstanceEndEvt(DelegateCaseExecution caseExecution) {
final CaseExecutionEntity caseExecutionEntity = (CaseExecutionEntity) caseExecution;
// create event instance
HistoricCaseActivityInstanceEventEntity evt = loadCaseActivityInstanceEventEntity(caseExecutionEntity);
// initialize event
initCaseActivityInstanceEvent(evt, caseExecutionEntity, HistoryEventTypes.CASE_ACTIVITY_INSTANCE_END);
// set end time
evt.setEndTime(ClockUtil.getCurrentTime());
// calculate duration
if (evt.getStartTime() != null) {
evt.setDurationInMillis(evt.getEndTime().getTime() - evt.getStartTime().getTime());
}
return evt;
}
use of org.camunda.bpm.engine.impl.history.event.HistoricCaseActivityInstanceEventEntity in project camunda-bpm-platform by camunda.
the class HistoricCaseActivityInstanceTest method assertHistoricState.
protected void assertHistoricState(String activityId, CaseExecutionState expectedState) {
HistoricCaseActivityInstanceEventEntity historicActivityInstance = (HistoricCaseActivityInstanceEventEntity) queryHistoricActivityCaseInstance(activityId);
int actualStateCode = historicActivityInstance.getCaseActivityInstanceState();
CaseExecutionState actualState = CaseExecutionState.CaseExecutionStateImpl.getStateForCode(actualStateCode);
assertEquals("The state of historic case activity '" + activityId + "' wasn't as expected", expectedState, actualState);
}
use of org.camunda.bpm.engine.impl.history.event.HistoricCaseActivityInstanceEventEntity in project camunda-bpm-platform by camunda.
the class DefaultCmmnHistoryEventProducer method createCaseActivityInstanceUpdateEvt.
public HistoryEvent createCaseActivityInstanceUpdateEvt(DelegateCaseExecution caseExecution) {
final CaseExecutionEntity caseExecutionEntity = (CaseExecutionEntity) caseExecution;
// create event instance
HistoricCaseActivityInstanceEventEntity evt = loadCaseActivityInstanceEventEntity(caseExecutionEntity);
// initialize event
initCaseActivityInstanceEvent(evt, caseExecutionEntity, HistoryEventTypes.CASE_ACTIVITY_INSTANCE_UPDATE);
if (caseExecutionEntity.getTask() != null) {
evt.setTaskId(caseExecutionEntity.getTask().getId());
}
if (caseExecutionEntity.getSubProcessInstance() != null) {
evt.setCalledProcessInstanceId(caseExecutionEntity.getSubProcessInstance().getId());
}
if (caseExecutionEntity.getSubCaseInstance() != null) {
evt.setCalledCaseInstanceId(caseExecutionEntity.getSubCaseInstance().getId());
}
return evt;
}
Aggregations