chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f...@apache.org
Subject svn commit: r1620653 - in /chemistry/opencmis/trunk: chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/ chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/mai...
Date Tue, 26 Aug 2014 16:31:50 GMT
Author: fmui
Date: Tue Aug 26 16:31:49 2014
New Revision: 1620653

URL: http://svn.apache.org/r1620653
Log:
CMIS-839: moveObject() workaround for SharePoint 2010

Modified:
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/ObjectServiceImpl.java
    chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/SessionParameter.java
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/configs/sharepoint-2010-atompub.properties

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/ObjectServiceImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/ObjectServiceImpl.java?rev=1620653&r1=1620652&r2=1620653&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/ObjectServiceImpl.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/ObjectServiceImpl.java
Tue Aug 26 16:31:49 2014
@@ -310,7 +310,7 @@ public class ObjectServiceImpl extends A
             Properties properties, ExtensionsData extension) {
         // we need an object id
         if ((objectId == null) || (objectId.getValue() == null) || (objectId.getValue().length()
== 0)) {
-            throw new CmisInvalidArgumentException("Object id must be set!");
+            throw new CmisInvalidArgumentException("Object ID must be set!");
         }
 
         // find the link
@@ -658,12 +658,12 @@ public class ObjectServiceImpl extends A
 
     public void moveObject(String repositoryId, Holder<String> objectId, String targetFolderId,
String sourceFolderId,
             ExtensionsData extension) {
-        if ((objectId == null) || (objectId.getValue() == null) || (objectId.getValue().length()
== 0)) {
-            throw new CmisInvalidArgumentException("Object id must be set!");
+        if (objectId == null || objectId.getValue() == null || objectId.getValue().length()
== 0) {
+            throw new CmisInvalidArgumentException("Object ID must be set!");
         }
 
-        if ((targetFolderId == null) || (targetFolderId.length() == 0) || (sourceFolderId
== null)
-                || (sourceFolderId.length() == 0)) {
+        if (targetFolderId == null || targetFolderId.length() == 0 || sourceFolderId == null
+                || sourceFolderId.length() == 0) {
             throw new CmisInvalidArgumentException("Source and target folder must be set!");
         }
 
@@ -677,6 +677,13 @@ public class ObjectServiceImpl extends A
         UrlBuilder url = new UrlBuilder(link);
         url.addParameter(Constants.PARAM_SOURCE_FOLDER_ID, sourceFolderId);
 
+        // workaround for SharePoint 2010 - see CMIS-839
+        boolean objectIdOnMove = getSession().get(SessionParameter.INCLUDE_OBJECTID_URL_PARAM_ON_MOVE,
false);
+        if (objectIdOnMove) {
+            url.addParameter("objectId", objectId.getValue());
+            url.addParameter("targetFolderId", targetFolderId);
+        }
+
         // set up object and writer
         final AtomEntryWriter entryWriter = new AtomEntryWriter(createIdObject(objectId.getValue()),
                 getCmisVersion(repositoryId));
@@ -688,6 +695,13 @@ public class ObjectServiceImpl extends A
             }
         });
 
+        // workaround for SharePoint 2010 - see CMIS-839
+        if (objectIdOnMove) {
+            // SharePoint doesn't return a new object ID
+            // we assume that the object ID hasn't changed
+            return;
+        }
+
         // parse the response
         AtomEntry entry = parse(resp.getStream(), AtomEntry.class);
 

Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/SessionParameter.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/SessionParameter.java?rev=1620653&r1=1620652&r2=1620653&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/SessionParameter.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/SessionParameter.java
Tue Aug 26 16:31:49 2014
@@ -519,6 +519,15 @@ package org.apache.chemistry.opencmis.co
  * <td>"false"</td>
  * </tr>
  * <tr>
+ * <td>{@link #INCLUDE_OBJECTID_URL_PARAM_ON_MOVE}</td>
+ * <td>Defines if the object ID should be added to the move URL<br>
+ * (Workaround for SharePoint 2010)</td>
+ * <td>AtomPub</td>
+ * <td>"true", "false"</td>
+ * <td>no</td>
+ * <td>"false"</td>
+ * </tr>
+ * <tr>
  * <td>{@link #OMIT_CHANGE_TOKENS}</td>
  * <td>Defines if the change token should be omitted for updating calls<br>
  * (Workaround for SharePoint 2010 and SharePoint 2013)</td>
@@ -672,5 +681,6 @@ public final class SessionParameter {
     // --- workarounds ---
 
     public static final String INCLUDE_OBJECTID_URL_PARAM_ON_CHECKOUT = "org.apache.chemistry.opencmis.workaround.includeObjectIdOnCheckout";
+    public static final String INCLUDE_OBJECTID_URL_PARAM_ON_MOVE = "org.apache.chemistry.opencmis.workaround.includeObjectIdOnMove";
     public static final String OMIT_CHANGE_TOKENS = "org.apache.chemistry.opencmis.workaround.omitChangeTokens";
 }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/configs/sharepoint-2010-atompub.properties
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/configs/sharepoint-2010-atompub.properties?rev=1620653&r1=1620652&r2=1620653&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/configs/sharepoint-2010-atompub.properties
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/configs/sharepoint-2010-atompub.properties
Tue Aug 26 16:31:49 2014
@@ -28,6 +28,7 @@ org.apache.chemistry.opencmis.user=<doma
 org.apache.chemistry.opencmis.password=<password>
 
 org.apache.chemistry.opencmis.workaround.includeObjectIdOnCheckout=true
+org.apache.chemistry.opencmis.workaround.includeObjectIdOnMove=true
 org.apache.chemistry.opencmis.workaround.omitChangeTokens=true
 
 cmis.workbench.folder.filter=*
\ No newline at end of file



Mime
View raw message