Author: fguillaume
Date: Mon Aug 3 00:36:50 2009
New Revision: 800177
URL: http://svn.apache.org/viewvc?rev=800177&view=rev
Log:
CMIS-44: includeRenditions only on SPI#query, SPI#getChildren,
SPI#getDescendants
Modified:
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-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/CMISQueryFeed.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/SPI.java
URL:
http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/SPI.java?rev=800177&r1=800176&r2=800177&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
Mon Aug 3 00:36:50 2009
@@ -110,12 +110,14 @@
* @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 orderBy an {...@code ORDER BY} clause, or {...@code null}
*/
// TODO return type for a tree
List<ObjectEntry> getDescendants(ObjectId folder, int depth, String filter,
boolean includeAllowableActions, boolean includeRelationships,
- String orderBy);
+ boolean includeRenditions, String orderBy);
/**
* Gets the direct children of a folder.
@@ -145,6 +147,8 @@
* @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 maxItems the maximum number of objects to return, or {...@code
0} for
* a repository-specific default
* @param skipCount the skip count
@@ -154,7 +158,8 @@
*/
List<ObjectEntry> getChildren(ObjectId folder, String filter,
boolean includeAllowableActions, boolean includeRelationships,
- int maxItems, int skipCount, String orderBy, boolean[]
hasMoreItems);
+ boolean includeRenditions, int maxItems, int skipCount,
+ String orderBy, boolean[] hasMoreItems);
/**
* Gets the parent of a folder.
@@ -575,6 +580,8 @@
* @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 maxItems the maximum number of objects to return, or {...@code
0} for
* a repository-specific default
* @param skipCount the skip count
@@ -584,7 +591,8 @@
// TODO returns a result set actually, there may be computed values
Collection<ObjectEntry> query(String statement, boolean searchAllVersions,
boolean includeAllowableActions, boolean includeRelationships,
- int maxItems, int skipCount, boolean[] hasMoreItems);
+ boolean includeRenditions, int maxItems, int skipCount,
+ boolean[] hasMoreItems);
/**
* 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=800177&r1=800176&r2=800177&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
Mon Aug 3 00:36:50 2009
@@ -179,8 +179,8 @@
protected void accumulateFolders(ObjectId folder, int depth, String filter,
boolean includeAllowableActions, List<ObjectEntry> list) {
List<ObjectEntry> children = getChildren(folder, filter,
- includeAllowableActions, false, Integer.MAX_VALUE, 0, null,
- new boolean[1]);
+ includeAllowableActions, false, false, Integer.MAX_VALUE, 0,
+ null, new boolean[1]);
for (ObjectEntry child : children) {
if (child.getBaseType() != BaseType.FOLDER) {
continue;
@@ -203,20 +203,24 @@
/**
* Accumulates the descendants into a list recursively.
+ *
+ * @param includeRenditions TODO
*/
protected void accumulateDescendants(ObjectId folder, int depth,
String filter, boolean includeAllowableActions,
- boolean includeRelationships, String orderBy, List<ObjectEntry>
list) {
+ boolean includeRelationships, boolean includeRenditions,
+ String orderBy, List<ObjectEntry> list) {
// TODO deal with paging properly
List<ObjectEntry> children = getChildren(folder, filter,
includeAllowableActions, includeRelationships,
- Integer.MAX_VALUE, 0, orderBy, new boolean[1]);
+ includeRenditions, Integer.MAX_VALUE, 0, orderBy,
+ new boolean[1]);
for (ObjectEntry child : children) {
list.add(child);
if (depth > 1 && child.getBaseType() == BaseType.FOLDER) {
accumulateDescendants(child, depth - 1, filter,
- includeAllowableActions, includeRelationships, orderBy,
- list);
+ includeAllowableActions, includeRelationships,
+ includeRenditions, orderBy, list);
}
}
}
@@ -224,17 +228,19 @@
// TODO use descendants feed
public List<ObjectEntry> getDescendants(ObjectId folder, int depth,
String filter, boolean includeAllowableActions,
- boolean includeRelationships, String orderBy) {
+ boolean includeRelationships, boolean includeRenditions,
+ String orderBy) {
// TODO includeRelationship, includeAllowableActions, orderBy
List<ObjectEntry> list = new ArrayList<ObjectEntry>();
accumulateDescendants(folder, depth, filter, includeAllowableActions,
- includeRelationships, orderBy, list);
+ includeRelationships, includeRenditions, orderBy, list);
return list;
}
public List<ObjectEntry> getChildren(ObjectId folder, String filter,
boolean includeAllowableActions, boolean includeRelationships,
- int maxItems, int skipCount, String orderBy, boolean[]
hasMoreItems) {
+ boolean includeRenditions, int maxItems, int skipCount,
+ String orderBy, boolean[] hasMoreItems) {
// TODO filter, includeRelationship, includeAllowableActions, orderBy
if (maxItems <= 0) {
maxItems = DEFAULT_MAX_CHILDREN;
@@ -488,8 +494,8 @@
public Collection<ObjectEntry> query(String statement,
boolean searchAllVersions, boolean includeAllowableActions,
- boolean includeRelationships, int maxItems, int skipCount,
- boolean[] hasMoreItems) {
+ boolean includeRelationships, boolean includeRenditions,
+ int maxItems, int skipCount, boolean[] hasMoreItems) {
String href = repository.getCollectionHref(CMIS.COL_QUERY);
Response resp = connector.postQuery(new Request(href), statement,
searchAllVersions, maxItems, skipCount,
includeAllowableActions);
@@ -506,7 +512,7 @@
boolean searchAllVersions) {
boolean[] hasMoreItems = new boolean[1];
Collection<ObjectEntry> res = query(statement, searchAllVersions,
- false, false, -1, 0, hasMoreItems);
+ false, false, false, -1, 0, hasMoreItems);
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-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=800177&r1=800176&r2=800177&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
Mon Aug 3 00:36:50 2009
@@ -41,7 +41,7 @@
boolean[] hasMoreItems = new boolean[1];
ObjectId objectId = spi.newObjectId(id);
List<ObjectEntry> children = spi.getChildren(objectId, null, false,
- false, 0, 0, null, hasMoreItems);
+ false, false, 0, 0, null, hasMoreItems);
return children;
}
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=800177&r1=800176&r2=800177&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
Mon Aug 3 00:36:50 2009
@@ -96,12 +96,14 @@
boolean searchAllVersions = false;
boolean includeAllowableActions = false;
boolean includeRelationships = false;
+ boolean includeRenditions = false;
int maxItems = -1;
int skipCount = 0;
boolean[] hasMoreItems = new boolean[1];
Collection<ObjectEntry> results = spi.query(statement,
searchAllVersions, includeAllowableActions,
- includeRelationships, maxItems, skipCount, hasMoreItems);
+ includeRelationships, includeRenditions, maxItems, skipCount,
+ hasMoreItems);
return results;
}
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=800177&r1=800176&r2=800177&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
Mon Aug 3 00:36:50 2009
@@ -160,8 +160,8 @@
protected void accumulateFolders(ObjectId folder, int depth, String filter,
boolean includeAllowableActions, List<ObjectEntry> list) {
List<ObjectEntry> children = getChildren(folder, filter,
- includeAllowableActions, false, Integer.MAX_VALUE, 0, null,
- new boolean[1]);
+ includeAllowableActions, false, false, Integer.MAX_VALUE, 0,
+ null, new boolean[1]);
for (ObjectEntry child : children) {
if (child.getBaseType() != BaseType.FOLDER) {
continue;
@@ -183,36 +183,42 @@
/**
* Accumulates the descendants into a list recursively.
+ *
+ * @param includeRenditions TODO
*/
protected void accumulateDescendants(ObjectId folder, int depth,
String filter, boolean includeAllowableActions,
- boolean includeRelationships, String orderBy, List<ObjectEntry>
list) {
+ boolean includeRelationships, boolean includeRenditions,
+ String orderBy, List<ObjectEntry> list) {
// TODO deal with paging properly
List<ObjectEntry> children = getChildren(folder, filter,
includeAllowableActions, includeRelationships,
- Integer.MAX_VALUE, 0, orderBy, new boolean[1]);
+ includeRenditions, Integer.MAX_VALUE, 0, orderBy,
+ new boolean[1]);
for (ObjectEntry child : children) {
list.add(child);
if (depth > 1 && child.getBaseType() == BaseType.FOLDER) {
accumulateDescendants(child, depth - 1, filter,
- includeAllowableActions, includeRelationships, orderBy,
- list);
+ includeAllowableActions, includeRelationships,
+ includeRenditions, orderBy, list);
}
}
}
public List<ObjectEntry> getDescendants(ObjectId folder, int depth,
String filter, boolean includeAllowableActions,
- boolean includeRelationships, String orderBy) {
+ boolean includeRelationships, boolean includeRenditions,
+ String orderBy) {
List<ObjectEntry> list = new ArrayList<ObjectEntry>();
accumulateDescendants(folder, depth, filter, includeAllowableActions,
- includeRelationships, orderBy, list);
+ includeRelationships, includeRenditions, orderBy, list);
return list;
}
public List<ObjectEntry> getChildren(ObjectId folder, String filter,
boolean includeAllowableActions, boolean includeRelationships,
- int maxItems, int skipCount, String orderBy, boolean[]
hasMoreItems) {
+ boolean includeRenditions, int maxItems, int skipCount,
+ String orderBy, boolean[] hasMoreItems) {
// TODO orderBy
Set<String> ids = repository.children.get(folder.getId());
List<ObjectEntry> all = new ArrayList<ObjectEntry>(ids.size());
@@ -598,8 +604,8 @@
public Collection<ObjectEntry> query(String statement,
boolean searchAllVersions, boolean includeAllowableActions,
- boolean includeRelationships, int maxItems, int skipCount,
- boolean[] hasMoreItems) {
+ boolean includeRelationships, boolean includeRenditions,
+ int maxItems, int skipCount, boolean[] hasMoreItems) {
// this implementation doesn't try to be very efficient...
List<ObjectEntry> all = new ArrayList<ObjectEntry>();
String tableName = null;
@@ -659,7 +665,7 @@
boolean searchAllVersions) {
boolean[] hasMoreItems = new boolean[1];
Collection<ObjectEntry> res = query(statement, searchAllVersions,
- false, false, 0, 0, hasMoreItems);
+ false, false, false, 0, 0, hasMoreItems);
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=800177&r1=800176&r2=800177&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
Mon Aug 3 00:36:50 2009
@@ -135,7 +135,7 @@
boolean searchAllVersions) {
boolean[] hasMoreItems = new boolean[1];
Collection<ObjectEntry> entries = query(statement, searchAllVersions,
- false, false, Integer.MAX_VALUE, 0, hasMoreItems);
+ false, false, false, Integer.MAX_VALUE, 0, hasMoreItems);
List<CMISObject> objects = new ArrayList<CMISObject>(entries.size());
for (ObjectEntry entry : entries) {
// cast entries, they are all JcrFolder or JcrDocument
@@ -270,7 +270,8 @@
public List<ObjectEntry> getChildren(ObjectId folderId, String filter,
boolean includeAllowableActions, boolean includeRelationships,
- int maxItems, int skipCount, String orderBy, boolean[]
hasMoreItems) {
+ boolean includeRenditions, int maxItems, int skipCount,
+ String orderBy, boolean[] hasMoreItems) {
try {
if (maxItems == 0) {
@@ -341,7 +342,8 @@
public List<ObjectEntry> getDescendants(ObjectId folderId, int depth,
String filter, boolean includeAllowableActions,
- boolean includeRelationships, String orderBy) {
+ boolean includeRelationships, boolean includeRenditions,
+ String orderBy) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException();
}
@@ -415,8 +417,8 @@
public Collection<ObjectEntry> query(String statement,
boolean searchAllVersions, boolean includeAllowableActions,
- boolean includeRelationships, int maxItems, int skipCount,
- boolean[] hasMoreItems) {
+ boolean includeRelationships, boolean includeRenditions,
+ int maxItems, int skipCount, boolean[] hasMoreItems) {
try {
QueryManager qm = session.getWorkspace().getQueryManager();
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=800177&r1=800176&r2=800177&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
Mon Aug 3 00:36:50 2009
@@ -158,28 +158,28 @@
public void testGetChildren() {
boolean[] hasMoreItems = new boolean[1];
Folder root = conn.getRootFolder();
- assertEquals(1, spi.getChildren(root, null, true, false, 20, 0, null,
- hasMoreItems).size());
+ assertEquals(1, spi.getChildren(root, null, true, false, false, 20, 0,
+ null, hasMoreItems).size());
assertFalse(hasMoreItems[0]);
ObjectId folder1 = root.getChildren().get(0);
- assertEquals(2, spi.getChildren(folder1, null, false, false, 20, 0,
- null, hasMoreItems).size());
+ assertEquals(2, spi.getChildren(folder1, null, false, false, false, 20,
+ 0, null, hasMoreItems).size());
assertFalse(hasMoreItems[0]);
- assertEquals(1, spi.getChildren(folder1, null, false, false, 1, 0,
- null, hasMoreItems).size());
+ assertEquals(1, spi.getChildren(folder1, null, false, false, false, 1,
+ 0, null, hasMoreItems).size());
assertTrue(hasMoreItems[0]);
- assertEquals(1, spi.getChildren(folder1, null, false, false, 1, 1,
- null, hasMoreItems).size());
+ assertEquals(1, spi.getChildren(folder1, null, false, false, false, 1,
+ 1, null, hasMoreItems).size());
assertFalse(hasMoreItems[0]);
List<ObjectEntry> temp = spi.getChildren(folder1, null, false, false,
- 2, 0, null, hasMoreItems);
+ false, 2, 0, null, hasMoreItems);
ObjectId folder2 = temp.get(0).getTypeId().equals("fold") ? temp.get(0)
: temp.get(1);
- assertEquals(1, spi.getChildren(folder2, null, false, false, 1, 1,
- null, hasMoreItems).size());
+ assertEquals(1, spi.getChildren(folder2, null, false, false, false, 1,
+ 1, null, hasMoreItems).size());
assertTrue(hasMoreItems[0]);
- assertEquals(2, spi.getChildren(folder2, null, false, false, 2, 0,
- null, hasMoreItems).size());
+ assertEquals(2, spi.getChildren(folder2, null, false, false, false, 2,
+ 0, null, hasMoreItems).size());
assertTrue(hasMoreItems[0]);
}
@@ -192,7 +192,7 @@
public void testGetDescendants() {
Folder root = conn.getRootFolder();
List<ObjectEntry> desc = spi.getDescendants(root, 4, null, false,
- false, null);
+ false, false, null);
assertEquals(6, desc.size());
}