From 6a4253117b3d2ebade72098a5d5613854835ff72 Mon Sep 17 00:00:00 2001 From: Roy Wetherall Date: Thu, 8 May 2008 17:00:35 +0000 Subject: [PATCH] Site Service: GET and POST methods implemented on Site Membership REST API git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@9042 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../alfresco/repo/jscript/ValueConverter.java | 62 +++++++++++++++---- 1 file changed, 49 insertions(+), 13 deletions(-) diff --git a/source/java/org/alfresco/repo/jscript/ValueConverter.java b/source/java/org/alfresco/repo/jscript/ValueConverter.java index 4eba330e92..1e96cc44c7 100644 --- a/source/java/org/alfresco/repo/jscript/ValueConverter.java +++ b/source/java/org/alfresco/repo/jscript/ValueConverter.java @@ -173,22 +173,38 @@ public class ValueConverter { // convert JavaScript array of values to a List of Serializable objects Object[] propIds = values.getIds(); - List propValues = new ArrayList(propIds.length); - for (int i=0; i propValues = new ArrayList(propIds.length); + for (int i=0; i propValues = new HashMap(propIds.length); + for (Object propId : propIds) + { + // Get the value and add to the map + Serializable val = (Serializable)values.get(propId.toString(), values); + propValues.put(convertValueForRepo((Serializable)propId), convertValueForRepo(val)); + } + + value = (Serializable)propValues; } - value = (Serializable)propValues; } else { @@ -227,4 +243,24 @@ public class ValueConverter return value; } + /** + * Look at the id's of a native array and try to determine whether it's actually an Array or a Hashmap + * + * @param ids id's of the native array + * @return boolean true if it's an array, false otherwise (ie it's a map) + */ + private boolean isArray(Object[] ids) + { + boolean result = true; + for (Object id : ids) + { + if (id instanceof Integer == false) + { + result = false; + break; + } + } + return result; + } + }