juergen 02/04/04 00:40:39
Modified: src/webdav/server/org/apache/slide/webdav/util
VersioningHelper.java
Log:
Removed methods addUriToCheckoutSet() and removeUriFromCheckoutSet().
Use the PropertyHelper utility methods addHrefToProperty() and
removeHrefFromProperty() instead.
(ralf)
Revision Changes Path
1.17 +6 -74
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.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- VersioningHelper.java 3 Apr 2002 11:57:31 -0000 1.16
+++ VersioningHelper.java 4 Apr 2002 08:40:39 -0000 1.17
@@ -1,7 +1,7 @@
/*
- * $Header:
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/util/VersioningHelper.java,v
1.16 2002/04/03 11:57:31 juergen Exp $
- * $Revision: 1.16 $
- * $Date: 2002/04/03 11:57:31 $
+ * $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 $
*
* ====================================================================
*
@@ -337,7 +337,7 @@
NodeRevisionDescriptors vhrNrds = content.retrieve(sToken, cinUri);
// update <checkout-set>
- addUriToCheckoutSet(cinNrd, rNrds.getUri());
+ PropertyHelper.addHrefToProperty(cinNrd, P_CHECKOUT_SET,
rNrds.getUri());
content.store(sToken, cinNrds.getUri(), cinNrd, null);
// do the checkout
@@ -471,7 +471,7 @@
NodeRevisionDescriptors vhrNrds = content.retrieve(sToken, coutUri);
// update <checkout-set>
- removeUriFromCheckoutSet(coutNrd, rNrds.getUri());
+ PropertyHelper.removeHrefFromProperty(coutNrd, P_CHECKOUT_SET,
rNrds.getUri());
content.store( sToken, coutNrds.getUri(), coutNrd, null);
// restore revision descriptor
@@ -542,7 +542,7 @@
}
// update <checkout-set>
- removeUriFromCheckoutSet(vrNrdOld, rNrds.getUri());
+ PropertyHelper.removeHrefFromProperty(vrNrdOld, P_CHECKOUT_SET,
rNrds.getUri());
content.store( sToken, vhrNrds.getUri(), vrNrdOld, null);
// Create new VR in the MAIN branch
@@ -664,74 +664,6 @@
}
}
return violatedPrecondition;
- }
-
- /**
- * Adds the given <code>uri</code> to the <code><checkout-set></code>
- * property of the VR's NodeRevisionDescriptor (if not already contained).
- *
- * @param nrd the NodeRevisionDescriptor of the VR for which to update
- * the <code><checkout-set></code>.
- * @param uri the uri to add.
- *
- * @throws JDOMException if parsing the <code><checkout-set></code>
- * failed.
- */
- protected static void addUriToCheckoutSet(NodeRevisionDescriptor nrd, String
uri) throws JDOMException {
-
- NodeProperty checkoutSetProperty = nrd.getProperty(P_CHECKOUT_SET);
- if (checkoutSetProperty == null) {
- checkoutSetProperty = new NodeProperty(P_CHECKOUT_SET, null);
- }
- XMLValue xmlValue = new XMLValue((String)checkoutSetProperty.getValue());
- Iterator iterator = xmlValue.iterator();
- boolean alreadyContained = false;
- Element element = null;
- while (iterator.hasNext() && !alreadyContained) {
- element = (Element)iterator.next();
- if (element.getName().equals(E_HREF) && element.getText().equals(uri)) {
- alreadyContained = true;
- }
- }
- if (!alreadyContained) {
- element = new Element(E_HREF);
- element.setText(uri);
- xmlValue.add(element);
- }
- nrd.setProperty(P_CHECKOUT_SET, xmlValue.toString());
- }
-
- /**
- * Removes the given <code>uri</code> from the <code><checkout-set></code>
- * property of the VR's NodeRevisionDescriptor (if contained).
- *
- * @param nrd the NodeRevisionDescriptor of the VR for which to update
- * the <code><checkout-set></code>.
- * @param uri the uri to remove.
- *
- * @throws JDOMException if parsing the <code><checkout-set></code>
- * failed.
- */
- protected static void removeUriFromCheckoutSet(NodeRevisionDescriptor nrd,
String uri) throws JDOMException {
-
- NodeProperty checkoutSetProperty = nrd.getProperty(P_CHECKOUT_SET);
- if (checkoutSetProperty != null) {
-
- XMLValue xmlValue = new
XMLValue((String)checkoutSetProperty.getValue());
- Iterator iterator = xmlValue.iterator();
- boolean found = false;
- Element element = null;
- while (iterator.hasNext() && !found) {
- element = (Element)iterator.next();
- if (element.getName().equals(E_HREF) &&
element.getText().equals(uri)) {
- found = true;
- iterator.remove();
- }
- }
- if (found) {
- nrd.setProperty(P_CHECKOUT_SET, xmlValue.toString());
- }
- }
}
/**
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>