chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f...@apache.org
Subject svn commit: r1509172 - in /chemistry/opencmis/trunk: chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/dataobjects/ chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/...
Date Thu, 01 Aug 2013 11:21:21 GMT
Author: fmui
Date: Thu Aug  1 11:21:20 2013
New Revision: 1509172

URL: http://svn.apache.org/r1509172
Log:
TypeDefinitionFactory: fixes and improvements

Modified:
    chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/dataobjects/AbstractTypeDefinition.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/RepositoryServiceTest.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/TypeDefinitionFactory.java

Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/dataobjects/AbstractTypeDefinition.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/dataobjects/AbstractTypeDefinition.java?rev=1509172&r1=1509171&r2=1509172&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/dataobjects/AbstractTypeDefinition.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/dataobjects/AbstractTypeDefinition.java
Thu Aug  1 11:21:20 2013
@@ -49,7 +49,7 @@ public abstract class AbstractTypeDefini
     private Boolean isFulltextIndexed;
     private Boolean isControllableACL;
     private Boolean isControllablePolicy;
-    private LinkedHashMap<String, PropertyDefinition<?>> propertyDefinitions;
+    private LinkedHashMap<String, PropertyDefinition<?>> propertyDefinitions
= new LinkedHashMap<String, PropertyDefinition<?>>();
     private TypeMutability typeMutability;
 
     public void initialize(TypeDefinition typeDefinition) {
@@ -202,7 +202,7 @@ public abstract class AbstractTypeDefini
 
     public void setPropertyDefinitions(Map<String, PropertyDefinition<?>> newPropertyDefinitions)
{
         if (newPropertyDefinitions == null) {
-            propertyDefinitions = null;
+            propertyDefinitions = new LinkedHashMap<String, PropertyDefinition<?>>();
         } else if (newPropertyDefinitions instanceof LinkedHashMap) {
             propertyDefinitions = (LinkedHashMap<String, PropertyDefinition<?>>)
newPropertyDefinitions;
         } else {
@@ -215,10 +215,6 @@ public abstract class AbstractTypeDefini
             return;
         }
 
-        if (propertyDefinitions == null) {
-            propertyDefinitions = new LinkedHashMap<String, PropertyDefinition<?>>();
-        }
-
         propertyDefinitions.put(propertyDefinition.getId(), propertyDefinition);
     }
 
@@ -227,13 +223,11 @@ public abstract class AbstractTypeDefini
             return;
         }
 
-        if (propertyDefinitions != null) {
-            propertyDefinitions.remove(propertyId);
-        }
+        propertyDefinitions.remove(propertyId);
     }
 
     public void removeAllPropertyDefinitions() {
-        propertyDefinitions = null;
+        propertyDefinitions = new LinkedHashMap<String, PropertyDefinition<?>>();
     }
 
     public TypeMutability getTypeMutability() {

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/RepositoryServiceTest.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/RepositoryServiceTest.java?rev=1509172&r1=1509171&r2=1509172&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/RepositoryServiceTest.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/RepositoryServiceTest.java
Thu Aug  1 11:21:20 2013
@@ -165,8 +165,8 @@ public class RepositoryServiceTest exten
             log.info("Found type: " + typeDef.getId() + ", display name is: " + typeDef.getDisplayName());
             log.info("  Base type is: " + typeDef.getBaseTypeId());
             Map<String, PropertyDefinition<?>> propDefs = typeDef.getPropertyDefinitions();
-            log.info("  Property definitions (must be null): " + propDefs);
-            assertNull(propDefs);
+            log.info("  Property definitions (must be empty): " + propDefs);
+            assertTrue(propDefs.isEmpty());
         }
 
         log.info("... testGetTypesWihtoutPropDefs() finished.");
