RM-2047 (Set classification repository action)

+review RM

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@102123 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Tuna Aksoy
2015-04-17 14:08:53 +00:00
parent f1cefc629c
commit 4afa2f7dd1
5 changed files with 178 additions and 0 deletions

View File

@@ -317,4 +317,30 @@ public final class WebScriptUtils
return jsonObject;
}
/**
* Gets the {@link JSONArray} value of a given key from a json object
*
* @param jsonObject The json object
* @param key The key
* @return The {@link JSONArray} value of the given key from the json object
*/
public static JSONArray getJSONArrayFromJSONObject(JSONObject jsonObject, String key)
{
JSONArray jsonArray;
mandatory("jsonObject", jsonObject);
mandatory("key", key);
try
{
jsonArray = jsonObject.getJSONArray(key);
}
catch (JSONException error)
{
throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Could not get the json array for the key '" + key + "'.", error);
}
return jsonArray;
}
}