chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r1458157 - in /chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory: TypeManagerImpl.java TypeValidator.java
Date Tue, 19 Mar 2013 05:49:33 GMT
Author: jens
Date: Tue Mar 19 05:49:32 2013
New Revision: 1458157

URL: http://svn.apache.org/r1458157
Log:
InMemory: fix bug when deleting types

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

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/TypeManagerImpl.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/TypeManagerImpl.java?rev=1458157&r1=1458156&r2=1458157&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/TypeManagerImpl.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/TypeManagerImpl.java
Tue Mar 19 05:49:32 2013
@@ -162,6 +162,10 @@ public class TypeManagerImpl implements 
      * @param typeId
      */
     public void deleteTypeDefinition(String typeId) {
+        TypeDefinitionContainer typeDef = fTypesMap.remove(typeId);  
+        // remove type from children of parent types
+        TypeDefinitionContainer parentTypeContainer = fTypesMap.get(typeDef.getTypeDefinition().getParentTypeId());
+        parentTypeContainer.getChildren().remove(typeDef);
         fTypesMap.remove(typeId);       
     }
 

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=1458157&r1=1458156&r2=1458157&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
Tue Mar 19 05:49:32 2013
@@ -91,6 +91,11 @@ public class TypeValidator {
                     + " does not exist.");
         }
 
+        if (null != tm.getTypeById(td.getId())) {
+            throw new CmisInvalidArgumentException("Cannot add type, because type with id
" + td.getId()
+                    + " already exists.");
+        }
+
         checkTypeId(tm, td.getId());
         checkTypeQueryName(tm, td.getQueryName());
         checkTypeLocalName(tm, td.getLocalName());



Mime
View raw message