/** * write the descriptor class to a DOM tree and return it * * @param parent node for the DOM tree * @param node name * @param the descriptor to write * @return the DOM tree top node */ public Node writeDescriptor(Node parent, String nodeName, SecurityRoleMapping descriptor) { Node roleMapping = appendChild(parent, nodeName); //role-name appendTextChild(roleMapping, RuntimeTagNames.ROLE_NAME, descriptor.getRoleName()); //principal-name+ PrincipalNameNode principal = new PrincipalNameNode(); List<PrincipalNameDescriptor> principals = descriptor.getPrincipalNames(); for (int i = 0; i < principals.size(); i++) { principal.writeDescriptor( roleMapping, RuntimeTagNames.PRINCIPAL_NAME, principals.get(i)); } //group+ List<String> groups = descriptor.getGroupNames(); for (int i = 0; i < groups.size(); i++) { appendTextChild(roleMapping, RuntimeTagNames.GROUP_NAME, groups.get(i)); } return roleMapping; } }
/** * write the descriptor class to a DOM tree and return it * * @param parent node for the DOM tree * @param node name * @param the descriptor to write * @return the DOM tree top node */ public Node writeDescriptor(Node parent, String nodeName, SecurityRoleMapping descriptor) { Node roleMapping = appendChild(parent, nodeName); //role-name appendTextChild(roleMapping, RuntimeTagNames.ROLE_NAME, descriptor.getRoleName()); //principal-name+ PrincipalNameNode principal = new PrincipalNameNode(); List<PrincipalNameDescriptor> principals = descriptor.getPrincipalNames(); for (int i = 0; i < principals.size(); i++) { principal.writeDescriptor( roleMapping, RuntimeTagNames.PRINCIPAL_NAME, principals.get(i)); } //group+ List<String> groups = descriptor.getGroupNames(); for (int i = 0; i < groups.size(); i++) { appendTextChild(roleMapping, RuntimeTagNames.GROUP_NAME, groups.get(i)); } return roleMapping; } }