List of usage examples for org.dom4j.util UserDataAttribute UserDataAttribute
public UserDataAttribute(QName qname)
From source file:net.sf.jguard.ext.authorization.manager.XmlAuthorizationManager.java
License:Open Source License
private void insertPermissionsAndInheritance(Element principalElement, RolePrincipal ppal) { Element permsRefElement = principalElement.addElement(PERMISSIONS_REF); Set perms = ppal.getPermissions(); for (Object orphanedPerm : perms) { Permission perm = (Permission) orphanedPerm; Element permRef = permsRefElement.addElement(PERMISSION_REF); //add the name attribute Attribute idAttribute = new UserDataAttribute(new QName(ID)); idAttribute.setValue("" + perm.getId()); permRef.add(idAttribute);//w w w .j a va2 s .c o m } //role inheritance is only supported by RolePrincipal if (ppal.getDescendants().size() > 0) { Element descendants = principalElement.addElement(DESCENDANTS); //add the descendants of this role for (RolePrincipal o : ppal.getDescendants()) { Element principalRef = descendants.addElement(PRINCIPAL_REF); Attribute idAttribute = new UserDataAttribute(new QName(ID)); idAttribute.setValue("" + o.getId()); principalRef.add(idAttribute); } } }