chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r1235874 - in /chemistry/opencmis/trunk/chemistry-opencmis-server: chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/ chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis...
Date Wed, 25 Jan 2012 18:55:06 GMT
Author: jens
Date: Wed Jan 25 18:55:06 2012
New Revision: 1235874

URL: http://svn.apache.org/viewvc?rev=1235874&view=rev
Log:
Make InMemory server compatible to latest TCK and browser binding (Versioning Tests)

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

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryNavigationServiceImpl.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/InMemoryNavigationServiceImpl.java?rev=1235874&r1=1235873&r2=1235874&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryNavigationServiceImpl.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryNavigationServiceImpl.java
Wed Jan 25 18:55:06 2012
@@ -103,13 +103,14 @@ public class InMemoryNavigationServiceIm
                 odList.add(od);
             }
         } else {
+            LOG.debug("getting checked-out documents for folder: " + folderId);
             ObjectInFolderList children = getChildrenIntern(repositoryId, folderId, filter,
orderBy,
                     includeAllowableActions, includeRelationships, renditionFilter, false,
-1, -1, false, context
                             .isObjectInfoRequired() ? objectInfos : null, user);
             for (ObjectInFolderData child : children.getObjects()) {
                 ObjectData obj = child.getObject();
                 StoredObject so = fStoreManager.getObjectStore(repositoryId).getObjectById(obj.getId());
-                LOG.info("Checked out: children:" + obj.getId());
+                LOG.debug("Checked out: children:" + obj.getId());
                 if (so instanceof DocumentVersion && ((DocumentVersion) so).getParentDocument().isCheckedOut())
{
                     odList.add(obj);
                     if (context.isObjectInfoRequired()) {

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=1235874&r1=1235873&r2=1235874&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
Wed Jan 25 18:55:06 2012
@@ -69,6 +69,10 @@ public class InMemoryVersioningServiceIm
         VersionedDocument verDoc = testHasProperCheckedOutStatus(so, user);
 
         verDoc.cancelCheckOut(user);
+        
+        // if this is the last version delete the document itself
+        if (verDoc.getAllVersions().size() == 0)
+            fStoreManager.getObjectStore(repositoryId).deleteObject(verDoc.getId(), true,
user);
     }
 
     public void checkIn(CallContext context, String repositoryId, Holder<String> objectId,
Boolean major,
@@ -80,6 +84,11 @@ public class InMemoryVersioningServiceIm
         String user = context.getUsername();
         VersionedDocument verDoc = testHasProperCheckedOutStatus(so, user);
 
+        // check if the contentStream is a usable object or ignore it otherwise
+        // Note Bworser binding sets an empty object
+        if (contentStream != null && contentStream.getStream() == null)
+            contentStream = null;
+        
         verDoc.checkIn(major, properties, contentStream, checkinComment, user);
 
         // To be able to provide all Atom links in the response we need

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/TypeValidator.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/TypeValidator.java?rev=1235874&r1=1235873&r2=1235874&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/TypeValidator.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/TypeValidator.java
Wed Jan 25 18:55:06 2012
@@ -43,6 +43,7 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.enums.Cardinality;
 import org.apache.chemistry.opencmis.commons.enums.VersioningState;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisConstraintException;
+import org.apache.chemistry.opencmis.commons.exceptions.CmisInvalidArgumentException;
 
 /**
  * @author Jens
@@ -51,11 +52,11 @@ public class TypeValidator {
 
     public static void validateRequiredSystemProperties(Properties properties) {
         if (properties == null || properties.getProperties() == null) {
-            throw new RuntimeException("Cannot create object, no properties are given");
+            throw new CmisInvalidArgumentException("Cannot create object, no properties are
given");
         }
 
         if (!properties.getProperties().containsKey(PropertyIds.OBJECT_TYPE_ID)) {
-            throw new RuntimeException("Cannot create object, type id is missing");
+            throw new CmisInvalidArgumentException("Cannot create object, type id is missing");
         }
 
     }
@@ -325,7 +326,7 @@ public class TypeValidator {
     	{
     		throw new CmisConstraintException("acl set for type: " + typeDef.getDisplayName() +
" that is not controllableACL");
     	}
-    	}
+    }
 
     private static List<String> getMandatoryPropDefs(Map<String, PropertyDefinition<?>>
propDefs) {
         List<String> res = new ArrayList<String>();



Mime
View raw message