You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@chemistry.apache.org by fm...@apache.org on 2016/08/08 12:53:15 UTC

svn commit: r1755503 - 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...

Author: fmui
Date: Mon Aug  8 12:53:15 2016
New Revision: 1755503

URL: http://svn.apache.org/viewvc?rev=1755503&view=rev
Log:
Client: added another workaround for SharePoint

Modified:
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/VersioningServiceImpl.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
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/configs/sharepoint-2013-atompub.properties

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/VersioningServiceImpl.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/VersioningServiceImpl.java?rev=1755503&r1=1755502&r2=1755503&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/VersioningServiceImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/VersioningServiceImpl.java Mon Aug  8 12:53:15 2016
@@ -325,6 +325,26 @@ public class VersioningServiceImpl exten
             returnVersion = ReturnVersion.LASTESTMAJOR;
         }
 
+        // workaround for SharePoint - use the version series ID instead of the
+        // object ID
+        if (getSession().get(SessionParameter.LATEST_VERSION_WITH_VERSION_SERIES_ID, false)) {
+            if (versionSeriesId != null) {
+                objectId = versionSeriesId;
+            } else {
+                ObjectData obj = getObjectInternal(repositoryId, IdentifierType.ID, objectId, null,
+                        PropertyIds.OBJECT_ID + "," + PropertyIds.VERSION_SERIES_ID, Boolean.FALSE,
+                        IncludeRelationships.NONE, "cmis:none", Boolean.FALSE, Boolean.FALSE, extension);
+
+                if (obj.getProperties() != null && obj.getProperties().getProperties() != null) {
+                    PropertyData<?> versionSeriesProp = obj.getProperties().getProperties()
+                            .get(PropertyIds.VERSION_SERIES_ID);
+                    if (versionSeriesProp != null && versionSeriesProp.getFirstValue() instanceof String) {
+                        objectId = (String) versionSeriesProp.getFirstValue();
+                    }
+                }
+            }
+        }
+
         return getObjectInternal(repositoryId, IdentifierType.ID, objectId, returnVersion, filter,
                 includeAllowableActions, includeRelationships, renditionFilter, includePolicyIds, includeACL, extension);
     }
@@ -332,15 +352,7 @@ public class VersioningServiceImpl exten
     @Override
     public Properties getPropertiesOfLatestVersion(String repositoryId, String objectId, String versionSeriesId,
             Boolean major, String filter, ExtensionsData extension) {
-
-        ReturnVersion returnVersion = ReturnVersion.LATEST;
-        if ((major != null) && (major.booleanValue())) {
-            returnVersion = ReturnVersion.LASTESTMAJOR;
-        }
-
-        ObjectData object = getObjectInternal(repositoryId, IdentifierType.ID, objectId, returnVersion, filter,
-                Boolean.FALSE, IncludeRelationships.NONE, "cmis:none", Boolean.FALSE, Boolean.FALSE, extension);
-
-        return object.getProperties();
+        return getObjectOfLatestVersion(repositoryId, objectId, versionSeriesId, major, filter, Boolean.FALSE,
+                IncludeRelationships.NONE, "cmis:none", Boolean.FALSE, Boolean.FALSE, extension).getProperties();
     }
 }

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=1755503&r1=1755502&r2=1755503&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 Mon Aug  8 12:53:15 2016
@@ -594,6 +594,16 @@ package org.apache.chemistry.opencmis.co
  * <td>no</td>
  * <td>"false"</td>
  * </tr>
+ * <tr>
+ * <td>{@link #LATEST_VERSION_WITH_VERSION_SERIES_ID}</td>
+ * <td>Defines if getObjectOfLatestVersion should use the version series ID
+ * instead of the object ID<br>
+ * (Workaround for SharePoint 2010 and SharePoint 2013)</td>
+ * <td>AtomPub</td>
+ * <td>"true", "false"</td>
+ * <td>no</td>
+ * <td>"false"</td>
+ * </tr>
  * </table>
  */
 public final class SessionParameter {
@@ -746,6 +756,7 @@ public final class SessionParameter {
     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";
     public static final String ADD_NAME_ON_CHECK_IN = "org.apache.chemistry.opencmis.workaround.addNameOnCheckIn";
+    public static final String LATEST_VERSION_WITH_VERSION_SERIES_ID = "org.apache.chemistry.opencmis.workaround.getLatestVersionWithVersionSeriesId";
 
     // utility class
     private SessionParameter() {

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=1755503&r1=1755502&r2=1755503&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 Mon Aug  8 12:53:15 2016
@@ -31,5 +31,6 @@ org.apache.chemistry.opencmis.workaround
 org.apache.chemistry.opencmis.workaround.includeObjectIdOnMove=true
 org.apache.chemistry.opencmis.workaround.omitChangeTokens=true
 org.apache.chemistry.opencmis.workaround.addNameOnCheckIn=true
+org.apache.chemistry.opencmis.workaround.getLatestVersionWithVersionSeriesId=true
 
 cmis.workbench.folder.filter=*
\ No newline at end of file

Modified: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/configs/sharepoint-2013-atompub.properties
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/configs/sharepoint-2013-atompub.properties?rev=1755503&r1=1755502&r2=1755503&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/configs/sharepoint-2013-atompub.properties (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/configs/sharepoint-2013-atompub.properties Mon Aug  8 12:53:15 2016
@@ -28,5 +28,6 @@ org.apache.chemistry.opencmis.password=<
 
 org.apache.chemistry.opencmis.workaround.omitChangeTokens=true
 org.apache.chemistry.opencmis.workaround.addNameOnCheckIn=true
+org.apache.chemistry.opencmis.workaround.getLatestVersionWithVersionSeriesId=true
 
 cmis.workbench.folder.filter=*
\ No newline at end of file