You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@chemistry.apache.org by fg...@apache.org on 2009/12/09 19:26:19 UTC
svn commit: r888908 - in /incubator/chemistry/trunk/chemistry:
chemistry-api/src/main/java/org/apache/chemistry/
chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/
chemistry-atompub-client/src/main/java/org/apache/chemistry/ato...
Author: fguillaume
Date: Wed Dec 9 18:26:18 2009
New Revision: 888908
URL: http://svn.apache.org/viewvc?rev=888908&view=rev
Log:
CMIS-71: fix query SPI and implementation to recognize all query parameters
Modified:
incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/CMIS.java
incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/RelationshipDirection.java
incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/SPI.java
incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/APPConnection.java
incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/connector/Connector.java
incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/connector/DefaultIOProvider.java
incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/connector/HttpClientConnector.java
incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/connector/IOProvider.java
incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/stax/QueryWriter.java
incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISCheckedOutCollection.java
incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISChildrenCollection.java
incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISObjectsCollection.java
incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISQueryFeed.java
incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/test/java/org/apache/chemistry/atompub/server/AtomPubServerTestCase.java
incubator/chemistry/trunk/chemistry/chemistry-atompub/src/main/java/org/apache/chemistry/atompub/abdera/QueryElement.java
incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimpleConnection.java
incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrConnection.java
incubator/chemistry/trunk/chemistry/chemistry-tests/src/main/java/org/apache/chemistry/test/BasicTestCase.java
Modified: incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/CMIS.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/CMIS.java?rev=888908&r1=888907&r2=888908&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/CMIS.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/CMIS.java Wed Dec 9 18:26:18 2009
@@ -205,12 +205,16 @@
public static final QName SEARCH_ALL_VERSIONS = CMISName("searchAllVersions");
+ public static final QName INCLUDE_ALLOWABLE_ACTIONS = CMISName("includeAllowableActions");
+
+ public static final QName INCLUDE_RELATIONSHIPS = CMISName("includeRelationships");
+
+ public static final QName RENDITION_FILTER = CMISName("renditionFilter");
+
public static final QName MAX_ITEMS = CMISName("maxItems");
public static final QName SKIP_COUNT = CMISName("skipCount");
- public static final QName INCLUDE_ALLOWABLE_ACTIONS = CMISName("includeAllowableActions");
-
// no namespace for attributes
public static final QName PDID = new QName("propertyDefinitionId");
Modified: incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/RelationshipDirection.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/RelationshipDirection.java?rev=888908&r1=888907&r2=888908&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/RelationshipDirection.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/RelationshipDirection.java Wed Dec 9 18:26:18 2009
@@ -62,8 +62,51 @@
return o;
}
+ public static RelationshipDirection get(String value,
+ RelationshipDirection def) {
+ RelationshipDirection o = all.get(value);
+ if (o == null) {
+ o = def;
+ }
+ return o;
+ }
+
+ protected static final String INCLUSION_NONE = "none";
+
+ protected static final String INCLUSION_SOURCE = "source";
+
+ protected static final String INCLUSION_TARGET = "target";
+
+ protected static final String INCLUSION_BOTH = "both";
+
+ public static RelationshipDirection fromInclusion(String value) {
+ if (INCLUSION_SOURCE.equals(value)) {
+ return SOURCE;
+ } else if (INCLUSION_TARGET.equals(value)) {
+ return TARGET;
+ } else if (INCLUSION_BOTH.equals(value)) {
+ return EITHER;
+ } else {
+ return null;
+ }
+ }
+
+ public static String toInclusion(RelationshipDirection o) {
+ if (o == SOURCE) {
+ return INCLUSION_SOURCE;
+ } else if (o == TARGET) {
+ return INCLUSION_TARGET;
+ } else if (o == EITHER) {
+ return INCLUSION_BOTH;
+ } else {
+ return INCLUSION_NONE;
+ }
+
+ }
+
@Override
public String toString() {
return value;
}
+
}
Modified: incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/SPI.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/SPI.java?rev=888908&r1=888907&r2=888908&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/SPI.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/SPI.java Wed Dec 9 18:26:18 2009
@@ -113,8 +113,8 @@
* @param depth the depth, or {@code -1} for all levels
* @param filter the properties filter, or {@code null} for all properties
* @param includeAllowableActions {@code true} to include allowable actions
- * @param includeRelationships {@code true} if relationships should be
- * included as well
+ * @param includeRelationships if not {@code null}, which relationships
+ * should be included as well
* @param includeRenditions {@code true} if renditions should be included as
* well
* @param orderBy an {@code ORDER BY} clause, or {@code null}
@@ -125,7 +125,8 @@
*/
// TODO return type for a tree
List<ObjectEntry> getDescendants(ObjectId folder, int depth, String filter,
- boolean includeAllowableActions, boolean includeRelationships,
+ boolean includeAllowableActions,
+ RelationshipDirection includeRelationships,
boolean includeRenditions, String orderBy);
/**
@@ -152,8 +153,8 @@
* @param folder the folder
* @param filter the properties filter, or {@code null} for all properties
* @param includeAllowableActions {@code true} to include allowable actions
- * @param includeRelationships {@code true} if relationships should be
- * included as well
+ * @param includeRelationships if not {@code null}, which relationships
+ * should be included as well
* @param includeRenditions {@code true} if renditions should be included as
* well
* @param orderBy an {@code ORDER BY} clause, or {@code null}
@@ -164,7 +165,8 @@
* @throws IllegalArgumentException if the object is not a folder
*/
ListPage<ObjectEntry> getChildren(ObjectId folder, String filter,
- boolean includeAllowableActions, boolean includeRelationships,
+ boolean includeAllowableActions,
+ RelationshipDirection includeRelationships,
boolean includeRenditions, String orderBy, Paging paging);
/**
@@ -215,8 +217,8 @@
* @param folder the folder, or {@code null}
* @param filter
* @param includeAllowableActions
- * @param includeRelationships {@code true} if relationships should be
- * included as well
+ * @param includeRelationships if not {@code null}, which relationships
+ * should be included as well
* @param paging paging information, or {@code null} for a
* repository-specific default
*
@@ -225,7 +227,7 @@
*/
ListPage<ObjectEntry> getCheckedOutDocuments(ObjectId folder,
String filter, boolean includeAllowableActions,
- boolean includeRelationships, Paging paging);
+ RelationshipDirection includeRelationships, Paging paging);
/*
* ----- Object Services -----
@@ -329,15 +331,16 @@
* @param object the object
* @param filter the properties filter, or {@code null} for all properties
* @param includeAllowableActions {@code true} to include allowable actions
- * @param includeRelationships {@code true} if relationships should be
- * included as well
+ * @param includeRelationships if not {@code null}, which relationships
+ * should be included as well
* @return the properties of the object, or {@code null} if the object is
* not found
*
* @throws FilterNotValidException if the filter is not valid
*/
ObjectEntry getProperties(ObjectId object, String filter,
- boolean includeAllowableActions, boolean includeRelationships);
+ boolean includeAllowableActions,
+ RelationshipDirection includeRelationships);
/**
* Gets the properties of an object, given its path.
@@ -345,15 +348,16 @@
* @param path the object path
* @param filter the properties filter, or {@code null} for all properties
* @param includeAllowableActions {@code true} to include allowable actions
- * @param includeRelationships {@code true} if relationships should be
- * included as well
+ * @param includeRelationships if not {@code null}, which relationships
+ * should be included as well
* @return the properties of the object, or {@code null} if the object is
* not found
*
* @throws FilterNotValidException if the filter is not valid
*/
ObjectEntry getObjectByPath(String path, String filter,
- boolean includeAllowableActions, boolean includeRelationships);
+ boolean includeAllowableActions,
+ RelationshipDirection includeRelationships);
/**
* Gets the list of associated renditions for an object.
@@ -664,10 +668,9 @@
* @param searchAllVersions {@code true} if all versions (not only that
* latest) must be searched
* @param includeAllowableActions {@code true} to include allowable actions
- * @param includeRelationships {@code true} if relationships should be
- * included as well
- * @param includeRenditions {@code true} if renditions should be included as
- * well
+ * @param includeRelationships if not {@code null}, which relationships
+ * should be included as well
+ * @param renditionFilter a rendition filter, or {@code null}
* @param paging paging information, or {@code null} for a
* repository-specific default
* @return the matching objects
@@ -676,8 +679,9 @@
*/
// TODO returns a result set actually, there may be computed values
ListPage<ObjectEntry> query(String statement, boolean searchAllVersions,
- boolean includeAllowableActions, boolean includeRelationships,
- boolean includeRenditions, Paging paging);
+ boolean includeAllowableActions,
+ RelationshipDirection includeRelationships, String renditionFilter,
+ Paging paging);
/**
* Gets a list of content changes.
Modified: incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/APPConnection.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/APPConnection.java?rev=888908&r1=888907&r2=888908&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/APPConnection.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/APPConnection.java Wed Dec 9 18:26:18 2009
@@ -187,7 +187,7 @@
protected void accumulateFolders(ObjectId folder, int depth, String filter,
boolean includeAllowableActions, List<ObjectEntry> list) {
List<ObjectEntry> children = getChildren(folder, filter,
- includeAllowableActions, false, false, null, new Paging(
+ includeAllowableActions, null, false, null, new Paging(
Integer.MAX_VALUE, 0));
for (ObjectEntry child : children) {
if (child.getBaseType() != BaseType.FOLDER) {
@@ -211,8 +211,8 @@
public List<ObjectEntry> getDescendants(ObjectId folder, int depth,
String filter, boolean includeAllowableActions,
- boolean includeRelationships, boolean includeRenditions,
- String orderBy) {
+ RelationshipDirection includeRelationships,
+ boolean includeRenditions, String orderBy) {
// TODO includeRelationship, includeAllowableActions, orderBy
// TODO filter, includeRenditions
String href = getObjectEntry(folder).getLink(AtomPub.LINK_DOWN,
@@ -229,7 +229,8 @@
}
public ListPage<ObjectEntry> getChildren(ObjectId folder, String filter,
- boolean includeAllowableActions, boolean includeRelationships,
+ boolean includeAllowableActions,
+ RelationshipDirection includeRelationships,
boolean includeRenditions, String orderBy, Paging paging) {
// TODO filter, includeRelationship, includeAllowableActions, orderBy
String href = getObjectEntry(folder).getLink(AtomPub.LINK_DOWN,
@@ -290,7 +291,7 @@
public ListPage<ObjectEntry> getCheckedOutDocuments(ObjectId folder,
String filter, boolean includeAllowableActions,
- boolean includeRelationships, Paging paging) {
+ RelationshipDirection includeRelationships, Paging paging) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException();
}
@@ -365,7 +366,8 @@
}
public ObjectEntry getProperties(ObjectId object, String filter,
- boolean includeAllowableActions, boolean includeRelationships) {
+ boolean includeAllowableActions,
+ RelationshipDirection includeRelationships) {
APPObjectEntry current = getObjectEntry(object);
String href = current.getLink(AtomPub.LINK_SELF);
Response resp = connector.get(new Request(href));
@@ -383,7 +385,8 @@
}
public ObjectEntry getObjectByPath(String path, String filter,
- boolean includeAllowableActions, boolean includeRelationships) {
+ boolean includeAllowableActions,
+ RelationshipDirection includeRelationships) {
if (!path.startsWith("/")) {
throw new IllegalArgumentException("Path must start with / : "
+ path);
@@ -577,11 +580,12 @@
public ListPage<ObjectEntry> query(String statement,
boolean searchAllVersions, boolean includeAllowableActions,
- boolean includeRelationships, boolean includeRenditions,
+ RelationshipDirection includeRelationships, String renditionFilter,
Paging paging) {
String href = repository.getCollectionHref(AtomPubCMIS.COL_QUERY);
Response resp = connector.postQuery(new Request(href), statement,
- searchAllVersions, includeAllowableActions, paging);
+ searchAllVersions, includeAllowableActions,
+ includeRelationships, renditionFilter, paging);
if (!resp.isOk()) {
throw new ContentManagerException(
"Remote server returned error code: "
@@ -594,7 +598,7 @@
public Collection<CMISObject> query(String statement,
boolean searchAllVersions) {
ListPage<ObjectEntry> res = query(statement, searchAllVersions, false,
- false, false, new Paging(-1, 0));
+ null, null, new Paging(-1, 0));
List<CMISObject> objects = new ArrayList<CMISObject>(res.size());
for (ObjectEntry e : res) {
objects.add(APPObject.construct((APPObjectEntry) e));
Modified: incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/connector/Connector.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/connector/Connector.java?rev=888908&r1=888907&r2=888908&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/connector/Connector.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/connector/Connector.java Wed Dec 9 18:26:18 2009
@@ -21,6 +21,7 @@
import org.apache.chemistry.ObjectEntry;
import org.apache.chemistry.Paging;
+import org.apache.chemistry.RelationshipDirection;
import org.apache.chemistry.Repository;
import org.apache.chemistry.Type;
import org.apache.chemistry.atompub.client.ContentManagerException;
@@ -68,14 +69,16 @@
throws ContentManagerException;
Response putQuery(Request req, String query, boolean searchAllVersions,
- boolean includeAllowableActions, Paging paging)
- throws ContentManagerException;
+ boolean includeAllowableActions,
+ RelationshipDirection includeRelationships, String renditionFilter,
+ Paging paging) throws ContentManagerException;
Response postObject(Request req, ObjectEntry entry)
throws ContentManagerException;
Response postQuery(Request req, String query, boolean searchAllVersions,
- boolean includeAllowableActions, Paging paging)
- throws ContentManagerException;
+ boolean includeAllowableActions,
+ RelationshipDirection includeRelationships, String renditionFilter,
+ Paging paging) throws ContentManagerException;
}
Modified: incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/connector/DefaultIOProvider.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/connector/DefaultIOProvider.java?rev=888908&r1=888907&r2=888908&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/connector/DefaultIOProvider.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/connector/DefaultIOProvider.java Wed Dec 9 18:26:18 2009
@@ -21,6 +21,7 @@
import org.apache.chemistry.ListPage;
import org.apache.chemistry.ObjectEntry;
import org.apache.chemistry.Paging;
+import org.apache.chemistry.RelationshipDirection;
import org.apache.chemistry.Type;
import org.apache.chemistry.TypeManager;
import org.apache.chemistry.atompub.client.APPObjectEntryReader;
@@ -78,14 +79,18 @@
}
public XmlObjectWriter<String> getQueryWriter(boolean searchAllVersions,
- boolean includeAllowableActions, Paging paging) {
+ boolean includeAllowableActions,
+ RelationshipDirection includeRelationships, String renditionFilter,
+ Paging paging) {
QueryWriter queryWriter = new QueryWriter();
queryWriter.setSearchAllVersions(searchAllVersions);
+ queryWriter.setIncludeAllowableActions(includeAllowableActions);
+ queryWriter.setIncludeRelationships(includeRelationships);
+ queryWriter.setRenditionFilter(renditionFilter);
if (paging != null) {
queryWriter.setMaxItems(paging.maxItems);
queryWriter.setSkipCount(paging.skipCount);
}
- queryWriter.setIncludeAllowableActions(includeAllowableActions);
return queryWriter;
}
Modified: incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/connector/HttpClientConnector.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/connector/HttpClientConnector.java?rev=888908&r1=888907&r2=888908&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/connector/HttpClientConnector.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/connector/HttpClientConnector.java Wed Dec 9 18:26:18 2009
@@ -24,6 +24,7 @@
import org.apache.chemistry.ObjectEntry;
import org.apache.chemistry.Paging;
+import org.apache.chemistry.RelationshipDirection;
import org.apache.chemistry.Repository;
import org.apache.chemistry.Type;
import org.apache.chemistry.atompub.client.ContentManagerException;
@@ -157,7 +158,8 @@
PutMethod method = new PutMethod(request.getUrl());
setMethodParams(method, request);
setMethodHeaders(method, request);
- method.setRequestEntity(new InputStreamRequestEntity(in, length, type));
+ method.setRequestEntity(new InputStreamRequestEntity(in, length,
+ type));
client.executeMethod(method);
return new HttpClientResponse(method, io);
} catch (Exception e) {
@@ -230,9 +232,11 @@
public Response putQuery(Request req, String query,
boolean searchAllVersions, boolean includeAllowableActions,
+ RelationshipDirection includeRelationships, String renditionFilter,
Paging paging) throws ContentManagerException {
return put(req, io.getQueryWriter(searchAllVersions,
- includeAllowableActions, paging), query);
+ includeAllowableActions, includeRelationships, renditionFilter,
+ paging), query);
}
public Response postObject(Request req, ObjectEntry entry)
@@ -242,9 +246,11 @@
public Response postQuery(Request req, String query,
boolean searchAllVersions, boolean includeAllowableActions,
+ RelationshipDirection includeRelationships, String renditionFilter,
Paging paging) throws ContentManagerException {
return post(req, io.getQueryWriter(searchAllVersions,
- includeAllowableActions, paging), query);
+ includeAllowableActions, includeRelationships, renditionFilter,
+ paging), query);
}
public static class XmlObjectWriterRequestEntity<T> implements
Modified: incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/connector/IOProvider.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/connector/IOProvider.java?rev=888908&r1=888907&r2=888908&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/connector/IOProvider.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/connector/IOProvider.java Wed Dec 9 18:26:18 2009
@@ -20,6 +20,7 @@
import org.apache.chemistry.ListPage;
import org.apache.chemistry.ObjectEntry;
import org.apache.chemistry.Paging;
+import org.apache.chemistry.RelationshipDirection;
import org.apache.chemistry.Type;
import org.apache.chemistry.TypeManager;
import org.apache.chemistry.atompub.client.stax.EntryReader;
@@ -46,6 +47,8 @@
XmlObjectWriter<ObjectEntry> getObjectEntryWriter();
XmlObjectWriter<String> getQueryWriter(boolean searchAllVersions,
- boolean includeAllowableActions, Paging paging);
+ boolean includeAllowableActions,
+ RelationshipDirection includeRelationships, String renditionFilter,
+ Paging paging);
}
Modified: incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/stax/QueryWriter.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/stax/QueryWriter.java?rev=888908&r1=888907&r2=888908&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/stax/QueryWriter.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/stax/QueryWriter.java Wed Dec 9 18:26:18 2009
@@ -20,6 +20,7 @@
import java.io.IOException;
import org.apache.chemistry.CMIS;
+import org.apache.chemistry.RelationshipDirection;
import org.apache.chemistry.atompub.AtomPubCMIS;
import org.apache.chemistry.xml.stax.XMLWriter;
@@ -30,12 +31,16 @@
protected boolean searchAllVersions;
+ protected boolean includeAllowableActions;
+
+ protected RelationshipDirection includeRelationships;
+
+ protected String renditionFilter;
+
protected long maxItems = -1;
protected long skipCount;
- protected boolean includeAllowableActions;
-
public void setSearchAllVersions(boolean searchAllVersions) {
this.searchAllVersions = searchAllVersions;
}
@@ -66,6 +71,15 @@
this.includeAllowableActions = includeAllowableActions;
}
+ public void setIncludeRelationships(
+ RelationshipDirection includeRelationships) {
+ this.includeRelationships = includeRelationships;
+ }
+
+ public void setRenditionFilter(String renditionFilter) {
+ this.renditionFilter = renditionFilter;
+ }
+
@Override
public String getContentType() {
return AtomPubCMIS.MEDIA_TYPE_CMIS_QUERY;
@@ -78,6 +92,13 @@
xw.start();
xw.element(CMIS.STATEMENT).econtent(statement);
xw.element(CMIS.SEARCH_ALL_VERSIONS).content(searchAllVersions);
+ xw.element(CMIS.INCLUDE_ALLOWABLE_ACTIONS).content(
+ includeAllowableActions);
+ xw.element(CMIS.INCLUDE_RELATIONSHIPS).content(
+ RelationshipDirection.toInclusion(includeRelationships));
+ if (renditionFilter != null) {
+ xw.element(CMIS.RENDITION_FILTER).econtent(renditionFilter);
+ }
if (maxItems > -1) {
xw.element(CMIS.MAX_ITEMS).content(maxItems);
}
Modified: incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISCheckedOutCollection.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISCheckedOutCollection.java?rev=888908&r1=888907&r2=888908&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISCheckedOutCollection.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISCheckedOutCollection.java Wed Dec 9 18:26:18 2009
@@ -25,6 +25,7 @@
import org.apache.chemistry.ObjectEntry;
import org.apache.chemistry.ObjectId;
import org.apache.chemistry.Paging;
+import org.apache.chemistry.RelationshipDirection;
import org.apache.chemistry.Repository;
import org.apache.chemistry.SPI;
import org.apache.chemistry.atompub.AtomPub;
@@ -72,8 +73,8 @@
0);
boolean includeAllowableActions = getParameter(request,
AtomPubCMIS.PARAM_INCLUDE_ALLOWABLE_ACTIONS, false);
- boolean includeRelationships = getParameter(request,
- AtomPubCMIS.PARAM_INCLUDE_RELATIONSHIPS, false);
+ String incl = target.getParameter(AtomPubCMIS.PARAM_INCLUDE_RELATIONSHIPS);
+ RelationshipDirection includeRelationships = RelationshipDirection.fromInclusion(incl);
ListPage<ObjectEntry> objectEntries = spi.getCheckedOutDocuments(
folderId, filter, includeAllowableActions,
includeRelationships, new Paging(maxItems, skipCount));
Modified: incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISChildrenCollection.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISChildrenCollection.java?rev=888908&r1=888907&r2=888908&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISChildrenCollection.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISChildrenCollection.java Wed Dec 9 18:26:18 2009
@@ -42,6 +42,7 @@
import org.apache.chemistry.ObjectId;
import org.apache.chemistry.Paging;
import org.apache.chemistry.Property;
+import org.apache.chemistry.RelationshipDirection;
import org.apache.chemistry.Repository;
import org.apache.chemistry.SPI;
import org.apache.chemistry.UpdateConflictException;
@@ -87,7 +88,7 @@
ObjectEntry entry;
SPI spi = repository.getSPI();
try {
- entry = spi.getProperties(spi.newObjectId(id), null, false, false);
+ entry = spi.getProperties(spi.newObjectId(id), null, false, null);
} finally {
spi.close();
}
@@ -163,8 +164,8 @@
String filter = target.getParameter(AtomPubCMIS.PARAM_FILTER);
boolean includeAllowableActions = getParameter(request,
AtomPubCMIS.PARAM_INCLUDE_ALLOWABLE_ACTIONS, false);
- boolean includeRelationships = getParameter(request,
- AtomPubCMIS.PARAM_INCLUDE_RELATIONSHIPS, false);
+ String incl = target.getParameter(AtomPubCMIS.PARAM_INCLUDE_RELATIONSHIPS);
+ RelationshipDirection includeRelationships = RelationshipDirection.fromInclusion(incl);
// TODO proper renditionFilter use
boolean includeRenditions = target.getParameter(AtomPubCMIS.PARAM_RENDITION_FILTER) == null ? false
: true;
Modified: incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISObjectsCollection.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISObjectsCollection.java?rev=888908&r1=888907&r2=888908&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISObjectsCollection.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISObjectsCollection.java Wed Dec 9 18:26:18 2009
@@ -56,6 +56,7 @@
import org.apache.chemistry.ObjectEntry;
import org.apache.chemistry.ObjectId;
import org.apache.chemistry.Property;
+import org.apache.chemistry.RelationshipDirection;
import org.apache.chemistry.Repository;
import org.apache.chemistry.SPI;
import org.apache.chemistry.Type;
@@ -374,7 +375,7 @@
// AbstractEntityCollectionAdapter#getEntryFromCollectionProvider is
// package-private...
Entry entry = request.getAbdera().getFactory().newEntry();
- ObjectEntry object = spi.getProperties(objectId, null, false, false);
+ ObjectEntry object = spi.getProperties(objectId, null, false, null);
addEntryDetails(request, entry, null, object);
if (isMediaEntry(object)) {
addMediaContent(null, entry, object, request);
@@ -409,7 +410,7 @@
// existing object
String id = getResourceName(request);
ObjectEntry object = spi.getProperties(spi.newObjectId(id), null,
- false, false);
+ false, null);
if (object == null) {
return new EmptyResponseContext(404);
}
@@ -434,7 +435,7 @@
// build response
Entry entry = request.getAbdera().getFactory().newEntry();
// refetch full object
- object = spi.getProperties(object, null, false, false);
+ object = spi.getProperties(object, null, false, null);
addEntryDetails(request, entry, null, object);
if (isMediaEntry(object)) {
addMediaContent(null, entry, object, request);
@@ -540,8 +541,8 @@
String filter = target.getParameter(AtomPubCMIS.PARAM_FILTER);
boolean includeAllowableActions = getParameter(request,
AtomPubCMIS.PARAM_INCLUDE_ALLOWABLE_ACTIONS, false);
- boolean includeRelationships = getParameter(request,
- AtomPubCMIS.PARAM_INCLUDE_RELATIONSHIPS, false);
+ String incl = target.getParameter(AtomPubCMIS.PARAM_INCLUDE_RELATIONSHIPS);
+ RelationshipDirection includeRelationships = RelationshipDirection.fromInclusion(incl);
if ("path".equals(getType())) {
String path = resourceName;
if (!path.startsWith("/")) {
Modified: incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISQueryFeed.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISQueryFeed.java?rev=888908&r1=888907&r2=888908&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISQueryFeed.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISQueryFeed.java Wed Dec 9 18:26:18 2009
@@ -27,6 +27,7 @@
import org.apache.chemistry.ListPage;
import org.apache.chemistry.ObjectEntry;
import org.apache.chemistry.Paging;
+import org.apache.chemistry.RelationshipDirection;
import org.apache.chemistry.Repository;
import org.apache.chemistry.SPI;
import org.apache.chemistry.atompub.AtomPubCMIS;
@@ -43,6 +44,18 @@
protected String statement;
+ protected boolean searchAllVersions;
+
+ protected boolean includeAllowableActions;
+
+ protected RelationshipDirection includeRelationships;
+
+ protected String renditionFilter;
+
+ protected int maxItems;
+
+ protected int skipCount;
+
public CMISQueryFeed(Repository repository) {
super(AtomPubCMIS.COL_QUERY, "query", null, repository);
}
@@ -88,6 +101,12 @@
Element element = (Element) document.getOMDocumentElement();
QueryElement q = new QueryElement(element);
statement = q.getStatement();
+ searchAllVersions = q.getSearchAllVersions();
+ includeAllowableActions = q.getIncludeAllowableActions();
+ includeRelationships = q.getIncludeRelationships();
+ renditionFilter = q.getRenditionFilter();
+ maxItems = q.getMaxItems();
+ skipCount = q.getSkipCount();
ResponseContext res = getFeed(request); // calls getEntries
if (res.getStatus() == HttpStatus.SC_OK) {
res.setStatus(HttpStatus.SC_CREATED);
@@ -100,16 +119,10 @@
throws ResponseContextException {
SPI spi = repository.getSPI();
try {
- boolean searchAllVersions = false;
- boolean includeAllowableActions = false;
- boolean includeRelationships = false;
- boolean includeRenditions = false;
- int maxItems = -1;
- int skipCount = 0;
ListPage<ObjectEntry> results = spi.query(statement,
searchAllVersions, includeAllowableActions,
- includeRelationships, includeRenditions, new Paging(
- maxItems, skipCount));
+ includeRelationships, renditionFilter, new Paging(maxItems,
+ skipCount));
return results;
} finally {
spi.close();
Modified: incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/test/java/org/apache/chemistry/atompub/server/AtomPubServerTestCase.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/test/java/org/apache/chemistry/atompub/server/AtomPubServerTestCase.java?rev=888908&r1=888907&r2=888908&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/test/java/org/apache/chemistry/atompub/server/AtomPubServerTestCase.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/test/java/org/apache/chemistry/atompub/server/AtomPubServerTestCase.java Wed Dec 9 18:26:18 2009
@@ -42,6 +42,7 @@
import org.apache.chemistry.Folder;
import org.apache.chemistry.PropertyDefinition;
import org.apache.chemistry.PropertyType;
+import org.apache.chemistry.RelationshipDirection;
import org.apache.chemistry.Repository;
import org.apache.chemistry.Updatability;
import org.apache.chemistry.atompub.AtomPub;
@@ -224,7 +225,8 @@
assertEquals(HttpStatus.SC_CONFLICT, status);
method.releaseConnection();
- EntityProvider provider = new QueryEntityProvider("SELECT * FROM doc");
+ EntityProvider provider = new QueryEntityProvider("SELECT * FROM doc",
+ true, false, null, null, 5, 0);
resp = client.post(base + "/query", provider);
assertEquals(HttpStatus.SC_CREATED, resp.getStatus());
Element res = resp.getDocument().getRoot();
@@ -250,8 +252,29 @@
public String statement;
- public QueryEntityProvider(String statement) {
+ public boolean searchAllVersions;
+
+ public boolean includeAllowableActions;
+
+ public RelationshipDirection includeRelationships;
+
+ public String renditionFilter;
+
+ public int maxItems;
+
+ public int skipCount;
+
+ public QueryEntityProvider(String statement, boolean searchAllVersions,
+ boolean includeAllowableActions,
+ RelationshipDirection includeRelationships,
+ String renditionFilter, int maxItems, int skipCount) {
this.statement = statement;
+ this.searchAllVersions = searchAllVersions;
+ this.includeAllowableActions = includeAllowableActions;
+ this.includeRelationships = includeRelationships;
+ this.renditionFilter = renditionFilter;
+ this.maxItems = maxItems;
+ this.skipCount = skipCount;
}
@Override
@@ -265,15 +288,22 @@
public void writeTo(StreamWriter sw) {
sw.startDocument();
- sw.startElement("query", CMIS.CMIS_NS, CMIS.CMIS_PREFIX);
- sw.startElement("statement", CMIS.CMIS_NS, CMIS.CMIS_PREFIX).writeElementText(
- statement).endElement();
- sw.startElement("searchAllVersions", CMIS.CMIS_NS, CMIS.CMIS_PREFIX).writeElementText(
- "false").endElement();
- sw.startElement("pageSize", CMIS.CMIS_NS, CMIS.CMIS_PREFIX).writeElementText(
- 0).endElement();
- sw.startElement("skipCount", CMIS.CMIS_NS, CMIS.CMIS_PREFIX).writeElementText(
- 0).endElement();
+ sw.startElement(CMIS.QUERY);
+ sw.startElement(CMIS.STATEMENT).writeElementText(statement).endElement();
+ sw.startElement(CMIS.SEARCH_ALL_VERSIONS).writeElementText(
+ Boolean.toString(searchAllVersions)).endElement();
+ sw.startElement(CMIS.INCLUDE_ALLOWABLE_ACTIONS).writeElementText(
+ Boolean.toString(includeAllowableActions)).endElement();
+ sw.startElement(CMIS.INCLUDE_RELATIONSHIPS).writeElementText(
+ RelationshipDirection.toInclusion(includeRelationships)).endElement();
+ if (renditionFilter != null) {
+ sw.startElement(CMIS.RENDITION_FILTER).writeElementText(
+ renditionFilter).endElement();
+ }
+ sw.startElement(CMIS.MAX_ITEMS).writeElementText(
+ Integer.toString(maxItems)).endElement();
+ sw.startElement(CMIS.SKIP_COUNT).writeElementText(
+ Integer.toString(skipCount)).endElement();
sw.endElement(); // query
sw.endDocument();
}
Modified: incubator/chemistry/trunk/chemistry/chemistry-atompub/src/main/java/org/apache/chemistry/atompub/abdera/QueryElement.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-atompub/src/main/java/org/apache/chemistry/atompub/abdera/QueryElement.java?rev=888908&r1=888907&r2=888908&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-atompub/src/main/java/org/apache/chemistry/atompub/abdera/QueryElement.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-atompub/src/main/java/org/apache/chemistry/atompub/abdera/QueryElement.java Wed Dec 9 18:26:18 2009
@@ -13,6 +13,7 @@
*
* Authors:
* Florent Guillaume, Nuxeo
+ * Amelie Avramo, EntropySoft
*/
package org.apache.chemistry.atompub.abdera;
@@ -25,6 +26,7 @@
import org.apache.abdera.parser.stax.FOMElement;
import org.apache.axiom.om.OMElement;
import org.apache.chemistry.CMIS;
+import org.apache.chemistry.RelationshipDirection;
/**
* Element wrapping for a CMIS query.
@@ -58,6 +60,32 @@
addExtension(new StatementElement(getFactory(), statement));
}
+ public boolean getSearchAllVersions() {
+ return Boolean.parseBoolean(getChildElementText(CMIS.SEARCH_ALL_VERSIONS));
+ }
+
+ public boolean getIncludeAllowableActions() {
+ return Boolean.parseBoolean(getChildElementText(CMIS.INCLUDE_ALLOWABLE_ACTIONS));
+ }
+
+ public RelationshipDirection getIncludeRelationships() {
+ return RelationshipDirection.fromInclusion(getChildElementText(CMIS.INCLUDE_RELATIONSHIPS));
+ }
+
+ public String getRenditionFilter() {
+ return getChildElementText(CMIS.RENDITION_FILTER);
+ }
+
+ public int getMaxItems() {
+ String maxItems = getChildElementText(CMIS.MAX_ITEMS);
+ return maxItems == null ? -1 : Integer.parseInt(maxItems);
+ }
+
+ public int getSkipCount() {
+ String skipCount = getChildElementText(CMIS.SKIP_COUNT);
+ return skipCount == null ? 0 : Integer.parseInt(skipCount);
+ }
+
protected static class StatementElement extends ElementWrapper {
public StatementElement(Factory factory, String statement) {
super(factory, CMIS.STATEMENT);
Modified: incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimpleConnection.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimpleConnection.java?rev=888908&r1=888907&r2=888908&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimpleConnection.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimpleConnection.java Wed Dec 9 18:26:18 2009
@@ -164,7 +164,7 @@
protected void accumulateFolders(ObjectId folder, int depth, String filter,
boolean includeAllowableActions, List<ObjectEntry> list) {
ListPage<ObjectEntry> children = getChildren(folder, filter,
- includeAllowableActions, false, false, null, null);
+ includeAllowableActions, null, false, null, null);
for (ObjectEntry child : children) {
if (child.getBaseType() != BaseType.FOLDER) {
continue;
@@ -191,8 +191,8 @@
*/
protected void accumulateDescendants(ObjectId folder, int depth,
String filter, boolean includeAllowableActions,
- boolean includeRelationships, boolean includeRenditions,
- String orderBy, List<ObjectEntry> list) {
+ RelationshipDirection includeRelationships,
+ boolean includeRenditions, String orderBy, List<ObjectEntry> list) {
// TODO deal with paging properly
List<ObjectEntry> children = getChildren(folder, filter,
includeAllowableActions, includeRelationships,
@@ -209,8 +209,8 @@
public List<ObjectEntry> getDescendants(ObjectId folder, int depth,
String filter, boolean includeAllowableActions,
- boolean includeRelationships, boolean includeRenditions,
- String orderBy) {
+ RelationshipDirection includeRelationships,
+ boolean includeRenditions, String orderBy) {
List<ObjectEntry> list = new ArrayList<ObjectEntry>();
accumulateDescendants(folder, depth, filter, includeAllowableActions,
includeRelationships, includeRenditions, orderBy, list);
@@ -218,7 +218,8 @@
}
public ListPage<ObjectEntry> getChildren(ObjectId folder, String filter,
- boolean includeAllowableActions, boolean includeRelationships,
+ boolean includeAllowableActions,
+ RelationshipDirection includeRelationships,
boolean includeRenditions, String orderBy, Paging paging) {
// TODO orderBy
Set<String> ids = repository.children.get(folder.getId());
@@ -303,7 +304,7 @@
public ListPage<ObjectEntry> getCheckedOutDocuments(ObjectId folder,
String filter, boolean includeAllowableActions,
- boolean includeRelationships, Paging paging) {
+ RelationshipDirection includeRelationships, Paging paging) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException();
}
@@ -485,7 +486,8 @@
}
public ObjectEntry getProperties(ObjectId object, String filter,
- boolean includeAllowableActions, boolean includeRelationships) {
+ boolean includeAllowableActions,
+ RelationshipDirection includeRelationships) {
// TODO filter, includeAllowableActions, includeRelationships
SimpleData data = repository.datas.get(object.getId());
if (data == null) {
@@ -495,7 +497,8 @@
}
public ObjectEntry getObjectByPath(String path, String filter,
- boolean includeAllowableActions, boolean includeRelationships) {
+ boolean includeAllowableActions,
+ RelationshipDirection includeRelationships) {
// TODO filter, includeAllowableActions, includeRelationships
if (!path.startsWith("/")) {
throw new IllegalArgumentException("Path must start with / : "
@@ -738,7 +741,7 @@
public ListPage<ObjectEntry> query(String statement,
boolean searchAllVersions, boolean includeAllowableActions,
- boolean includeRelationships, boolean includeRenditions,
+ RelationshipDirection includeRelationships, String renditionFilter,
Paging paging) {
// this implementation doesn't try to be very efficient...
List<ObjectEntry> all = new ArrayList<ObjectEntry>();
@@ -798,7 +801,7 @@
public Collection<CMISObject> query(String statement,
boolean searchAllVersions) {
ListPage<ObjectEntry> res = query(statement, searchAllVersions, false,
- false, false, null);
+ null, null, null);
List<CMISObject> objects = new ArrayList<CMISObject>(res.size());
for (ObjectEntry e : res) {
objects.add(SimpleObject.construct((SimpleObjectEntry) e));
Modified: incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrConnection.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrConnection.java?rev=888908&r1=888907&r2=888908&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrConnection.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrConnection.java Wed Dec 9 18:26:18 2009
@@ -138,7 +138,7 @@
public Collection<CMISObject> query(String statement,
boolean searchAllVersions) {
ListPage<ObjectEntry> entries = query(statement, searchAllVersions,
- false, false, false, new Paging(Integer.MAX_VALUE, 0));
+ false, null, null, new Paging(Integer.MAX_VALUE, 0));
List<CMISObject> objects = new ArrayList<CMISObject>(entries.size());
for (ObjectEntry entry : entries) {
// cast entries, they are all JcrFolder or JcrDocument
@@ -262,13 +262,14 @@
public ListPage<ObjectEntry> getCheckedOutDocuments(ObjectId folderId,
String filter, boolean includeAllowableActions,
- boolean includeRelationships, Paging paging) {
+ RelationshipDirection includeRelationships, Paging paging) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException();
}
public ListPage<ObjectEntry> getChildren(ObjectId folderId, String filter,
- boolean includeAllowableActions, boolean includeRelationships,
+ boolean includeAllowableActions,
+ RelationshipDirection includeRelationships,
boolean includeRenditions, String orderBy, Paging paging) {
try {
@@ -338,8 +339,8 @@
public List<ObjectEntry> getDescendants(ObjectId folderId, int depth,
String filter, boolean includeAllowableActions,
- boolean includeRelationships, boolean includeRenditions,
- String orderBy) {
+ RelationshipDirection includeRelationships,
+ boolean includeRenditions, String orderBy) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException();
}
@@ -356,7 +357,8 @@
}
public ObjectEntry getProperties(ObjectId objectId, String filter,
- boolean includeAllowableActions, boolean includeRelationships) {
+ boolean includeAllowableActions,
+ RelationshipDirection includeRelationships) {
try {
String relPath = JcrObjectEntry.getPath(objectId.getId()).substring(
@@ -379,7 +381,8 @@
}
public ObjectEntry getObjectByPath(String path, String filter,
- boolean includeAllowableActions, boolean includeRelationships) {
+ boolean includeAllowableActions,
+ RelationshipDirection includeRelationships) {
try {
if (path == null || path.equals("") || path.equals("/")) {
return (ObjectEntry) getRootFolder();
@@ -437,7 +440,7 @@
public ListPage<ObjectEntry> query(String statement,
boolean searchAllVersions, boolean includeAllowableActions,
- boolean includeRelationships, boolean includeRenditions,
+ RelationshipDirection includeRelationships, String renditionFilter,
Paging paging) {
try {
Modified: incubator/chemistry/trunk/chemistry/chemistry-tests/src/main/java/org/apache/chemistry/test/BasicTestCase.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-tests/src/main/java/org/apache/chemistry/test/BasicTestCase.java?rev=888908&r1=888907&r2=888908&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-tests/src/main/java/org/apache/chemistry/test/BasicTestCase.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-tests/src/main/java/org/apache/chemistry/test/BasicTestCase.java Wed Dec 9 18:26:18 2009
@@ -209,56 +209,56 @@
public void testGetObjectByPath() {
Folder root = conn.getRootFolder();
assertEquals(ROOT_FOLDER_NAME, root.getName());
- assertNotNull(spi.getObjectByPath("/", null, false, false));
- assertNotNull(spi.getObjectByPath("/folder 1", null, false, false));
- assertNotNull(spi.getObjectByPath("/folder 1/doc 1", null, false, false));
+ assertNotNull(spi.getObjectByPath("/", null, false, null));
+ assertNotNull(spi.getObjectByPath("/folder 1", null, false, null));
+ assertNotNull(spi.getObjectByPath("/folder 1/doc 1", null, false, null));
assertNotNull(spi.getObjectByPath("/folder 1/folder 2", null, false,
- false));
+ null));
assertNotNull(spi.getObjectByPath("/folder 1/folder 2/doc 2", null,
- false, false));
+ false, null));
assertNotNull(spi.getObjectByPath("/folder 1/folder 2/doc 3", null,
- false, false));
- assertNull(spi.getObjectByPath("/notsuchname", null, false, false));
+ false, null));
+ assertNull(spi.getObjectByPath("/notsuchname", null, false, null));
}
public void testGetChildren() {
Folder root = conn.getRootFolder();
- ListPage<ObjectEntry> page = spi.getChildren(root, null, true, false,
+ ListPage<ObjectEntry> page = spi.getChildren(root, null, true, null,
false, null, new Paging(20, 0));
assertEquals(1, page.size());
assertFalse(page.getHasMoreItems());
assertEquals(1, page.getNumItems());
ObjectId folder1 = root.getChildren().get(0);
- page = spi.getChildren(folder1, null, false, false, false, null,
+ page = spi.getChildren(folder1, null, false, null, false, null,
new Paging(20, 0));
assertEquals(2, page.size());
assertFalse(page.getHasMoreItems());
assertEquals(2, page.getNumItems());
- page = spi.getChildren(folder1, null, false, false, false, null,
+ page = spi.getChildren(folder1, null, false, null, false, null,
new Paging(1, 0));
assertEquals(1, page.size());
assertTrue(page.getHasMoreItems());
assertEquals(2, page.getNumItems());
- page = spi.getChildren(folder1, null, false, false, false, null,
+ page = spi.getChildren(folder1, null, false, null, false, null,
new Paging(1, 1));
assertEquals(1, page.size());
assertFalse(page.getHasMoreItems());
assertEquals(2, page.getNumItems());
- page = spi.getChildren(folder1, null, false, false, false, null,
+ page = spi.getChildren(folder1, null, false, null, false, null,
new Paging(2, 0));
ObjectId folder2 = page.get(0).getTypeId().equals("fold") ? page.get(0)
: page.get(1);
- page = spi.getChildren(folder2, null, false, false, false, null,
+ page = spi.getChildren(folder2, null, false, null, false, null,
new Paging(1, 1));
assertEquals(1, page.size());
assertTrue(page.getHasMoreItems());
assertEquals(3, page.getNumItems());
- page = spi.getChildren(folder2, null, false, false, false, null,
+ page = spi.getChildren(folder2, null, false, null, false, null,
new Paging(2, 0));
assertEquals(2, page.size());
assertTrue(page.getHasMoreItems());
@@ -273,8 +273,8 @@
public void testGetDescendants() {
Folder root = conn.getRootFolder();
- List<ObjectEntry> desc = spi.getDescendants(root, 4, null, false,
- false, false, null);
+ List<ObjectEntry> desc = spi.getDescendants(root, 4, null, false, null,
+ false, null);
assertEquals(6, desc.size());
}
@@ -328,7 +328,7 @@
public void testContentStreamSPI() throws Exception {
// set
ObjectEntry ob = spi.getObjectByPath("/folder 1/doc 1", null, false,
- false);
+ null);
SimpleObjectId id = new SimpleObjectId(ob.getId());
assertFalse(spi.hasContentStream(id)); // unfetched
assertFalse(spi.hasContentStream(ob)); // fetched
@@ -435,7 +435,7 @@
public void testUpdateSPI() throws Exception {
ObjectEntry ob = spi.getObjectByPath("/folder 1/doc 1", null, false,
- false);
+ null);
assertEquals("doc 1 title", ob.getValue("title"));
assertEquals("The doc 1 descr", ob.getValue("description"));
// update
@@ -443,7 +443,7 @@
properties.put("description", "new descr");
spi.updateProperties(ob, null, properties);
// refetch
- ob = spi.getProperties(ob, null, false, false);
+ ob = spi.getProperties(ob, null, false, null);
assertEquals("doc 1 title", ob.getValue("title"));
assertEquals("new descr", ob.getValue("description"));
}