private Restaurant warmupRestaurant(Order order, Model uiModel) { Collection<Restaurant> restaurants = restaurantService.findAll(); uiModel.addAttribute("restaurants", restaurants); Restaurant restaurant = restaurantService.fetchWarmedUp(order.getBill().getDiningTable().getRestaurant().getId()); uiModel.addAttribute("restaurant", restaurant); return restaurant; }
private Bill warmupRestaurant(String billId, Model uiModel) { Bill bill = billService.findById(Long.valueOf(billId)); Collection<Restaurant> restaurants = restaurantService.findAll(); uiModel.addAttribute("restaurants", restaurants); Restaurant restaurant = restaurantService.fetchWarmedUp(bill.getDiningTable().getRestaurant().getId()); uiModel.addAttribute("restaurant", restaurant); return bill; }
private Order warmupRestaurantByOrder(String orderId, Model uiModel) { Order order = orderService.findById(Long.valueOf(orderId)); Collection<Restaurant> restaurants = restaurantService.findAll(); uiModel.addAttribute("restaurants", restaurants); Restaurant restaurant = restaurantService.fetchWarmedUp(order.getBill().getDiningTable().getRestaurant().getId()); uiModel.addAttribute("restaurant", restaurant); return order; }
@RequestMapping(value = "/restaurants/{restaurantName}/waiter", method = RequestMethod.GET) public String showWaiter(@PathVariable("restaurantName") String restaurantName, Model uiModel) { // warmup stuff Collection<Restaurant> restaurants = restaurantService.findAll(); uiModel.addAttribute("restaurants", restaurants); Restaurant restaurant = restaurantService.fetchWarmedUp(restaurantName); uiModel.addAttribute("restaurant", restaurant); List<Order> allPreparedOrders = orderService.findPreparedOrdersForRestaurant(restaurant); uiModel.addAttribute("allPreparedOrders", allPreparedOrders); List<Bill> allSubmittedBills = billService.findSubmittedBillsForRestaurant(restaurant); uiModel.addAttribute("allSubmittedBills", allSubmittedBills); return "hartigehap/waiter"; }
public void loadRestaurantsForLocation(LatLng location, int startIndex, int numResults) { Log.i(MimiLog.TAG, "Getting restaurants for location: " + location.toString()); try { float latitude = (float) location.latitude; float longitude = (float) location.longitude; // First try to get the results from the cache RestaurantResults restaurantResults = restaurantService.getCachedRestaurantsAtLocation( latitude, longitude, startIndex, numResults); Log.i( MimiLog.TAG, "Got " + restaurantResults.restaurants.size() + " results from cache from index " + startIndex + ". Full results: " + restaurantResults.fullResults); for (Restaurant restaurant : restaurantResults.restaurants) { Log.i(MimiLog.TAG, "Got restaurant " + restaurant.name); } // If we did not get the full results for this location, // lookup the remaining results from the API if (!restaurantResults.fullResults && isNetworkAvailable()) { // We haven't got all the possible results from the cache // call the remote api if it is available fetchRestaurantsFromApi(location, startIndex); } else { // Display the restaurants loaded from the cache (whether they are full or not) for (RestaurantListener restaurantListener : restaurantListeners) { restaurantListener.onRestaurantsLoaded( restaurantResults.restaurants, location, startIndex); } } } catch (IOException e) { // TODO handle error properly throw new RuntimeException("Error getting results from cache", e); } }