private static List<Geocache> requestCaches( final OCApiConnector connector, final Parameters params, final Map<String, String> valueMap, final boolean my) { // if a global type filter is set, and OKAPI does not know that type, then return an empty list // instead of all caches if (Settings.getCacheType() != CacheType.ALL && StringUtils.isBlank(getFilterFromType())) { return Collections.emptyList(); } addFilterParams(valueMap, connector, my); try { params.add("search_params", JsonUtils.writer.writeValueAsString(valueMap)); } catch (final JsonProcessingException e) { Log.e("requestCaches", e); return Collections.emptyList(); } addRetrieveParams(params, connector); final ObjectNode data = request(connector, OkapiService.SERVICE_SEARCH_AND_RETRIEVE, params).data; if (data == null) { return Collections.emptyList(); } return parseCaches(data); }
private static List<Geocache> requestCaches( final OCApiConnector connector, final Parameters params, final Map<String, String> valueMap) { addFilterParams(valueMap, connector); params.add("search_params", new JSONObject(valueMap).toString()); addRetrieveParams(params, connector); final JSONObject data = request(connector, OkapiService.SERVICE_SEARCH_AND_RETRIEVE, params); if (data == null) { return Collections.emptyList(); } return parseCaches(data); }