コード例 #1
0
  private void completePlace(Place place) throws IOException {

    if (place.getCoord() == null) {

      return;
    }

    Place googlePlace = googleProvider.retrievePlace(place.getCoord(), place.getName());

    if (googlePlace == null) {

      return;
    }

    place.setOpenningDays(googlePlace.getOpenningDays());
    place.setPhone(googlePlace.getPhone());
  }
コード例 #2
0
  private Place buildPlace(JSONObject json) {

    Place place = new Place();
    place.setAddressString(json.getJSONObject("address_obj").getString("address_string"));

    Coordinates coord = new Coordinates(json.getDouble("latitude"), json.getDouble("longitude"));

    if (coord.getLat() != 0 || coord.getLon() != 0) {

      place.setCoord(coord);
    }

    place.setId(json.getString("location_id"));
    place.setName(json.getString("name"));

    Rating rating = new Rating();
    rating.setRating(json.getDouble("rating"));
    rating.setRevisions(json.getInt("num_reviews"));

    place.setRating(rating);

    if (json.has("price_level") && !json.isNull("price_level")) {

      place.setPriceLevel(json.getString("price_level").length());
    } else {

      place.setPriceLevel(-1);
    }

    place.setPhotoId(place.getId());
    place.setProvider(providerId);

    return place;
  }