Package org.openntf.domino.utils.xml

Examples of org.openntf.domino.utils.xml.XMLNode


    public Map<String, String> getMapEntries() {
      Map<String, String> result = new LinkedHashMap<String, String>();

      List<XMLNode> mapEntries = node_.selectNodes("map-entries/map-entry");
      for (XMLNode entry : mapEntries) {
        XMLNode keyNode = entry.selectSingleNode("key");
        XMLNode valueNode = entry.selectSingleNode("value | null-value");

        if (keyNode != null) {
          if (valueNode == null || "null-value".equals(valueNode.getNodeName())) {
            result.put(keyNode.getText(), null);
          } else {
            result.put(keyNode.getText(), valueNode.getText());
          }
        }
      }

      return Collections.unmodifiableMap(result);
View Full Code Here


    /* (non-Javadoc)
     * @see org.openntf.domino.design.FacesConfig.ManagedBean#setMapEntries(java.util.Map)
     */
    public void setMapEntries(final Map<?, ?> mapEntries) {
      XMLNode mapEntriesNode = node_.selectSingleNode("map-entries");
      if (mapEntriesNode != null) {
        node_.removeChild(mapEntriesNode);
      }
      mapEntriesNode = node_.addChildElement("map-entries");
      for (Map.Entry<?, ?> entry : mapEntries.entrySet()) {
        XMLNode entryNode = mapEntriesNode.addChildElement("map-entry");
        XMLNode keyNode = entryNode.addChildElement("key");
        keyNode.setText(String.valueOf(entry.getKey()));
        if (entry.getValue() == null) {
          entryNode.addChildElement("null-value");
        } else {
          XMLNode valueNode = entryNode.addChildElement("value");
          valueNode.setText(String.valueOf(entry.getValue()));
        }
      }

      // Clear out any list-entries, as they're mutually incompatible with map-entries
      XMLNode listEntries = node_.selectSingleNode("list-entries");
      if (listEntries != null) {
        node_.removeChild(listEntries);
      }
    }
View Full Code Here

      /* (non-Javadoc)
       * @see org.openntf.domino.design.FacesConfig.ManagedBean.Property#getName()
       */
      public String getName() {
        XMLNode valueNode = node_.selectSingleNode("property-name");
        if (valueNode == null) {
          return "";
        }
        return valueNode.getText();
      }
View Full Code Here

      /* (non-Javadoc)
       * @see org.openntf.domino.design.FacesConfig.ManagedBean.Property#setName(java.lang.String)
       */
      public void setName(final String name) {
        XMLNode valueNode = node_.selectSingleNode("property-name");
        if (valueNode == null) {
          valueNode = node_.addChildElement("property-name");
        }
        valueNode.setText(name);
      }
View Full Code Here

      /* (non-Javadoc)
       * @see org.openntf.domino.design.FacesConfig.ManagedBean.Property#getValue()
       */
      public String getValue() {
        XMLNode valueNode = node_.selectSingleNode("null-value");
        if (valueNode != null) {
          return null;
        }

        valueNode = node_.selectSingleNode("value");
        if (valueNode == null) {
          return "";
        }
        return valueNode.getText();
      }
View Full Code Here

      /* (non-Javadoc)
       * @see org.openntf.domino.design.FacesConfig.ManagedBean.Property#setValue(java.lang.String)
       */
      public void setValue(final String value) {
        if (value == null) {
          XMLNode valueNode = node_.selectSingleNode("value");
          if (valueNode != null) {
            node_.removeChild(valueNode);
          }
          node_.addChildElement("null-value");
        } else {
          XMLNode nullNode = node_.selectSingleNode("null-value");
          if (nullNode != null) {
            node_.removeChild(nullNode);
          }

          XMLNode valueNode = node_.selectSingleNode("value");
          if (valueNode == null) {
            valueNode = node_.addChildElement("value");
          }
          valueNode.setText(value);
        }

        // Clear out any list-entries and map-entries, as they're mutually incompatible with single values
        XMLNode listEntries = node_.selectSingleNode("list-entries");
        if (listEntries != null) {
          node_.removeChild(listEntries);
        }
        listEntries = node_.selectSingleNode("map-entries");
        if (listEntries != null) {
View Full Code Here

      /* (non-Javadoc)
       * @see org.openntf.domino.design.FacesConfig.ManagedBean.Property#getValueClassName()
       */
      public String getListValueClassName() {
        XMLNode valueNode = node_.selectSingleNode("list-entries/value-class");
        if (valueNode == null) {
          return "";
        }
        return valueNode.getText();
      }
View Full Code Here

      /* (non-Javadoc)
       * @see org.openntf.domino.design.FacesConfig.ManagedBean.Property#setValueClassName(java.lang.String)
       */
      public void setListValueClassName(final String className) {
        XMLNode valueNode = node_.selectSingleNode("list-entries/value-class");
        if (valueNode == null) {
          XMLNode listEntries = node_.selectSingleNode("list-entries");
          if (listEntries == null) {
            listEntries = node_.addChildElement("list-entries");
          }
          valueNode = listEntries.addChildElement("value-class");
        }
        valueNode.setText(className);

        // Clear out any value and map-entries, as they're mutually incompatible with list-entries
        XMLNode value = node_.selectSingleNode("value");
        if (value != null) {
          node_.removeChild(value);
        }
        value = node_.selectSingleNode("null-value");
        if (value != null) {
View Full Code Here

      /* (non-Javadoc)
       * @see org.openntf.domino.design.FacesConfig.ManagedBean.Property#setListEntries(java.util.Collection)
       */
      public void setListEntries(final Collection<?> listEntries) {
        XMLNode listEntriesNode = node_.selectSingleNode("list-entries");
        String valueClassName = getListValueClassName();
        if (listEntriesNode != null) {
          node_.removeChild(listEntriesNode);
        }
        listEntriesNode = node_.addChildElement("list-entries");
        XMLNode valueClassNode = listEntriesNode.addChildElement("value-class");
        valueClassNode.setText(valueClassName);
        for (Object entry : listEntries) {
          if (entry == null) {
            listEntriesNode.addChildElement("null-value");
          } else {
            XMLNode valueNode = listEntriesNode.addChildElement("value");
            valueNode.setText(String.valueOf(entry));
          }
        }

        // Clear out any value and map-entries, as they're mutually incompatible with list-entries
        XMLNode value = node_.selectSingleNode("value");
        if (value != null) {
          node_.removeChild(value);
        }
        value = node_.selectSingleNode("null-value");
        if (value != null) {
View Full Code Here

      public Map<String, String> getMapEntries() {
        Map<String, String> result = new LinkedHashMap<String, String>();

        List<XMLNode> mapEntries = node_.selectNodes("map-entries/map-entry");
        for (XMLNode entry : mapEntries) {
          XMLNode keyNode = entry.selectSingleNode("key");
          XMLNode valueNode = entry.selectSingleNode("value | null-value");

          if (keyNode != null) {
            if (valueNode == null || "null-value".equals(valueNode.getNodeName())) {
              result.put(keyNode.getText(), null);
            } else {
              result.put(keyNode.getText(), valueNode.getText());
            }
          }
        }

        return Collections.unmodifiableMap(result);
View Full Code Here

TOP

Related Classes of org.openntf.domino.utils.xml.XMLNode

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.