@Override public Comment execute(CommandContext commandContext) { for (TaskEntity taskEntity : commandContext.getTaskEntityManager().findTasksByExecutionId(executionId)) { commandContext.getTaskEntityManager().deleteTask(taskEntity, "jump", false); } ExecutionEntity executionEntity = Context.getCommandContext().getExecutionEntityManager().findExecutionById(executionId); ProcessDefinitionImpl processDefinition = executionEntity.getProcessDefinition(); ActivityImpl activity = processDefinition.findActivity(activityId); executionEntity.executeActivity(activity); return null; } }
public Void execute(CommandContext commandContext) { if (processInstanceId == null) { throw new ActivitiIllegalArgumentException("processInstanceId is null"); } ExecutionEntity processInstanceEntity = commandContext.getExecutionEntityManager().findById(processInstanceId); if (processInstanceEntity == null) { throw new ActivitiObjectNotFoundException("No process instance found for id '" + processInstanceId + "'", ProcessInstance.class); } commandContext.getExecutionEntityManager().deleteProcessInstance(processInstanceEntity.getProcessInstanceId(), deleteReason, false); return null; }
protected void deleteProcessInstancesForProcessDefinitions(List<ProcessDefinition> processDefinitions) { for (ProcessDefinition processDefinition : processDefinitions) { getExecutionEntityManager().deleteProcessInstancesByProcessDefinition(processDefinition.getId(), "deleted deployment", true); } }
private ExecutionEntityManager deleteAllChildExecutions(ExecutionEntityManager executionEntityManager, ExecutionEntity scopeExecution) { // Delete all child executions Collection<ExecutionEntity> childExecutions = executionEntityManager.findChildExecutionsByParentExecutionId(scopeExecution.getId()); for (ExecutionEntity childExecution : childExecutions) { executionEntityManager.deleteExecutionAndRelatedData(childExecution, execution.getDeleteReason(), false); } return executionEntityManager; } }
protected void deleteChildExecutions(ExecutionEntity parentExecution, ExecutionEntity notToDeleteExecution, CommandContext commandContext) { // TODO: would be good if this deleteChildExecutions could be removed and the one on the executionEntityManager is used // The problem however, is that the 'notToDeleteExecution' is passed here. // This could be solved by not reusing an execution, but creating a new // Delete all child executions ExecutionEntityManager executionEntityManager = commandContext.getExecutionEntityManager(); Collection<ExecutionEntity> childExecutions = executionEntityManager.findChildExecutionsByParentExecutionId(parentExecution.getId()); if (CollectionUtil.isNotEmpty(childExecutions)) { for (ExecutionEntity childExecution : childExecutions) { if (childExecution.getId().equals(notToDeleteExecution.getId()) == false) { deleteChildExecutions(childExecution, notToDeleteExecution, commandContext); } } } String deleteReason = DeleteReason.BOUNDARY_EVENT_INTERRUPTING + " (" + notToDeleteExecution.getCurrentActivityId() + ")"; if (parentExecution.getCurrentFlowElement() instanceof CallActivity) { ExecutionEntity subProcessExecution = executionEntityManager.findSubProcessInstanceBySuperExecutionId(parentExecution.getId()); if (subProcessExecution != null) { executionEntityManager.deleteProcessInstanceExecutionEntity(subProcessExecution.getId(), subProcessExecution.getCurrentActivityId(), deleteReason, true, true); } } executionEntityManager.deleteExecutionAndRelatedData(parentExecution, deleteReason, false); }
.findExecutionById(executionId); List<ExecutionEntity> childExecutions = commandContext.getExecutionEntityManager().findChildExecutionsByProcessInstanceId(executionId); for (ExecutionEntity childExecution : childExecutions) { if (!childExecution.getId().equals(executionId)) {
List<ExecutionEntity> processInstanceExecutions = executionEntityManager.findChildExecutionsByProcessInstanceId(execution.getProcessInstanceId()); for (ExecutionEntity childExecution : processInstanceExecutions) { if (childExecution.getCurrentFlowElement() != null executionEntityManager.deleteExecutionAndRelatedData(subProcessExecution, deleteReason, false); if (subProcessExecution.getCurrentFlowElement() instanceof Activity) { Activity activity = (Activity) subProcessExecution.getCurrentFlowElement(); if (activity.getLoopCharacteristics() != null) { ExecutionEntity miExecution = subProcessExecution.getParent(); List<ExecutionEntity> miChildExecutions = executionEntityManager.findChildExecutionsByParentExecutionId(miExecution.getId()); for (ExecutionEntity miChildExecution : miChildExecutions) { if (subProcessExecution.getId().equals(miChildExecution.getId()) == false && activity.getId().equals(miChildExecution.getCurrentActivityId())) { executionEntityManager.deleteExecutionAndRelatedData(miChildExecution, deleteReason, false);
protected int getNumberOfActiveChildExecutionsForExecution(ExecutionEntityManager executionEntityManager, String executionId) { List<ExecutionEntity> executions = executionEntityManager.findChildExecutionsByParentExecutionId(executionId); int activeExecutions = 0; // Filter out the boundary events for (ExecutionEntity activeExecution : executions) { if (!(activeExecution.getCurrentFlowElement() instanceof BoundaryEvent)) { activeExecutions++; } } return activeExecutions; }
public long executeCount(CommandContext commandContext, Map<String, Object> parameterMap) { return commandContext.getExecutionEntityManager() // can use execution count, since the result type doesn't matter .findExecutionCountByNativeQuery(parameterMap); }
protected void dispatchExecutionCancelled(DelegateExecution execution, FlowElement terminateEndEvent) { ExecutionEntityManager executionEntityManager = Context.getCommandContext().getExecutionEntityManager(); // subprocesses for (DelegateExecution subExecution : executionEntityManager.findChildExecutionsByParentExecutionId(execution.getId())) { dispatchExecutionCancelled(subExecution, terminateEndEvent); } // call activities ExecutionEntity subProcessInstance = Context.getCommandContext().getExecutionEntityManager().findSubProcessInstanceBySuperExecutionId(execution.getId()); if (subProcessInstance != null) { dispatchExecutionCancelled(subProcessInstance, terminateEndEvent); } // activity with message/signal boundary events FlowElement currentFlowElement = execution.getCurrentFlowElement(); if (currentFlowElement instanceof FlowNode) { dispatchActivityCancelled(execution, terminateEndEvent); } }
Collection<ExecutionEntity> allExecutions = executionEntityManager.findChildExecutionsByProcessInstanceId(execution.getProcessInstanceId()); Iterator<ExecutionEntity> executionIterator = allExecutions.iterator(); boolean oneExecutionCanReachGateway = false; .findInactiveExecutionsByActivityIdAndProcessInstanceId(execution.getCurrentActivityId(), execution.getProcessInstanceId()); for (ExecutionEntity executionEntityInGateway : executionsInGateway) { if (!executionEntityInGateway.getId().equals(execution.getId())) { commandContext.getHistoryManager().recordActivityEnd(executionEntityInGateway, null); executionEntityManager.deleteExecutionAndRelatedData(executionEntityInGateway, null, false);
ExecutionEntity executionEntity = commandContext.getExecutionEntityManager().findById(processInstanceId); commandContext.getExecutionEntityManager().update(executionEntity, false); Collection<ExecutionEntity> childExecutions = commandContext.getExecutionEntityManager().findChildExecutionsByProcessInstanceId(processInstanceId); for (ExecutionEntity childExecution : childExecutions) { if (!childExecution.getId().equals(processInstanceId)) { SuspensionStateUtil.setSuspensionState(childExecution, getNewState()); commandContext.getExecutionEntityManager().update(childExecution, false);
@SuppressWarnings("unchecked") public void deleteProcessInstancesByProcessDefinition(String processDefinitionId, String deleteReason, boolean cascade) { List<String> processInstanceIds = getDbSqlSession() .selectList("selectProcessInstanceIdsByProcessDefinitionId", processDefinitionId); for (String processInstanceId : processInstanceIds) { deleteProcessInstance(processInstanceId, deleteReason, cascade); } if (cascade) { Context .getCommandContext() .getHistoricProcessInstanceEntityManager() .deleteHistoricProcessInstanceByProcessDefinitionId(processDefinitionId); } }
List<ExecutionEntity> childExecutions = executionEntityManager.findChildExecutionsByParentExecutionId(executionEntity.getParentId()); for (ExecutionEntity childExecution : childExecutions) { if (!childExecution.getId().equals(executionEntity.getId())) { executionEntityManager.deleteExecutionAndRelatedData(childExecution, DeleteReason.EVENT_SUBPROCESS_INTERRUPTING + "(" + startEvent.getId() + ")", false); executionEntity.setScope(true); ExecutionEntity outgoingFlowExecution = executionEntityManager.createChildExecution(executionEntity); outgoingFlowExecution.setCurrentFlowElement(startEvent);
public void deleteProcessInstance(String processInstanceId, String deleteReason, boolean cascade) { ExecutionEntity execution = findExecutionById(processInstanceId); if (execution == null) { throw new ActivitiObjectNotFoundException("No process instance found for id '" + processInstanceId + "'", ProcessInstance.class); } deleteProcessInstanceCascade(execution, deleteReason, cascade); }
public long executeCount(CommandContext commandContext) { checkQueryOk(); ensureVariablesInitialized(); return commandContext.getExecutionEntityManager().findExecutionCountByQueryCriteria(this); }
public List<ProcessInstance> executeList(CommandContext commandContext, Map<String, Object> parameterMap, int firstResult, int maxResults) { return commandContext.getExecutionEntityManager().findProcessInstanceByNativeQuery(parameterMap, firstResult, maxResults); }
public List<Execution> executeList(CommandContext commandContext, Map<String, Object> parameterMap, int firstResult, int maxResults) { return commandContext.getExecutionEntityManager().findExecutionsByNativeQuery(parameterMap, firstResult, maxResults); }
@SuppressWarnings({ "unchecked" }) public List<Execution> executeList(CommandContext commandContext, Page page) { checkQueryOk(); ensureVariablesInitialized(); List<?> executions = commandContext.getExecutionEntityManager().findExecutionsByQueryCriteria(this, page); if (Context.getProcessEngineConfiguration().getPerformanceSettings().isEnableLocalization()) { for (ExecutionEntity execution : (List<ExecutionEntity>) executions) { String activityId = null; if (execution.getId().equals(execution.getProcessInstanceId())) { if (execution.getProcessDefinitionId() != null) { ProcessDefinition processDefinition = commandContext.getProcessEngineConfiguration() .getDeploymentManager() .findDeployedProcessDefinitionById(execution.getProcessDefinitionId()); activityId = processDefinition.getKey(); } } else { activityId = execution.getActivityId(); } if (activityId != null) { localize(execution, activityId); } } } return (List<Execution>) executions; }
public void deleteProcessInstance(String processInstanceId, String deleteReason,String bussinessOperation,String bussinessRemark) { deleteProcessInstance(processInstanceId, deleteReason, false, bussinessOperation, bussinessRemark); }