This method makes the API call to get the list value for the specified resource. It loads the return
from the API into the arrayList, updates the index if necessary and sets the new link values
@param params the params
760062
protected void getPage(final JSONObject params) {
		
		if (this.client == null)
			client = BandwidthClient.getInstance();
    	
        try {
	        final RestResponse response = client.get(resourceUri, params);
	        
	        final JSONArray array = Utils.response2JSONArray(response);
	        
	        for (final Object obj : array) {	
        		final E elem = clazz.getConstructor(BandwidthClient.class, JSONObject.class).newInstance(client, (JSONObject) obj);
        		add(elem);
	        }
	        
	        // if anything comes back, reset the index
	        if (array.size() > 0)
	        	this.index = 0;
	        
	        // set the next links
	        this.setNextLink(response.getNextLink());	        
	        this.setFirstLink(response.getFirstLink());
	        this.setPreviousLink(response.getPreviousLink());
        }
        catch(final Exception e) {
        	e.printStackTrace();
        }
	}
130307
@SuppressWarnings("unchecked")
	private static void bindRequestParameters(UriComponentsBuilder builder,
			AnnotatedParametersParameterAccessor.BoundMethodParameter parameter) {

		Object value = parameter.getValue();
		String key = parameter.getVariableName();

		if (value instanceof MultiValueMap) {

			MultiValueMap<String, String> requestParams = (MultiValueMap<String, String>) value;

			for (Map.Entry<String, List<String>> multiValueEntry : requestParams.entrySet()) {
				for (String singleEntryValue : multiValueEntry.getValue()) {
					builder.queryParam(multiValueEntry.getKey(), encodeParameter(singleEntryValue));
				}
			}

		} else if (value instanceof Map) {

			Map<String, String> requestParams = (Map<String, String>) value;

			for (Map.Entry<String, String> requestParamEntry : requestParams.entrySet()) {
				builder.queryParam(requestParamEntry.getKey(), encodeParameter(requestParamEntry.getValue()));
			}

		} else if (value instanceof Collection) {

			for (Object element : (Collection<?>) value) {
				if (key != null) {
					builder.queryParam(key, encodeParameter(element));
				}
			}

		} else if (SKIP_VALUE.equals(value)) {

			if (parameter.isRequired()) {
				if (key != null) {
					builder.queryParam(key, String.format("{%s}", parameter.getVariableName()));
				}
			}

		} else {
			if (key != null) {
				builder.queryParam(key, encodeParameter(parameter.asString()));
			}
		}
	}
266227
protected SortedMap<String, String> getParametersToDisplay(List<ParameterSetOperation> params) {
        // populate param map with sorted by key: key=index/name, value=first value
        SortedMap<String, String> paramMap = new TreeMap<String, String>(new StringAsIntegerComparator());
        for (ParameterSetOperation param : params) {
            String key = getParameterKeyToDisplay(param);
            String value = getParameterValueToDisplay(param);
            paramMap.put(key, value);
        }
        return paramMap;
    }
660190
public <T> List<T> getObjectsList(Class<T> objectClass,
			Collection<? extends NameValuePair> params) throws RedmineException {
		final EntityConfig<T> config = getConfig(objectClass);
		final List<T> result = new ArrayList<T>();

		final List<NameValuePair> newParams = new ArrayList<NameValuePair>(
				params);

		newParams.add(new BasicNameValuePair("limit", String
				.valueOf(objectsPerPage)));
		int offset = 0;

		int totalObjectsFoundOnServer;
		do {
			List<NameValuePair> paramsList = new ArrayList<NameValuePair>(
					newParams);
			paramsList.add(new BasicNameValuePair("offset", String
					.valueOf(offset)));

			final URI uri = getURIConfigurator().getObjectsURI(objectClass,
					paramsList);

			logger.debug(uri.toString());
			final HttpGet http = new HttpGet(uri);

			final String response = getCommunicator().sendRequest(http);
			logger.debug("received: " + response);

			final List<T> foundItems;
			try {
				final JSONObject responseObject = RedmineJSONParser
						.getResponse(response);
				foundItems = JsonInput.getListOrNull(responseObject,
						config.multiObjectName, config.parser);
				result.addAll(foundItems);

				/* Necessary for trackers */
				if (!responseObject.has(KEY_TOTAL_COUNT)) {
					break;
				}
				totalObjectsFoundOnServer = JsonInput.getInt(responseObject,
						KEY_TOTAL_COUNT);
			} catch (JSONException e) {
				throw new RedmineFormatException(e);
			}

			if (foundItems.size() == 0) {
				break;
			}

			offset += foundItems.size();
		} while (offset < totalObjectsFoundOnServer);

		return result;
	}
356874
public Request setParam(String name, Iterable<String> values) {
        this.params.putAll(name, values);
        return this;
    }
1355165
public static void addValue(String key, Object value, MultiValueMap<String, String> params) {
        if (value != null) {
            params.add(key, value.toString());
        }
    }
