chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r953313 - in /incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory: ./ storedobj/api/ storedobj/impl/
Date Thu, 10 Jun 2010 12:58:48 GMT
Author: jens
Date: Thu Jun 10 12:58:48 2010
New Revision: 953313

URL: http://svn.apache.org/viewvc?rev=953313&view=rev
Log:
prepare some additional methods for query support

Modified:
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/TypeManager.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/TypeValidator.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/StoreManager.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/StoreManagerImpl.java

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/TypeManager.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/TypeManager.java?rev=953313&r1=953312&r2=953313&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/TypeManager.java
(original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/TypeManager.java
Thu Jun 10 12:58:48 2010
@@ -64,6 +64,21 @@ public class TypeManager {
     }
 
     /**
+     * return a type definition from the type query name or null if not found
+     * 
+     * @param typeQueryName
+     *            query name of the type definition
+     * @return type definition for this query name
+     */
+    public TypeDefinition getTypeByQueryName(String typeQueryName) {
+        for (Entry<String, TypeDefinitionContainer> entry : fTypesMap.entrySet()) {
+            if (entry.getValue().getTypeDefinition().getQueryName().equals(typeQueryName))
+                return entry.getValue().getTypeDefinition();
+        }
+        return null;
+    }
+
+    /**
      * return a list of all types known in this repository
      * 
      * @return
@@ -163,6 +178,24 @@ public class TypeManager {
         fTypesMap.clear();
         createCmisDefaultTypes();
     }
+    
+    /**
+     * retrieve the property id from a type for a given property query name 
+     * 
+     * @param typeDefinition
+     *      type definition containing query name
+     * @param propQueryName
+     *      query name of property
+     * @return
+     *      property id of property or null if not found
+     */
+    public String getPropertyIdForQueryName(TypeDefinition typeDefinition, String propQueryName)
{
+        for (PropertyDefinition<?> pd : typeDefinition.getPropertyDefinitions().values())
{
+            if (pd.getQueryName().equals(propQueryName))
+                return pd.getId();
+        }
+        return null;
+    }
 
     private void addInheritedProperties(Map<String, PropertyDefinition<?>> propDefs,
TypeDefinition typeDefinition) {
 

Modified: incubator/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/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/TypeValidator.java?rev=953313&r1=953312&r2=953313&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/TypeValidator.java
(original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/TypeValidator.java
Thu Jun 10 12:58:48 2010
@@ -310,6 +310,20 @@ public class TypeValidator {
             return true;
     }
 
+    public static boolean typeContainsPropertyWithQueryName(TypeDefinition typeDef, String
propertyQueryName) {
+
+        Map<String, PropertyDefinition<?>> propDefs = typeDef.getPropertyDefinitions();
+        if (null == propDefs)
+            return false;
+
+        for (PropertyDefinition<?> propDef : propDefs.values()) {
+            if (propDef.getQueryName().equals(propertyQueryName))
+                return true;
+        }
+        
+        return false; // unknown property query name in this type
+    }
+
     @SuppressWarnings("unchecked")
     private static <T> PropertyDefinition<T> getPropertyDefinition(TypeDefinition
typeDef, String propertyId) {
 

Modified: incubator/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/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/StoreManager.java?rev=953313&r1=953312&r2=953313&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/StoreManager.java
(original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/StoreManager.java
Thu Jun 10 12:58:48 2010
@@ -24,6 +24,7 @@ import java.util.List;
 import org.apache.chemistry.opencmis.commons.data.RepositoryInfo;
 import org.apache.chemistry.opencmis.commons.definitions.TypeDefinitionContainer;
 import org.apache.chemistry.opencmis.commons.spi.BindingsObjectFactory;
+import org.apache.chemistry.opencmis.inmemory.TypeManager;
 
 /**
  * interface to a repository implementation. This interface is the entry point
@@ -142,5 +143,14 @@ public interface StoreManager {
      * @return repository information
      */
     RepositoryInfo getRepositoryInfo(String repositoryId);
+    
+    /**
+     * retrieve the type manager for a given repository
+     * @param repositoryId
+     *      id of repository
+     * @return
+     *      type manager for this repository or null if repository is unknown
+     */
+    TypeManager getTypeManager(String repositoryId);
 
 }
\ No newline at end of file

Modified: incubator/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/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/StoreManagerImpl.java?rev=953313&r1=953312&r2=953313&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/StoreManagerImpl.java
(original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/StoreManagerImpl.java
Thu Jun 10 12:58:48 2010
@@ -349,4 +349,9 @@ public class StoreManagerImpl implements
         }
     }
 
+    public TypeManager getTypeManager(String repositoryId) {
+        TypeManager typeManager = fMapRepositoryToTypeManager.get(repositoryId);
+        return typeManager;
+    }
+
 }



Mime
View raw message