public ExecutionEntity getProcessInstance() { return execution.getProcessInstance(); }
public void setExecution(PvmExecutionImpl execution) { if (execution!=null) { this.execution = (ExecutionEntity) execution; this.executionId = this.execution.getId(); this.processInstanceId = this.execution.getProcessInstanceId(); this.processDefinitionId = this.execution.getProcessDefinitionId(); // get the process instance ExecutionEntity instance = this.execution.getProcessInstance(); if (instance != null) { // set case instance id on this task this.caseInstanceId = instance.getCaseInstanceId(); } } else { this.execution = null; this.executionId = null; this.processInstanceId = null; this.processDefinitionId = null; this.caseInstanceId = null; } }
public void setExecution(PvmExecutionImpl execution) { if (execution!=null) { this.execution = (ExecutionEntity) execution; this.executionId = this.execution.getId(); this.processInstanceId = this.execution.getProcessInstanceId(); this.processDefinitionId = this.execution.getProcessDefinitionId(); // get the process instance ExecutionEntity instance = this.execution.getProcessInstance(); if (instance != null) { // set case instance id on this task this.caseInstanceId = instance.getCaseInstanceId(); } } else { this.execution = null; this.executionId = null; this.processInstanceId = null; this.processDefinitionId = null; this.caseInstanceId = null; } }
public ExecutionEntity getProcessInstance() { return execution.getProcessInstance(); }
protected List<ExecutionEntity> loadProcessInstance(String processInstanceId, CommandContext commandContext) { List<ExecutionEntity> result = null; // first try to load from cache // check whether the process instance is already (partially) loaded in command context List<ExecutionEntity> cachedExecutions = commandContext.getDbEntityManager().getCachedEntitiesByType(ExecutionEntity.class); for (ExecutionEntity executionEntity : cachedExecutions) { if(processInstanceId.equals(executionEntity.getProcessInstanceId())) { // found one execution from process instance result = new ArrayList<ExecutionEntity>(); ExecutionEntity processInstance = executionEntity.getProcessInstance(); // add process instance result.add(processInstance); loadChildExecutionsFromCache(processInstance, result); break; } } if(result == null) { // if the process instance could not be found in cache, load from database result = loadFromDb(processInstanceId, commandContext); } return result; }
public String getRootProcessInstanceId() { if (isProcessInstanceExecution()) { return rootProcessInstanceId; } else { ExecutionEntity processInstance = getProcessInstance(); return processInstance.rootProcessInstanceId; } }
protected List<ExecutionEntity> loadProcessInstance(String processInstanceId, CommandContext commandContext) { List<ExecutionEntity> result = null; // first try to load from cache // check whether the process instance is already (partially) loaded in command context List<ExecutionEntity> cachedExecutions = commandContext.getDbEntityManager().getCachedEntitiesByType(ExecutionEntity.class); for (ExecutionEntity executionEntity : cachedExecutions) { if(processInstanceId.equals(executionEntity.getProcessInstanceId())) { // found one execution from process instance result = new ArrayList<ExecutionEntity>(); ExecutionEntity processInstance = executionEntity.getProcessInstance(); // add process instance result.add(processInstance); loadChildExecutionsFromCache(processInstance, result); break; } } if(result == null) { // if the process instance could not be found in cache, load from database result = loadFromDb(processInstanceId, commandContext); } return result; }
public String getRootProcessInstanceId() { if (isProcessInstanceExecution()) { return rootProcessInstanceId; } else { ExecutionEntity processInstance = getProcessInstance(); return processInstance.rootProcessInstanceId; } }
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); }
@Override public String getProcessBusinessKey() { return getProcessInstance().getBusinessKey(); }
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); }
@Override public String getProcessBusinessKey() { return getProcessInstance().getBusinessKey(); }
@Override public boolean isDetached() { ExecutionEntity representativeExecution = resolveRepresentativeExecution(); return representativeExecution != representativeExecution.getProcessInstance() && representativeExecution.getParent() == null; }
@Override public boolean isDetached() { ExecutionEntity representativeExecution = resolveRepresentativeExecution(); return representativeExecution != representativeExecution.getProcessInstance() && representativeExecution.getParent() == null; }
/** 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); } } }
public String getRootProcessInstanceId() { if (isProcessInstanceExecution()) { return rootProcessInstanceId; } else { ExecutionEntity processInstance = getProcessInstance(); return processInstance.rootProcessInstanceId; } }
createdExecution.setProcessInstance(getProcessInstance()); createdExecution.setActivity(getActivity()); createdExecution.setSuspensionState(getSuspensionState());
createdExecution.setProcessInstance(getProcessInstance()); createdExecution.setActivity(getActivity()); createdExecution.setSuspensionState(getSuspensionState());
@Override public boolean isDetached() { ExecutionEntity representativeExecution = resolveRepresentativeExecution(); return representativeExecution != representativeExecution.getProcessInstance() && representativeExecution.getParent() == null; }