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;
}