250584
public static JSONObject getJsonParameterMap(Map<String, String[]> params) {

        JSONObject result = new JSONObject();
        for (Map.Entry<String, String[]> entry : params.entrySet()) {
            String paramKey = entry.getKey();
            JSONArray paramValue = new JSONArray();
            for (int i = 0, l = entry.getValue().length; i < l; i++) {
                paramValue.put(entry.getValue()[i]);
            }
            try {
                result.putOpt(paramKey, paramValue);
            } catch (JSONException e) {
                // should never happen
                LOG.warn(e.getLocalizedMessage(), e);
            }
        }
        return result;
    }
1352509
public void open(AerialParams params) throws Exception {
        content = new ArrayList<String>();

        DefaultHttpClient client = new DefaultHttpClient();
        client.getCredentialsProvider().setCredentials(
                AuthScope.ANY,
                new UsernamePasswordCredentials(userName, password));

        for (String query : params.getValueParams()) {
            URI uri = UriBuilder.fromUri(url)
                    .path("/rest/api/2/search")
                    .queryParam("jql", query)
                    .queryParam("fields", "key," + fieldName).build();
            HttpGet request = new HttpGet(uri);
            HttpResponse response = client.execute(request);
            String responseText = EntityUtils.toString(response.getEntity());
            JSONObject json = new JSONObject(responseText);
            JSONArray array = json.getJSONArray("issues");
            for (int i = 0; i < array.length(); i++) {
                String value = null;
                if (!array.getJSONObject(i).has("fields")) {
                    continue;
                }
                if (!array.getJSONObject(i).getJSONObject("fields").has(fieldName)) {
                    continue;
                }
                value = array.getJSONObject(i).getJSONObject("fields").getString(fieldName);
                if (value != null && !value.equals("null")) {
                    content.add(value);
                }
                String tag = null;
                tag = array.getJSONObject(i).getString("key");
                if (tag != null) {
                    this.getTags().add(tag);
                }
            }
        }
        client.getConnectionManager().shutdown();
        this.iterator = content.iterator();
    }
943544
private Map<String, String> getParameters(String param) {

        if (CmsStringUtil.isNotEmpty(param)) {
            return CmsStringUtil.splitAsMap(param, "|", "=");
        }
        return Collections.emptyMap();
    }
1148458
public void add(final Param key, final String[] value) {
        if (value != null && value.length > 0) {
            parameters.put(key, toList(value));
        }
    }
254142
public static void setParamDefault(
            final Multimap<String, String> params, final String key, final String value) {
        if (!params.containsKey(key)) {
            params.put(key, value);
        }
    }
236003
public void createLink(HalRelation rel, String... pathParams) {
    if(pathParams != null && pathParams.length > 0 && pathParams[0] != null) {
      Set<String> linkedResourceIds = linkedResources.get(rel);
      if(linkedResourceIds == null) {
        linkedResourceIds = new HashSet<String>();
        linkedResources.put(rel, linkedResourceIds);
      }

      // Hmm... use the last id in the pathParams as linked resource id
      linkedResourceIds.add(pathParams[pathParams.length - 1]);

      resource.addLink(rel.relName, rel.uriTemplate.build((Object[])pathParams));
    }
  }
227235
public static String getOptionalStringParam(JSONObject params, String paramName) {
		if (params.containsKey(paramName)) {
			return params.getString(paramName);
		}
		return null;
	}
851561
private static List<NameValuePair> convert(List<Parameter> params) {
		List<NameValuePair> pairs = new ArrayList<>(params.size());
		for (Parameter param : params) {
			if (param.getValue() != null) {
				pairs.add(new BasicNameValuePair(param.getName(), param.getValue()));
			}
		}
		return pairs;
	}
1036207
public static Pager getPagerFromParams(MultivaluedMap<String, String> params) {
		Pager pager = new Pager();
		pager.setPage(NumberUtils.toLong(paramOrDefault(params, "page", ""), 0));
		if (pager.getPage() > Config.MAX_PAGES) {
			pager.setPage(Config.MAX_PAGES);
		}
		pager.setLimit(NumberUtils.toInt(paramOrDefault(params, "limit", ""), pager.getLimit()));
		if (pager.getLimit() > Config.MAX_PAGE_LIMIT) {
			pager.setLimit(Config.MAX_PAGE_LIMIT);
		}
		pager.setSortby(paramOrDefault(params, "sort", pager.getSortby()));
		pager.setDesc(Boolean.parseBoolean(paramOrDefault(params, "desc", "true")));
		pager.setLastKey(paramOrDefault(params, "lastKey", null));
		return pager;
	}
1057473
public void setSdParams(List<SDParam> sdParams) {
        if (null == sdParams) {
            throw new IllegalArgumentException("sdParams list cannot be null");
        }
        this.sdParams.addAll(sdParams);
    }
380414
@Override
  public void loadParam(BackendModel m, String param_path) {
    ((DeepwaterCaffeModel) m).loadParam(param_path);
  }