chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r1222093 - /chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryVersioningServiceImpl.java
Date Thu, 22 Dec 2011 08:31:22 GMT
Author: jens
Date: Thu Dec 22 08:31:21 2011
New Revision: 1222093

URL: http://svn.apache.org/viewvc?rev=1222093&view=rev
Log:
set contentCopied flag properly and deal with the differences between AtomPub and WS bindings
correctly

Modified:
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryVersioningServiceImpl.java

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryVersioningServiceImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryVersioningServiceImpl.java?rev=1222093&r1=1222092&r2=1222093&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryVersioningServiceImpl.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryVersioningServiceImpl.java
Thu Dec 22 08:31:21 2011
@@ -127,7 +127,9 @@ public class InMemoryVersioningServiceIm
 
         DocumentVersion pwc = verDoc.checkOut(content, user);
         objectId.setValue(pwc.getId()); // return the id of the created pwc
-
+        if (null != contentCopied) // Note: always null in AtomPub binding
+            contentCopied.setValue(true);
+        
         // To be able to provide all Atom links in the response we need
         // additional information:
         if (context.isObjectInfoRequired()) {
@@ -140,6 +142,8 @@ public class InMemoryVersioningServiceIm
     public List<ObjectData> getAllVersions(CallContext context, String repositoryId,
String objectId, String versionSeriesId,
             String filter, Boolean includeAllowableActions, ExtensionsData extension, ObjectInfoHandler
objectInfos) {
         
+        // Note that in AtomPub object id is null and versionSeriesId is set and in SOAP
bindinf versionSeriesId is set
+        // and objectId is null
         StoredObject so;
         List<ObjectData> res = new ArrayList<ObjectData>();
         if (null == versionSeriesId)
@@ -148,18 +152,23 @@ public class InMemoryVersioningServiceIm
             throw new CmisInvalidArgumentException("getAllVersions requires a version series
id, but ist was null.");
         so = validator.getAllVersions(context, repositoryId, objectId, versionSeriesId, extension);
 
+        if (null == objectId)
+            objectId = versionSeriesId;
+
         if (!(so instanceof VersionedDocument)) {
-            so = validator.getObject(context, repositoryId, objectId, extension);  
-            ObjectData objData = getObject(context, repositoryId, objectId, filter, includeAllowableActions,
-                    IncludeRelationships.NONE,extension, objectInfos);
-            res.add(objData);
+            if (!(so instanceof DocumentVersion))
+                throw new CmisInvalidArgumentException("getAllVersions requires a id of a
versioned document.");
+            so = ((DocumentVersion)so).getParentDocument();
         }
+        ObjectData objData = getObject(context, repositoryId, objectId, filter, includeAllowableActions,
+                IncludeRelationships.NONE,extension, objectInfos);
+        res.add(objData);
 
         VersionedDocument verDoc = (VersionedDocument) so;
         res = new ArrayList<ObjectData>();
         List<DocumentVersion> versions = verDoc.getAllVersions();
         for (DocumentVersion version : versions) {
-            ObjectData objData = getObject(context, repositoryId, version.getId(), filter,
includeAllowableActions,
+            objData = getObject(context, repositoryId, version.getId(), filter, includeAllowableActions,
                     IncludeRelationships.NONE,extension, objectInfos);
             res.add(objData);
         }



Mime
View raw message