public String getRolesAsXML() { ArrayList<Role> rList = new ArrayList<Role>(roleMap.values()); Collections.sort(rList); StringBuilder xml = new StringBuilder("<roles>"); for (Role r : rList) xml.append(r.toXML()); xml.append("</roles>"); return xml.toString(); }
public String getParticipantRolesAsXML(String pid) { Set<Role> roles = getParticipantRoles(pid); if (roles != null) { String header = String.format("<roles participantid=\"%s\">", pid); StringBuilder xml = new StringBuilder(header); for (Role r : roles) xml.append(r.toXML()); xml.append("</roles>"); return xml.toString(); } else return ("<roles/>"); }