@@ -301,7 +301,7 @@ public class RepositoryServiceTest exten
         children = fRepSvc.getTypeChildren(repositoryId, typeId, null, maxItems, null, null);
 
         for (TypeDefinition type : children.getList()) {
-            assertNull(type.getPropertyDefinitions());
+            assertTrue(type.getPropertyDefinitions().isEmpty());
         }
 
         log.info("... testGetTypeChildrenNoProperties() finished.");

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/TypeDefinitionFactory.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/TypeDefinitionFactory.java?rev=1509172&r1=1509171&r2=1509172&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/TypeDefinitionFactory.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/TypeDefinitionFactory.java
Thu Aug  1 11:21:20 2013
@@ -75,6 +75,7 @@ public class TypeDefinitionFactory {
     private boolean defaultControllableAcl;
     private boolean defaultControllablePolicy;
     private boolean defaultQueryable;
+    private boolean defaultFulltextIndexed;
     private TypeMutability defaultTypeMutability;
 
     private TypeDefinitionFactory() {
@@ -89,6 +90,7 @@ public class TypeDefinitionFactory {
         defaultControllableAcl = false;
         defaultControllablePolicy = false;
         defaultQueryable = true;
+        defaultFulltextIndexed = false;
 
         TypeMutabilityImpl typeMutability = new TypeMutabilityImpl();
         typeMutability.setCanCreate(false);
@@ -191,6 +193,14 @@ public class TypeDefinitionFactory {
         this.defaultQueryable = defaultQueryable;
     }
 
+    public boolean getDefaultFulltextIndexed() {
+        return defaultFulltextIndexed;
+    }
+
+    public void setDefaultFulltextIndexed(boolean defaultFulltextIndexed) {
+        this.defaultFulltextIndexed = defaultFulltextIndexed;
+    }
+
     public TypeMutability getDefaultTypeMutability() {
         return defaultTypeMutability;
     }
@@ -238,7 +248,7 @@ public class TypeDefinitionFactory {
         documentType.setDescription("Document");
         documentType.setDisplayName("Document");
         documentType.setIsFileable(true);
-        documentType.setIsFulltextIndexed(false);
+        documentType.setIsFulltextIndexed(defaultFulltextIndexed);
         documentType.setIsIncludedInSupertypeQuery(true);
         documentType.setLocalName("Document");
         documentType.setLocalNamespace(defaultNamespace);
@@ -294,14 +304,14 @@ public class TypeDefinitionFactory {
      */
     public MutableFolderTypeDefinition createBaseFolderTypeDefinition(CmisVersion cmisVersion)
             throws InstantiationException, IllegalAccessException {
-        return createFoldertTypeDefinition(cmisVersion, null);
+        return createFolderTypeDefinition(cmisVersion, null);
     }
 
     /**
      * Creates a new mutable folder type definition including all base property
      * definitions defined in the CMIS specification.
      */
-    public MutableFolderTypeDefinition createFoldertTypeDefinition(CmisVersion cmisVersion,
String parentId)
+    public MutableFolderTypeDefinition createFolderTypeDefinition(CmisVersion cmisVersion,
String parentId)
             throws InstantiationException, IllegalAccessException {
         MutableFolderTypeDefinition folderType = folderTypeDefinitionClass.newInstance();
         folderType.setBaseTypeId(BaseTypeId.CMIS_FOLDER);
@@ -312,7 +322,7 @@ public class TypeDefinitionFactory {
         folderType.setDescription("Folder");
         folderType.setDisplayName("Folder");
         folderType.setIsFileable(true);
-        folderType.setIsFulltextIndexed(false);
+        folderType.setIsFulltextIndexed(defaultFulltextIndexed);
         folderType.setIsIncludedInSupertypeQuery(true);
         folderType.setLocalName("Folder");
         folderType.setLocalNamespace(defaultNamespace);
@@ -323,8 +333,8 @@ public class TypeDefinitionFactory {
             folderType.setTypeMutability(defaultTypeMutability);
         }
 
-        addBasePropertyDefinitions(folderType, cmisVersion, parentId == null);
-        addFolderPropertyDefinitions(folderType, cmisVersion, parentId == null);
+        addBasePropertyDefinitions(folderType, cmisVersion, parentId != null);
+        addFolderPropertyDefinitions(folderType, cmisVersion, parentId != null);
 
         return folderType;
     }
@@ -353,6 +363,7 @@ public class TypeDefinitionFactory {
         policyType.setDescription("Policy");
         policyType.setDisplayName("Policy");
         policyType.setIsFileable(false);
+        policyType.setIsFulltextIndexed(defaultFulltextIndexed);
         policyType.setIsIncludedInSupertypeQuery(true);
         policyType.setLocalName("Policy");
         policyType.setLocalNamespace(defaultNamespace);
@@ -363,8 +374,8 @@ public class TypeDefinitionFactory {
             policyType.setTypeMutability(defaultTypeMutability);
         }
 
-        addBasePropertyDefinitions(policyType, cmisVersion, parentId == null);
-        addPolicyPropertyDefinitions(policyType, cmisVersion, parentId == null);
+        addBasePropertyDefinitions(policyType, cmisVersion, parentId != null);
+        addPolicyPropertyDefinitions(policyType, cmisVersion, parentId != null);
 
         return policyType;
     }
@@ -393,6 +404,7 @@ public class TypeDefinitionFactory {
         relationshipType.setDescription("Relationship");
         relationshipType.setDisplayName("Relationship");
         relationshipType.setIsFileable(false);
+        relationshipType.setIsFulltextIndexed(defaultFulltextIndexed);
         relationshipType.setIsIncludedInSupertypeQuery(true);
         relationshipType.setLocalName("Relationship");
         relationshipType.setLocalNamespace(defaultNamespace);
@@ -403,8 +415,8 @@ public class TypeDefinitionFactory {
             relationshipType.setTypeMutability(defaultTypeMutability);
         }
 
-        addBasePropertyDefinitions(relationshipType, cmisVersion, parentId == null);
-        addRelationshipPropertyDefinitions(relationshipType, cmisVersion, parentId == null);
+        addBasePropertyDefinitions(relationshipType, cmisVersion, parentId != null);
+        addRelationshipPropertyDefinitions(relationshipType, cmisVersion, parentId != null);
 
         return relationshipType;
     }
@@ -437,6 +449,7 @@ public class TypeDefinitionFactory {
         itemType.setDescription("Item");
         itemType.setDisplayName("Item");
         itemType.setIsFileable(true);
+        itemType.setIsFulltextIndexed(defaultFulltextIndexed);
         itemType.setIsIncludedInSupertypeQuery(true);
         itemType.setLocalName("Item");
         itemType.setLocalNamespace(defaultNamespace);
@@ -445,7 +458,7 @@ public class TypeDefinitionFactory {
         itemType.setId(BaseTypeId.CMIS_ITEM.value());
         itemType.setTypeMutability(defaultTypeMutability);
 
-        addBasePropertyDefinitions(itemType, cmisVersion, parentId == null);
+        addBasePropertyDefinitions(itemType, cmisVersion, parentId != null);
 
         return itemType;
     }
@@ -476,6 +489,7 @@ public class TypeDefinitionFactory {
         secondaryType.setDescription("Secondary");
         secondaryType.setDisplayName("Secondary");
         secondaryType.setIsFileable(false);
+        secondaryType.setIsFulltextIndexed(false);
         secondaryType.setIsIncludedInSupertypeQuery(true);
         secondaryType.setLocalName("Secondary");
         secondaryType.setLocalNamespace(defaultNamespace);



Mime
View raw message