mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
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
This commit is contained in:
@@ -173,22 +173,38 @@ public class ValueConverter
|
|||||||
{
|
{
|
||||||
// convert JavaScript array of values to a List of Serializable objects
|
// convert JavaScript array of values to a List of Serializable objects
|
||||||
Object[] propIds = values.getIds();
|
Object[] propIds = values.getIds();
|
||||||
List<Serializable> propValues = new ArrayList<Serializable>(propIds.length);
|
if (isArray(propIds) == true)
|
||||||
for (int i=0; i<propIds.length; i++)
|
{
|
||||||
{
|
List<Serializable> propValues = new ArrayList<Serializable>(propIds.length);
|
||||||
// work on each key in turn
|
for (int i=0; i<propIds.length; i++)
|
||||||
Object propId = propIds[i];
|
|
||||||
|
|
||||||
// we are only interested in keys that indicate a list of values
|
|
||||||
if (propId instanceof Integer)
|
|
||||||
{
|
{
|
||||||
// get the value out for the specified key
|
// work on each key in turn
|
||||||
Serializable val = (Serializable)values.get((Integer)propId, values);
|
Object propId = propIds[i];
|
||||||
// recursively call this method to convert the value
|
|
||||||
propValues.add(convertValueForRepo(val));
|
// we are only interested in keys that indicate a list of values
|
||||||
|
if (propId instanceof Integer)
|
||||||
|
{
|
||||||
|
// get the value out for the specified key
|
||||||
|
Serializable val = (Serializable)values.get((Integer)propId, values);
|
||||||
|
// recursively call this method to convert the value
|
||||||
|
propValues.add(convertValueForRepo(val));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
value = (Serializable)propValues;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Map<Serializable, Serializable> propValues = new HashMap<Serializable, Serializable>(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
|
else
|
||||||
{
|
{
|
||||||
@@ -227,4 +243,24 @@ public class ValueConverter
|
|||||||
return value;
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user