Package com.dotcms.repackage.org.dom4j

Examples of com.dotcms.repackage.org.dom4j.DocumentFactory


    throws SystemException {

    try {
      Map preferences = prefs.getPreferences();

      DocumentFactory docFactory = DocumentFactory.getInstance();

      Element portletPreferences =
        docFactory.createElement("portlet-preferences");

      Iterator itr = preferences.entrySet().iterator();

      while (itr.hasNext()) {
        Map.Entry entry = (Map.Entry)itr.next();

        Preference preference = (Preference)entry.getValue();

        Element prefEl = docFactory.createElement("preference");

        Element nameEl = docFactory.createElement("name");
        nameEl.addText(preference.getName());

        prefEl.add(nameEl);

        String[] values = preference.getValues();

        for (int i = 0; i < values.length; i++) {
          Element valueEl = docFactory.createElement("value");
          valueEl.addText(values[i]);

          prefEl.add(valueEl);
        }

        if (preference.isReadOnly()) {
          Element valueEl = docFactory.createElement("read-only");
          valueEl.addText("true");
        }

        portletPreferences.add(prefEl);
      }
View Full Code Here

TOP

Related Classes of com.dotcms.repackage.org.dom4j.DocumentFactory

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.