}
if (principalElm != null) {
subjectUri = createSubjectUri(principalElm);
}
else {
throw new PreconditionViolationException(
new ViolatedPrecondition("missing-ace-principal", WebdavStatus.SC_BAD_REQUEST), resourcePath
);
}
// ACE grant and deny
Element grantDenyElm = null;
Element grantElm = aceElm.getChild(E_GRANT, DNSP);
Element denyElm = aceElm.getChild(E_DENY, DNSP);
if (grantElm != null && denyElm == null) {
grantDenyElm = grantElm;
}
else if (grantElm == null && denyElm != null) {
negative = true;
grantDenyElm = denyElm;
}
else if(grantElm != null && denyElm != null) {
throw new PreconditionViolationException(
new ViolatedPrecondition("only-grant-or-deny-allowed", WebdavStatus.SC_BAD_REQUEST), resourcePath
);
}
else if(grantElm == null && denyElm == null) {
throw new PreconditionViolationException(
new ViolatedPrecondition("missing-grant-or-deny", WebdavStatus.SC_BAD_REQUEST), resourcePath
);
}
Iterator privilegeIt = grantDenyElm.getChildren(E_PRIVILEGE, DNSP).iterator();
while (privilegeIt.hasNext()) {
Element privilegeElm = (Element)privilegeIt.next();
actionUri = createActionUri(privilegeElm);
if (actionUri == null) {
throw new PreconditionViolationException(
new ViolatedPrecondition("not-supported-privilege", WebdavStatus.SC_BAD_REQUEST), resourcePath
);
}
else {
NodePermission np = new NodePermission(objectUri, subjectUri, actionUri, true, negative);