[prev in list] [next in list] [prev in thread] [next in thread]
List: slide-dev
Subject: cvs commit: jakarta-slide/src/webdav/server/org/apache/slide/webdav/util VersioningHelper.java
From: juergen () apache ! org
Date: 2002-06-28 7:30:54
[Download RAW message or body]
juergen 2002/06/28 00:30:54
Modified: src/webdav/server/org/apache/slide/webdav/util
VersioningHelper.java
Log:
Just some minor refactoring in order to extract method \
searchResourcesWithGivenHistory(). (ralf)
Revision Changes Path
1.59 +35 -12 \
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.58
retrieving revision 1.59
diff -u -r1.58 -r1.59
--- VersioningHelper.java 25 Jun 2002 10:50:38 -0000 1.58
+++ VersioningHelper.java 28 Jun 2002 07:30:54 -0000 1.59
@@ -105,6 +105,7 @@
import org.apache.slide.search.Search;
import org.apache.slide.search.SearchQuery;
import org.apache.slide.search.SearchQueryResult;
+import org.apache.slide.search.BadQueryException;
import org.apache.slide.search.basic.Literals;
@@ -486,24 +487,46 @@
return new ViolatedPrecondition(C_MUST_BE_VERSION, \
WebdavStatus.SC_CONFLICT); }
+ String scope = resourceUrihandler.getAssociatedWorkspaceUri();
+ String historyPath = existingVersionUrihandler.getAssociatedHistoryUri();
+ SearchQueryResult queryResult = \
searchResourcesWithGivenHistory(historyPath, scope, Integer.MAX_VALUE); + \
Iterator queryResultIterator = queryResult.iterator(); + if \
(queryResultIterator.hasNext()) { + return new \
ViolatedPrecondition(C_ONE_VERSION_CONTROLLED_RESOURCE_PER_HISTORY_PER_WORKSPACE, + \
WebdavStatus.SC_CONFLICT); + }
+
+ return null;
+ }
+
+ /**
+ * Searches all resources in the given <code>scope</code> that have either a
+ * <code><checked-in></code> or <code><checked-in></code> property
+ * with a <code><href></code> element containing the given
+ * <code>historyPath</code>.
+ *
+ * @param historyPath the path of the history.
+ * @param scope the scope of the search.
+ *
+ * @return all matching resources.
+ *
+ * @throws ServiceAccessException
+ * @throws BadQueryException
+ */
+ protected SearchQueryResult searchResourcesWithGivenHistory(String \
historyPath, String scope, int maxDepth) throws ServiceAccessException, \
BadQueryException {
- Element basicSearch = \
getResourcesWithVersionHistoryQueryElement(resourceUrihandler.getAssociatedWorkspaceUri(),
- \
existingVersionUrihandler.getAssociatedHistoryUri()); + Element basicSearch = \
getResourcesWithVersionHistoryQueryElement(scope, + \
historyPath); String grammarNamespace = basicSearch.getNamespaceURI();
Search searchHelper = nsaToken.getSearchHelper();
SearchQuery searchQuery = searchHelper.createSearchQuery(grammarNamespace,
basicSearch,
sToken,
- \
Integer.MAX_VALUE); + \
maxDepth);
SearchQueryResult queryResult = searchHelper.search(sToken, searchQuery);
- Iterator queryResultIterator = queryResult.iterator();
- if (queryResultIterator.hasNext()) {
- return new \
ViolatedPrecondition(C_ONE_VERSION_CONTROLLED_RESOURCE_PER_HISTORY_PER_WORKSPACE,
- WebdavStatus.SC_CONFLICT);
+ return queryResult;
}
- return null;
- }
/**
* Returns the query document used to search all resources in the given
--
To unsubscribe, e-mail: <mailto:slide-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:slide-dev-help@jakarta.apache.org>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic