Ejemplo n.º 1
0
  @SuppressWarnings("unchecked")
  public Object start(
      final String uri,
      final String localName,
      final Attributes attrs,
      final ExtensibleXmlParser parser)
      throws SAXException {
    parser.startElementBuilder(localName, attrs);

    String id = attrs.getValue("id");
    String type = attrs.getValue("structureRef");
    if (type == null || type.trim().length() == 0) {
      type = "java.lang.Object";
    }

    ProcessBuildData buildData = (ProcessBuildData) parser.getData();
    Map<String, ItemDefinition> itemDefinitions =
        (Map<String, ItemDefinition>) buildData.getMetaData("ItemDefinitions");
    if (itemDefinitions == null) {
      itemDefinitions = new HashMap<String, ItemDefinition>();
      buildData.setMetaData("ItemDefinitions", itemDefinitions);
    }
    ItemDefinition itemDefinition = new ItemDefinition(id);
    itemDefinition.setStructureRef(type);
    itemDefinitions.put(id, itemDefinition);
    return itemDefinition;
  }
Ejemplo n.º 2
0
  @SuppressWarnings("unchecked")
  protected void readMultiInstanceLoopCharacteristics(
      org.w3c.dom.Node xmlNode, ForEachNode forEachNode, ExtensibleXmlParser parser) {
    // sourceRef
    org.w3c.dom.Node subNode = xmlNode.getFirstChild();
    while (subNode != null) {
      String nodeName = subNode.getNodeName();
      if ("inputDataItem".equals(nodeName)) {
        String variableName = ((Element) subNode).getAttribute("id");
        String itemSubjectRef = ((Element) subNode).getAttribute("itemSubjectRef");
        DataType dataType = null;
        Map<String, ItemDefinition> itemDefinitions =
            (Map<String, ItemDefinition>)
                ((ProcessBuildData) parser.getData()).getMetaData("ItemDefinitions");
        if (itemDefinitions != null) {
          ItemDefinition itemDefinition = itemDefinitions.get(itemSubjectRef);
          if (itemDefinition != null) {
            dataType = new ObjectDataType(itemDefinition.getStructureRef());
          }
        }
        if (dataType == null) {
          dataType = new ObjectDataType("java.lang.Object");
        }
        if (variableName != null && variableName.trim().length() > 0) {
          forEachNode.setVariable(variableName, dataType);
        }
      } else if ("outputDataItem".equals(nodeName)) {
        String variableName = ((Element) subNode).getAttribute("id");
        String itemSubjectRef = ((Element) subNode).getAttribute("itemSubjectRef");
        DataType dataType = null;
        Map<String, ItemDefinition> itemDefinitions =
            (Map<String, ItemDefinition>)
                ((ProcessBuildData) parser.getData()).getMetaData("ItemDefinitions");
        if (itemDefinitions != null) {
          ItemDefinition itemDefinition = itemDefinitions.get(itemSubjectRef);
          if (itemDefinition != null) {
            dataType = new ObjectDataType(itemDefinition.getStructureRef());
          }
        }
        if (dataType == null) {
          dataType = new ObjectDataType("java.lang.Object");
        }
        if (variableName != null && variableName.trim().length() > 0) {
          forEachNode.setOutputVariable(variableName, dataType);
        }
      } else if ("loopDataOutputRef".equals(nodeName)) {

        String outputDataRef = ((Element) subNode).getTextContent();

        String outputDataName = dataOutputs.get(outputDataRef);
        if (outputDataName != null && outputDataName.trim().length() > 0) {
          forEachNode.setOutputCollectionExpression(outputDataName);
        }
      }
      subNode = subNode.getNextSibling();
    }
  }
  @Override
  public Object start(
      final String uri,
      final String localName,
      final Attributes attrs,
      final ExtensibleXmlParser parser)
      throws SAXException {
    ItemDefinition item = (ItemDefinition) super.start(uri, localName, attrs, parser);
    String id = item.getId();
    String structureRef = item.getStructureRef();
    String itemDefinitionId = module.getRepoHelper().getGlobalItemDefinitions().get(id);
    if (itemDefinitionId == null) {
      module.getRepoHelper().getGlobalItemDefinitions().put(id, structureRef);
    }

    return item;
  }