コード例 #1
0
ファイル: OkapiClient.java プロジェクト: 9cat/cgeo
  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);
  }
コード例 #2
0
ファイル: OkapiClient.java プロジェクト: nyordanov/cgeo
  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);
  }