chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r1457768 - in /chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory: TypeValidator.java server/InMemoryNavigationServiceImpl.java
Date Mon, 18 Mar 2013 13:50:09 GMT
Author: jens
Date: Mon Mar 18 13:50:09 2013
New Revision: 1457768

URL: http://svn.apache.org/r1457768
Log:
InMemory: Bugfix for TypeMutability with empty properties, filter items for CMIS 1.0 binding
instead of 1.1

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

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/TypeValidator.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/TypeValidator.java?rev=1457768&r1=1457767&r2=1457768&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/TypeValidator.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/TypeValidator.java
Mon Mar 18 13:50:09 2013
@@ -94,6 +94,7 @@ public class TypeValidator {
         checkTypeId(tm, td.getId());
         checkTypeQueryName(tm, td.getQueryName());
         checkTypeLocalName(tm, td.getLocalName());
+        checkBaseAndParentType(tm, td);
         
         if (null != td.getPropertyDefinitions())
             TypeValidator.checkProperties(tm, td.getPropertyDefinitions().values());    
   
@@ -155,7 +156,9 @@ public class TypeValidator {
         td.setTypeMutability(tm);
         td.setExtensions(td.getExtensions());
         
-        if (null != td.getPropertyDefinitions()) {
+        if (null == td.getPropertyDefinitions()) {
+            td.setPropertyDefinitions(new HashMap<String, PropertyDefinition<?>>());
+        } else {
             Map<String, PropertyDefinition<?>> propDefsNew = new HashMap<String,
PropertyDefinition<?>>();
             Map<String, PropertyDefinition<?>> propDefs = td.getPropertyDefinitions();
             for (PropertyDefinition<?> pd : propDefs.values()) {
@@ -479,4 +482,12 @@ public class TypeValidator {
         }
     }
 
+    private static void checkBaseAndParentType(TypeManager tm, TypeDefinition td) {
+        if (null == td.getBaseTypeId()) 
+            throw new CmisInvalidArgumentException("You canno create a type without a base
type id: " + td.getId());
+        if (null == td.getParentTypeId()) 
+            throw new CmisInvalidArgumentException("You canno create a type without a parent
type id: " + td.getId());
+        
+    }
+
 }

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=1457768&r1=1457767&r2=1457768&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
Mon Mar 18 13:50:09 2013
@@ -284,7 +284,7 @@ public class InMemoryNavigationServiceIm
         StoredObject so = fs.getObjectById(folderId);
         Folder folder = null;
         boolean cmis11 = InMemoryServiceContext.getCallContext().getCmisVersion() != CmisVersion.CMIS_1_0;
-;
+        
         if (so == null) {
             throw new CmisObjectNotFoundException("Unknown object id: " + folderId);
         }
@@ -300,7 +300,7 @@ public class InMemoryNavigationServiceIm
                 .getChildren(maxItems, skipCount, user);
 
         for (StoredObject spo : children.getChildren()) {
-            if (cmis11 && spo instanceof Item)
+            if (!cmis11 && spo instanceof Item)
                 continue; // ignore items for CMIS 1.1‚
             
             ObjectInFolderDataImpl oifd = new ObjectInFolderDataImpl();



Mime
View raw message