1
0
mirror of https://github.com/owncloud/android-library.git synced 2025-06-07 16:06:08 +00:00

Parse the lists of remote users from the JSON response of the server

This commit is contained in:
Juan Carlos González Cabrero 2016-03-03 12:45:05 +01:00
parent 23643ad28e
commit 36da2a2336

View File

@ -78,7 +78,7 @@ public class GetRemoteShareesOperation extends RemoteOperation{
// Arguments - constant values
private static final String VALUE_FORMAT = "json";
private static final String VALUE_ITEM_TYPE = "search"; // to get the server search for users / groups
private static final String VALUE_ITEM_TYPE = "file"; // to get the server search for users / groups
// JSON Node names
@ -87,6 +87,7 @@ public class GetRemoteShareesOperation extends RemoteOperation{
private static final String NODE_EXACT = "exact";
private static final String NODE_USERS = "users";
private static final String NODE_GROUPS = "groups";
private static final String NODE_REMOTES = "remotes";
public static final String NODE_VALUE = "value";
public static final String PROPERTY_LABEL = "label";
public static final String PROPERTY_SHARE_TYPE = "shareType";
@ -146,17 +147,21 @@ public class GetRemoteShareesOperation extends RemoteOperation{
JSONObject respExact = respData.getJSONObject(NODE_EXACT);
JSONArray respExactUsers = respExact.getJSONArray(NODE_USERS);
JSONArray respExactGroups = respExact.getJSONArray(NODE_GROUPS);
JSONArray respExactRemotes = respExact.getJSONArray(NODE_REMOTES);
JSONArray respPartialUsers = respData.getJSONArray(NODE_USERS);
JSONArray respPartialGroups = respData.getJSONArray(NODE_GROUPS);
JSONArray respPartialRemotes = respData.getJSONArray(NODE_REMOTES);
JSONArray[] jsonResults = {
respExactUsers,
respExactGroups,
respExactRemotes,
respPartialUsers,
respPartialGroups
respPartialGroups,
respPartialRemotes
};
ArrayList<Object> data = new ArrayList<Object>(); // For result data
for (int i=0; i<4; i++) {
for (int i=0; i<6; i++) {
for(int j=0; j< jsonResults[i].length(); j++){
JSONObject jsonResult = jsonResults[i].getJSONObject(j);
data.add(jsonResult);