public HistoryEvent createCaseInstanceCreateEvt(DelegateCaseExecution caseExecution) {
final CaseExecutionEntity caseExecutionEntity = (CaseExecutionEntity) caseExecution;
// create event instance
HistoricCaseInstanceEventEntity evt = newCaseInstanceEventEntity(caseExecutionEntity);
// initialize event
initCaseInstanceEvent(evt, caseExecutionEntity, HistoryEventTypes.CASE_INSTANCE_CREATE);
// set create time
evt.setCreateTime(ClockUtil.getCurrentTime());
// set create user id
evt.setCreateUserId(Context.getCommandContext().getAuthenticatedUserId());
// set super case instance id
CmmnExecution superCaseExecution = caseExecutionEntity.getSuperCaseExecution();
if (superCaseExecution != null) {
evt.setSuperCaseInstanceId(superCaseExecution.getCaseInstanceId());
}
return evt;
}