private void validateModel(BpmnModel model) { assertEquals("simpleProcess", model.getMainProcess().getId()); assertEquals("Simple process", model.getMainProcess().getName()); FlowElement flowElement = model.getMainProcess().getFlowElement("flow1"); assertNotNull(flowElement); assertTrue(flowElement instanceof SequenceFlow); assertEquals("flow1", flowElement.getId()); flowElement = model.getMainProcess().getFlowElement("catchEvent"); assertNotNull(flowElement); assertTrue(flowElement instanceof IntermediateCatchEvent); assertEquals("catchEvent", flowElement.getId()); IntermediateCatchEvent catchEvent = (IntermediateCatchEvent) flowElement; assertTrue(catchEvent.getEventDefinitions().size() == 1); EventDefinition eventDefinition = catchEvent.getEventDefinitions().get(0); assertTrue(eventDefinition instanceof TimerEventDefinition); TimerEventDefinition timerDefinition = (TimerEventDefinition) eventDefinition; assertEquals("PT5M", timerDefinition.getTimeDuration()); flowElement = model.getMainProcess().getFlowElement("flow1Condition"); assertNotNull(flowElement); assertTrue(flowElement instanceof SequenceFlow); assertEquals("flow1Condition", flowElement.getId()); SequenceFlow flow = (SequenceFlow) flowElement; assertEquals("${number <= 1}", flow.getConditionExpression()); }
private void validateModel(BpmnModel model) { FlowElement flowElement = model.getMainProcess().getFlowElement("start1"); assertNotNull(flowElement); assertTrue(flowElement instanceof StartEvent); assertEquals("start1", flowElement.getId()); flowElement = model.getMainProcess().getFlowElement("userTask1"); assertNotNull(flowElement); assertTrue(flowElement instanceof UserTask); assertEquals("userTask1", flowElement.getId()); UserTask userTask = (UserTask) flowElement; assertTrue(userTask.getCandidateUsers().size() == 1); assertTrue(userTask.getCandidateGroups().size() == 1); assertTrue(userTask.getFormProperties().size() == 2); flowElement = model.getMainProcess().getFlowElement("subprocess1"); assertNotNull(flowElement); assertTrue(flowElement instanceof SubProcess); assertEquals("subprocess1", flowElement.getId()); SubProcess subProcess = (SubProcess) flowElement; assertTrue(subProcess.getFlowElements().size() == 5); flowElement = model.getMainProcess().getFlowElement("boundaryEvent1"); assertNotNull(flowElement); assertTrue(flowElement instanceof BoundaryEvent); assertEquals("boundaryEvent1", flowElement.getId()); BoundaryEvent boundaryEvent = (BoundaryEvent) flowElement; assertNotNull(boundaryEvent.getAttachedToRef()); assertEquals("subprocess1", boundaryEvent.getAttachedToRef().getId()); assertEquals(1, boundaryEvent.getEventDefinitions().size()); assertTrue(boundaryEvent.getEventDefinitions().get(0) instanceof TimerEventDefinition); }
private void validateModel(BpmnModel model) { FlowElement flowElement = model.getFlowElement("_5"); assertNotNull(flowElement); assertTrue(flowElement instanceof ScriptTask); assertEquals("_5", flowElement.getId()); ScriptTask scriptTask = (ScriptTask) flowElement; assertEquals("_5", scriptTask.getId()); assertEquals("Send Hello Message", scriptTask.getName()); }
private void validateModel(BpmnModel model) { FlowElement flowElement = model.getMainProcess().getFlowElementMap().get("usertask"); assertNotNull(flowElement); assertTrue(flowElement instanceof UserTask); assertEquals("usertask", flowElement.getId()); UserTask userTask = (UserTask) flowElement; assertEquals("usertask", userTask.getId()); assertEquals("User task", userTask.getName()); assertEquals("testKey", userTask.getFormKey()); assertEquals("40", userTask.getPriority()); assertEquals("2012-11-01", userTask.getDueDate()); assertEquals("kermit", userTask.getAssignee()); assertEquals(2, userTask.getCandidateUsers().size()); assertTrue(userTask.getCandidateUsers().contains("kermit")); assertTrue(userTask.getCandidateUsers().contains("fozzie")); assertEquals(2, userTask.getCandidateGroups().size()); assertTrue(userTask.getCandidateGroups().contains("management")); assertTrue(userTask.getCandidateGroups().contains("sales")); List<FormProperty> formProperties = userTask.getFormProperties(); assertEquals(2, formProperties.size()); FormProperty formProperty = formProperties.get(0); assertEquals("formId", formProperty.getId()); assertEquals("formName", formProperty.getName()); assertEquals("string", formProperty.getType()); assertEquals("variable", formProperty.getVariable()); assertEquals("${expression}", formProperty.getExpression()); formProperty = formProperties.get(1); assertEquals("formId2", formProperty.getId()); assertEquals("anotherName", formProperty.getName()); assertEquals("long", formProperty.getType()); assertTrue(StringUtils.isEmpty(formProperty.getVariable())); assertTrue(StringUtils.isEmpty(formProperty.getExpression())); List<ActivitiListener> listeners = userTask.getTaskListeners(); assertEquals(3, listeners.size()); ActivitiListener listener = (ActivitiListener) listeners.get(0); assertTrue( ImplementationType.IMPLEMENTATION_TYPE_CLASS.equals(listener.getImplementationType())); assertEquals("org.test.TestClass", listener.getImplementation()); assertEquals("create", listener.getEvent()); listener = (ActivitiListener) listeners.get(1); assertTrue( ImplementationType.IMPLEMENTATION_TYPE_EXPRESSION.equals(listener.getImplementationType())); assertEquals("${someExpression}", listener.getImplementation()); assertEquals("assignment", listener.getEvent()); listener = (ActivitiListener) listeners.get(2); assertTrue( ImplementationType.IMPLEMENTATION_TYPE_DELEGATEEXPRESSION.equals( listener.getImplementationType())); assertEquals("${someDelegateExpression}", listener.getImplementation()); assertEquals("complete", listener.getEvent()); }
private void createXML(FlowElement flowElement, BpmnModel model, XMLStreamWriter xtw) throws Exception { if (flowElement instanceof SubProcess) { SubProcess subProcess = (SubProcess) flowElement; xtw.writeStartElement(ELEMENT_SUBPROCESS); xtw.writeAttribute(ATTRIBUTE_ID, subProcess.getId()); if (StringUtils.isNotEmpty(subProcess.getName())) { xtw.writeAttribute(ATTRIBUTE_NAME, subProcess.getName()); } else { xtw.writeAttribute(ATTRIBUTE_NAME, "subProcess"); } if (subProcess instanceof EventSubProcess) { xtw.writeAttribute(ATTRIBUTE_TRIGGERED_BY, ATTRIBUTE_VALUE_TRUE); } if (StringUtils.isNotEmpty(subProcess.getDocumentation())) { xtw.writeStartElement(ELEMENT_DOCUMENTATION); xtw.writeCharacters(subProcess.getDocumentation()); xtw.writeEndElement(); } for (FlowElement subElement : subProcess.getFlowElements()) { createXML(subElement, model, xtw); } for (Artifact artifact : subProcess.getArtifacts()) { createXML(artifact, model, xtw); } xtw.writeEndElement(); } else { Class<? extends BaseBpmnXMLConverter> converter = convertersToXMLMap.get(flowElement.getClass()); if (converter == null) { throw new XMLException("No converter for " + flowElement.getClass() + " found"); } converter.newInstance().convertToXML(xtw, flowElement, model); } }
protected void convertElementToJson(ObjectNode propertiesNode, FlowElement flowElement) { propertiesNode.put("activitytype", "Sub-Process"); propertiesNode.put("subprocesstype", "Embedded"); ArrayNode subProcessshapesArrayNode = objectMapper.createArrayNode(); GraphicInfo graphicInfo = model.getGraphicInfo(flowElement.getId()); processor.processFlowElements( process, model, shapesArrayNode, graphicInfo.x + subProcessX, graphicInfo.y + subProcessY); flowElementNode.put("childShapes", subProcessshapesArrayNode); }
public static List<FlowElement> findSucessorFlowElementsFor( Process process, FlowElement sourceFlowElement) { List<FlowElement> successors = new ArrayList<FlowElement>(); for (SequenceFlow sequenceFlow : findFlowElementsOfType(process, SequenceFlow.class)) { if (sequenceFlow.getSourceRef().equals(sourceFlowElement.getId())) { successors.add(process.getFlowElement(sequenceFlow.getTargetRef())); } } return successors; }
public void processFlowElements(Collection<FlowElement> flowElements) { // Parsing the elements is done in a strict order of types, // as otherwise certain information might not be available when parsing a certain type. // Using lists as we want to keep the order in which they are defined List<SequenceFlow> sequenceFlowToParse = new ArrayList<SequenceFlow>(); List<BoundaryEvent> boundaryEventsToParse = new ArrayList<BoundaryEvent>(); // Activities are parsed first for (FlowElement flowElement : flowElements) { // Sequence flow are also flow elements, but are only parsed once every activity is found if (flowElement instanceof SequenceFlow) { sequenceFlowToParse.add((SequenceFlow) flowElement); } else if (flowElement instanceof BoundaryEvent) { boundaryEventsToParse.add((BoundaryEvent) flowElement); } else { bpmnParserHandlers.parse(this, flowElement); } } // Boundary events are parsed after all the regular activities are parsed for (BoundaryEvent boundaryEvent : boundaryEventsToParse) { bpmnParserHandlers.parse(this, boundaryEvent); } // sequence flows for (SequenceFlow sequenceFlow : sequenceFlowToParse) { bpmnParserHandlers.parse(this, sequenceFlow); } // validations after complete model for (FlowElement flowElement : flowElements) { if (flowElement instanceof ExclusiveGateway) { ActivityImpl gatewayActivity = getCurrentScope().findActivity(flowElement.getId()); validateExclusiveGateway(gatewayActivity, (ExclusiveGateway) flowElement); } } }
protected void fillContainerWithLanguage(FlowElementsContainer container, String language) { for (FlowElement flowElement : container.getFlowElements()) { List<ExtensionElement> languageElements = flowElement.getExtensionElements().get(BpmnExtensions.LANGUAGE_EXTENSION); if (languageElements != null && languageElements.size() > 0) { for (ExtensionElement extensionElement : languageElements) { List<ExtensionAttribute> languageAttributes = extensionElement.getAttributes().get("language"); if (languageAttributes != null && languageAttributes.size() == 1) { String languageValue = languageAttributes.get(0).getValue(); if (language.equals(languageValue)) { flowElement.setName(extensionElement.getElementText()); } } } } if (flowElement instanceof SubProcess) { fillContainerWithLanguage((SubProcess) flowElement, language); } } }
protected void drawArtifacts( final FlowElementsContainer container, final Map<String, GraphicInfo> locationMap, final ContainerShape parent, final Process process) { final IFeatureProvider featureProvider = getDiagramTypeProvider().getFeatureProvider(); final List<Artifact> artifactsWithoutDI = new ArrayList<Artifact>(); for (final Artifact artifact : container.getArtifacts()) { if (artifact instanceof Association) { continue; } final AddContext context = new AddContext(new AreaContext(), artifact); final IAddFeature addFeature = featureProvider.getAddFeature(context); if (addFeature == null) { System.out.println("Element not supported: " + artifact); return; } final GraphicInfo gi = locationMap.get(artifact.getId()); if (gi == null) { artifactsWithoutDI.add(artifact); } else { context.setNewObject(artifact); context.setSize((int) gi.getWidth(), (int) gi.getHeight()); ContainerShape parentContainer = null; if (parent instanceof Diagram) { FlowElement connectingElement = null; for (final Artifact associationArtifact : container.getArtifacts()) { if (associationArtifact instanceof Association) { Association association = (Association) associationArtifact; if (association.getSourceRef().equals(artifact.getId())) { connectingElement = container.getFlowElement(association.getTargetRef()); } else if (association.getTargetRef().equals(artifact.getId())) { connectingElement = container.getFlowElement(association.getSourceRef()); } } } if (connectingElement != null) { parentContainer = getParentContainer(connectingElement.getId(), process, (Diagram) parent); } else { parentContainer = parent; } } else { parentContainer = parent; } context.setTargetContainer(parentContainer); if (parentContainer instanceof Diagram) { context.setLocation((int) gi.getX(), (int) gi.getY()); } else { final Point location = getLocation(parentContainer); context.setLocation((int) gi.getX() - location.x, (int) gi.getY() - location.y); } if (addFeature.canAdd(context)) { final PictogramElement newContainer = addFeature.add(context); featureProvider.link(newContainer, new Object[] {artifact}); } } } for (final Artifact artifact : artifactsWithoutDI) { container.getArtifacts().remove(artifact); } for (FlowElement flowElement : container.getFlowElements()) { if (flowElement instanceof SubProcess) { ContainerShape subProcessShape = (ContainerShape) featureProvider.getPictogramElementForBusinessObject(flowElement); drawArtifacts((SubProcess) flowElement, locationMap, subProcessShape, process); } } }
@SuppressWarnings({"rawtypes", "unchecked"}) protected void drawFlowElements( Collection<FlowElement> elementList, Map<String, GraphicInfo> locationMap, ContainerShape parentShape, Process process) { final IFeatureProvider featureProvider = getDiagramTypeProvider().getFeatureProvider(); List<FlowElement> noDIList = new ArrayList<FlowElement>(); for (FlowElement flowElement : elementList) { if (flowElement instanceof SequenceFlow) { continue; } AddContext context = new AddContext(new AreaContext(), flowElement); IAddFeature addFeature = featureProvider.getAddFeature(context); if (addFeature == null) { System.out.println("Element not supported: " + flowElement); return; } GraphicInfo graphicInfo = locationMap.get(flowElement.getId()); if (graphicInfo == null) { noDIList.add(flowElement); } else { context.setNewObject(flowElement); context.setSize((int) graphicInfo.getWidth(), (int) graphicInfo.getHeight()); ContainerShape parentContainer = null; if (parentShape instanceof Diagram) { parentContainer = getParentContainer(flowElement.getId(), process, (Diagram) parentShape); } else { parentContainer = parentShape; } context.setTargetContainer(parentContainer); if (parentContainer instanceof Diagram == false) { Point location = getLocation(parentContainer); context.setLocation( (int) graphicInfo.getX() - location.x, (int) graphicInfo.getY() - location.y); } else { context.setLocation((int) graphicInfo.getX(), (int) graphicInfo.getY()); } if (flowElement instanceof ServiceTask) { ServiceTask serviceTask = (ServiceTask) flowElement; if (serviceTask.isExtended()) { CustomServiceTask targetTask = findCustomServiceTask(serviceTask); if (targetTask != null) { for (FieldExtension field : serviceTask.getFieldExtensions()) { CustomProperty customFieldProperty = new CustomProperty(); customFieldProperty.setName(field.getFieldName()); if (StringUtils.isNotEmpty(field.getExpression())) { customFieldProperty.setSimpleValue(field.getExpression()); } else { customFieldProperty.setSimpleValue(field.getStringValue()); } serviceTask.getCustomProperties().add(customFieldProperty); } serviceTask.getFieldExtensions().clear(); } } } else if (flowElement instanceof UserTask) { UserTask userTask = (UserTask) flowElement; if (userTask.isExtended()) { CustomUserTask targetTask = findCustomUserTask(userTask); if (targetTask != null) { final List<Class<CustomUserTask>> classHierarchy = new ArrayList<Class<CustomUserTask>>(); final List<String> fieldInfoObjects = new ArrayList<String>(); Class clazz = targetTask.getClass(); classHierarchy.add(clazz); boolean hierarchyOpen = true; while (hierarchyOpen) { clazz = clazz.getSuperclass(); if (CustomUserTask.class.isAssignableFrom(clazz)) { classHierarchy.add(clazz); } else { hierarchyOpen = false; } } for (final Class<CustomUserTask> currentClass : classHierarchy) { for (final Field field : currentClass.getDeclaredFields()) { if (field.isAnnotationPresent(Property.class)) { fieldInfoObjects.add(field.getName()); } } } for (String fieldName : userTask.getExtensionElements().keySet()) { if (fieldInfoObjects.contains(fieldName)) { CustomProperty customFieldProperty = new CustomProperty(); customFieldProperty.setName(fieldName); customFieldProperty.setSimpleValue( userTask.getExtensionElements().get(fieldName).get(0).getElementText()); userTask.getCustomProperties().add(customFieldProperty); } } for (String fieldName : fieldInfoObjects) { userTask.getExtensionElements().remove(fieldName); } } } } if (flowElement instanceof BoundaryEvent) { BoundaryEvent boundaryEvent = (BoundaryEvent) flowElement; if (boundaryEvent.getAttachedToRef() != null) { ContainerShape container = (ContainerShape) featureProvider.getPictogramElementForBusinessObject( boundaryEvent.getAttachedToRef()); if (container != null) { AddContext boundaryContext = new AddContext(new AreaContext(), boundaryEvent); boundaryContext.setTargetContainer(container); Point location = getLocation(container); boundaryContext.setLocation( (int) graphicInfo.getX() - location.x, (int) graphicInfo.getY() - location.y); if (addFeature.canAdd(boundaryContext)) { addFeature.add(boundaryContext); } } } } else if (addFeature.canAdd(context)) { PictogramElement newContainer = addFeature.add(context); featureProvider.link(newContainer, new Object[] {flowElement}); if (flowElement instanceof SubProcess) { drawFlowElements( ((SubProcess) flowElement).getFlowElements(), locationMap, (ContainerShape) newContainer, process); } } } } for (FlowElement flowElement : noDIList) { if (flowElement instanceof BoundaryEvent) { ((BoundaryEvent) flowElement).getAttachedToRef().getBoundaryEvents().remove(flowElement); } else { // do not remove Data Objects if (flowElement instanceof DataObject == false) { elementList.remove(flowElement); } } } }
private void validateModel(BpmnModel model) { FlowElement flowElement = model.getMainProcess().getFlowElement("start1"); assertNotNull(flowElement); assertTrue(flowElement instanceof StartEvent); assertEquals("start1", flowElement.getId()); // verify the main process data objects List<ValuedDataObject> dataObjects = model.getMainProcess().getDataObjects(); assertEquals(1, dataObjects.size()); Map<String, ValuedDataObject> objectMap = new HashMap<String, ValuedDataObject>(); for (ValuedDataObject valueObj : dataObjects) { objectMap.put(valueObj.getId(), valueObj); } ValuedDataObject dataObj = objectMap.get("dObj1"); assertEquals("dObj1", dataObj.getId()); assertEquals("StringTest", dataObj.getName()); assertEquals("xsd:string", dataObj.getItemSubjectRef().getStructureRef()); assertTrue(dataObj.getValue() instanceof String); assertEquals("Testing123", dataObj.getValue()); /* * Verify DataObject attributes extension */ Map<String, String> attributes = getDataObjectAttributes(dataObj); assertEquals(2, attributes.size()); for (String key : attributes.keySet()) { if (key.equals("Attr1")) { assertTrue("1".equals(attributes.get(key))); } else if (key.equals("Attr2")) { assertTrue("2".equals(attributes.get(key))); } else { fail("Unknown key value"); } } /* * Verify DataObject localization extension */ Localization localization = getLocalization(dataObj); assertEquals("rbkfn-1", localization.getResourceBundleKeyForName()); assertEquals("rbkfd-1", localization.getResourceBundleKeyForDescription()); assertEquals("leifn-1", localization.getLabeledEntityIdForName()); assertEquals("leifd-1", localization.getLabeledEntityIdForDescription()); flowElement = model.getMainProcess().getFlowElement("subprocess1"); assertNotNull(flowElement); assertTrue(flowElement instanceof SubProcess); assertEquals("subprocess1", flowElement.getId()); SubProcess subProcess = (SubProcess) flowElement; assertEquals(6, subProcess.getFlowElements().size()); // verify the sub process data objects dataObjects = subProcess.getDataObjects(); assertEquals(1, dataObjects.size()); objectMap = new HashMap<String, ValuedDataObject>(); for (ValuedDataObject valueObj : dataObjects) { objectMap.put(valueObj.getId(), valueObj); } dataObj = objectMap.get("dObj2"); assertEquals("dObj2", dataObj.getId()); assertEquals("BooleanTest", dataObj.getName()); assertEquals("xsd:boolean", dataObj.getItemSubjectRef().getStructureRef()); assertTrue(dataObj.getValue() instanceof Boolean); assertEquals(Boolean.TRUE, dataObj.getValue()); /* * Verify DataObject attributes extension */ attributes = getDataObjectAttributes(dataObj); assertEquals(2, attributes.size()); for (String key : attributes.keySet()) { if (key.equals("Attr3")) { assertTrue("3".equals(attributes.get(key))); } else if (key.equals("Attr4")) { assertTrue("4".equals(attributes.get(key))); } else { fail("Unknown key value"); } } /* * Verify DataObject localization extension */ localization = getLocalization(dataObj); assertEquals("rbkfn-2", localization.getResourceBundleKeyForName()); assertEquals("rbkfd-2", localization.getResourceBundleKeyForDescription()); assertEquals("leifn-2", localization.getLabeledEntityIdForName()); assertEquals("leifd-2", localization.getLabeledEntityIdForDescription()); }
public void convertToBpmnModel( JsonNode elementNode, JsonNode modelNode, ActivityProcessor processor, BaseElement parentElement, Map<String, JsonNode> shapeMap, BpmnModel bpmnModel) { this.processor = processor; this.model = bpmnModel; BaseElement baseElement = convertJsonToElement(elementNode, modelNode, shapeMap); baseElement.setId(BpmnJsonConverterUtil.getElementId(elementNode)); if (baseElement instanceof FlowElement) { FlowElement flowElement = (FlowElement) baseElement; flowElement.setName(getPropertyValueAsString(PROPERTY_NAME, elementNode)); flowElement.setDocumentation(getPropertyValueAsString(PROPERTY_DOCUMENTATION, elementNode)); BpmnJsonConverterUtil.convertJsonToListeners(elementNode, flowElement); if (baseElement instanceof Activity) { Activity activity = (Activity) baseElement; activity.setAsynchronous(getPropertyValueAsBoolean(PROPERTY_ASYNCHRONOUS, elementNode)); activity.setNotExclusive(!getPropertyValueAsBoolean(PROPERTY_EXCLUSIVE, elementNode)); String multiInstanceType = getPropertyValueAsString(PROPERTY_MULTIINSTANCE_TYPE, elementNode); String multiInstanceCardinality = getPropertyValueAsString(PROPERTY_MULTIINSTANCE_CARDINALITY, elementNode); String multiInstanceCollection = getPropertyValueAsString(PROPERTY_MULTIINSTANCE_COLLECTION, elementNode); String multiInstanceCondition = getPropertyValueAsString(PROPERTY_MULTIINSTANCE_CONDITION, elementNode); if (StringUtils.isNotEmpty(multiInstanceType) && "none".equalsIgnoreCase(multiInstanceType) == false) { String multiInstanceVariable = getPropertyValueAsString(PROPERTY_MULTIINSTANCE_VARIABLE, elementNode); MultiInstanceLoopCharacteristics multiInstanceObject = new MultiInstanceLoopCharacteristics(); if ("sequential".equalsIgnoreCase(multiInstanceType)) { multiInstanceObject.setSequential(true); } else { multiInstanceObject.setSequential(false); } multiInstanceObject.setLoopCardinality(multiInstanceCardinality); multiInstanceObject.setInputDataItem(multiInstanceCollection); multiInstanceObject.setElementVariable(multiInstanceVariable); multiInstanceObject.setCompletionCondition(multiInstanceCondition); activity.setLoopCharacteristics(multiInstanceObject); } } else if (baseElement instanceof Gateway) { JsonNode flowOrderNode = getProperty(PROPERTY_SEQUENCEFLOW_ORDER, elementNode); if (flowOrderNode != null) { flowOrderNode = BpmnJsonConverterUtil.validateIfNodeIsTextual(flowOrderNode); JsonNode orderArray = flowOrderNode.get("sequenceFlowOrder"); if (orderArray != null && orderArray.size() > 0) { for (JsonNode orderNode : orderArray) { ExtensionElement orderElement = new ExtensionElement(); orderElement.setName("EDITOR_FLOW_ORDER"); orderElement.setElementText(orderNode.asText()); flowElement.addExtensionElement(orderElement); } } } } } if (baseElement instanceof FlowElement) { FlowElement flowElement = (FlowElement) baseElement; if (flowElement instanceof SequenceFlow) { ExtensionElement idExtensionElement = new ExtensionElement(); idExtensionElement.setName("EDITOR_RESOURCEID"); idExtensionElement.setElementText(elementNode.get(EDITOR_SHAPE_ID).asText()); flowElement.addExtensionElement(idExtensionElement); } if (parentElement instanceof Process) { ((Process) parentElement).addFlowElement(flowElement); } else if (parentElement instanceof SubProcess) { ((SubProcess) parentElement).addFlowElement(flowElement); } else if (parentElement instanceof Lane) { Lane lane = (Lane) parentElement; lane.getFlowReferences().add(flowElement.getId()); lane.getParentProcess().addFlowElement(flowElement); } } else if (baseElement instanceof Artifact) { Artifact artifact = (Artifact) baseElement; if (parentElement instanceof Process) { ((Process) parentElement).addArtifact(artifact); } else if (parentElement instanceof SubProcess) { ((SubProcess) parentElement).addArtifact(artifact); } else if (parentElement instanceof Lane) { Lane lane = (Lane) parentElement; lane.getFlowReferences().add(artifact.getId()); lane.getParentProcess().addArtifact(artifact); } } }
public void convertToXML(XMLStreamWriter xtw, FlowElement flowElement) throws Exception { xtw.writeStartElement(getXMLElementName()); didWriteExtensionStartElement = false; writeDefaultAttribute(ATTRIBUTE_ID, flowElement.getId(), xtw); writeDefaultAttribute(ATTRIBUTE_NAME, flowElement.getName(), xtw); if (flowElement instanceof Activity) { Activity activity = (Activity) flowElement; if (activity.isAsynchronous()) { writeQualifiedAttribute(ATTRIBUTE_ACTIVITY_ASYNCHRONOUS, ATTRIBUTE_VALUE_TRUE, xtw); } if (activity.isNotExclusive()) { writeQualifiedAttribute(ATTRIBUTE_ACTIVITY_EXCLUSIVE, ATTRIBUTE_VALUE_FALSE, xtw); } writeDefaultAttribute(ATTRIBUTE_ACTIVITY_DEFAULT, activity.getDefaultFlow(), xtw); } writeAdditionalAttributes(flowElement, xtw); if (StringUtils.isNotEmpty(flowElement.getDocumentation())) { xtw.writeStartElement(ELEMENT_DOCUMENTATION); xtw.writeCharacters(flowElement.getDocumentation()); xtw.writeEndElement(); } writeAdditionalChildElements(flowElement, xtw); writeListeners(flowElement, xtw); if (didWriteExtensionStartElement) { xtw.writeEndElement(); } if (flowElement instanceof Activity) { Activity activity = (Activity) flowElement; if (activity.getLoopCharacteristics() != null) { MultiInstanceLoopCharacteristics multiInstanceObject = activity.getLoopCharacteristics(); if (StringUtils.isNotEmpty(multiInstanceObject.getLoopCardinality()) || StringUtils.isNotEmpty(multiInstanceObject.getInputDataItem()) || StringUtils.isNotEmpty(multiInstanceObject.getCompletionCondition())) { xtw.writeStartElement(ELEMENT_MULTIINSTANCE); writeDefaultAttribute( ATTRIBUTE_MULTIINSTANCE_SEQUENTIAL, String.valueOf(multiInstanceObject.isSequential()).toLowerCase(), xtw); if (StringUtils.isNotEmpty(multiInstanceObject.getInputDataItem())) { writeQualifiedAttribute( ATTRIBUTE_MULTIINSTANCE_COLLECTION, multiInstanceObject.getInputDataItem(), xtw); } if (StringUtils.isNotEmpty(multiInstanceObject.getElementVariable())) { writeQualifiedAttribute( ATTRIBUTE_MULTIINSTANCE_VARIABLE, multiInstanceObject.getElementVariable(), xtw); } if (StringUtils.isNotEmpty(multiInstanceObject.getLoopCardinality())) { xtw.writeStartElement(ELEMENT_MULTIINSTANCE_CARDINALITY); xtw.writeCharacters(multiInstanceObject.getLoopCardinality()); xtw.writeEndElement(); } if (StringUtils.isNotEmpty(multiInstanceObject.getCompletionCondition())) { xtw.writeStartElement(ELEMENT_MULTIINSTANCE_CONDITION); xtw.writeCharacters(multiInstanceObject.getCompletionCondition()); xtw.writeEndElement(); } xtw.writeEndElement(); } } } xtw.writeEndElement(); }
public static void writeBPMNDI(BpmnModel model, XMLStreamWriter xtw) throws Exception { // BPMN DI information xtw.writeStartElement(BPMNDI_PREFIX, ELEMENT_DI_DIAGRAM, BPMNDI_NAMESPACE); String processId = null; if (model.getPools().size() > 0) { processId = "Collaboration"; } else { processId = model.getMainProcess().getId(); } xtw.writeAttribute(ATTRIBUTE_ID, "BPMNDiagram_" + processId); xtw.writeStartElement(BPMNDI_PREFIX, ELEMENT_DI_PLANE, BPMNDI_NAMESPACE); xtw.writeAttribute(ATTRIBUTE_DI_BPMNELEMENT, processId); xtw.writeAttribute(ATTRIBUTE_ID, "BPMNPlane_" + processId); // System.out.println("DI EXPORT"); for (String elementId : model.getLocationMap().keySet()) { if (model.getFlowElement(elementId) != null || model.getArtifact(elementId) != null || model.getPool(elementId) != null || model.getLane(elementId) != null) { xtw.writeStartElement(BPMNDI_PREFIX, ELEMENT_DI_SHAPE, BPMNDI_NAMESPACE); xtw.writeAttribute(ATTRIBUTE_DI_BPMNELEMENT, elementId); xtw.writeAttribute(ATTRIBUTE_ID, "BPMNShape_" + elementId); GraphicInfo graphicInfo = model.getGraphicInfo(elementId); FlowElement flowElement = model.getFlowElement(elementId); if (flowElement != null && flowElement instanceof SubProcess && graphicInfo.getExpanded() != null) { xtw.writeAttribute(ATTRIBUTE_DI_IS_EXPANDED, String.valueOf(graphicInfo.getExpanded())); } if (flowElement == null) { boolean foundLane = false; for (Pool pool : model.getPools()) { if (foundLane) { break; } if (elementId.equals(pool.getId())) { if (graphicInfo.getHorizontal() != null) { xtw.writeAttribute( ATTRIBUTE_DI_IS_HORIZONTAL, String.valueOf(graphicInfo.getHorizontal())); } } else { Process process = model.getProcess(pool.getId()); if (process != null) { for (Lane lane : process.getLanes()) { if (elementId.equals(lane.getId())) { foundLane = true; if (graphicInfo.getHorizontal() != null) { xtw.writeAttribute( ATTRIBUTE_DI_IS_HORIZONTAL, String.valueOf(graphicInfo.getHorizontal())); } break; } } } } } } xtw.writeStartElement(OMGDC_PREFIX, ELEMENT_DI_BOUNDS, OMGDC_NAMESPACE); xtw.writeAttribute(ATTRIBUTE_DI_HEIGHT, "" + graphicInfo.getHeight()); xtw.writeAttribute(ATTRIBUTE_DI_WIDTH, "" + graphicInfo.getWidth()); xtw.writeAttribute(ATTRIBUTE_DI_X, "" + graphicInfo.getX()); xtw.writeAttribute(ATTRIBUTE_DI_Y, "" + graphicInfo.getY()); xtw.writeEndElement(); xtw.writeEndElement(); } } for (String elementId : model.getFlowLocationMap().keySet()) { if (model.getFlowElement(elementId) != null || model.getArtifact(elementId) != null) { xtw.writeStartElement(BPMNDI_PREFIX, ELEMENT_DI_EDGE, BPMNDI_NAMESPACE); xtw.writeAttribute(ATTRIBUTE_DI_BPMNELEMENT, elementId); xtw.writeAttribute(ATTRIBUTE_ID, "BPMNEdge_" + elementId); List<GraphicInfo> graphicInfoList = model.getFlowLocationGraphicInfo(elementId); for (GraphicInfo graphicInfo : graphicInfoList) { xtw.writeStartElement(OMGDI_PREFIX, ELEMENT_DI_WAYPOINT, OMGDI_NAMESPACE); xtw.writeAttribute(ATTRIBUTE_DI_X, "" + graphicInfo.getX()); xtw.writeAttribute(ATTRIBUTE_DI_Y, "" + graphicInfo.getY()); xtw.writeEndElement(); } GraphicInfo labelGraphicInfo = model.getLabelGraphicInfo(elementId); FlowElement flowElement = model.getFlowElement(elementId); if (labelGraphicInfo != null && flowElement != null && StringUtils.isNotEmpty(flowElement.getName())) { xtw.writeStartElement(BPMNDI_PREFIX, ELEMENT_DI_LABEL, BPMNDI_NAMESPACE); xtw.writeStartElement(OMGDC_PREFIX, ELEMENT_DI_BOUNDS, OMGDC_NAMESPACE); xtw.writeAttribute(ATTRIBUTE_DI_HEIGHT, "" + labelGraphicInfo.getHeight()); xtw.writeAttribute(ATTRIBUTE_DI_WIDTH, "" + labelGraphicInfo.getWidth()); xtw.writeAttribute(ATTRIBUTE_DI_X, "" + labelGraphicInfo.getX()); xtw.writeAttribute(ATTRIBUTE_DI_Y, "" + labelGraphicInfo.getY()); xtw.writeEndElement(); xtw.writeEndElement(); } xtw.writeEndElement(); } } // end BPMN DI elements xtw.writeEndElement(); xtw.writeEndElement(); }
public void convertToXML(XMLStreamWriter xtw, BaseElement baseElement, BpmnModel model) throws Exception { xtw.writeStartElement(getXMLElementName()); boolean didWriteExtensionStartElement = false; writeDefaultAttribute(ATTRIBUTE_ID, baseElement.getId(), xtw); if (baseElement instanceof FlowElement) { writeDefaultAttribute(ATTRIBUTE_NAME, ((FlowElement) baseElement).getName(), xtw); } if (baseElement instanceof Activity) { final Activity activity = (Activity) baseElement; if (activity.isAsynchronous()) { writeQualifiedAttribute(ATTRIBUTE_ACTIVITY_ASYNCHRONOUS, ATTRIBUTE_VALUE_TRUE, xtw); if (activity.isNotExclusive()) { writeQualifiedAttribute(ATTRIBUTE_ACTIVITY_EXCLUSIVE, ATTRIBUTE_VALUE_FALSE, xtw); } } if (StringUtils.isNotEmpty(activity.getDefaultFlow())) { FlowElement defaultFlowElement = model.getFlowElement(activity.getDefaultFlow()); if (defaultFlowElement != null && defaultFlowElement instanceof SequenceFlow) { writeDefaultAttribute(ATTRIBUTE_DEFAULT, activity.getDefaultFlow(), xtw); } } } if (baseElement instanceof Gateway) { final Gateway gateway = (Gateway) baseElement; if (gateway.isAsynchronous()) { writeQualifiedAttribute(ATTRIBUTE_ACTIVITY_ASYNCHRONOUS, ATTRIBUTE_VALUE_TRUE, xtw); if (gateway.isNotExclusive()) { writeQualifiedAttribute(ATTRIBUTE_ACTIVITY_EXCLUSIVE, ATTRIBUTE_VALUE_FALSE, xtw); } } if (StringUtils.isNotEmpty(gateway.getDefaultFlow())) { FlowElement defaultFlowElement = model.getFlowElement(gateway.getDefaultFlow()); if (defaultFlowElement != null && defaultFlowElement instanceof SequenceFlow) { writeDefaultAttribute(ATTRIBUTE_DEFAULT, gateway.getDefaultFlow(), xtw); } } } writeAdditionalAttributes(baseElement, model, xtw); if (baseElement instanceof FlowElement) { final FlowElement flowElement = (FlowElement) baseElement; if (StringUtils.isNotEmpty(flowElement.getDocumentation())) { xtw.writeStartElement(ELEMENT_DOCUMENTATION); xtw.writeCharacters(flowElement.getDocumentation()); xtw.writeEndElement(); } } didWriteExtensionStartElement = writeExtensionChildElements(baseElement, didWriteExtensionStartElement, xtw); didWriteExtensionStartElement = writeListeners(baseElement, didWriteExtensionStartElement, xtw); didWriteExtensionStartElement = BpmnXMLUtil.writeExtensionElements(baseElement, didWriteExtensionStartElement, xtw); if (didWriteExtensionStartElement) { xtw.writeEndElement(); } if (baseElement instanceof Activity) { final Activity activity = (Activity) baseElement; MultiInstanceExport.writeMultiInstance(activity, xtw); } writeAdditionalChildElements(baseElement, model, xtw); xtw.writeEndElement(); }
private void drawFlowElements( Collection<FlowElement> elementList, Map<String, GraphicInfo> locationMap, ContainerShape parentShape, Process process) { final IFeatureProvider featureProvider = getDiagramTypeProvider().getFeatureProvider(); List<FlowElement> noDIList = new ArrayList<FlowElement>(); for (FlowElement flowElement : elementList) { if (flowElement instanceof SequenceFlow) { continue; } AddContext context = new AddContext(new AreaContext(), flowElement); IAddFeature addFeature = featureProvider.getAddFeature(context); if (addFeature == null) { System.out.println("Element not supported: " + flowElement); return; } GraphicInfo graphicInfo = locationMap.get(flowElement.getId()); if (graphicInfo == null) { noDIList.add(flowElement); } else { context.setNewObject(flowElement); context.setSize((int) graphicInfo.getWidth(), (int) graphicInfo.getHeight()); ContainerShape parentContainer = null; if (parentShape instanceof Diagram) { parentContainer = getParentContainer(flowElement.getId(), process, (Diagram) parentShape); } else { parentContainer = parentShape; } context.setTargetContainer(parentContainer); if (parentContainer instanceof Diagram == false) { Point location = getLocation(parentContainer); context.setLocation( (int) graphicInfo.getX() - location.x, (int) graphicInfo.getY() - location.y); } else { context.setLocation((int) graphicInfo.getX(), (int) graphicInfo.getY()); } if (flowElement instanceof ServiceTask) { ServiceTask serviceTask = (ServiceTask) flowElement; if (serviceTask.isExtended()) { CustomServiceTask targetTask = findCustomServiceTask(serviceTask); if (targetTask != null) { for (FieldExtension field : serviceTask.getFieldExtensions()) { CustomProperty customFieldProperty = new CustomProperty(); customFieldProperty.setName(field.getFieldName()); if (StringUtils.isNotEmpty(field.getExpression())) { customFieldProperty.setSimpleValue(field.getExpression()); } else { customFieldProperty.setSimpleValue(field.getStringValue()); } serviceTask.getCustomProperties().add(customFieldProperty); } serviceTask.getFieldExtensions().clear(); } } } if (flowElement instanceof BoundaryEvent) { BoundaryEvent boundaryEvent = (BoundaryEvent) flowElement; if (boundaryEvent.getAttachedToRef() != null) { ContainerShape container = (ContainerShape) featureProvider.getPictogramElementForBusinessObject( boundaryEvent.getAttachedToRef()); if (container != null) { AddContext boundaryContext = new AddContext(new AreaContext(), boundaryEvent); boundaryContext.setTargetContainer(container); Point location = getLocation(container); boundaryContext.setLocation( (int) graphicInfo.getX() - location.x, (int) graphicInfo.getY() - location.y); if (addFeature.canAdd(boundaryContext)) { PictogramElement newBoundaryContainer = addFeature.add(boundaryContext); // featureProvider.link(newBoundaryContainer, new Object[] { boundaryEvent }); } } } } else if (addFeature.canAdd(context)) { PictogramElement newContainer = addFeature.add(context); featureProvider.link(newContainer, new Object[] {flowElement}); if (flowElement instanceof SubProcess) { drawFlowElements( ((SubProcess) flowElement).getFlowElements(), locationMap, (ContainerShape) newContainer, process); } } } } for (FlowElement flowElement : noDIList) { if (flowElement instanceof BoundaryEvent) { ((BoundaryEvent) flowElement).getAttachedToRef().getBoundaryEvents().remove(flowElement); } else { elementList.remove(flowElement); } } }
public void convertToBpmnModel( XMLStreamReader xtr, BpmnModel model, Process activeProcess, List<SubProcess> activeSubProcessList) throws Exception { String elementId = xtr.getAttributeValue(null, ATTRIBUTE_ID); String elementName = xtr.getAttributeValue(null, ATTRIBUTE_NAME); boolean async = parseAsync(xtr); boolean notExclusive = parseNotExclusive(xtr); String defaultFlow = xtr.getAttributeValue(null, ATTRIBUTE_DEFAULT); boolean isForCompensation = parseForCompensation(xtr); BaseElement parsedElement = convertXMLToElement(xtr, model); if (parsedElement instanceof Artifact) { Artifact currentArtifact = (Artifact) parsedElement; currentArtifact.setId(elementId); if (isInSubProcess(activeSubProcessList)) { final SubProcess currentSubProcess = activeSubProcessList.get(activeSubProcessList.size() - 2); currentSubProcess.addArtifact(currentArtifact); } else { activeProcess.addArtifact(currentArtifact); } } if (parsedElement instanceof FlowElement) { FlowElement currentFlowElement = (FlowElement) parsedElement; currentFlowElement.setId(elementId); currentFlowElement.setName(elementName); if (currentFlowElement instanceof Activity) { Activity activity = (Activity) currentFlowElement; activity.setAsynchronous(async); activity.setNotExclusive(notExclusive); activity.setForCompensation(isForCompensation); if (StringUtils.isNotEmpty(defaultFlow)) { activity.setDefaultFlow(defaultFlow); } } if (currentFlowElement instanceof Gateway) { Gateway gateway = (Gateway) currentFlowElement; if (StringUtils.isNotEmpty(defaultFlow)) { gateway.setDefaultFlow(defaultFlow); } gateway.setAsynchronous(async); gateway.setNotExclusive(notExclusive); } if (currentFlowElement instanceof DataObject) { if (activeSubProcessList.size() > 0) { activeSubProcessList .get(activeSubProcessList.size() - 1) .getDataObjects() .add((ValuedDataObject) parsedElement); } else { activeProcess.getDataObjects().add((ValuedDataObject) parsedElement); } } if (activeSubProcessList.size() > 0) { activeSubProcessList .get(activeSubProcessList.size() - 1) .addFlowElement(currentFlowElement); } else { activeProcess.addFlowElement(currentFlowElement); } } }
public void convertToJson( BaseElement baseElement, ActivityProcessor processor, BpmnModel model, FlowElementsContainer container, ArrayNode shapesArrayNode, double subProcessX, double subProcessY) { this.model = model; this.processor = processor; this.subProcessX = subProcessX; this.subProcessY = subProcessY; this.shapesArrayNode = shapesArrayNode; GraphicInfo graphicInfo = model.getGraphicInfo(baseElement.getId()); String stencilId = null; if (baseElement instanceof ServiceTask) { ServiceTask serviceTask = (ServiceTask) baseElement; if ("mail".equalsIgnoreCase(serviceTask.getType())) { stencilId = STENCIL_TASK_MAIL; } else if ("camel".equalsIgnoreCase(serviceTask.getType())) { stencilId = STENCIL_TASK_CAMEL; } else if ("mule".equalsIgnoreCase(serviceTask.getType())) { stencilId = STENCIL_TASK_MULE; } else { stencilId = getStencilId(baseElement); } } else { stencilId = getStencilId(baseElement); } flowElementNode = BpmnJsonConverterUtil.createChildShape( baseElement.getId(), stencilId, graphicInfo.getX() - subProcessX + graphicInfo.getWidth(), graphicInfo.getY() - subProcessY + graphicInfo.getHeight(), graphicInfo.getX() - subProcessX, graphicInfo.getY() - subProcessY); shapesArrayNode.add(flowElementNode); ObjectNode propertiesNode = objectMapper.createObjectNode(); propertiesNode.put(PROPERTY_OVERRIDE_ID, baseElement.getId()); if (baseElement instanceof FlowElement) { FlowElement flowElement = (FlowElement) baseElement; if (StringUtils.isNotEmpty(flowElement.getName())) { propertiesNode.put(PROPERTY_NAME, flowElement.getName()); } if (StringUtils.isNotEmpty(flowElement.getDocumentation())) { propertiesNode.put(PROPERTY_DOCUMENTATION, flowElement.getDocumentation()); } } convertElementToJson(propertiesNode, baseElement); flowElementNode.put(EDITOR_SHAPE_PROPERTIES, propertiesNode); ArrayNode outgoingArrayNode = objectMapper.createArrayNode(); if (baseElement instanceof FlowNode) { FlowNode flowNode = (FlowNode) baseElement; for (SequenceFlow sequenceFlow : flowNode.getOutgoingFlows()) { outgoingArrayNode.add(BpmnJsonConverterUtil.createResourceNode(sequenceFlow.getId())); } for (MessageFlow messageFlow : model.getMessageFlows().values()) { if (messageFlow.getSourceRef().equals(flowNode.getId())) { outgoingArrayNode.add(BpmnJsonConverterUtil.createResourceNode(messageFlow.getId())); } } } if (baseElement instanceof Activity) { Activity activity = (Activity) baseElement; for (BoundaryEvent boundaryEvent : activity.getBoundaryEvents()) { outgoingArrayNode.add(BpmnJsonConverterUtil.createResourceNode(boundaryEvent.getId())); } propertiesNode.put(PROPERTY_ASYNCHRONOUS, activity.isAsynchronous()); propertiesNode.put(PROPERTY_EXCLUSIVE, !activity.isNotExclusive()); if (activity.getLoopCharacteristics() != null) { MultiInstanceLoopCharacteristics loopDef = activity.getLoopCharacteristics(); if (StringUtils.isNotEmpty(loopDef.getLoopCardinality()) || StringUtils.isNotEmpty(loopDef.getInputDataItem()) || StringUtils.isNotEmpty(loopDef.getCompletionCondition())) { if (loopDef.isSequential() == false) { propertiesNode.put(PROPERTY_MULTIINSTANCE_TYPE, "Parallel"); } else { propertiesNode.put(PROPERTY_MULTIINSTANCE_TYPE, "Sequential"); } if (StringUtils.isNotEmpty(loopDef.getLoopCardinality())) { propertiesNode.put(PROPERTY_MULTIINSTANCE_CARDINALITY, loopDef.getLoopCardinality()); } if (StringUtils.isNotEmpty(loopDef.getInputDataItem())) { propertiesNode.put(PROPERTY_MULTIINSTANCE_COLLECTION, loopDef.getInputDataItem()); } if (StringUtils.isNotEmpty(loopDef.getElementVariable())) { propertiesNode.put(PROPERTY_MULTIINSTANCE_VARIABLE, loopDef.getElementVariable()); } if (StringUtils.isNotEmpty(loopDef.getCompletionCondition())) { propertiesNode.put(PROPERTY_MULTIINSTANCE_CONDITION, loopDef.getCompletionCondition()); } } } if (activity instanceof UserTask) { BpmnJsonConverterUtil.convertListenersToJson( ((UserTask) activity).getTaskListeners(), false, propertiesNode); } BpmnJsonConverterUtil.convertListenersToJson( activity.getExecutionListeners(), true, propertiesNode); if (CollectionUtils.isNotEmpty(activity.getDataInputAssociations())) { for (DataAssociation dataAssociation : activity.getDataInputAssociations()) { if (model.getFlowElement(dataAssociation.getSourceRef()) != null) { createDataAssociation(dataAssociation, true, activity); } } } if (CollectionUtils.isNotEmpty(activity.getDataOutputAssociations())) { for (DataAssociation dataAssociation : activity.getDataOutputAssociations()) { if (model.getFlowElement(dataAssociation.getTargetRef()) != null) { createDataAssociation(dataAssociation, false, activity); outgoingArrayNode.add( BpmnJsonConverterUtil.createResourceNode(dataAssociation.getId())); } } } } for (Artifact artifact : container.getArtifacts()) { if (artifact instanceof Association) { Association association = (Association) artifact; if (StringUtils.isNotEmpty(association.getSourceRef()) && association.getSourceRef().equals(baseElement.getId())) { outgoingArrayNode.add(BpmnJsonConverterUtil.createResourceNode(association.getId())); } } } if (baseElement instanceof DataStoreReference) { for (Process process : model.getProcesses()) { processDataStoreReferences(process, baseElement.getId(), outgoingArrayNode); } } flowElementNode.put("outgoing", outgoingArrayNode); }
protected boolean localizeFlowElements( Collection<FlowElement> flowElements, ObjectNode infoNode) { boolean localizationValuesChanged = false; if (flowElements == null) return localizationValuesChanged; CommandContext commandContext = Context.getCommandContext(); DynamicBpmnService dynamicBpmnService = commandContext.getProcessEngineConfiguration().getDynamicBpmnService(); for (FlowElement flowElement : flowElements) { if (flowElement instanceof UserTask || flowElement instanceof SubProcess) { List<ExtensionElement> localizationElements = flowElement.getExtensionElements().get("localization"); if (localizationElements != null) { for (ExtensionElement localizationElement : localizationElements) { if (BpmnXMLConstants.ACTIVITI_EXTENSIONS_PREFIX.equals( localizationElement.getNamespacePrefix())) { String locale = localizationElement.getAttributeValue(null, "locale"); String name = localizationElement.getAttributeValue(null, "name"); String documentation = null; List<ExtensionElement> documentationElements = localizationElement.getChildElements().get("documentation"); if (documentationElements != null) { for (ExtensionElement documentationElement : documentationElements) { documentation = StringUtils.trimToNull(documentationElement.getElementText()); break; } } String flowElementId = flowElement.getId(); if (isEqualToCurrentLocalizationValue(locale, flowElementId, "name", name, infoNode) == false) { dynamicBpmnService.changeLocalizationName(locale, flowElementId, name, infoNode); localizationValuesChanged = true; } if (documentation != null && isEqualToCurrentLocalizationValue( locale, flowElementId, "description", documentation, infoNode) == false) { dynamicBpmnService.changeLocalizationDescription( locale, flowElementId, documentation, infoNode); localizationValuesChanged = true; } break; } } } if (flowElement instanceof SubProcess) { SubProcess subprocess = (SubProcess) flowElement; boolean isFlowElementLocalizationChanged = localizeFlowElements(subprocess.getFlowElements(), infoNode); boolean isDataObjectLocalizationChanged = localizeDataObjectElements(subprocess.getDataObjects(), infoNode); if (isFlowElementLocalizationChanged || isDataObjectLocalizationChanged) { localizationValuesChanged = true; } } } } return localizationValuesChanged; }