protected List<String> gatherCompletedFlows(Set<String> completedActivityInstances, Set<String> currentActivityinstances, BpmnModel pojoModel) { List<String> completedFlows = new ArrayList<>(); List<String> activities = new ArrayList<>(completedActivityInstances); activities.addAll(currentActivityinstances); // TODO: not a robust way of checking when parallel paths are active, should be revisited // Go over all activities and check if it's possible to match any outgoing paths against the activities for (FlowElement activity : pojoModel.getMainProcess().getFlowElements()) { if (activity instanceof FlowNode) { int index = activities.indexOf(activity.getId()); if (index >= 0 && index + 1 < activities.size()) { List<SequenceFlow> outgoingFlows = ((FlowNode) activity).getOutgoingFlows(); for (SequenceFlow flow : outgoingFlows) { String destinationFlowId = flow.getTargetRef(); if (destinationFlowId.equals(activities.get(index + 1))) { completedFlows.add(flow.getId()); } } } } } return completedFlows; } }
protected List<String> gatherCompletedFlows(List<String> completedActivityInstances, List<String> currentActivityinstances, BpmnModel pojoModel) { List<String> completedFlows = new ArrayList<>(); List<String> activities = new ArrayList<>(completedActivityInstances); if (currentActivityinstances != null) { activities.addAll(currentActivityinstances); } // TODO: not a robust way of checking when parallel paths are active, should be revisited // Go over all activities and check if it's possible to match any outgoing paths against the activities for (FlowElement activity : pojoModel.getMainProcess().getFlowElements()) { if (activity instanceof FlowNode) { int index = activities.indexOf(activity.getId()); if (index >= 0 && index + 1 < activities.size()) { List<SequenceFlow> outgoingFlows = ((FlowNode) activity).getOutgoingFlows(); for (SequenceFlow flow : outgoingFlows) { String destinationFlowId = flow.getTargetRef(); if (destinationFlowId.equals(activities.get(index + 1))) { completedFlows.add(flow.getId()); } } } } } return completedFlows; }
protected FlowElement resolveFlowElementFromBpmnModel(BpmnModel bpmnModel, String activityId) { FlowElement flowElement = bpmnModel.getFlowElement(activityId); if (flowElement == null) { throw new FlowableException("Cannot find activity '" + activityId + "' in process definition with id '" + bpmnModel.getMainProcess().getId() + "'"); } return flowElement; } //-- Move container preparation section end
protected List<FormDefinition> getFormDefinitionsFromModel(BpmnModel bpmnModel, ProcessDefinition processDefinition) { Set<String> formKeys = new HashSet<>(); List<FormDefinition> formDefinitions = new ArrayList<>(); // for all start events List<StartEvent> startEvents = bpmnModel.getMainProcess().findFlowElementsOfType(StartEvent.class, true); for (StartEvent startEvent : startEvents) { if (StringUtils.isNotEmpty(startEvent.getFormKey())) { formKeys.add(startEvent.getFormKey()); } } // for all user tasks List<UserTask> userTasks = bpmnModel.getMainProcess().findFlowElementsOfType(UserTask.class, true); for (UserTask userTask : userTasks) { if (StringUtils.isNotEmpty(userTask.getFormKey())) { formKeys.add(userTask.getFormKey()); } } for (String formKey : formKeys) { addFormDefinitionToCollection(formDefinitions, formKey, processDefinition); } return formDefinitions; }
protected List<DmnDecisionTable> getDecisionTablesFromModel(BpmnModel bpmnModel, ProcessDefinition processDefinition) { Set<String> decisionTableKeys = new HashSet<>(); List<DmnDecisionTable> decisionTables = new ArrayList<>(); List<ServiceTask> serviceTasks = bpmnModel.getMainProcess().findFlowElementsOfType(ServiceTask.class, true); for (ServiceTask serviceTask : serviceTasks) { if ("dmn".equals(serviceTask.getType())) { if (serviceTask.getFieldExtensions() != null && serviceTask.getFieldExtensions().size() > 0) { for (FieldExtension fieldExtension : serviceTask.getFieldExtensions()) { if ("decisionTableReferenceKey".equals(fieldExtension.getFieldName())) { String decisionTableReferenceKey = fieldExtension.getStringValue(); if (!decisionTableKeys.contains(decisionTableReferenceKey)) { addDecisionTableToCollection(decisionTables, decisionTableReferenceKey, processDefinition); decisionTableKeys.add(decisionTableReferenceKey); } break; } } } } } return decisionTables; }
throw new IllegalStateException("No flow element with id " + elementId + " found in bpmnmodel " + bpmnModel.getMainProcess().getId());
processId = "Collaboration"; } else { processId = model.getMainProcess().getId();
mappingModel = ProcessDefinitionUtil.getBpmnModel(mappingProcDef.getId()); } catch (FlowableException e) { validationResult.addValidationMessage(e.getMessage() + " for call activity element with id '" + mapping.getToCallActivityId() + "' in the process definition with id '" + mappingModel.getMainProcess().getId() + "'"); continue; validationResult.addValidationMessage("There's no call activity element with id '" + mapping.getToCallActivityId() + "' in the process definition with id '" + mappingModel.getMainProcess().getId() + "'"); continue; for (String targetActivityId : toActivityIds) { if (!isActivityIdInProcessDefinitionModel(targetActivityId, mappingModel)) { validationResult.addValidationMessage("Invalid mapping for '" + execution.getCurrentActivityId() + "' to '" + targetActivityId + "', cannot be found in the process definition with id '" + mappingModel.getMainProcess().getId() + "'"); continue; Optional<String> targetFlowElementMultiInstanceParentId = getFlowElementMultiInstanceParentId(targetFlowElement); if (targetFlowElementMultiInstanceParentId.isPresent()) { validationResult.addValidationMessage("Invalid mapping for '" + execution.getCurrentActivityId() + "' to '" + targetActivityId + "', cannot migrate arbitrarily inside a Multi Instance container '" + targetFlowElementMultiInstanceParentId.get() + "' inside process definition with id '" + mappingModel.getMainProcess().getId() + "'"); continue;
mainProcess = model.getProcess(model.getPools().get(0).getId()); } else { mainProcess = model.getMainProcess(); processFlowElements(model.getMainProcess(), model, shapesArrayNode, formKeyMap, decisionTableKeyMap, 0.0, 0.0); processMessageFlows(model, shapesArrayNode);
for (Artifact artifact : model.getMainProcess().getArtifacts()) { if (artifact instanceof Association){ Association association= (Association) artifact;
ValuedDataObject foundDataObject = null; if (executionEntity.getParentId() == null) { for (ValuedDataObject dataObject : bpmnModel.getMainProcess().getDataObjects()) { if (dataObject.getName().equals(variableEntity.getName())) { foundDataObject = dataObject;
ValuedDataObject foundDataObject = null; if (executionEntity.getParentId() == null) { for (ValuedDataObject dataObject : bpmnModel.getMainProcess().getDataObjects()) { if (dataObject.getName().equals(variableEntity.getName())) { foundDataObject = dataObject;
ValuedDataObject foundDataObject = null; if (executionEntity.getParentId() == null) { for (ValuedDataObject dataObjectDefinition : bpmnModel.getMainProcess().getDataObjects()) { if (dataObjectDefinition.getName().equals(variableEntity.getName())) { foundDataObject = dataObjectDefinition;
ValuedDataObject foundDataObject = null; if (executionEntity.getParentId() == null) { for (ValuedDataObject dataObjectDefinition : bpmnModel.getMainProcess().getDataObjects()) { if (dataObjectDefinition.getName().equals(variableEntity.getName())) { foundDataObject = dataObjectDefinition;
@Override protected void updateExecutions(CommandContext commandContext, ProcessDefinitionEntity processDefinitionEntity, ExecutionEntity processInstance, List<ExecutionEntity> childExecutions) { ExecutionEntityManager executionEntityManager = CommandContextUtil.getExecutionEntityManager(commandContext); TaskEntity taskEntity = CommandContextUtil.getTaskService().getTask(taskId); ExecutionEntity executionAtTask = executionEntityManager.findById(taskEntity.getExecutionId()); BpmnModel bpmnModel = ProcessDefinitionUtil.getBpmnModel(processDefinitionEntity.getId()); FlowElement taskElement = bpmnModel.getFlowElement(executionAtTask.getCurrentActivityId()); FlowElement subProcessElement = bpmnModel.getFlowElement(((SubProcess) taskElement.getParentContainer()).getId()); ExecutionEntity subProcessExecution = executionEntityManager.createChildExecution(executionAtTask.getParent()); subProcessExecution.setScope(true); subProcessExecution.setCurrentFlowElement(subProcessElement); CommandContextUtil.getActivityInstanceEntityManager(commandContext).recordActivityStart(subProcessExecution); executionAtTask.setParent(subProcessExecution); ExecutionEntity execution = executionEntityManager.createChildExecution(subProcessExecution); FlowElement newSubProcess = bpmnModel.getMainProcess().getFlowElement(dynamicEmbeddedSubProcessBuilder.getDynamicSubProcessId(), true); execution.setCurrentFlowElement(newSubProcess); CommandContextUtil.getAgenda().planContinueProcessOperation(execution); }
.findResourceByDeploymentIdAndResourceName(subProcessDefinition.getDeploymentId(), subProcessDefinition.getResourceName()); BpmnModel bpmnModelSubProcess = new BpmnXMLConverter().convertToBpmnModel(new BytesStreamSource(subProcessBpmnResource.getBytes()), false, false); for (FlowElement flowElement : bpmnModelSubProcess.getMainProcess().getFlowElements()) { subProcess.addFlowElement(flowElement);
.findResourceByDeploymentIdAndResourceName(subProcessDefinition.getDeploymentId(), subProcessDefinition.getResourceName()); BpmnModel bpmnModelSubProcess = new BpmnXMLConverter().convertToBpmnModel(new BytesStreamSource(subProcessBpmnResource.getBytes()), false, false); for (FlowElement flowElement : bpmnModelSubProcess.getMainProcess().getFlowElements()) { subProcess.addFlowElement(flowElement);