protected ViolatedPrecondition getPreconditionViolation(String resourcePath) throws SlideException {
// use a non-blocking slide token.
SlideToken stoken = readonlySlideToken();
ViolatedPrecondition violatedPrecondition = null;
NodeRevisionDescriptors revisionDescriptors =
content.retrieve( stoken, resourcePath);
NodeRevisionDescriptor revisionDescriptor =
content.retrieve( stoken, revisionDescriptors);
ResourceKind resourceKind = AbstractResourceKind.determineResourceKind(token, revisionDescriptors, revisionDescriptor);
// check <DAV:must-be-checked-in>
if ( (resourceKind instanceof VersionControlled) &&
!(resourceKind instanceof CheckedInVersionControlled) ) {
return new ViolatedPrecondition(DeltavConstants.C_MUST_BE_CHECKED_IN,
WebdavStatus.SC_CONFLICT);
}
// check <DAV:must-select-version-in-history>
if ( (resourceKind instanceof VersionControlled) &&
(labelHeader != null) ) {
try {
versioningHelper.getLabeledResourceUri(resourcePath, labelHeader);
}
catch (LabeledRevisionNotFoundException e) {
return new ViolatedPrecondition(DeltavConstants.C_MUST_SELECT_VERSION_IN_HISTORY,
WebdavStatus.SC_CONFLICT);
}
}
try {
String slideResourceUri = getResourceUri(resourcePath, labelHeader);
revisionDescriptors =
content.retrieve( stoken, slideResourceUri);
revisionDescriptor =
content.retrieve( stoken, revisionDescriptors);
resourceKind = AbstractResourceKind.determineResourceKind(token, revisionDescriptors, revisionDescriptor);
if (resourceKind instanceof Version) {
// check <DAV:label-must-exist>
if (DeltavConstants.E_REMOVE.equals(operation)) {
if ( ! hasLabel(revisionDescriptor, label) ) {
return new ViolatedPrecondition(DeltavConstants.C_LABEL_MUST_EXIST,
WebdavStatus.SC_CONFLICT);
}
}
try {
versioningHelper.retrieveLabeledRevision(revisionDescriptors.getUri(), label);
// check <DAV:must-be-new-label>
if (DeltavConstants.E_ADD.equals(operation)) {
return new ViolatedPrecondition(DeltavConstants.C_MUST_BE_NEW_LABEL,
WebdavStatus.SC_CONFLICT);
}