chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r1432327 - in /chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory: server/ storedobj/api/ storedobj/impl/ types/
Date Fri, 11 Jan 2013 23:14:58 GMT
Author: jens
Date: Fri Jan 11 23:14:57 2013
New Revision: 1432327

URL: http://svn.apache.org/viewvc?rev=1432327&view=rev
Log:
InMemory: don't return property definitions for root types if includepropertydefinitios is
set to false, 

set type mutability flags for non base types to true for delete and update

Modified:
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryRepositoryServiceImpl.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/StoreManager.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/StoreManagerImpl.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/InMemoryDocumentTypeDefinition.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/InMemoryFolderTypeDefinition.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/InMemoryItemTypeDefinition.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/InMemoryPolicyTypeDefinition.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/InMemoryRelationshipTypeDefinition.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/InMemorySecondaryTypeDefinition.java

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryRepositoryServiceImpl.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/InMemoryRepositoryServiceImpl.java?rev=1432327&r1=1432326&r2=1432327&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryRepositoryServiceImpl.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryRepositoryServiceImpl.java
Fri Jan 11 23:14:57 2013
@@ -80,7 +80,7 @@ public class InMemoryRepositoryServiceIm
         List<TypeDefinitionContainer> children;
         if (typeId == null) {
             // spec says that base types must be returned in this case
-            children = fStoreManager.getRootTypes(repositoryId);
+            children = fStoreManager.getRootTypes(repositoryId, inclPropDefs);
         } else {
             children = getTypeDescendants(context, repositoryId, typeId, BigInteger.valueOf(1),
                     inclPropDefs, null);

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/StoreManager.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/storedobj/api/StoreManager.java?rev=1432327&r1=1432326&r2=1432327&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/StoreManager.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/StoreManager.java
Fri Jan 11 23:14:57 2013
@@ -141,9 +141,10 @@ public interface StoreManager {
      * 
      * @param repositoryId
      *            id of repository
+     * @param inclPropDefs 
      * @return list of root types
      */
-    List<TypeDefinitionContainer> getRootTypes(String repositoryId);
+    List<TypeDefinitionContainer> getRootTypes(String repositoryId, boolean inclPropDefs);
 
     /**
      * Retrieve the repository information for a repository

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/StoreManagerImpl.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/storedobj/impl/StoreManagerImpl.java?rev=1432327&r1=1432326&r2=1432327&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/StoreManagerImpl.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/StoreManagerImpl.java
Fri Jan 11 23:14:57 2013
@@ -193,29 +193,31 @@ public class StoreManagerImpl implements
 
     public Collection<TypeDefinitionContainer> getTypeDefinitionList(String repositoryId,
             boolean includePropertyDefinitions) {
-        Collection<TypeDefinitionContainer> result;
+//        Collection<TypeDefinitionContainer> result;
         TypeManager typeManager = fMapRepositoryToTypeManager.get(repositoryId);
         if (null == typeManager) {
             throw new CmisInvalidArgumentException("Unknown repository " + repositoryId);
         }
-        Collection<TypeDefinitionContainer> typeColl = getRootTypes(repositoryId);
-        if (includePropertyDefinitions) {
-            result = typeColl;
-        } else {
-            result = new ArrayList<TypeDefinitionContainer>(typeColl.size());
-            // copy list and omit properties
-            for (TypeDefinitionContainer c : typeColl) {
-                AbstractTypeDefinition td = ((AbstractTypeDefinition) c.getTypeDefinition()).clone();
-                TypeDefinitionContainerImpl tdc = new TypeDefinitionContainerImpl(td);
-                tdc.setChildren(c.getChildren());
-                td.setPropertyDefinitions(null);
-                result.add(tdc);
-            }
-        }
-        return result;
+        Collection<TypeDefinitionContainer> typeColl = getRootTypes(repositoryId, includePropertyDefinitions);
+//        if (includePropertyDefinitions) {
+//            result = typeColl;
+//        } else {
+//            result = new ArrayList<TypeDefinitionContainer>(typeColl.size());
+//            // copy list and omit properties
+//            for (TypeDefinitionContainer c : typeColl) {
+//                AbstractTypeDefinition td = ((AbstractTypeDefinition) c.getTypeDefinition()).clone();
+//                TypeDefinitionContainerImpl tdc = new TypeDefinitionContainerImpl(td);
+//                tdc.setChildren(c.getChildren());
+//                td.setPropertyDefinitions(null);
+//                result.add(tdc);
+//            }
+//        }
+//        return result;
+        return typeColl;
     }
 
-    public List<TypeDefinitionContainer> getRootTypes(String repositoryId) {
+    public List<TypeDefinitionContainer> getRootTypes(String repositoryId, boolean
includePropertyDefinitions) {
+        List<TypeDefinitionContainer> result;
         TypeManager typeManager = fMapRepositoryToTypeManager.get(repositoryId);
         if (null == typeManager) {
             throw new CmisInvalidArgumentException("Unknown repository " + repositoryId);
@@ -239,7 +241,20 @@ public class StoreManagerImpl implements
                 rootTypes.remove(tcSecondary);
         }
         
-        return rootTypes;
+        if (includePropertyDefinitions) {
+            result = rootTypes;
+        } else {
+            result = new ArrayList<TypeDefinitionContainer>(rootTypes.size());
+            // copy list and omit properties
+            for (TypeDefinitionContainer c : rootTypes) {
+                AbstractTypeDefinition td = ((AbstractTypeDefinition) c.getTypeDefinition()).clone();
+                TypeDefinitionContainerImpl tdc = new TypeDefinitionContainerImpl(td);
+                tdc.setChildren(c.getChildren());
+                td.setPropertyDefinitions(null);
+                result.add(tdc);
+            }
+        }
+        return result;
     }
 
     public RepositoryInfo getRepositoryInfo(String repositoryId) {

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/InMemoryDocumentTypeDefinition.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/types/InMemoryDocumentTypeDefinition.java?rev=1432327&r1=1432326&r2=1432327&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/InMemoryDocumentTypeDefinition.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/InMemoryDocumentTypeDefinition.java
Fri Jan 11 23:14:57 2013
@@ -45,7 +45,7 @@ public class InMemoryDocumentTypeDefinit
 
     /* This constructor is just for creating the root document */
     public InMemoryDocumentTypeDefinition() {
-        init(BaseTypeId.CMIS_DOCUMENT.value(), "CMIS Document");
+        init(BaseTypeId.CMIS_DOCUMENT.value(), "CMIS Document", true);
         setParentTypeId(null);
         // set base properties
         Map<String, PropertyDefinition<?>> props = getPropertyDefinitions();
@@ -53,13 +53,13 @@ public class InMemoryDocumentTypeDefinit
     }
 
     public InMemoryDocumentTypeDefinition(String id, String displayName) {
-        init(id, displayName);
+        init(id, displayName, false);
         setParentTypeId(DOCUMENT_TYPE.getId());
     }
 
     public InMemoryDocumentTypeDefinition(String id, String displayName, InMemoryDocumentTypeDefinition
parentType) {
         // get root type
-        init(id, displayName);
+        init(id, displayName, false);
         if (parentType != null) {
             setBaseTypeId(parentType.getBaseTypeId());
         } else {
@@ -80,7 +80,7 @@ public class InMemoryDocumentTypeDefinit
         DocumentTypeCreationHelper.mergePropertyDefinitions(getPropertyDefinitions(), propertyDefinitions);
     }
 
-    private void init(String id, String displayName) {
+    private void init(String id, String displayName, boolean isBaseType) {
         if (!NameValidator.isValidId(id)) {
             throw new CmisInvalidArgumentException(NameValidator.ERROR_ILLEGAL_ID);
         }
@@ -106,8 +106,8 @@ public class InMemoryDocumentTypeDefinit
 
         TypeMutabilityImpl typeMutability = new TypeMutabilityImpl();
         typeMutability.setCanCreate(true);
-        typeMutability.setCanDelete(false);
-        typeMutability.setCanUpdate(false);
+        typeMutability.setCanDelete(!isBaseType);
+        typeMutability.setCanUpdate(!isBaseType);
         setTypeMutability (typeMutability);
 
         Map<String, PropertyDefinition<?>> props = new HashMap<String, PropertyDefinition<?>>();

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/InMemoryFolderTypeDefinition.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/types/InMemoryFolderTypeDefinition.java?rev=1432327&r1=1432326&r2=1432327&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/InMemoryFolderTypeDefinition.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/InMemoryFolderTypeDefinition.java
Fri Jan 11 23:14:57 2013
@@ -40,7 +40,7 @@ public class InMemoryFolderTypeDefinitio
 
     /* This constructor is just for creating the root document */
     public InMemoryFolderTypeDefinition() {
-        init(BaseTypeId.CMIS_FOLDER.value(), "CMIS Folder");
+        init(BaseTypeId.CMIS_FOLDER.value(), "CMIS Folder", true);
         setParentTypeId(null);
         // set base properties
         Map<String, PropertyDefinition<?>> props = getPropertyDefinitions();
@@ -48,13 +48,13 @@ public class InMemoryFolderTypeDefinitio
     }
 
     public InMemoryFolderTypeDefinition(String id, String displayName) {
-        init(id, displayName);
+        init(id, displayName, false);
         setParentTypeId(FOLDER_TYPE.getId());
     }
 
     public InMemoryFolderTypeDefinition(String id, String displayName, InMemoryFolderTypeDefinition
parentType) {
         // get root type
-        init(id, displayName);
+        init(id, displayName, false);
         if (parentType != null) {
             setBaseTypeId(parentType.getBaseTypeId());
         } else {
@@ -75,7 +75,7 @@ public class InMemoryFolderTypeDefinitio
         DocumentTypeCreationHelper.mergePropertyDefinitions(getPropertyDefinitions(), propertyDefinitions);
     }
 
-    private void init(String id, String displayName) {
+    private void init(String id, String displayName, boolean isBaseType) {
         if (!NameValidator.isValidId(id)) {
             throw new CmisInvalidArgumentException(NameValidator.ERROR_ILLEGAL_NAME);
         }
@@ -101,8 +101,8 @@ public class InMemoryFolderTypeDefinitio
 
         TypeMutabilityImpl typeMutability = new TypeMutabilityImpl();
         typeMutability.setCanCreate(true);
-        typeMutability.setCanDelete(false);
-        typeMutability.setCanUpdate(false);
+        typeMutability.setCanDelete(!isBaseType);
+        typeMutability.setCanUpdate(!isBaseType);
         setTypeMutability (typeMutability);
 
 

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/InMemoryItemTypeDefinition.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/types/InMemoryItemTypeDefinition.java?rev=1432327&r1=1432326&r2=1432327&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/InMemoryItemTypeDefinition.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/InMemoryItemTypeDefinition.java
Fri Jan 11 23:14:57 2013
@@ -39,7 +39,7 @@ public class InMemoryItemTypeDefinition 
 
     /* This constructor is just for creating the root document */
     public InMemoryItemTypeDefinition() {
-        init(BaseTypeId.CMIS_ITEM.value(), "CMIS Item");
+        init(BaseTypeId.CMIS_ITEM.value(), "CMIS Item", true);
         setParentTypeId(null);
         // set base properties
         Map<String, PropertyDefinition<?>> props = getPropertyDefinitions();
@@ -47,13 +47,13 @@ public class InMemoryItemTypeDefinition 
     }
 
     public InMemoryItemTypeDefinition(String id, String displayName) {
-        init(id, displayName);
+        init(id, displayName, false);
         setParentTypeId(ITEM_TYPE.getId());
     }
 
     public InMemoryItemTypeDefinition(String id, String displayName, InMemoryDocumentTypeDefinition
parentType) {
         // get root type
-        init(id, displayName);
+        init(id, displayName, false);
         if (parentType != null) {
             setBaseTypeId(parentType.getBaseTypeId());
         } else {
@@ -74,7 +74,7 @@ public class InMemoryItemTypeDefinition 
         DocumentTypeCreationHelper.mergePropertyDefinitions(getPropertyDefinitions(), propertyDefinitions);
     }
 
-    private void init(String id, String displayName) {
+    private void init(String id, String displayName, boolean isBaseType) {
         if (!NameValidator.isValidId(id)) {
             throw new CmisInvalidArgumentException(NameValidator.ERROR_ILLEGAL_ID);
         }
@@ -100,8 +100,8 @@ public class InMemoryItemTypeDefinition 
 
         TypeMutabilityImpl typeMutability = new TypeMutabilityImpl();
         typeMutability.setCanCreate(true);
-        typeMutability.setCanDelete(false);
-        typeMutability.setCanUpdate(false);
+        typeMutability.setCanDelete(!isBaseType);
+        typeMutability.setCanUpdate(!isBaseType);
         setTypeMutability (typeMutability);
 
         Map<String, PropertyDefinition<?>> props = new HashMap<String, PropertyDefinition<?>>();

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/InMemoryPolicyTypeDefinition.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/types/InMemoryPolicyTypeDefinition.java?rev=1432327&r1=1432326&r2=1432327&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/InMemoryPolicyTypeDefinition.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/InMemoryPolicyTypeDefinition.java
Fri Jan 11 23:14:57 2013
@@ -40,7 +40,7 @@ public class InMemoryPolicyTypeDefinitio
 
     /* This constructor is just for creating the root document */
     public InMemoryPolicyTypeDefinition() {
-        init(BaseTypeId.CMIS_POLICY.value(), "CMIS Policy");
+        init(BaseTypeId.CMIS_POLICY.value(), "CMIS Policy", true);
         setParentTypeId(null);
 
         Map<String, PropertyDefinition<?>> props = getPropertyDefinitions();
@@ -48,13 +48,13 @@ public class InMemoryPolicyTypeDefinitio
     }
 
     public InMemoryPolicyTypeDefinition(String id, String displayName) {
-        init(id, displayName);
+        init(id, displayName, false);
         setParentTypeId(POLICY_TYPE.getId());
     }
 
     public InMemoryPolicyTypeDefinition(String id, String displayName, InMemoryPolicyTypeDefinition
parentType) {
         // get root type
-        init(id, displayName);
+        init(id, displayName, false);
         if (parentType != null) {
             setBaseTypeId(parentType.getBaseTypeId());
         } else {
@@ -75,7 +75,7 @@ public class InMemoryPolicyTypeDefinitio
         DocumentTypeCreationHelper.mergePropertyDefinitions(getPropertyDefinitions(), propertyDefinitions);
     }
 
-    private void init(String id, String displayName) {
+    private void init(String id, String displayName, boolean isBaseType) {
         if (!NameValidator.isValidId(id)) {
             throw new CmisInvalidArgumentException(NameValidator.ERROR_ILLEGAL_NAME);
         }
@@ -101,8 +101,8 @@ public class InMemoryPolicyTypeDefinitio
 
         TypeMutabilityImpl typeMutability = new TypeMutabilityImpl();
         typeMutability.setCanCreate(true);
-        typeMutability.setCanDelete(false);
-        typeMutability.setCanUpdate(false);
+        typeMutability.setCanDelete(!isBaseType);
+        typeMutability.setCanUpdate(!isBaseType);
         setTypeMutability (typeMutability);
 
 

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/InMemoryRelationshipTypeDefinition.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/types/InMemoryRelationshipTypeDefinition.java?rev=1432327&r1=1432326&r2=1432327&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/InMemoryRelationshipTypeDefinition.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/InMemoryRelationshipTypeDefinition.java
Fri Jan 11 23:14:57 2013
@@ -40,7 +40,7 @@ public class InMemoryRelationshipTypeDef
 
     /* This constructor is just for creating the root document */
     public InMemoryRelationshipTypeDefinition() {
-        init(BaseTypeId.CMIS_RELATIONSHIP.value(), "CMIS Relation");
+        init(BaseTypeId.CMIS_RELATIONSHIP.value(), "CMIS Relation", true);
         setParentTypeId(null);
 
         Map<String, PropertyDefinition<?>> props = getPropertyDefinitions();
@@ -48,14 +48,14 @@ public class InMemoryRelationshipTypeDef
     }
 
     public InMemoryRelationshipTypeDefinition(String id, String displayName) {
-        init(id, displayName);
+        init(id, displayName, false);
         setParentTypeId(RELATIONSHIP_TYPE.getId());
     }
 
     public InMemoryRelationshipTypeDefinition(String id, String displayName,
             InMemoryRelationshipTypeDefinition parentType) {
         // get root type
-        init(id, displayName);
+        init(id, displayName, false);
         if (parentType != null) {
             setBaseTypeId(parentType.getBaseTypeId());
         } else {
@@ -76,7 +76,7 @@ public class InMemoryRelationshipTypeDef
         DocumentTypeCreationHelper.mergePropertyDefinitions(getPropertyDefinitions(), propertyDefinitions);
     }
 
-    private void init(String id, String displayName) {
+    private void init(String id, String displayName, boolean isBaseType) {
         if (!NameValidator.isValidId(id)) {
             throw new CmisInvalidArgumentException(NameValidator.ERROR_ILLEGAL_NAME);
         }
@@ -102,8 +102,8 @@ public class InMemoryRelationshipTypeDef
 
         TypeMutabilityImpl typeMutability = new TypeMutabilityImpl();
         typeMutability.setCanCreate(true);
-        typeMutability.setCanDelete(false);
-        typeMutability.setCanUpdate(false);
+        typeMutability.setCanDelete(!isBaseType);
+        typeMutability.setCanUpdate(!isBaseType);
         setTypeMutability (typeMutability);
 
         // relationship specifics

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/InMemorySecondaryTypeDefinition.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/types/InMemorySecondaryTypeDefinition.java?rev=1432327&r1=1432326&r2=1432327&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/InMemorySecondaryTypeDefinition.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/InMemorySecondaryTypeDefinition.java
Fri Jan 11 23:14:57 2013
@@ -39,18 +39,18 @@ public class InMemorySecondaryTypeDefini
 
     /* This constructor is just for creating the root document */
     public InMemorySecondaryTypeDefinition() {
-        init(BaseTypeId.CMIS_SECONDARY.value(), "Secondary Type");
+        init(BaseTypeId.CMIS_SECONDARY.value(), "Secondary Type", true);
         setParentTypeId(null);
     }
 
     public InMemorySecondaryTypeDefinition(String id, String displayName) {
-        init(id, displayName);
+        init(id, displayName, false);
         setParentTypeId(SECONDARY_TYPE.getId());
     }
 
     public InMemorySecondaryTypeDefinition(String id, String displayName, InMemoryDocumentTypeDefinition
parentType) {
         // get root type
-        init(id, displayName);
+        init(id, displayName, false);
         if (parentType != null) {
             setBaseTypeId(parentType.getBaseTypeId());
         } else {
@@ -71,7 +71,7 @@ public class InMemorySecondaryTypeDefini
         DocumentTypeCreationHelper.mergePropertyDefinitions(getPropertyDefinitions(), propertyDefinitions);
     }
 
-    private void init(String id, String displayName) {
+    private void init(String id, String displayName, boolean isBaseType) {
         if (!NameValidator.isValidId(id)) {
             throw new CmisInvalidArgumentException(NameValidator.ERROR_ILLEGAL_ID);
         }
@@ -97,8 +97,8 @@ public class InMemorySecondaryTypeDefini
 
         TypeMutabilityImpl typeMutability = new TypeMutabilityImpl();
         typeMutability.setCanCreate(true);
-        typeMutability.setCanDelete(false);
-        typeMutability.setCanUpdate(false);
+        typeMutability.setCanDelete(!isBaseType);
+        typeMutability.setCanUpdate(!isBaseType);
         setTypeMutability (typeMutability);
 
         Map<String, PropertyDefinition<?>> props = new HashMap<String, PropertyDefinition<?>>();



Mime
View raw message