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/07/29 19:20:08 UTC

svn commit: r798984 - 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-commons/src/main/java/org/apache/chemistry/impl/simpl...

Author: fguillaume
Date: Wed Jul 29 17:20:08 2009
New Revision: 798984

URL: http://svn.apache.org/viewvc?rev=798984&view=rev
Log:
CMIS-44: added parameter allVersions to SPI#deleteObject and removed SPI#deleteAllVersions

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-commons/src/main/java/org/apache/chemistry/impl/simple/SimpleConnection.java
    incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimpleObject.java
    incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrConnection.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=798984&r1=798983&r2=798984&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 17:20:08 2009
@@ -433,15 +433,17 @@
      * When a filed object is deleted, it is removed from all folders it is
      * filed in.
      * <p>
-     * This service deletes a specific version of a document object. To delete
-     * all versions, use {@link #deleteAllVersions}.
+     * If allVersions is {@code false}, this deletes a specific version of a
+     * document object. If allVersions is {@code true}, then the whole version
+     * series is deleted.
      * <p>
      * Deletion of a private working copy (checked out version) is the same as
      * the cancelling of a checkout.
      *
      * @param object the object to delete
+     * @param allVersions if {@code true}, then delete all versions as well
      */
-    void deleteObject(ObjectId object);
+    void deleteObject(ObjectId object, boolean allVersions);
 
     /**
      * Deletes a tree of objects.
@@ -644,15 +646,6 @@
      */
     Collection<ObjectEntry> getAllVersions(String versionSeriesId, String filter);
 
-    /**
-     * Deletes all the versions of a document.
-     * <p>
-     * Deletes all document versions in the specified version series.
-     *
-     * @param versionSeriesId the version series ID
-     */
-    void deleteAllVersions(String versionSeriesId);
-
     /*
      * ----- Relationship Services -----
      */

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=798984&r1=798983&r2=798984&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 17:20:08 2009
@@ -414,7 +414,7 @@
         throw new UnsupportedOperationException();
     }
 
-    public void deleteObject(ObjectId object) {
+    public void deleteObject(ObjectId object, boolean allVersions) {
         // TODO Auto-generated method stub
         throw new UnsupportedOperationException();
     }
@@ -500,11 +500,6 @@
         throw new UnsupportedOperationException();
     }
 
-    public void deleteAllVersions(String versionSeriesId) {
-        // TODO Auto-generated method stub
-        throw new UnsupportedOperationException();
-    }
-
     /*
      * ----- Relationship Services -----
      */

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=798984&r1=798983&r2=798984&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 17:20:08 2009
@@ -24,7 +24,6 @@
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
-import java.util.HashSet;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
@@ -483,7 +482,8 @@
         throw new UnsupportedOperationException();
     }
 
-    public void deleteObject(ObjectId object) {
+    public void deleteObject(ObjectId object, boolean allVersions) {
+        // TODO allVersions
         String id = object.getId();
         if (repository.rootId.equals(id)) {
             throw new RuntimeException("Cannot delete root"); // TODO
@@ -518,6 +518,7 @@
             boolean continueOnFailure) {
         // TODO unfiling
         // TODO continueOnFailure
+        boolean allVersions = false; // TODO add in signature?
         String id = folder.getId();
         if (repository.rootId.equals(id)) {
             throw new RuntimeException("Cannot delete root"); // TODO
@@ -530,22 +531,18 @@
         if (repository.getType(typeId).getBaseType() != BaseType.FOLDER) {
             throw new RuntimeException("Not a folder: " + folder); // TODO
         }
-        Set<ObjectId> deletedIds = new HashSet<ObjectId>();
         for (String childId : repository.children.get(id)) {
             SimpleData childData = repository.datas.get(childId);
             String childTypeId = (String) childData.get(Property.TYPE_ID);
             ObjectId objectId = new SimpleObjectId(childId);
             if (repository.getType(childTypeId).getBaseType() == BaseType.FOLDER) {
-                deletedIds.addAll(deleteTree(objectId, unfiling,
-                        continueOnFailure));
+                deleteTree(objectId, unfiling, continueOnFailure);
             } else {
-                deleteObject(objectId);
-                deletedIds.add(objectId);
+                deleteObject(objectId, allVersions);
             }
         }
-        deleteObject(folder);
-        deletedIds.add(new SimpleObjectId(id));
-        return deletedIds;
+        deleteObject(folder, false);
+        return Collections.emptyList();
     }
 
     public void addObjectToFolder(ObjectId object, ObjectId folder) {
@@ -666,11 +663,6 @@
         throw new UnsupportedOperationException();
     }
 
-    public void deleteAllVersions(String versionSeriesId) {
-        // TODO Auto-generated method stub
-        throw new UnsupportedOperationException();
-    }
-
     /*
      * ----- Relationship Services -----
      */

Modified: incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimpleObject.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimpleObject.java?rev=798984&r1=798983&r2=798984&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimpleObject.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimpleObject.java Wed Jul 29 17:20:08 2009
@@ -69,7 +69,7 @@
     }
 
     public void delete() {
-        entry.connection.deleteObject(this);
+        entry.connection.deleteObject(this, false);
     }
 
     public void unfile() {

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=798984&r1=798983&r2=798984&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 17:20:08 2009
@@ -211,15 +211,11 @@
         throw new UnsupportedOperationException();
     }
 
-    public void deleteAllVersions(String versionSeriesId) {
-        throw new UnsupportedOperationException();
-    }
-
     public ObjectId deleteContentStream(ObjectId documentId) {
         throw new UnsupportedOperationException();
     }
 
-    public void deleteObject(ObjectId objectId) {
+    public void deleteObject(ObjectId objectId, boolean allVersions) {
         throw new UnsupportedOperationException();
     }