Java Code Examples for org.camunda.bpm.engine.impl.history.event.HistoricProcessInstanceEventEntity#setSuperProcessInstanceId()

The following examples show how to use org.camunda.bpm.engine.impl.history.event.HistoricProcessInstanceEventEntity#setSuperProcessInstanceId() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DefaultHistoryEventProducer.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
protected void initProcessInstanceEvent(HistoricProcessInstanceEventEntity evt, ExecutionEntity execution, HistoryEventType eventType) {

    String processDefinitionId = execution.getProcessDefinitionId();
    String processInstanceId = execution.getProcessInstanceId();
    String executionId = execution.getId();
    // the given execution is the process instance!
    String caseInstanceId = execution.getCaseInstanceId();
    String tenantId = execution.getTenantId();

    ProcessDefinitionEntity definition = execution.getProcessDefinition();
    String processDefinitionKey = null;
    if (definition != null) {
      processDefinitionKey = definition.getKey();
    }

    evt.setId(processInstanceId);
    evt.setEventType(eventType.getEventName());
    evt.setProcessDefinitionKey(processDefinitionKey);
    evt.setProcessDefinitionId(processDefinitionId);
    evt.setProcessInstanceId(processInstanceId);
    evt.setExecutionId(executionId);
    evt.setBusinessKey(execution.getProcessBusinessKey());
    evt.setCaseInstanceId(caseInstanceId);
    evt.setTenantId(tenantId);
    evt.setRootProcessInstanceId(execution.getRootProcessInstanceId());

    if (execution.getSuperCaseExecution() != null) {
      evt.setSuperCaseInstanceId(execution.getSuperCaseExecution().getCaseInstanceId());
    }
    if (execution.getSuperExecution() != null) {
      evt.setSuperProcessInstanceId(execution.getSuperExecution().getProcessInstanceId());
    }
  }
 
Example 2
Source File: DefaultHistoryEventProducer.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
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());
  }

  //state
  evt.setState(HistoricProcessInstance.STATE_ACTIVE);

  // set start user Id
  evt.setStartUserId(Context.getCommandContext().getAuthenticatedUserId());

  if (isHistoryRemovalTimeStrategyStart()) {
    if (isRootProcessInstance(evt)) {
      Date removalTime = calculateRemovalTime(evt);
      evt.setRemovalTime(removalTime);
    } else {
      provideRemovalTime(evt);
    }
  }

  return evt;
}