Author: fmui
Date: Tue Aug 20 10:56:44 2013
New Revision: 1515770

URL: http://svn.apache.org/r1515770
Log:
Browser bindig: fix for secondary type properties

Modified:
    
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/ClientTypeCacheImpl.java
    
chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/JSONConverter.java

Modified: 
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/ClientTypeCacheImpl.java
URL: 
http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/ClientTypeCacheImpl.java?rev=1515770&r1=1515769&r2=1515770&view=diff
==============================================================================
--- 
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/ClientTypeCacheImpl.java
 (original)
+++ 
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/ClientTypeCacheImpl.java
 Tue Aug 20 10:56:44 2013
@@ -51,10 +51,12 @@ public class ClientTypeCacheImpl impleme
 
     public TypeDefinition getTypeDefinitionForObject(String objectId) {
         // not used
+        assert false;
         return null;
     }
 
     public PropertyDefinition<?> getPropertyDefinition(String propId) {
+        assert false;
         return null;
     }
 }

Modified: 
chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/JSONConverter.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/JSONConverter.java?rev=1515770&r1=1515769&r2=1515770&view=diff
==============================================================================
--- 
chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/JSONConverter.java
 (original)
+++ 
chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/JSONConverter.java
 Tue Aug 20 10:56:44 2013
@@ -173,7 +173,12 @@ public final class JSONConverter {
     }
 
     public enum PropertyMode {
-        OBJECT, QUERY, CHANGE
+        /** object */
+        OBJECT,
+        /** query result */
+        QUERY,
+        /** change event */
+        CHANGE
     }
 
     /**
@@ -1168,6 +1173,9 @@ public final class JSONConverter {
         JSONObject result = new JSONObject();
 
         for (PropertyData<?> property : properties.getPropertyList()) {
+            assert property != null;
+            assert property.getId() != null;
+
             PropertyDefinition<?> propDef = null;
             if (typeCache != null) {
                 propDef = typeCache.getPropertyDefinition(property.getId());
@@ -1175,6 +1183,9 @@ public final class JSONConverter {
             if (propDef == null && type != null) {
                 propDef = type.getPropertyDefinitions().get(property.getId());
             }
+            if (propDef == null && typeCache != null && objectId != null && 
propertyMode != PropertyMode.CHANGE) {
+                type = typeCache.getTypeDefinitionForObject(objectId);
+            }
 
             String propId = (propertyMode == PropertyMode.QUERY ? 
property.getQueryName() : property.getId());
             if (propId == null) {


Reply via email to