chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fguilla...@apache.org
Subject svn commit: r798877 - 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-server/src/main/java/org/apache/chemistry/ato...
Date Wed, 29 Jul 2009 12:46:16 GMT
Author: fguillaume
Date: Wed Jul 29 12:46:15 2009
New Revision: 798877

URL: http://svn.apache.org/viewvc?rev=798877&view=rev
Log:
CMIS-44: removed type argument of SPI#getChildren and 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-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=798877&r1=798876&r2=798877&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 Jul 29 12:46:15 2009
@@ -82,9 +82,6 @@
      * the documents. Otherwise, the latest version of the documents will be
      * returned.
      * <p>
-     * If type is {@code null}, then at each level folders should be returned
-     * before other types of objects.
-     * <p>
      * As relationships are not fileable, type cannot be
      * {@link BaseType#RELATIONSHIP}. However, if includeRelationships is set
      * then relationships are also returned for each returned object, according
@@ -97,7 +94,6 @@
      * When returning more than one level, the objects are nested.
      *
      * @param folder the folder
-     * @param type the base type, or {@code null} for all types
      * @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
@@ -106,9 +102,9 @@
      * @param orderBy an {@code ORDER BY} clause, or {@code null}
      */
     // TODO return type for a tree
-    List<ObjectEntry> getDescendants(ObjectId folder, BaseType type, int depth,
-            String filter, boolean includeAllowableActions,
-            boolean includeRelationships, String orderBy);
+    List<ObjectEntry> getDescendants(ObjectId folder, int depth, String filter,
+            boolean includeAllowableActions, boolean includeRelationships,
+            String orderBy);
 
     /**
      * Gets the direct children of a folder.
@@ -124,24 +120,16 @@
      * Ordering is repository-specific, except that if the repository state has
      * not changed then the ordering remains consistent across invocations.
      * <p>
-     * If type is {@code null}, then at each level folders should be returned
-     * before other types of objects.
-     * <p>
-     * As relationships are not fileable, type cannot be
-     * {@link BaseType#RELATIONSHIP}. However, if includeRelationships is set
-     * then relationships are also returned for each returned object, according
-     * to the value of the parameter.
+     * If includeRelationships is set, relationships are also returned for each
+     * returned object, according to the value of the parameter.
      * <p>
      * If includeAllowableActions is {@code true}, the repository will return
-     * the allowable actions for the current user for each descendant object as
-     * part of the results.
-     * <p>
-     * When returning more than one level, the objects are nested.
+     * the allowable actions for the current user for object as part of the
+     * results.
      * <p>
      * The return value hasMoreItems is filled if {@code maxItems > 0}.
      *
      * @param folder the folder
-     * @param type the base type, or {@code null} for all types
      * @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
@@ -153,10 +141,9 @@
      * @param hasMoreItems a 1-value boolean array to return a flag stating if
      *            there are more items
      */
-    List<ObjectEntry> getChildren(ObjectId folder, BaseType type,
-            String filter, boolean includeAllowableActions,
-            boolean includeRelationships, int maxItems, int skipCount,
-            String orderBy, boolean[] hasMoreItems);
+    List<ObjectEntry> getChildren(ObjectId folder, String filter,
+            boolean includeAllowableActions, boolean includeRelationships,
+            int maxItems, int skipCount, String orderBy, boolean[] hasMoreItems);
 
     /**
      * Gets the parent of a folder.

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=798877&r1=798876&r2=798877&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 Jul 29 12:46:15 2009
@@ -170,40 +170,36 @@
     /**
      * Accumulates the descendants into a list recursively.
      */
-    protected void accumulateDescendants(ObjectId folder, BaseType type,
-            int depth, String filter, boolean includeAllowableActions,
+    protected void accumulateDescendants(ObjectId folder, int depth,
+            String filter, boolean includeAllowableActions,
             boolean includeRelationships, String orderBy, List<ObjectEntry> list) {
         // TODO deal with paging properly
-        List<ObjectEntry> children = getChildren(folder, type, filter,
+        List<ObjectEntry> children = getChildren(folder, filter,
                 includeAllowableActions, includeRelationships,
                 Integer.MAX_VALUE, 0, orderBy, new boolean[1]);
         for (ObjectEntry child : children) {
-            BaseType childType = child.getBaseType();
-            if (type == null || childType.equals(type)) {
-                list.add(child);
-            }
-            if (depth > 1 && childType == BaseType.FOLDER) {
-                accumulateDescendants(child, type, depth - 1, filter,
+            list.add(child);
+            if (depth > 1 && child.getBaseType() == BaseType.FOLDER) {
+                accumulateDescendants(child, depth - 1, filter,
                         includeAllowableActions, includeRelationships, orderBy,
                         list);
             }
         }
     }
 
-    public List<ObjectEntry> getDescendants(ObjectId folder, BaseType type,
-            int depth, String filter, boolean includeAllowableActions,
+    public List<ObjectEntry> getDescendants(ObjectId folder, int depth,
+            String filter, boolean includeAllowableActions,
             boolean includeRelationships, String orderBy) {
         // TODO includeRelationship, includeAllowableActions, orderBy
         List<ObjectEntry> list = new ArrayList<ObjectEntry>();
-        accumulateDescendants(folder, type, depth, filter,
-                includeAllowableActions, includeRelationships, orderBy, list);
+        accumulateDescendants(folder, depth, filter, includeAllowableActions,
+                includeRelationships, orderBy, list);
         return list;
     }
 
-    public List<ObjectEntry> getChildren(ObjectId folder, BaseType type,
-            String filter, boolean includeAllowableActions,
-            boolean includeRelationships, int maxItems, int skipCount,
-            String orderBy, boolean[] hasMoreItems) {
+    public List<ObjectEntry> getChildren(ObjectId folder, String filter,
+            boolean includeAllowableActions, boolean includeRelationships,
+            int maxItems, int skipCount, String orderBy, boolean[] hasMoreItems) {
         // TODO filter, includeRelationship, includeAllowableActions, orderBy
         if (maxItems <= 0) {
             maxItems = DEFAULT_MAX_CHILDREN;
@@ -225,10 +221,6 @@
         hasMoreItems[0] = false;
         boolean done = false;
         for (ObjectEntry entry : feed) {
-            // type filtering
-            if (type != null && !entry.getBaseType().equals(type)) {
-                continue;
-            }
             // skip
             if (skipCount > 0) {
                 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=798877&r1=798876&r2=798877&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 Jul 29 12:46:15 2009
@@ -26,7 +26,7 @@
 import org.apache.chemistry.SPI;
 
 /**
-* CMIS Collection for the children of an object.
+ * CMIS Collection for the children of an object.
  */
 public class CMISChildrenCollection extends CMISObjectsCollection {
 
@@ -40,8 +40,8 @@
         SPI spi = repository.getSPI(); // TODO XXX connection leak
         boolean[] hasMoreItems = new boolean[1];
         ObjectId objectId = spi.newObjectId(id);
-        List<ObjectEntry> children = spi.getChildren(objectId, null, null,
-                false, false, 0, 0, null, hasMoreItems);
+        List<ObjectEntry> children = spi.getChildren(objectId, null, false,
+                false, 0, 0, null, hasMoreItems);
         return children;
     }
 

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=798877&r1=798876&r2=798877&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 Jul 29 12:46:15 2009
@@ -156,41 +156,37 @@
     /**
      * Accumulates the descendants into a list recursively.
      */
-    protected void accumulateDescendants(ObjectId folder, BaseType type,
-            int depth, String filter, boolean includeAllowableActions,
+    protected void accumulateDescendants(ObjectId folder, int depth,
+            String filter, boolean includeAllowableActions,
             boolean includeRelationships, String orderBy, List<ObjectEntry> list) {
         // TODO deal with paging properly
-        List<ObjectEntry> children = getChildren(folder, type, filter,
+        List<ObjectEntry> children = getChildren(folder, filter,
                 includeAllowableActions, includeRelationships,
                 Integer.MAX_VALUE, 0, orderBy, new boolean[1]);
         for (ObjectEntry child : children) {
-            BaseType childType = repository.getType(child.getTypeId()).getBaseType();
-            if (type == null || childType.equals(type)) {
-                list.add(child);
-            }
-            if (depth > 1 && childType == BaseType.FOLDER) {
-                accumulateDescendants(child, type, depth - 1, filter,
+            list.add(child);
+            if (depth > 1 && child.getBaseType() == BaseType.FOLDER) {
+                accumulateDescendants(child, depth - 1, filter,
                         includeAllowableActions, includeRelationships, orderBy,
                         list);
             }
         }
     }
 
-    public List<ObjectEntry> getDescendants(ObjectId folder, BaseType type,
-            int depth, String filter, boolean includeAllowableActions,
+    public List<ObjectEntry> getDescendants(ObjectId folder, int depth,
+            String filter, boolean includeAllowableActions,
             boolean includeRelationships, String orderBy) {
         // TODO includeRelationship, includeAllowableActions, orderBy
         List<ObjectEntry> list = new ArrayList<ObjectEntry>();
-        accumulateDescendants(folder, type, depth, filter,
-                includeAllowableActions, includeRelationships, orderBy, list);
+        accumulateDescendants(folder, depth, filter, includeAllowableActions,
+                includeRelationships, orderBy, list);
         return list;
     }
 
-    public List<ObjectEntry> getChildren(ObjectId folder, BaseType type,
-            String filter, boolean includeAllowableActions,
-            boolean includeRelationships, int maxItems, int skipCount,
-            String orderBy, boolean[] hasMoreItems) {
-        // TODO type and orderBy
+    public List<ObjectEntry> getChildren(ObjectId folder, String filter,
+            boolean includeAllowableActions, boolean includeRelationships,
+            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());
         for (String id : ids) {

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=798877&r1=798876&r2=798877&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 Jul 29 12:46:15 2009
@@ -33,7 +33,6 @@
 import javax.jcr.query.QueryManager;
 import javax.jcr.query.QueryResult;
 
-import org.apache.chemistry.BaseType;
 import org.apache.chemistry.CMISObject;
 import org.apache.chemistry.Connection;
 import org.apache.chemistry.ContentStream;
@@ -253,7 +252,7 @@
         throw new UnsupportedOperationException();
     }
 
-    public List<ObjectEntry> getChildren(ObjectId folderId, BaseType type,
+    public List<ObjectEntry> getChildren(ObjectId folderId,
                                          String filter,
                                          boolean includeAllowableActions,
                                          boolean includeRelationships,
@@ -319,7 +318,7 @@
         return null;
     }
 
-    public List<ObjectEntry> getDescendants(ObjectId folderId, BaseType type,
+    public List<ObjectEntry> getDescendants(ObjectId folderId,
                                             int depth, String filter,
                                             boolean includeAllowableActions,
                                             boolean includeRelationships,

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=798877&r1=798876&r2=798877&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 Jul 29 12:46:15 2009
@@ -48,7 +48,7 @@
  */
 public abstract class BasicTestCase extends TestCase {
 
-    public static final String ROOT_TYPE_ID = "chemistry:root"; // not in the spec
+    public static final String ROOT_TYPE_ID = "chemistry:root"; // not in spec
 
     public Repository repository;
 
@@ -135,38 +135,36 @@
     public void testGetChildren() {
         boolean[] hasMoreItems = new boolean[1];
         Folder root = conn.getRootFolder();
-        assertEquals(1, spi.getChildren(root, BaseType.FOLDER, null, true,
-                false, 20, 0, null, hasMoreItems).size());
+        assertEquals(1, spi.getChildren(root, null, true, false, 20, 0, null,
+                hasMoreItems).size());
         assertFalse(hasMoreItems[0]);
         ObjectId folder1 = root.getChildren(null).get(0);
-        assertEquals(2, spi.getChildren(folder1, null, null, false, false, 20,
-                0, null, hasMoreItems).size());
+        assertEquals(2, spi.getChildren(folder1, null, false, false, 20, 0,
+                null, hasMoreItems).size());
         assertFalse(hasMoreItems[0]);
-        assertEquals(1, spi.getChildren(folder1, null, null, false, false, 1,
-                0, null, hasMoreItems).size());
+        assertEquals(1, spi.getChildren(folder1, null, false, false, 1, 0,
+                null, hasMoreItems).size());
         assertTrue(hasMoreItems[0]);
-        assertEquals(1, spi.getChildren(folder1, null, null, false, false, 1,
-                1, null, hasMoreItems).size());
+        assertEquals(1, spi.getChildren(folder1, null, false, false, 1, 1,
+                null, hasMoreItems).size());
         assertFalse(hasMoreItems[0]);
-        List<ObjectEntry> temp = spi.getChildren(folder1, null, null, false,
-                false, 2, 0, null, hasMoreItems);
+        List<ObjectEntry> temp = spi.getChildren(folder1, null, false, 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, null, false, false, 1,
-                1, null, hasMoreItems).size());
+        assertEquals(1, spi.getChildren(folder2, null, false, false, 1, 1,
+                null, hasMoreItems).size());
         assertTrue(hasMoreItems[0]);
-        assertEquals(2, spi.getChildren(folder2, null, null, false, false, 2,
-                0, null, hasMoreItems).size());
+        assertEquals(2, spi.getChildren(folder2, null, false, false, 2, 0,
+                null, hasMoreItems).size());
         assertTrue(hasMoreItems[0]);
     }
 
     public void testGetDescendants() {
         Folder root = conn.getRootFolder();
-        assertEquals(6, spi.getDescendants(root, null, 4, null, false, false,
-                null).size());
-        List<ObjectEntry> desc = spi.getDescendants(root, BaseType.FOLDER, 4,
-                null, false, false, null);
-        assertEquals(2, desc.size());
+        List<ObjectEntry> desc = spi.getDescendants(root, 4, null, false,
+                false, null);
+        assertEquals(6, desc.size());
     }
 
     public void testGetFolderParent() {



Mime
View raw message