XMLPrinter.OPENING);
Enumeration aceList = aces.elements();
while (aceList.hasMoreElements()) {
Ace ace = (Ace) aceList.nextElement();
if (ace.isInherited() || ace.isProtected()) {
// draft-ietf-webdav-acl-06
// do not submit inherited and protected aces
// continue with next ace
continue;
}
printer.writeElement("D", null, "ace",
XMLPrinter.OPENING);
printer.writeElement("D", null, "principal",
XMLPrinter.OPENING);
boolean found = false;
String principal = ace.getPrincipal();
String[] types = {"all", "authenticated", "unauthenticated",
"property", "self"};
for (int i = 0; i < types.length && !found; i++) {
if (types[i].equals(principal)) {
found = true;
if ("property".equals(principal)) {
printer.writeElement("D", null, principal,
XMLPrinter.OPENING);
PropertyName property = ace.getProperty();
String nsURI = property.getNamespaceURI();
if ("DAV:".equals(nsURI)) {
printer.writeElement("D", null,
property.getLocalName(),
XMLPrinter.NO_CONTENT);
} else {
printer.writeElement("Z", nsURI,
property.getLocalName(),
XMLPrinter.NO_CONTENT);
}
printer.writeElement("D", null, principal,
XMLPrinter.CLOSING);
} else {
printer.writeElement("D", null, principal,
XMLPrinter.NO_CONTENT);
}
}
}
if (!found) {
printer.writeElement("D", null, "href", XMLPrinter.OPENING);
printer.writeText(principal);
printer.writeElement("D", null, "href", XMLPrinter.CLOSING);
}
printer.writeElement("D", null, "principal",
XMLPrinter.CLOSING);
String positive = (ace.isNegative()) ? "deny" : "grant";
printer.writeElement("D", null, positive,
XMLPrinter.OPENING);
Enumeration privilegeList = ace.enumeratePrivileges();
while (privilegeList.hasMoreElements()) {
Privilege privilege = (Privilege) privilegeList.nextElement();
printer.writeElement("D", null, "privilege",
XMLPrinter.OPENING);
printer.writeElement(null,privilege.getNamespace(),privilege.getName(), XMLPrinter.NO_CONTENT);
printer.writeElement("D", null, "privilege",
XMLPrinter.CLOSING);
}
printer.writeElement("D", null, positive,
XMLPrinter.CLOSING);
if (ace.isInherited()) {
printer.writeElement("D", null, "inherited",
XMLPrinter.NO_CONTENT);
}
printer.writeElement("D", null, "ace",