protected List<ExecutionEntity> fetchExecutionsForProcessInstance(ExecutionEntity execution) { List<ExecutionEntity> executions = new ArrayList<ExecutionEntity>(); executions.addAll(execution.getExecutions()); for (ExecutionEntity child : execution.getExecutions()) { executions.addAll(fetchExecutionsForProcessInstance(child)); } return executions; }
protected static ExecutionTree forExecution(ExecutionEntity execution) { List<ExecutionTree> children = new ArrayList<ExecutionTree>(); for (ExecutionEntity child : execution.getExecutions()) { children.add(ExecutionTree.forExecution(child)); } return new ExecutionTree(execution, children); }
protected ExecutionEntity createMissingTargetFlowScopeExecution( ExecutionEntity parentScopeExecution, PvmActivity targetFlowScope) { ExecutionEntity newParentExecution = parentScopeExecution; if (!parentScopeExecution.getNonEventScopeExecutions().isEmpty() || parentScopeExecution.getActivity() != null) { newParentExecution = (ExecutionEntity) parentScopeExecution.createConcurrentExecution(); } List<PvmActivity> scopesToInstantiate = new ArrayList<PvmActivity>(); scopesToInstantiate.add(targetFlowScope); newParentExecution.createScopes(scopesToInstantiate); ExecutionEntity targetFlowScopeExecution = newParentExecution .getExecutions() .get(0); // TODO: this does not work for more than one scope targetFlowScopeExecution.setActivity(null); return targetFlowScopeExecution; }