Refine search
public ObjectNode getSummary() { ObjectNode summary = objectMapper.createObjectNode(); for (Process process : bpmnModel.getProcesses()) { for (FlowElement flowElement : process.getFlowElements()) { summary.set(flowElement.getId(), getElement(flowElement.getId())); } } return summary; }
xtw.writeAttribute(ATTRIBUTE_ID, process.getId()); if (StringUtils.isNotEmpty(process.getName())) { xtw.writeAttribute(ATTRIBUTE_NAME, process.getName()); xtw.writeAttribute(ATTRIBUTE_PROCESS_EXECUTABLE, Boolean.toString(process.isExecutable())); if (!process.getCandidateStarterUsers().isEmpty()) { xtw.writeAttribute(FLOWABLE_EXTENSIONS_PREFIX, FLOWABLE_EXTENSIONS_NAMESPACE, ATTRIBUTE_PROCESS_CANDIDATE_USERS, BpmnXMLUtil.convertToDelimitedString(process.getCandidateStarterUsers())); if (!process.getCandidateStarterGroups().isEmpty()) { xtw.writeAttribute(FLOWABLE_EXTENSIONS_PREFIX, FLOWABLE_EXTENSIONS_NAMESPACE, ATTRIBUTE_PROCESS_CANDIDATE_GROUPS, BpmnXMLUtil.convertToDelimitedString(process.getCandidateStarterGroups())); if (process.isEnableEagerExecutionTreeFetching()) { xtw.writeAttribute(FLOWABLE_EXTENSIONS_PREFIX, FLOWABLE_EXTENSIONS_NAMESPACE, ATTRIBUTE_PROCESS_EAGER_EXECUTION_FETCHING, "true"); BpmnXMLUtil.writeCustomAttributes(process.getAttributes().values(), xtw, defaultProcessAttributes); if (StringUtils.isNotEmpty(process.getDocumentation())) { xtw.writeCharacters(process.getDocumentation()); xtw.writeEndElement();
@Override protected void executeValidation(BpmnModel bpmnModel, Process process, List<ValidationError> errors) { // Gather data objects List<ValuedDataObject> allDataObjects = new ArrayList<>(); allDataObjects.addAll(process.getDataObjects()); List<SubProcess> subProcesses = process.findFlowElementsOfType(SubProcess.class, true); for (SubProcess subProcess : subProcesses) { allDataObjects.addAll(subProcess.getDataObjects()); } // Validate for (ValuedDataObject dataObject : allDataObjects) { if (StringUtils.isEmpty(dataObject.getName())) { addError(errors, Problems.DATA_OBJECT_MISSING_NAME, process, dataObject, "Name is mandatory for a data object"); } } }
public FlowElement getFlowElement(String id) { FlowElement foundFlowElement = null; for (Process process : processes) { foundFlowElement = process.getFlowElement(id); if (foundFlowElement != null) { break; } } if (foundFlowElement == null) { for (Process process : processes) { for (FlowElement flowElement : process.findFlowElementsOfType(SubProcess.class)) { foundFlowElement = getFlowElementInSubProcess(id, (SubProcess) flowElement); if (foundFlowElement != null) { break; } } if (foundFlowElement != null) { break; } } } return foundFlowElement; }
public Artifact getArtifact(String id) { Artifact foundArtifact = null; for (Process process : processes) { foundArtifact = process.getArtifact(id); if (foundArtifact != null) { break; } } if (foundArtifact == null) { for (Process process : processes) { for (FlowElement flowElement : process.findFlowElementsOfType(SubProcess.class)) { foundArtifact = getArtifactInSubProcess(id, (SubProcess) flowElement); if (foundArtifact != null) { break; } } if (foundArtifact != null) { break; } } } return foundArtifact; }
@SuppressWarnings("unchecked") public <FlowElementType extends FlowElement> List<FlowElementType> findFlowElementsOfType(Class<FlowElementType> type, boolean goIntoSubprocesses) { List<FlowElementType> foundFlowElements = new ArrayList<>(); for (FlowElement flowElement : this.getFlowElements()) { if (type.isInstance(flowElement)) { foundFlowElements.add((FlowElementType) flowElement); } if (flowElement instanceof SubProcess) { if (goIntoSubprocesses) { foundFlowElements.addAll(findFlowElementsInSubProcessOfType((SubProcess) flowElement, type)); } } } return foundFlowElements; }
@Override protected void executeValidation(BpmnModel bpmnModel, Process process, List<ValidationError> errors) { List<SendTask> sendTasks = process.findFlowElementsOfType(SendTask.class); for (SendTask sendTask : sendTasks) { // Verify implementation if (StringUtils.isEmpty(sendTask.getType()) && !ImplementationType.IMPLEMENTATION_TYPE_WEBSERVICE.equalsIgnoreCase(sendTask.getImplementationType())) { addError(errors, Problems.SEND_TASK_INVALID_IMPLEMENTATION, process, sendTask, "One of the attributes 'type' or 'operation' is mandatory on sendTask"); } // Verify type if (StringUtils.isNotEmpty(sendTask.getType())) { if (!sendTask.getType().equalsIgnoreCase("mail") && !sendTask.getType().equalsIgnoreCase("mule") && !sendTask.getType().equalsIgnoreCase("camel")) { addError(errors, Problems.SEND_TASK_INVALID_TYPE, process, sendTask, "Invalid or unsupported type for send task"); } if (sendTask.getType().equalsIgnoreCase("mail")) { validateFieldDeclarationsForEmail(process, sendTask, sendTask.getFieldExtensions(), errors); } } // Web service verifyWebservice(bpmnModel, process, sendTask, errors); } }
for (JsonNode eventNode : eventsNode) { JsonNode eventValueNode = eventNode.get(PROPERTY_EVENTLISTENER_EVENT); if (eventValueNode != null && !eventValueNode.isNull() && StringUtils.isNotEmpty(eventValueNode.asText())) { if (eventsBuilder.length() > 0) { eventsBuilder.append(","); if ("error".equalsIgnoreCase(rethrowTypeNode.asText())) { String errorCode = getValueAsString("errorcode", listenerNode); if (StringUtils.isNotEmpty(errorCode)) { listener.setImplementationType(ImplementationType.IMPLEMENTATION_TYPE_THROW_ERROR_EVENT); listener.setImplementation(errorCode); if (StringUtils.isNotEmpty(messageName)) { listener.setImplementationType(ImplementationType.IMPLEMENTATION_TYPE_THROW_MESSAGE_EVENT); listener.setImplementation(messageName); process.getEventListeners().add(listener);
if (!StringUtils.isEmpty(callActivity.getBusinessKey())) { Expression expression = expressionManager.createExpression(callActivity.getBusinessKey()); businessKey = expression.getValue(parentExecution).toString(); subProcessInstance.setVariables(processDataObjects(subProcess.getDataObjects())); if (StringUtils.isNotEmpty(ioParameter.getSourceExpression())) { Expression expression = expressionManager.createExpression(ioParameter.getSourceExpression().trim()); value = expression.getValue(parentExecution);
FlowElement initialFlowElement = subProcess.getInitialFlowElement(); if (initialFlowElement == null) { throw new FlowableException("No start element found for process definition " + processDefinition.getId()); if (!StringUtils.isEmpty(callActivity.getBusinessKey())) { Expression expression = expressionManager.createExpression(callActivity.getBusinessKey()); businessKey = expression.getValue(execution).toString(); processDefinition, executionEntity, businessKey, initialFlowElement.getId()); CommandContextUtil.getActivityInstanceEntityManager(commandContext).recordSubProcessInstanceStart(executionEntity, subProcessInstance); subProcessInstance.setVariables(processDataObjects(subProcess.getDataObjects())); if (StringUtils.isNotEmpty(ioParameter.getSourceExpression())) { Expression expression = expressionManager.createExpression(ioParameter.getSourceExpression().trim()); value = expression.getValue(execution); if (StringUtils.isNotEmpty(callActivity.getProcessInstanceName())) { Expression processInstanceNameExpression = expressionManager.createExpression(callActivity.getProcessInstanceName()); processInstanceName = processInstanceNameExpression.getValue(subProcessInstance).toString();
if (StringUtils.isNotEmpty(mainProcess.getId())) { propertiesNode.put(PROPERTY_PROCESS_ID, mainProcess.getId()); if (StringUtils.isNotEmpty(mainProcess.getName())) { propertiesNode.put(PROPERTY_NAME, mainProcess.getName()); if (StringUtils.isNotEmpty(mainProcess.getDocumentation())) { propertiesNode.put(PROPERTY_DOCUMENTATION, mainProcess.getDocumentation()); if (!mainProcess.isExecutable()) { propertiesNode.put(PROPERTY_IS_EXECUTABLE, "false"); if (CollectionUtils.isNotEmpty(mainProcess.getCandidateStarterGroups())) { propertiesNode.put(PROPERTY_PROCESS_POTENTIALSTARTERGROUP, StringUtils.join(mainProcess.getCandidateStarterGroups(), ",")); if (CollectionUtils.isNotEmpty(mainProcess.getCandidateStarterUsers())) { propertiesNode.put(PROPERTY_PROCESS_POTENTIALSTARTERUSER, StringUtils.join(mainProcess.getCandidateStarterUsers(), ",")); if (mainProcess.getExtensionElements().containsKey("historyLevel")) { List<ExtensionElement> historyExtensionElements = mainProcess.getExtensionElements().get("historyLevel"); if (historyExtensionElements != null && historyExtensionElements.size() > 0) { String historyLevel = historyExtensionElements.get(0).getElementText(); propertiesNode.put(PROPERTY_IS_EAGER_EXECUTION_FETCHING, Boolean.valueOf(mainProcess.isEnableEagerExecutionTreeFetching())); BpmnJsonConverterUtil.convertListenersToJson(mainProcess.getExecutionListeners(), true, propertiesNode); BpmnJsonConverterUtil.convertEventListenersToJson(mainProcess.getEventListeners(), propertiesNode); BpmnJsonConverterUtil.convertSignalDefinitionsToJson(model, propertiesNode); BpmnJsonConverterUtil.convertMessagesToJson(model, propertiesNode);
@Override protected void executeValidation(BpmnModel bpmnModel, Process process, List<ValidationError> errors) { List<ScriptTask> scriptTasks = process.findFlowElementsOfType(ScriptTask.class); for (ScriptTask scriptTask : scriptTasks) { if (StringUtils.isEmpty(scriptTask.getScript())) { addError(errors, Problems.SCRIPT_TASK_MISSING_SCRIPT, process, scriptTask, "No script provided for script task"); } } }
@Override protected void executeValidation(BpmnModel bpmnModel, Process process, List<ValidationError> errors) { List<SequenceFlow> sequenceFlows = process.findFlowElementsOfType(SequenceFlow.class); for (SequenceFlow sequenceFlow : sequenceFlows) { String targetRef = sequenceFlow.getTargetRef(); if (StringUtils.isEmpty(sourceRef)) { addError(errors, Problems.SEQ_FLOW_INVALID_SRC, process, sequenceFlow, "Invalid source for sequenceflow"); if (StringUtils.isEmpty(targetRef)) { addError(errors, Problems.SEQ_FLOW_INVALID_TARGET, process, sequenceFlow, "Invalid target for sequenceflow"); FlowElement source = process.getFlowElement(sourceRef, true); FlowElement target = process.getFlowElement(targetRef, true); FlowElementsContainer sourceContainer = process.getFlowElementsContainer(source.getId()); FlowElementsContainer targetContainer = process.getFlowElementsContainer(target.getId());
public Process getProcess(String poolRef) { for (Process process : processes) { boolean foundPool = false; for (Pool pool : pools) { if (StringUtils.isNotEmpty(pool.getProcessRef()) && pool.getProcessRef().equalsIgnoreCase(process.getId())) { if (poolRef != null) { if (pool.getId().equalsIgnoreCase(poolRef)) { foundPool = true; } } else { foundPool = true; } } } if (poolRef == null && !foundPool) { return process; } else if (poolRef != null && foundPool) { return process; } } return null; }
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; }
public void parse(XMLStreamReader xtr, Process activeProcess) throws Exception { String resourceElement = XMLStreamReaderUtil.moveDown(xtr); if (StringUtils.isNotEmpty(resourceElement) && "resourceAssignmentExpression".equals(resourceElement)) { String expression = XMLStreamReaderUtil.moveDown(xtr); if (StringUtils.isNotEmpty(expression) && "formalExpression".equals(expression)) { List<String> assignmentList = new ArrayList<>(); String assignmentText = xtr.getElementText(); if (assignmentValue.startsWith(userPrefix)) { assignmentValue = assignmentValue.substring(userPrefix.length(), assignmentValue.length() - 1).trim(); activeProcess.getCandidateStarterUsers().add(assignmentValue); } else if (assignmentValue.startsWith(groupPrefix)) { assignmentValue = assignmentValue.substring(groupPrefix.length(), assignmentValue.length() - 1).trim(); activeProcess.getCandidateStarterGroups().add(assignmentValue); } else { activeProcess.getCandidateStarterGroups().add(assignmentValue);
public static void writeLanes(Process process, XMLStreamWriter xtw) throws Exception { if (!process.getLanes().isEmpty()) { xtw.writeStartElement(ELEMENT_LANESET); xtw.writeAttribute(ATTRIBUTE_ID, "laneSet_" + process.getId()); for (Lane lane : process.getLanes()) { xtw.writeStartElement(ELEMENT_LANE); xtw.writeAttribute(ATTRIBUTE_ID, lane.getId()); if (StringUtils.isNotEmpty(lane.getName())) { xtw.writeAttribute(ATTRIBUTE_NAME, lane.getName()); } boolean didWriteExtensionStartElement = BpmnXMLUtil.writeExtensionElements(lane, false, xtw); if (didWriteExtensionStartElement) { xtw.writeEndElement(); } for (String flowNodeRef : lane.getFlowReferences()) { xtw.writeStartElement(ELEMENT_FLOWNODE_REF); xtw.writeCharacters(flowNodeRef); xtw.writeEndElement(); } xtw.writeEndElement(); } xtw.writeEndElement(); } } }
Process process = new Process(); process.setId(pool.getProcessRef()); process.setName(pool.getName()); process.setExecutable(pool.isExecutable()); process.setEnableEagerExecutionTreeFetching(JsonConverterUtil.getPropertyValueAsBoolean(PROPERTY_IS_EAGER_EXECUTION_FETCHING, shapeNode, false)); process.setDataObjects(dataObjects); process.getFlowElements().addAll(dataObjects); lane.setName(JsonConverterUtil.getPropertyValueAsString(PROPERTY_NAME, laneNode)); lane.setParentProcess(process); process.getLanes().add(lane); Process process = new Process(); bpmnModel.getProcesses().add(process); process.setId(BpmnJsonConverterUtil.getPropertyValueAsString(PROPERTY_PROCESS_ID, modelNode)); process.setName(BpmnJsonConverterUtil.getPropertyValueAsString(PROPERTY_NAME, modelNode)); String namespace = BpmnJsonConverterUtil.getPropertyValueAsString(PROPERTY_PROCESS_NAMESPACE, modelNode); if (StringUtils.isNotEmpty(namespace)) { process.setDocumentation(BpmnJsonConverterUtil.getPropertyValueAsString(PROPERTY_DOCUMENTATION, modelNode)); process.setExecutable(JsonConverterUtil.getPropertyValueAsBoolean(PROPERTY_IS_EXECUTABLE, modelNode)); historyExtensionElement.setNamespacePrefix("flowable"); historyExtensionElement.setElementText(historyLevel); process.addExtensionElement(historyExtensionElement); process.setDataObjects(dataObjects);
activeSubProcessList.get(activeSubProcessList.size() - 1).addArtifact(currentArtifact); activeProcess.addArtifact(currentArtifact); currentFlowElement.setId(elementId); currentFlowElement.setName(elementName); if (StringUtils.isNotEmpty(defaultFlow)) { activity.setDefaultFlow(defaultFlow); if (StringUtils.isNotEmpty(defaultFlow)) { gateway.setDefaultFlow(defaultFlow); if (!activeSubProcessList.isEmpty()) { SubProcess subProcess = activeSubProcessList.get(activeSubProcessList.size() - 1); subProcess.getDataObjects().add((ValuedDataObject) parsedElement); } else { activeProcess.getDataObjects().add((ValuedDataObject) parsedElement); subProcess.addFlowElement(currentFlowElement); activeProcess.addFlowElement(currentFlowElement);
public BpmnModel convertToBpmnModel(XMLStreamReader xtr) { BpmnModel model = new BpmnModel(); model.setStartEventFormTypes(startEventFormTypes); model.setUserTaskFormTypes(userTaskFormTypes); try { Process activeProcess = null; if (StringUtils.isNotEmpty(xtr.getAttributeValue(null, ATTRIBUTE_ID))) { model.addError(xtr.getAttributeValue(null, ATTRIBUTE_ID), xtr.getAttributeValue(null, ATTRIBUTE_ERROR_CODE)); for (Process process : model.getProcesses()) { for (Pool pool : model.getPools()) { if (process.getId().equals(pool.getProcessRef())) { pool.setExecutable(process.isExecutable()); processFlowElements(process.getFlowElements(), process);