/** * 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, WLSecurityRoleAssignment descriptor) { Node roleMapping = appendChild(parent, nodeName); //role-name appendTextChild(roleMapping, RuntimeTagNames.ROLE_NAME, descriptor.getRoleName()); //externally-defined if (descriptor.isExternallyDefined()){ appendChild(roleMapping, RuntimeTagNames.EXTERNALLY_DEFINED); } //principal-name+ List<String> principals = descriptor.getPrincipalNames(); for (int i = 0; i < principals.size(); i++) { appendTextChild(roleMapping, RuntimeTagNames.PRINCIPAL_NAME, principals.get(i)); } return roleMapping; } }
WLSecurityRoleAssignmentNode sran = new WLSecurityRoleAssignmentNode(); sran.writeDescriptor(root, RuntimeTagNames.WL_SECURITY_ROLE_ASSIGNMENT, wlRoleAssignments.get(i));
/** * receives notification of the value for a particular tag * * @param element the xml element * @param value it's associated value */ public void setElementValue(XMLElement element, String value) { WLSecurityRoleAssignment sra = (WLSecurityRoleAssignment) getDescriptor(); if (RuntimeTagNames.ROLE_NAME.equals(element.getQName())) { sra.setRoleName(value); } else if (RuntimeTagNames.PRINCIPAL_NAME.equals(element.getQName())) { sra.addPrincipalName(value); } else if (RuntimeTagNames.EXTERNALLY_DEFINED.equals(element.getQName())) { sra.setExternallyDefined(); } else { super.setElementValue(element, value); } }
WLSecurityRoleAssignmentNode sran = new WLSecurityRoleAssignmentNode(); for (int i = 0; i < wlRoleAssignments.length; i++) { sran.writeDescriptor(root, RuntimeTagNames.WL_SECURITY_ROLE_ASSIGNMENT, wlRoleAssignments[i]);