*
* @throws SlideException
*/
protected ViolatedPrecondition getPreconditionViolation(String updateSourcePath, String updateSourceLabel, String resourcePath) throws SlideException {
ViolatedPrecondition violatedPrecondition = null;
NodeRevisionDescriptors revisionDescriptors =
content.retrieve(slideToken, resourcePath);
NodeRevisionDescriptor revisionDescriptor =
content.retrieve(slideToken, revisionDescriptors);
ResourceKind resourceKind = AbstractResourceKind.determineResourceKind(token,
revisionDescriptors,
revisionDescriptor);
if ( ! (resourceKind instanceof CheckedInVersionControlled) ) {
return new ViolatedPrecondition(DeltavConstants.C_MUST_BE_CHECKED_IN_VERSION_CONTROLLED_RESOURCE,
WebdavStatus.SC_CONFLICT);
}
if (updateSourceLabel != null) {
try {
updateSourcePath = versioningHelper.getLabeledResourceUri(resourcePath, updateLabelName);
}
catch (LabeledRevisionNotFoundException e) {
return new ViolatedPrecondition(DeltavConstants.C_MUST_SELECT_VERSION_IN_HISTORY,
WebdavStatus.SC_CONFLICT);
}
}
String associatedVrUri = versioningHelper.getUriOfAssociatedVR(resourcePath);
String vcrHistoryUri = UriHandler.getUriHandler(associatedVrUri).getAssociatedHistoryUri();
UriHandler vrUriHandler = UriHandler.getUriHandler(updateSourcePath);
boolean isVersionOfVcrHistory = false;
if (vrUriHandler.isVersionUri() &&
vcrHistoryUri.equals(vrUriHandler.getAssociatedHistoryUri()) ) {
NodeRevisionDescriptors vrDescriptors =
content.retrieve(slideToken, updateSourcePath);
try {
content.retrieve(slideToken, vrDescriptors);
isVersionOfVcrHistory = true;
}
catch (RevisionDescriptorNotFoundException e) {
}
}
if ( ! isVersionOfVcrHistory ) {
return new ViolatedPrecondition(DeltavConstants.C_MUST_SELECT_VERSION_IN_HISTORY,
WebdavStatus.SC_CONFLICT);
}
return violatedPrecondition;
}