public void write(Object o, OutputElement xml) throws XMLStreamException { try { JSPrincipal p = (JSPrincipal) o; xml.setAttribute("type", p.getType()); xml.setAttribute("name", p.getName()); xml.setAttribute("mapped", p.isMapped()); xml.setAttribute("enabled", p.isEnabled()); xml.setAttribute("readonly", p.isReadonly()); xml.setAttribute("removable", p.isRemovable()); xml.setAttribute("extendable", p.isExtendable()); if (p.pwData != null) xml.add(p.pwData); if (p.secAttrs != null && p.secAttrs.size() > 0) { xml.add(p.secAttrs); } if (p.rules != null && p.rules.size() > 0) xml.add(p.rules); } catch (Exception e) { e.printStackTrace(); } }