protected ExecutionEntity findSuperExecution(ExecutionEntity parentScopeExecution, ExecutionEntity topmostCancellableExecution){ ExecutionEntity superExecution = null; if(parentScopeExecution == null) { superExecution = topmostCancellableExecution.getSuperExecution(); } return superExecution; }
protected ExecutionEntity findSuperExecution(ExecutionEntity parentScopeExecution, ExecutionEntity topmostCancellableExecution){ ExecutionEntity superExecution = null; if(parentScopeExecution == null) { superExecution = topmostCancellableExecution.getSuperExecution(); } return superExecution; }
@Override public void start(Map<String, Object> variables) { if (getSuperExecution() == null) { setRootProcessInstanceId(processInstanceId); } else { ExecutionEntity superExecution = getSuperExecution(); setRootProcessInstanceId(superExecution.getRootProcessInstanceId()); } // determine tenant Id if null provideTenantId(variables); super.start(variables); }
@Override public void start(Map<String, Object> variables) { if (getSuperExecution() == null) { setRootProcessInstanceId(processInstanceId); } else { ExecutionEntity superExecution = getSuperExecution(); setRootProcessInstanceId(superExecution.getRootProcessInstanceId()); } // determine tenant Id if null provideTenantId(variables); super.start(variables); }
protected void remove(boolean resolved) { ExecutionEntity execution = getExecution(); if(execution != null) { // Extract possible super execution of the assigned execution ExecutionEntity superExecution = null; if (execution.getId().equals(execution.getProcessInstanceId())) { superExecution = execution.getSuperExecution(); } else { superExecution = execution.getProcessInstance().getSuperExecution(); } if (superExecution != null) { // get the incident, where this incident is the cause IncidentEntity parentIncident = superExecution.getIncidentByCauseIncidentId(getId()); if (parentIncident != null) { // remove the incident parentIncident.remove(resolved); } } // remove link to execution execution.removeIncident(this); } // always delete the incident Context .getCommandContext() .getDbEntityManager() .delete(this); // update historic incident HistoryEventType eventType = resolved ? HistoryEventTypes.INCIDENT_RESOLVE : HistoryEventTypes.INCIDENT_DELETE; fireHistoricIncidentEvent(eventType); }
protected void remove(boolean resolved) { ExecutionEntity execution = getExecution(); if(execution != null) { // Extract possible super execution of the assigned execution ExecutionEntity superExecution = null; if (execution.getId().equals(execution.getProcessInstanceId())) { superExecution = execution.getSuperExecution(); } else { superExecution = execution.getProcessInstance().getSuperExecution(); } if (superExecution != null) { // get the incident, where this incident is the cause IncidentEntity parentIncident = superExecution.getIncidentByCauseIncidentId(getId()); if (parentIncident != null) { // remove the incident parentIncident.remove(resolved); } } // remove link to execution execution.removeIncident(this); } // always delete the incident Context .getCommandContext() .getDbEntityManager() .delete(this); // update historic incident HistoryEventType eventType = resolved ? HistoryEventTypes.INCIDENT_RESOLVE : HistoryEventTypes.INCIDENT_DELETE; fireHistoricIncidentEvent(eventType); }
protected ExecutionEntity findSuperExecution(ExecutionEntity parentScopeExecution, ExecutionEntity topmostCancellableExecution){ ExecutionEntity superExecution = null; if(parentScopeExecution == null) { superExecution = topmostCancellableExecution.getSuperExecution(); } return superExecution; }
protected void provideTenantId(Map<String, Object> variables) { if (tenantId == null) { TenantIdProvider tenantIdProvider = Context.getProcessEngineConfiguration().getTenantIdProvider(); if (tenantIdProvider != null) { VariableMap variableMap = Variables.fromMap(variables); ProcessDefinition processDefinition = getProcessDefinition(); TenantIdProviderProcessInstanceContext ctx; if (superExecutionId != null) { ctx = new TenantIdProviderProcessInstanceContext(processDefinition, variableMap, getSuperExecution()); } else if (superCaseExecutionId != null) { ctx = new TenantIdProviderProcessInstanceContext(processDefinition, variableMap, getSuperCaseExecution()); } else { ctx = new TenantIdProviderProcessInstanceContext(processDefinition, variableMap); } tenantId = tenantIdProvider.provideTenantIdForProcessInstance(ctx); } } }
public static void handleChildRemovalInScope(ExecutionEntity removedExecution) { ActivityImpl activity = removedExecution.getActivity(); if (activity == null) { if (removedExecution.getSuperExecution() != null) { removedExecution = removedExecution.getSuperExecution(); activity = removedExecution.getActivity(); if (activity == null) {
public static void handleChildRemovalInScope(ExecutionEntity removedExecution) { ActivityImpl activity = removedExecution.getActivity(); if (activity == null) { if (removedExecution.getSuperExecution() != null) { removedExecution = removedExecution.getSuperExecution(); activity = removedExecution.getActivity(); if (activity == null) {
protected void provideTenantId(Map<String, Object> variables) { if (tenantId == null) { TenantIdProvider tenantIdProvider = Context.getProcessEngineConfiguration().getTenantIdProvider(); if (tenantIdProvider != null) { VariableMap variableMap = Variables.fromMap(variables); ProcessDefinition processDefinition = getProcessDefinition(); TenantIdProviderProcessInstanceContext ctx; if (superExecutionId != null) { ctx = new TenantIdProviderProcessInstanceContext(processDefinition, variableMap, getSuperExecution()); } else if (superCaseExecutionId != null) { ctx = new TenantIdProviderProcessInstanceContext(processDefinition, variableMap, getSuperCaseExecution()); } else { ctx = new TenantIdProviderProcessInstanceContext(processDefinition, variableMap); } tenantId = tenantIdProvider.provideTenantIdForProcessInstance(ctx); } } }
/** Instantiate recursive a new incident a super execution * (i.e. super process instance) which is affected from this * incident. * For example: a super process instance called via CallActivity * a new process instance on which an incident happened, so that * the super process instance has an incident too. */ protected void createRecursiveIncidents(String rootCauseIncidentId, List<IncidentEntity> createdIncidents) { final ExecutionEntity execution = getExecution(); if(execution != null) { ExecutionEntity superExecution = execution.getProcessInstance().getSuperExecution(); if (superExecution != null) { // create a new incident IncidentEntity newIncident = create(incidentType); newIncident.setExecution(superExecution); newIncident.setActivityId(superExecution.getCurrentActivityId()); newIncident.setProcessDefinitionId(superExecution.getProcessDefinitionId()); newIncident.setTenantId(superExecution.getTenantId()); // set cause and root cause newIncident.setCauseIncidentId(id); newIncident.setRootCauseIncidentId(rootCauseIncidentId); // insert new incident (and create a new historic incident) insert(newIncident); // add new incident to result set createdIncidents.add(newIncident); newIncident.createRecursiveIncidents(rootCauseIncidentId, createdIncidents); } } }
/** Instantiate recursive a new incident a super execution * (i.e. super process instance) which is affected from this * incident. * For example: a super process instance called via CallActivity * a new process instance on which an incident happened, so that * the super process instance has an incident too. */ protected void createRecursiveIncidents(String rootCauseIncidentId, List<IncidentEntity> createdIncidents) { final ExecutionEntity execution = getExecution(); if(execution != null) { ExecutionEntity superExecution = execution.getProcessInstance().getSuperExecution(); if (superExecution != null) { // create a new incident IncidentEntity newIncident = create(incidentType); newIncident.setExecution(superExecution); newIncident.setActivityId(superExecution.getCurrentActivityId()); newIncident.setProcessDefinitionId(superExecution.getProcessDefinitionId()); newIncident.setTenantId(superExecution.getTenantId()); // set cause and root cause newIncident.setCauseIncidentId(id); newIncident.setRootCauseIncidentId(rootCauseIncidentId); // insert new incident (and create a new historic incident) insert(newIncident); // add new incident to result set createdIncidents.add(newIncident); newIncident.createRecursiveIncidents(rootCauseIncidentId, createdIncidents); } } }
final ExecutionEntity superExecution = execution.getSuperExecution(); if (superExecution != null) { commandContext.runWithoutAuthorization(new Callable<Void>() {
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()); } }
final ExecutionEntity superExecution = execution.getSuperExecution(); if (superExecution != null) { commandContext.runWithoutAuthorization(new Callable<Void>() {
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()); } }
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; }
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; }
@Override public void start(Map<String, Object> variables) { if (getSuperExecution() == null) { setRootProcessInstanceId(processInstanceId); } else { ExecutionEntity superExecution = getSuperExecution(); setRootProcessInstanceId(superExecution.getRootProcessInstanceId()); } // determine tenant Id if null provideTenantId(variables); super.start(variables); }