NodeProperty cinProp = rNrd.getProperty( P_CHECKED_IN );
String cinHref = getElementValue((String)cinProp.getValue());
UriHandler cinUriHandler = UriHandler.getUriHandler(cinHref);
String cinhUri = cinUriHandler.getAssociatedHistoryUri();
NodeRevisionNumber cinNrn = new NodeRevisionNumber(cinUriHandler.getVersionName());
NodeRevisionDescriptors cinNrds = content.retrieve(sToken, cinhUri);
NodeRevisionDescriptor cinNrd = content.retrieve(sToken, cinNrds, cinNrn);
// working resource feature
if( applyToVersion ) {
NodeRevisionContent cinNrc = content.retrieve( sToken, cinNrds, cinNrd );
return checkout( cinNrds, cinNrd, cinNrc, forkOk, rUri ); // autoUpdateUri=rUri
}
ViolatedPrecondition violatedPrecondition = getCheckoutPreconditionViolation(cinNrds, cinNrd, forkOk);
if (violatedPrecondition != null) {
throw new PreconditionViolationException(violatedPrecondition, rNrds.getUri());
}
//NodeRevisionDescriptors vhrNrds = content.retrieve(sToken, cinhUri);
// do the checkout
backupSpecificLiveProperties(rNrds, rNrd);
rNrd.removeProperty( cinProp );
rNrd.setProperty(
new NodeProperty(P_CHECKED_OUT, cinProp.getValue()) );
rNrd.setProperty(
new NodeProperty(P_PREDECESSOR_SET, cinProp.getValue()) );
NodeProperty property = cinNrd.getProperty(P_CHECKOUT_FORK);
if (property != null) {
rNrd.setProperty(property);
}
property = cinNrd.getProperty(P_CHECKIN_FORK);
if (property != null) {
rNrd.setProperty(property);
}
if (isAutoVersionCheckout &&
!(E_CHECKOUT_IGNORE_UNLOCK.equals(getAutoVersionElementName(rNrd)))) {
NodeLock writeLock = getWriteLock(sToken, rNrds);
if (writeLock != null) {
NodeProperty p =
new NodeProperty(I_CHECKIN_LOCKTOKEN,
writeLock.getLockId(),
NamespaceCache.SLIDE_URI);
p.setKind( NodeProperty.Kind.PROTECTED );
rNrd.setProperty( p );
}
}
// update checked-in VR's DAV:checkout-set property
PropertyHelper.addHrefToProperty(cinNrd, P_CHECKOUT_SET, rUri);
// Store changes
content.store( sToken, rNrds.getUri(), rNrd, null ); //revisionContent=null
content.store( sToken, cinNrds.getUri(), cinNrd, null );
return null;
}
else {
Domain.warn(
"Do not know how to checkout a '"+rRk+"' resource" );