public void read(InputElement xml, Object o) { try { JSNVPElements g = (JSNVPElements) o; while (xml.hasNext()) { // Allow any sub element as long as it has name-value pair. //JSNVPElement elem = (JSNVPElement)xml.get(g.getItemElementName(), JSNVPElement.class); JSNVPElement elem = (JSNVPElement)xml.getNext(); if (elem.getKey() != null) { g.add(elem); } } } catch (Exception e) { /** * while annoying invalid entries in the file should be * just disregarded */ e.printStackTrace(); } } };
public void write(Object o, OutputElement xml) throws XMLStreamException { try { JSEntityPreference g = (JSEntityPreference) o; String s = g.getPrincapalName(); if ((s == null) || (s.length() == 0)) s = "no-principal"; xml.setAttribute("principal-name", s); if ((g.preferences != null) && (g.preferences.size()>0)) xml.add(g.preferences); } catch (Exception e) { e.printStackTrace(); } }
public void write(Object o, OutputElement xml) throws XMLStreamException { try { JSNVPElements g = (JSNVPElements) o; for (JSNVPElement element : g.values) { xml.add(element, g.getItemElementName(), JSNVPElement.class); } } catch (Exception e) { e.printStackTrace(); } }
userPreference.setPrincapalName(userName); Iterator<String> preferences = userPreferences.keySet().iterator(); JSNVPElements v = new JSNVPElements("preference"); while (preferences.hasNext()) element.setValues(portletPreference.getValues()); element.setReadOnly(portletPreference.isReadOnly()); v.add(element); if (v.size() > 0)
for (JSNVPElement element : ((JSNVPElements)o1).getValues())
preferenceElements = pref.getPreferences(); for (JSNVPElement element : preferenceElements.getValues())
public void write(Object o, OutputElement xml) throws XMLStreamException { try { JSEntityPreferenceCompat g = (JSEntityPreferenceCompat) o; xml.setAttribute("name", ((g.getName() != null) ? g.getName() : "-")); if ((g.preferences != null) && (g.preferences.size()>0)) { xml.add(g.preferences); } } catch (Exception e) { e.printStackTrace(); } }