juergen 02/04/04 03:40:56
Modified: src/webdav/server/org/apache/slide/webdav/util
VersioningHelper.java
Log:
Added method getUriOfAssociatedVR().
(ralf)
Revision Changes Path
1.18 +65 -3
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.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- VersioningHelper.java 4 Apr 2002 08:40:39 -0000 1.17
+++ VersioningHelper.java 4 Apr 2002 11:40:56 -0000 1.18
@@ -1,7 +1,7 @@
/*
- * $Header:
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/util/VersioningHelper.java,v
1.17 2002/04/04 08:40:39 juergen Exp $
- * $Revision: 1.17 $
- * $Date: 2002/04/04 08:40:39 $
+ * $Header:
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/util/VersioningHelper.java,v
1.18 2002/04/04 11:40:56 juergen Exp $
+ * $Revision: 1.18 $
+ * $Date: 2002/04/04 11:40:56 $
*
* ====================================================================
*
@@ -667,6 +667,21 @@
}
/**
+ * If the resource described by the given <code>resourceUri</code> is a
+ * VCR this method returns the URI of the associated VR,
+ * otherwise <code>null</code>
+ *
+ * @param resourceUri the URI of the resource.
+ *
+ * @return the URI of the associated VR.
+ *
+ * @throws SlideException
+ */
+ public String getUriOfAssociatedVR(String resourceUri) throws SlideException {
+ return getUriOfAssociatedVR(nsaToken, sToken, content, resourceUri);
+ }
+
+ /**
* Expects a String containing an XML Element like
* <code><example>value</example></code>
* and returns the text <code>value</code> of this element.
@@ -810,6 +825,53 @@
}
return rNrd;
+ }
+
+
+ /**
+ * If the resource described by the given <code>resourceUri</code> is a
+ * VCR this method returns the URI of the associated VR,
+ * otherwise <code>null</code>
+ *
+ * @param nsaToken the NamespaceAccessToken to use.
+ * @param sToken the SlideToken to use.
+ * @param content the Content helper to use.
+ * @param resourceUri the URI of the resource.
+ *
+ * @return the URI of the associated VR.
+ *
+ * @throws SlideException
+ */
+ public static String getUriOfAssociatedVR(NamespaceAccessToken nsaToken,
+ SlideToken sToken,
+ Content content,
+ String resourceUri) throws
SlideException {
+
+ String vrUri = null;
+
+ NodeRevisionDescriptors revisionDescriptors =
retrieveRevisionDescriptors(nsaToken, sToken, content, resourceUri);
+ if (!revisionDescriptors.isVersioned()) {
+ NodeRevisionDescriptor revisionDescriptor =
retrieveLatestRevisionDescriptor(nsaToken, sToken, content, resourceUri,
revisionDescriptors);
+ NodeProperty property = revisionDescriptor.getProperty(P_CHECKED_OUT);
+ if ( (property == null) || (property.getValue() == null) ) {
+ property = revisionDescriptor.getProperty(P_CHECKED_IN);
+ }
+ if ( (property != null) && (property.getValue() != null) ) {
+
+ try {
+ XMLValue xmlValue = new
XMLValue(property.getValue().toString());
+ Iterator iterator = xmlValue.iterator();
+ if (iterator.hasNext()) {
+ Element element = (Element)iterator.next();
+ vrUri = element.getText();
+ }
+ }
+ catch (JDOMException e) {}
+ catch (IllegalArgumentException e) {}
+ }
+ }
+
+ return vrUri;
}
/**
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>