* MacroDeleteException.
*/
private void beforeUpdateOrDelete(String destinationUri) throws SlideException {
if( Configuration.useVersionControl() ) {
NodeRevisionDescriptors destinationNrds = null;
NodeRevisionDescriptor destinationNrd = null;
try {
destinationNrds = content.retrieve( slideToken, destinationUri);
destinationNrd = content.retrieve( slideToken, destinationNrds);
}
catch (ObjectNotFoundException e) {}
if (destinationNrds != null && destinationNrd != null) {
ResourceKind resourceKind = AbstractResourceKind.determineResourceKind(token, destinationUri, destinationNrd);
if (resourceKind instanceof CheckedInVersionControlled) {
// check precondition DAV:cannot-modify-version-controlled-content
String autoVersion = versioningHelper.getAutoVersionElementName(destinationNrd);
if (autoVersion == null) {
autoVersion = "";
}
if ( !E_CHECKOUT_CHECKIN.equals(autoVersion) &&
!E_CHECKOUT_UNLOCKED_CHECKIN.equals(autoVersion) &&
!E_CHECKOUT.equals(autoVersion) &&
!E_LOCKED_CHECKOUT.equals(autoVersion) ) {
throw new PreconditionViolationException(new ViolatedPrecondition(C_CANNOT_MODIFY_VERSION_CONTROLLED_CONTENT,
WebdavStatus.SC_FORBIDDEN), destinationUri);
}
if ( E_LOCKED_CHECKOUT.equals(autoVersion) &&
( !versioningHelper.isWriteLocked(slideToken, destinationNrds) ) ) {
throw new PreconditionViolationException(new ViolatedPrecondition(C_CANNOT_MODIFY_VERSION_CONTROLLED_CONTENT,
WebdavStatus.SC_FORBIDDEN), destinationUri);
}
}
// check precondition DAV:cannot-modify-version
UriHandler uriHandler = UriHandler.getUriHandler(destinationUri);
if (uriHandler.isVersionUri()) {
throw new PreconditionViolationException(new ViolatedPrecondition(C_CANNOT_MODIFY_VERSION,
WebdavStatus.SC_FORBIDDEN), destinationUri);
}
// checkout if necessary
if( Configuration.useVersionControl() &&
(resourceKind instanceof CheckedInVersionControlled) &&
versioningHelper.mustCheckoutAutoVersionedVCR(destinationNrds, destinationNrd) ) {
try {
versioningHelper.checkout(destinationNrds, destinationNrd, false, false, true );
}
catch (IOException e) {
throw new SlideException("Checkout failed: " + e.getMessage());
}
catch (JDOMException e) {
throw new SlideException("Checkout failed: " + e.getMessage());
}
}
// store the descriptor(s) in order to restore it in afterDelete()
// (the COPY specification for DeltaV says that an existing destination
// must not be deleted)
try {
NodeRevisionDescriptor backupNrd =
content.retrieve( slideToken, destinationNrds, NodeRevisionNumber.HIDDEN_0_0 );
destinationBackupDescriptorMap.put(destinationUri, backupNrd);
}
catch (RevisionDescriptorNotFoundException e) {
}