ViolatedPrecondition violatedPrecondition = null;
if( Configuration.useVersionControl() ) {
if (isRequestSourceWorkspace) {
UriHandler destinationUriHandler = UriHandler.getUriHandler(destinationUri);
NodeRevisionDescriptors destinationRevisionDescriptors = null;
NodeRevisionDescriptor destinationRevisionDescriptor = null;
try {
destinationRevisionDescriptors = content.retrieve( stoken, destinationUri);
destinationRevisionDescriptor = content.retrieve( stoken, destinationRevisionDescriptors);
}
catch( ObjectNotFoundException e ) {}; // can be ignored here!
ResourceKind destinationResourceKind =
AbstractResourceKind.determineResourceKind( token, destinationUri, destinationRevisionDescriptor );
if( !(destinationResourceKind instanceof DeltavCompliantUnmappedUrl) ) {
return new ViolatedPrecondition(C_RESOURCE_MUST_BE_NULL,
WebdavStatus.SC_CONFLICT);
}
if( !destinationUriHandler.isWorkspaceUri() ) {
return new ViolatedPrecondition(C_WORKSPACE_LOCATION_OK,
WebdavStatus.SC_CONFLICT);
}
}
}
if (isCollection(sourceUri)) {
UriHandler destinationUriHandler = UriHandler.getUriHandler(destinationUri);
ObjectNode destinationParentNode =
structure.retrieve(stoken, destinationUriHandler.getParentUriHandler().toString());
ObjectNode sourceNode =
structure.retrieve(stoken, sourceUri);
if (isDescendant(destinationParentNode, sourceNode)) {
return new ViolatedPrecondition(C_CYCLE_ALLOWED, WebdavStatus.SC_FORBIDDEN);
}