Package org.activiti.bpmn.model

Examples of org.activiti.bpmn.model.ItemDefinition


  }
 
  @Override
  protected BaseElement convertXMLToElement(XMLStreamReader xtr, BpmnModel model) throws Exception {
    ValuedDataObject dataObject = null;
    ItemDefinition itemSubjectRef = new ItemDefinition();

    String structureRef = xtr.getAttributeValue(null, ATTRIBUTE_DATA_ITEM_REF);
    if (StringUtils.isNotEmpty(structureRef) && structureRef.contains(":")) {
      String dataType = structureRef.substring(structureRef.indexOf(':') + 1);
     
      if (dataType.equals("string")) {
        dataObject = new StringDataObject();
      } else if (dataType.equals("int")) {
        dataObject = new IntegerDataObject();
      } else if (dataType.equals("long")) {
        dataObject = new LongDataObject();
      } else if (dataType.equals("double")) {
        dataObject = new DoubleDataObject();
      } else if (dataType.equals("boolean")) {
        dataObject = new BooleanDataObject();
      } else if (dataType.equals("datetime")) {
        dataObject = new DateDataObject();
      } else {
        LOGGER.error("Error converting {}, invalid data type: " + dataType, xtr.getAttributeValue(null, ATTRIBUTE_DATA_NAME));
      }
   
    } else {
      // use String as default type
      dataObject = new StringDataObject();
      structureRef = "xsd:string";
    }
   
    if (dataObject != null) {
      dataObject.setId(xtr.getAttributeValue(null, ATTRIBUTE_DATA_ID));
      dataObject.setName(xtr.getAttributeValue(null, ATTRIBUTE_DATA_NAME));
     
      BpmnXMLUtil.addXMLLocation(dataObject, xtr);

      itemSubjectRef.setStructureRef(structureRef);
      dataObject.setItemSubjectRef(itemSubjectRef);

      parseChildElements(getXMLElementName(), dataObject, model, xtr);
     
      List<ExtensionElement> valuesElement = dataObject.getExtensionElements().get("value");
View Full Code Here


        for (JsonNode dataNode : itemsArrayNode) {

          JsonNode dataIdNode = dataNode.get(PROPERTY_DATA_ID);
          if (dataIdNode != null && StringUtils.isNotEmpty(dataIdNode.asText())) {
            ValuedDataObject dataObject = null;
            ItemDefinition itemSubjectRef = new ItemDefinition();
            String dataType = dataNode.get(PROPERTY_DATA_TYPE).asText();

            if (dataType.equals("string")) {
              dataObject = new StringDataObject();
            } else if (dataType.equals("int")) {
              dataObject = new IntegerDataObject();
            } else if (dataType.equals("long")) {
              dataObject = new LongDataObject();
            } else if (dataType.equals("double")) {
              dataObject = new DoubleDataObject();
            } else if (dataType.equals("boolean")) {
              dataObject = new BooleanDataObject();
            } else if (dataType.equals("datetime")) {
              dataObject = new DateDataObject();
            } else {
              LOGGER.error("Error converting {}", dataIdNode.asText());
            }

            if (null != dataObject) {
              dataObject.setId(dataIdNode.asText());
              dataObject.setName(dataNode.get(PROPERTY_DATA_NAME).asText());

              itemSubjectRef.setStructureRef("xsd:" + dataType);
              dataObject.setItemSubjectRef(itemSubjectRef);

              if (dataObject instanceof DateDataObject) {
                try {
                  dataObject.setValue(sdf.parse(dataNode.get(PROPERTY_DATA_VALUE).asText()));
View Full Code Here

  public void parse(XMLStreamReader xtr, BpmnModel model) throws Exception {
    if (StringUtils.isNotEmpty(xtr.getAttributeValue(null, ATTRIBUTE_ID))) {
      String itemDefinitionId = model.getTargetNamespace() + ":" + xtr.getAttributeValue(null, ATTRIBUTE_ID);
      String structureRef = xtr.getAttributeValue(null, ATTRIBUTE_STRUCTURE_REF);
      if (StringUtils.isNotEmpty(structureRef)) {
        ItemDefinition item = new ItemDefinition();
        item.setId(itemDefinitionId);
        BpmnXMLUtil.addXMLLocation(item, xtr);
       
        int indexOfP = structureRef.indexOf(':');
        if (indexOfP != -1) {
          String prefix = structureRef.substring(0, indexOfP);
          String resolvedNamespace = model.getNamespace(prefix);
          structureRef = resolvedNamespace + ":" + structureRef.substring(indexOfP + 1);
        } else {
          structureRef = model.getTargetNamespace() + ":" + structureRef;
        }
       
        item.setStructureRef(structureRef);
        item.setItemKind(xtr.getAttributeValue(null, ATTRIBUTE_ITEM_KIND));
        BpmnXMLUtil.parseChildElements(ELEMENT_ITEM_DEFINITION, item, xtr, model);
        model.addItemDefinition(itemDefinitionId, item);
      }
    }
  }
View Full Code Here

TOP

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

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.