NodeProperty coutProp = rNrd.getProperty( P_CHECKED_OUT );
NodeProperty predSetProp = rNrd.getProperty( P_PREDECESSOR_SET );
NodeProperty autoUpdProp = rNrd.getProperty( P_AUTO_UPDATE );
// prepare auto-update
NodeRevisionDescriptors autoUpdNrds = null;
NodeRevisionDescriptor autoUpdNrd = null;
if( autoUpdProp != null ) {
Element autoUpdElm = pHelp.parsePropertyValue( (String)autoUpdProp.getValue() );
String autoUpdUri = autoUpdElm.getTextTrim();
autoUpdNrds = content.retrieve( sToken, autoUpdUri );
autoUpdNrd = content.retrieve( sToken, autoUpdNrds );
}
// Retrieve VHR
Element coutElm = pHelp.parsePropertyValue( (String)coutProp.getValue() );
String vrUriOld = coutElm.getTextTrim();
UriHandler vrUhOld = UriHandler.getUriHandler( vrUriOld );
NodeRevisionNumber vrNrnOld = new NodeRevisionNumber( vrUhOld.getVersionName() );
String vhrUri = vrUhOld.getAssociatedHistoryUri();
NodeRevisionDescriptors vhrNrds = content.retrieve( sToken, vhrUri );
NodeRevisionDescriptor vhrNrd = content.retrieve( sToken, vhrNrds ); //vhrUri
NodeProperty vSetProp = vhrNrd.getProperty( P_VERSION_SET );
// Retrieve old VR
NodeRevisionDescriptor vrNrdOld =
content.retrieve( sToken, vhrNrds, vrNrnOld ); // vrUriOld
// update the old VR's DAV:checkout-set property
if (!PropertyHelper.removeHrefFromProperty(vrNrdOld, P_CHECKOUT_SET, rUri)) {
StringBuffer b = new StringBuffer("Invalid path");
PropertyHelper propertyHelper = PropertyHelper.getPropertyHelper(sToken, nsaToken, sConf);
NodeProperty checkoutSetProp = propertyHelper.getProperty(P_CHECKOUT_SET, vhrNrds, vrNrdOld, slideContextPath);
if( checkoutSetProp != null && checkoutSetProp.getValue() != null ) {
XMLValue checkoutSetValue = new XMLValue( checkoutSetProp.getValue().toString() );
if (checkoutSetValue.iterator().hasNext()) {
b.append(" - please use "+checkoutSetValue.getTextValue()+" instead");
}
}
throw new ConflictException(
rUri, new SlideException(b.toString()));
}
content.store(sToken, vhrNrds.getUri(), vrNrdOld, null);
// check preconditions
ViolatedPrecondition violatedPrecondition =
getCheckinPreconditionViolation( predSetProp, vhrNrds, forkOk, autoUpdNrd );
if (violatedPrecondition != null) {
throw new PreconditionViolationException(violatedPrecondition, rUri);
}
// check forking
String forkBranch = getForkBranch(predSetProp, vhrNrds, forkOk);
NodeRevisionDescriptor vrNrdNew = null;
if (forkBranch != null) {
// Create a new branch
NodeRevisionNumber branchedRevisionNumber =
content.fork(sToken, vhrNrds.getUri(), forkBranch, vrNrdOld);
vhrNrds = content.retrieve( sToken, vhrUri );
vrNrdNew = content.retrieve(sToken, vhrNrds, branchedRevisionNumber);
vrNrdNew.setContentLength(rNrd.getContentLength());
}
else {