chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f...@apache.org
Subject svn commit: r1429786 - in /chemistry/opencmis/trunk/chemistry-opencmis-client: chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/ chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runti...
Date Mon, 07 Jan 2013 13:01:29 GMT
Author: fmui
Date: Mon Jan  7 13:01:29 2013
New Revision: 1429786

URL: http://svn.apache.org/viewvc?rev=1429786&view=rev
Log:
Client: added method to find the object types that define a property

Modified:
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/CmisObjectProperties.java
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/AbstractCmisObject.java
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/AbstractTransientCmisObject.java
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/test/java/org/apache/chemistry/opencmis/client/runtime/CmisObjectMock.java

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/CmisObjectProperties.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/CmisObjectProperties.java?rev=1429786&r1=1429785&r2=1429786&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/CmisObjectProperties.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/CmisObjectProperties.java
Mon Jan  7 13:01:29 2013
@@ -119,6 +119,13 @@ public interface CmisObjectProperties {
     List<SecondaryType> getSecondaryTypes();
 
     /**
+     * Returns a list of primary and secondary object types that define the
+     * given property. If the property is not defined in any attached type,
+     * <code>null</code> is returned.
+     */
+    List<ObjectType> findObjectType(String id);
+
+    /**
      * Returns the change token (CMIS property <code>cmis:changeToken</code>).
      */
     String getChangeToken();

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/AbstractCmisObject.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/AbstractCmisObject.java?rev=1429786&r1=1429785&r2=1429786&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/AbstractCmisObject.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/AbstractCmisObject.java
Mon Jan  7 13:01:29 2013
@@ -108,7 +108,7 @@ public abstract class AbstractCmisObject
 
             // handle properties
             if (objectData.getProperties() != null) {
-                
+
                 // get secondary types
                 if (objectData.getProperties().getProperties() != null
                         && objectData.getProperties().getProperties()
@@ -465,6 +465,34 @@ public abstract class AbstractCmisObject
         }
     }
 
+    public List<ObjectType> findObjectType(String id) {
+        List<ObjectType> result = null;
+
+        readLock();
+        try {
+            if (objectType.getPropertyDefinitions().containsKey(id)) {
+                result = new ArrayList<ObjectType>();
+                result.add(objectType);
+            }
+
+            if (secondaryTypes != null) {
+                for (SecondaryType secondaryType : secondaryTypes) {
+                    if (secondaryType.getPropertyDefinitions() != null
+                            && secondaryType.getPropertyDefinitions().containsKey(id))
{
+                        if (result == null) {
+                            result = new ArrayList<ObjectType>();
+                        }
+                        result.add(secondaryType);
+                    }
+                }
+            }
+        } finally {
+            readUnlock();
+        }
+
+        return result;
+    }
+
     // --- allowable actions ---
 
     public AllowableActions getAllowableActions() {

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/AbstractTransientCmisObject.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/AbstractTransientCmisObject.java?rev=1429786&r1=1429785&r2=1429786&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/AbstractTransientCmisObject.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/AbstractTransientCmisObject.java
Mon Jan  7 13:01:29 2013
@@ -194,6 +194,10 @@ public abstract class AbstractTransientC
         return object.getSecondaryTypes();
     }
 
+    public List<ObjectType> findObjectType(String id) {
+        return object.findObjectType(id);
+    }
+
     public String getChangeToken() {
         return getPropertyValue(PropertyIds.CHANGE_TOKEN);
     }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/test/java/org/apache/chemistry/opencmis/client/runtime/CmisObjectMock.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/test/java/org/apache/chemistry/opencmis/client/runtime/CmisObjectMock.java?rev=1429786&r1=1429785&r2=1429786&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/test/java/org/apache/chemistry/opencmis/client/runtime/CmisObjectMock.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/test/java/org/apache/chemistry/opencmis/client/runtime/CmisObjectMock.java
Mon Jan  7 13:01:29 2013
@@ -164,6 +164,10 @@ public class CmisObjectMock implements C
     public List<SecondaryType> getSecondaryTypes() {
         return null;
     }
+    
+    public List<ObjectType> findObjectType(String id) {
+        return null;
+    }
 
     public List<CmisExtensionElement> getExtensions(ExtensionLevel level) {
         return null;



Mime
View raw message