You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@chemistry.apache.org by fm...@apache.org on 2014/05/15 18:47:35 UTC

svn commit: r1594976 - /chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/repository/ObjectFactoryImpl.java

Author: fmui
Date: Thu May 15 16:47:34 2014
New Revision: 1594976

URL: http://svn.apache.org/r1594976
Log:
fixed handling of object type ID when it is provided as a list

Modified:
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/repository/ObjectFactoryImpl.java

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/repository/ObjectFactoryImpl.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/repository/ObjectFactoryImpl.java?rev=1594976&r1=1594975&r2=1594976&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/repository/ObjectFactoryImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/repository/ObjectFactoryImpl.java Thu May 15 16:47:34 2014
@@ -338,7 +338,7 @@ public class ObjectFactoryImpl implement
         return result;
     }
 
-    @SuppressWarnings("unchecked")
+    @SuppressWarnings({ "unchecked", "rawtypes" })
     public Properties convertProperties(Map<String, ?> properties, ObjectType type,
             Collection<SecondaryType> secondaryTypes, Set<Updatability> updatabilityFilter) {
         // check input
@@ -349,11 +349,14 @@ public class ObjectFactoryImpl implement
         // get the type
         if (type == null) {
             Object typeId = properties.get(PropertyIds.OBJECT_TYPE_ID);
-            if (!(typeId instanceof String)) {
+
+            if (typeId instanceof String) {
+                type = session.getTypeDefinition(typeId.toString());
+            } else if (typeId instanceof List && !((List) typeId).isEmpty() && ((List) typeId).get(0) instanceof String) {
+                type = session.getTypeDefinition(((List) typeId).get(0).toString());
+            } else {
                 throw new IllegalArgumentException("Type or type property must be set!");
             }
-
-            type = session.getTypeDefinition(typeId.toString());
         }
 
         // get secondary types