Exemple #1
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();
    }
  }
Exemple #2
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 name = attrs.getValue("name");
    String implRef = attrs.getValue("implementationRef");

    ProcessBuildData buildData = (ProcessBuildData) parser.getData();
    List<Interface> interfaces = (List<Interface>) buildData.getMetaData("Interfaces");
    if (interfaces == null) {
      interfaces = new ArrayList<Interface>();
      buildData.setMetaData("Interfaces", interfaces);
    }
    Interface i = new Interface(id, name);
    if (implRef != null) {
      i.setImplementationRef(implRef);
    }
    interfaces.add(i);
    return i;
  }
Exemple #3
0
  public Object start(
      final String uri,
      final String localName,
      final Attributes attrs,
      final ExtensibleXmlParser xmlPackageReader)
      throws SAXException {
    xmlPackageReader.startElementBuilder(localName, attrs);

    WorkflowProcessImpl process = (WorkflowProcessImpl) xmlPackageReader.getParent();

    ActionNode actionNode = new ActionNode();

    final String name = attrs.getValue("name");
    emptyAttributeCheck(localName, "name", name, xmlPackageReader);
    actionNode.setName(name);

    final String id = attrs.getValue("id");
    emptyAttributeCheck(localName, "id", name, xmlPackageReader);
    actionNode.setId(new Long(id));

    process.addNode(actionNode);
    ((ProcessBuildData) xmlPackageReader.getData()).addNode(actionNode);

    return actionNode;
  }
 @SuppressWarnings("unchecked")
 protected void handleMessageNode(
     final Node node,
     final Element element,
     final String uri,
     final String localName,
     final ExtensibleXmlParser parser)
     throws SAXException {
   super.handleNode(node, element, uri, localName, parser);
   EventNode eventNode = (EventNode) node;
   org.w3c.dom.Node xmlNode = element.getFirstChild();
   while (xmlNode != null) {
     String nodeName = xmlNode.getNodeName();
     if ("dataOutputAssociation".equals(nodeName)) {
       readDataOutputAssociation(xmlNode, eventNode);
     } else if ("messageEventDefinition".equals(nodeName)) {
       String messageRef = ((Element) xmlNode).getAttribute("messageRef");
       Map<String, Message> messages =
           (Map<String, Message>) ((ProcessBuildData) parser.getData()).getMetaData("Messages");
       if (messages == null) {
         throw new IllegalArgumentException("No messages found");
       }
       Message message = messages.get(messageRef);
       if (message == null) {
         throw new IllegalArgumentException("Could not find message " + messageRef);
       }
       eventNode.setMetaData("MessageType", message.getType());
       List<EventFilter> eventFilters = new ArrayList<EventFilter>();
       EventTypeFilter eventFilter = new EventTypeFilter();
       eventFilter.setType("Message-" + messageRef);
       eventFilters.add(eventFilter);
       eventNode.setEventFilters(eventFilters);
     }
     xmlNode = xmlNode.getNextSibling();
   }
 }