chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f...@apache.org
Subject svn commit: r1544508 - in /chemistry/opencmis/trunk/chemistry-opencmis-client: chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/ chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runti...
Date Fri, 22 Nov 2013 12:17:28 GMT
Author: fmui
Date: Fri Nov 22 12:17:28 2013
New Revision: 1544508

URL: http://svn.apache.org/r1544508
Log:
Client: added rename() method to CmisObject

Modified:
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/CmisObject.java
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/AbstractCmisObject.java
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/test/java/org/apache/chemistry/opencmis/client/runtime/CmisObjectMock.java

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/CmisObject.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/CmisObject.java?rev=1544508&r1=1544507&r2=1544508&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/CmisObject.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/CmisObject.java
Fri Nov 22 12:17:28 2013
@@ -105,12 +105,44 @@ public interface CmisObject extends Obje
      *            {@code true} if this object should be refresh after the
      *            update, {@code false} if not
      * 
-     * @return the object id of the updated object
+     * @return the object ID of the updated object
      * 
      * @cmis 1.0
      */
     ObjectId updateProperties(Map<String, ?> properties, boolean refresh);
 
+    /**
+     * Renames this object (changes the value of {@code cmis:name}). If the
+     * repository created a new object, for example a new version, this new
+     * object is returned. Otherwise the current object is returned.
+     * 
+     * @param newName
+     *            the new name, not {@code null} or empty
+     * 
+     * @return the updated object
+     * 
+     * @cmis 1.0
+     */
+    CmisObject rename(String newName);
+
+    /**
+     * Renames this object (changes the value of {@code cmis:name}). If the
+     * repository created a new object, for example a new version, the object id
+     * of the new object is returned. Otherwise the object id of the current
+     * object is returned.
+     * 
+     * @param newName
+     *            the new name, not {@code null} or empty
+     * @param refresh
+     *            {@code true} if this object should be refresh after the
+     *            update, {@code false} if not
+     * 
+     * @return the object ID of the updated object
+     * 
+     * @cmis 1.0
+     */
+    ObjectId rename(String newName, boolean refresh);
+
     // renditions
 
     /**

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/AbstractCmisObject.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/AbstractCmisObject.java?rev=1544508&r1=1544507&r2=1544508&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/AbstractCmisObject.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/AbstractCmisObject.java
Fri Nov 22 12:17:28 2013
@@ -24,6 +24,7 @@ import java.util.Collections;
 import java.util.EnumMap;
 import java.util.EnumSet;
 import java.util.GregorianCalendar;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -366,6 +367,28 @@ public abstract class AbstractCmisObject
         return getSession().createObjectId(newObjectId);
     }
 
+    public CmisObject rename(String newName) {
+        if (newName == null || newName.length() == 0) {
+            throw new IllegalArgumentException("New name must not be empty!");
+        }
+
+        Map<String, Object> prop = new HashMap<String, Object>();
+        prop.put(PropertyIds.NAME, newName);
+
+        return updateProperties(prop);
+    }
+
+    public ObjectId rename(String newName, boolean refresh) {
+        if (newName == null || newName.length() == 0) {
+            throw new IllegalArgumentException("New name must not be empty!");
+        }
+
+        Map<String, Object> prop = new HashMap<String, Object>();
+        prop.put(PropertyIds.NAME, newName);
+
+        return updateProperties(prop, refresh);
+    }
+
     // --- properties ---
 
     public ObjectType getBaseType() {

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/test/java/org/apache/chemistry/opencmis/client/runtime/CmisObjectMock.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/test/java/org/apache/chemistry/opencmis/client/runtime/CmisObjectMock.java?rev=1544508&r1=1544507&r2=1544508&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/test/java/org/apache/chemistry/opencmis/client/runtime/CmisObjectMock.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/test/java/org/apache/chemistry/opencmis/client/runtime/CmisObjectMock.java
Fri Nov 22 12:17:28 2013
@@ -197,6 +197,14 @@ public class CmisObjectMock implements C
         return null;
     }
 
+    public CmisObject rename(String newName) {
+        return null;
+    }
+
+    public ObjectId rename(String newName, boolean refresh) {
+        return null;
+    }
+
     public void applyPolicy(ObjectId... policyIds) {
 
     }



Mime
View raw message