Package org.activiti.bpmn.model

Examples of org.activiti.bpmn.model.ExtensionElement


      parseChildElements(getXMLElementName(), dataObject, model, xtr);
     
      List<ExtensionElement> valuesElement = dataObject.getExtensionElements().get("value");
      if (valuesElement != null && !valuesElement.isEmpty()) {
        ExtensionElement valueElement = valuesElement.get(0);
        if (StringUtils.isNotEmpty(valueElement.getElementText())) {
          if (dataObject instanceof DateDataObject) {
            try {
              dataObject.setValue(sdf.parse(valueElement.getElementText()));
            } catch (Exception e) {
              LOGGER.error("Error converting {}", dataObject.getName(), e.getMessage());
            }
          } else {
            dataObject.setValue(valueElement.getElementText());
          }
        }
       
        // remove value element
        dataObject.getExtensionElements().remove("value");
View Full Code Here


    assertEquals(1, extensionElementMap.size());
   
    List<ExtensionElement> extensionElements = extensionElementMap.get("test");
    assertEquals(2, extensionElements.size());
   
    ExtensionElement extensionElement = extensionElements.get(0);
    assertNotNull(extensionElement);
    assertEquals("test", extensionElement.getName());
    assertEquals("custom", extensionElement.getNamespacePrefix());
    assertEquals("http://custom.org/bpmn", extensionElement.getNamespace());
    assertEquals(2, extensionElement.getAttributes().size());

    List<ExtensionAttribute> attributes = extensionElement.getAttributes().get("id");
    assertEquals(1, attributes.size());
    ExtensionAttribute attribute = attributes.get(0);
    assertNotNull(attribute);
    assertEquals("id", attribute.getName());
    assertEquals("test", attribute.getValue());
    assertNull(attribute.getNamespace());
    assertNull(attribute.getNamespacePrefix());
   
    attributes = extensionElement.getAttributes().get("name");
    assertEquals(1, attributes.size());
    attribute = attributes.get(0);
    assertNotNull(attribute);
    assertEquals("name", attribute.getName());
    assertEquals("test", attribute.getValue());
   
    assertEquals(2, extensionElement.getChildElements().size());
    List<ExtensionElement> childExtensions = extensionElement.getChildElements().get("name");
    assertEquals(2, childExtensions.size());
   
    ExtensionElement childExtension = childExtensions.get(0);
    assertNotNull(childExtension);
    assertEquals("name", childExtension.getName());
    assertEquals("custom", childExtension.getNamespacePrefix());
    assertEquals("http://custom.org/bpmn", childExtension.getNamespace());
    assertEquals(0, childExtension.getAttributes().size());
    assertEquals(1, childExtension.getChildElements().size());
   
    List<ExtensionElement> subChildExtensions = childExtension.getChildElements().get("test");
    assertEquals(1, subChildExtensions.size());
   
    childExtension = subChildExtensions.get(0);
    assertNotNull(childExtension);
    assertEquals("test", childExtension.getName());
    assertEquals("custom", childExtension.getNamespacePrefix());
    assertEquals("http://custom.org/bpmn", childExtension.getNamespace());
    assertEquals(0, childExtension.getAttributes().size());
    assertEquals(0, childExtension.getChildElements().size());
    assertEquals("test", childExtension.getElementText());
   
    childExtensions = extensionElement.getChildElements().get("description");
    assertEquals(1, childExtensions.size());
    childExtension = childExtensions.get(0);
    assertNotNull(childExtension);
    assertEquals("description", childExtension.getName());
    assertEquals(1, childExtension.getAttributes().size());
    attributes = childExtension.getAttributes().get("id");
    attribute = attributes.get(0);
    assertNotNull(attribute);
    assertEquals("id", attribute.getName());
    assertEquals("test", attribute.getValue());
    assertEquals("custom2", attribute.getNamespacePrefix());
View Full Code Here

    BpmnXMLUtil.parseChildElements(elementName, parentElement, xtr, childParsers, model);
  }
 
  @SuppressWarnings("unchecked")
  protected ExtensionElement parseExtensionElement(XMLStreamReader xtr) throws Exception {
    ExtensionElement extensionElement = new ExtensionElement();
    extensionElement.setName(xtr.getLocalName());
    if (StringUtils.isNotEmpty(xtr.getNamespaceURI())) {
      extensionElement.setNamespace(xtr.getNamespaceURI());
    }
    if (StringUtils.isNotEmpty(xtr.getPrefix())) {
      extensionElement.setNamespacePrefix(xtr.getPrefix());
    }

    BpmnXMLUtil.addCustomAttributes(xtr, extensionElement, defaultElementAttributes);

    boolean readyWithExtensionElement = false;
    while (readyWithExtensionElement == false && xtr.hasNext()) {
      xtr.next();
      if (xtr.isCharacters() || XMLStreamReader.CDATA == xtr.getEventType()) {
        if (StringUtils.isNotEmpty(xtr.getText().trim())) {
          extensionElement.setElementText(xtr.getText().trim());
        }
      } else if (xtr.isStartElement()) {
        ExtensionElement childExtensionElement = parseExtensionElement(xtr);
        extensionElement.addChildElement(childExtensionElement);
      } else if (xtr.isEndElement() && extensionElement.getName().equalsIgnoreCase(xtr.getLocalName())) {
        readyWithExtensionElement = true;
      }
    }
View Full Code Here

        } else if (ELEMENT_EVENT_LISTENER.equals(xtr.getLocalName())){
          new ActivitiEventListenerParser().parseChildElement(xtr, parentElement, model);
        } else if (ELEMENT_POTENTIAL_STARTER.equals(xtr.getLocalName())){
          new PotentialStarterParser().parse(xtr, activeProcess);
        } else {
          ExtensionElement extensionElement = BpmnXMLUtil.parseExtensionElement(xtr);
          parentElement.addExtensionElement(extensionElement);
        }

      } else if (xtr.isEndElement()) {
        if (ELEMENT_EXTENSIONS.equals(xtr.getLocalName())) {
View Full Code Here

        if (ELEMENT_EXTENSIONS.equals(xtr.getLocalName())) {
          inExtensionElements = true;
        } else if (childParsers.containsKey(xtr.getLocalName())) {
          childParsers.get(xtr.getLocalName()).parseChildElement(xtr, parentElement, model);
        } else if (inExtensionElements) {
          ExtensionElement extensionElement = BpmnXMLUtil.parseExtensionElement(xtr);
          parentElement.addExtensionElement(extensionElement);
        }

      } else if (xtr.isEndElement()) {
        if (ELEMENT_EXTENSIONS.equals(xtr.getLocalName())) {
View Full Code Here

      }
    }
  }
 
  public static ExtensionElement parseExtensionElement(XMLStreamReader xtr) throws Exception {
    ExtensionElement extensionElement = new ExtensionElement();
    extensionElement.setName(xtr.getLocalName());
    if (StringUtils.isNotEmpty(xtr.getNamespaceURI())) {
      extensionElement.setNamespace(xtr.getNamespaceURI());
    }
    if (StringUtils.isNotEmpty(xtr.getPrefix())) {
      extensionElement.setNamespacePrefix(xtr.getPrefix());
    }
   
    for (int i = 0; i < xtr.getAttributeCount(); i++) {
      ExtensionAttribute extensionAttribute = new ExtensionAttribute();
      extensionAttribute.setName(xtr.getAttributeLocalName(i));
      extensionAttribute.setValue(xtr.getAttributeValue(i));
      if (StringUtils.isNotEmpty(xtr.getAttributeNamespace(i))) {
        extensionAttribute.setNamespace(xtr.getAttributeNamespace(i));
      }
      if (StringUtils.isNotEmpty(xtr.getAttributePrefix(i))) {
        extensionAttribute.setNamespacePrefix(xtr.getAttributePrefix(i));
      }
      extensionElement.addAttribute(extensionAttribute);
    }
   
    boolean readyWithExtensionElement = false;
    while (readyWithExtensionElement == false && xtr.hasNext()) {
      xtr.next();
      if (xtr.isCharacters() || XMLStreamReader.CDATA == xtr.getEventType()) {
        if (StringUtils.isNotEmpty(xtr.getText().trim())) {
          extensionElement.setElementText(xtr.getText().trim());
        }
      } else if (xtr.isStartElement()) {
        ExtensionElement childExtensionElement = parseExtensionElement(xtr);
        extensionElement.addChildElement(childExtensionElement);
      } else if (xtr.isEndElement() && extensionElement.getName().equalsIgnoreCase(xtr.getLocalName())) {
        readyWithExtensionElement = true;
      }
    }
View Full Code Here

TOP

Related Classes of org.activiti.bpmn.model.ExtensionElement

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.