コード例 #1
0
  /**
   * Retruns the xml string equivalent of this object
   *
   * @param document instance of Xml Document.
   * @return org.w3c.dom.Node
   * @exception FioranoException thrown in case of error.
   */
  protected Node toJXMLString(Document document) throws FioranoException {
    Node root0 = document.createElement("InPort");

    ((Element) root0).setAttribute("isSyncRequestType", "" + isSyncRequestType());

    Node child = null;

    child = XMLDmiUtil.getNodeObject("Name", m_strPortName, document);
    if (child != null) {
      root0.appendChild(child);
    }

    child = XMLDmiUtil.getNodeObject("Description", m_strDscription, document);
    if (child != null) {
      root0.appendChild(child);
    }

    if (m_strXSD != null) {
      Element elem = document.createElement("XSD");
      CDATASection cdata = document.createCDATASection(m_strXSD);

      elem.appendChild(cdata);
      root0.appendChild(elem);
    }

    child = XMLDmiUtil.getNodeObject("JavaClass", m_strJavaClass, document);
    if (child != null) {
      root0.appendChild(child);
    }

    if (m_params != null && m_params.size() > 0) {
      Enumeration _enum = m_params.elements();

      while (_enum.hasMoreElements()) {
        Param param = (Param) _enum.nextElement();
        if (!StringUtil.isEmpty(param.getParamName())
            && !StringUtil.isEmpty(param.getParamValue())) {
          Node paramNode = param.toJXMLString(document);

          root0.appendChild(paramNode);
        }
      }
    }

    return root0;
  }
コード例 #2
0
  /**
   * This interface method is called to set all the fieldValues of this object of <code>InPort
   * </code>, using the specified XML string.
   *
   * @param port The new fieldValues value
   * @exception FioranoException if an error occurs while parsing the XMLString
   * @since Tifosi2.0
   */
  public void setFieldValues(Element port) throws FioranoException {
    //        Document doc = XMLUtils.getDOMDocumentFromXML(xmlString);
    //        Element port = doc.getDocumentElement();

    if (port != null) {
      m_bIsSyncRequestType = XMLDmiUtil.getAttributeAsBoolean(port, "isSyncRequestType");

      NodeList children = port.getChildNodes();
      Node child = null;

      for (int i = 0; children != null && i < children.getLength(); ++i) {
        child = children.item(i);

        String nodeName = child.getNodeName();

        if (nodeName.equalsIgnoreCase("Name")) {
          m_strPortName = XMLUtils.getNodeValueAsString(child).toUpperCase();
        }

        if (nodeName.equalsIgnoreCase("Description")) {
          m_strDscription = XMLUtils.getNodeValueAsString(child);
        }

        if (nodeName.equalsIgnoreCase("XSD")) {
          m_strXSD = XMLUtils.getNodeValueAsString(child);
        }

        if (nodeName.equalsIgnoreCase("JavaClass")) {
          m_strJavaClass = XMLUtils.getNodeValueAsString(child);
        }

        if (nodeName.equalsIgnoreCase("Param")) {
          Param paramDmi = new Param();

          paramDmi.setFieldValues((Element) child);
          addParam(paramDmi);
        }
      }
    }
    validate();
  }