@@ -0,0 +1,2728 @@
+package com.google.sps.data;%0A%0Aimport com.google.appengine.api.datastore.DatastoreService;%0Aimport com.google.appengine.api.datastore.DatastoreServiceFactory;%0Aimport com.google.appengine.api.datastore.Entity;%0Aimport com.google.appengine.api.datastore.FetchOptions;%0Aimport com.google.appengine.api.datastore.Key;%0Aimport com.google.appengine.api.datastore.PreparedQuery;%0Aimport com.google.appengine.api.datastore.Query;%0Aimport com.google.appengine.api.datastore.Query.SortDirection;%0Aimport com.google.gson.Gson;%0Aimport com.google.maps.model.PlaceDetails;%0Aimport com.google.sps.data.Restaurant;%0Aimport com.google.sps.data.RestaurantDetailsGetter;%0Aimport com.google.sps.data.RestaurantQueryHelper;%0Aimport java.io.IOException;%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0Aimport java.util.Set;%0Aimport javax.servlet.annotation.WebServlet;%0Aimport javax.servlet.http.HttpServlet;%0Aimport javax.servlet.http.HttpServletRequest;%0Aimport javax.servlet.http.HttpServletResponse;%0Aimport org.jsoup.Jsoup;%0Aimport org.jsoup.nodes.Document;%0Aimport org.jsoup.nodes.Element;%0Aimport org.jsoup.select.Elements;%0Aimport com.google.appengine.api.datastore.PreparedQuery;%0Aimport com.google.appengine.api.datastore.Query;%0Aimport com.google.appengine.api.datastore.Query.SortDirection;%0Aimport com.google.appengine.api.datastore.Query.Filter;%0Aimport com.google.appengine.api.datastore.Query.FilterPredicate;%0Aimport com.google.appengine.api.datastore.Query.FilterOperator;%0Aimport com.google.appengine.api.datastore.FetchOptions;%0Aimport com.google.appengine.api.datastore.FetchOptions.Builder;%0A%0Apublic final class StoreRestaurantDataHelper %7B%0A  public void storeData(List%3CString%3E restaurantNames, String DATABASE_NAME, RestaurantDetailsGetter details, RestaurantQueryHelper queryHelper) %7B%0A    clearDatastore();%0A%0A    for (String restaurantName : restaurantNames) %7B%0A      PlaceDetails place = details.request(restaurantName);%0A%0A      if (place.geometry == null) continue;%0A%0A      PlaceDetails.Review%5B%5D reviewsArray = place.reviews;%0A      String reviews = details.getTagsfromReviews(reviewsArray);%0A%0A      Entity restaurantEntity = queryHelper.makeRestaurantEntity(place, restaurantName, reviews, DATABASE_NAME);%0A      DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();%0A      datastore.put(restaurantEntity);%0A    %7D%0A  %7D%0A%0A  public void clearDatastore() %7B%0A    Query restaurantQuery = new Query(%22Restaurant%22);%0A    DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();%0A    PreparedQuery allRestaurants = datastore.prepare(restaurantQuery);%0A    ArrayList%3CKey%3E keys = new ArrayList%3C%3E();%0A    for (Entity restaurant : allRestaurants.asIterable()) %7B%0A      keys.add(restaurant.getKey());%0A    %7D%0A    datastore.delete(keys);%0A  %7D%0A%7D

Resolve place.geometry null error