public HistoryEvent createProcessInstanceStartEvt(DelegateExecution execution) {
final ExecutionEntity executionEntity = (ExecutionEntity) execution;
// create event instance
HistoricProcessInstanceEventEntity evt = newProcessInstanceEventEntity(executionEntity);
// initialize event
initProcessInstanceEvent(evt, executionEntity, HistoryEventTypes.PROCESS_INSTANCE_START);
evt.setStartActivityId(executionEntity.getActivityId());
evt.setStartTime(ClockUtil.getCurrentTime());
// set super process instance id
ExecutionEntity superExecution = executionEntity.getSuperExecution();
if (superExecution != null) {
evt.setSuperProcessInstanceId(superExecution.getProcessInstanceId());
}
// set start user Id
evt.setStartUserId(Context.getCommandContext().getAuthenticatedUserId());
return evt;
}