juergen 2002/07/31 05:12:28
Modified: src/webdav/server/org/apache/slide/webdav/util
VersioningHelper.java
Log:
Added checkout() signature which allows to specify the Uri of the version to use.
This is needed by CHECKOUT with a label.
(ralf)
Revision Changes Path
1.67 +34 -5
jakarta-slide/src/webdav/server/org/apache/slide/webdav/util/VersioningHelper.java
Index: VersioningHelper.java
===================================================================
RCS file:
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/util/VersioningHelper.java,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -r1.66 -r1.67
--- VersioningHelper.java 31 Jul 2002 09:09:03 -0000 1.66
+++ VersioningHelper.java 31 Jul 2002 12:12:28 -0000 1.67
@@ -732,6 +732,29 @@
public String checkout( NodeRevisionDescriptors rNrds,
NodeRevisionDescriptor rNrd, boolean forkOk, boolean
applyToVersion, boolean isAutoVersionCheckout )
throws SlideException, JDOMException, IOException,
PreconditionViolationException {
+ return checkout(rNrds, rNrd, null, forkOk, applyToVersion,
isAutoVersionCheckout);
+ }
+
+ /**
+ * Checkout a resource (for both: checkout-in-place and working-resource
features).
+ * Checkout a resource (for both: checkout-in-place and working-resource
features).
+ * @param rNrds the revision descriptors instance
+ * @param rNrd the revision descriptor instance
+ * @param versionUri if not <code>null</code> this the Uri of the version that
+ * should be used for checkout instead of the one that is
+ * contained in the <checked-in> property of the given
descriptor.
+ * @param forkOk true, if the request body contained a DAV:fork-ok element
+ * @param applyToVersion true, if the request body contained a
DAV:apply-to-version element
+ * @param isAutoVersionCheckout true, if this is an implicit request due to
auto-versioning
+ * @return the URI of the created working resource, null if no resource was
created
+ * @throws SlideException
+ * @throws JDOMException
+ * @throws IOException
+ * @throws PreconditionViolatedException
+ */
+ public String checkout( NodeRevisionDescriptors rNrds,
+ NodeRevisionDescriptor rNrd, String versionUri, boolean
forkOk, boolean applyToVersion, boolean isAutoVersionCheckout )
+ throws SlideException, JDOMException, IOException,
PreconditionViolationException {
Iterator i;
String rUri = getUri( rNrds, rNrd );
@@ -746,9 +769,16 @@
throw new WebdavException(WebdavStatus.SC_FORBIDDEN);
}
+ NodeProperty cinProp = null;
+ if (versionUri != null) {
+ cinProp = new NodeProperty(P_CHECKED_IN,
pHelp.createHrefValue(versionUri));
+ }
+
if( rRk instanceof CheckedInVersionControlled ) {
// get checked-in VR
- NodeProperty cinProp = rNrd.getProperty( P_CHECKED_IN );
+ if (cinProp == null) {
+ cinProp = rNrd.getProperty( P_CHECKED_IN );
+ }
String cinHref = getElementValue((String)cinProp.getValue());
UriHandler cinUriHandler = UriHandler.getUriHandler(cinHref);
String cinhUri = cinUriHandler.getAssociatedHistoryUri();
@@ -830,7 +860,6 @@
Enumeration j;
String rUri = getUri( rNrds, rNrd );
ResourceKind rRk = AbstractResourceKind.determineResourceKind( nsaToken,
rNrds, rNrd );
-
if( !rRk.isSupportedMethod(req.getMethod()) ) {
// check precondition C_MUST_BE_CHECKED_IN
if( rRk instanceof CheckedOut ) {
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>