@RequestMapping(value = "/", method = RequestMethod.POST) public String homeSubmit(@ModelAttribute Form form, Model model) { String[] cmdArgs = {""}; model.addAttribute("form", form); userForm = form; switch (form.getCity()) { case "Amarillo": form.setLatitude(35.1992); form.setLongitude(-101.8453); break; case "Austin": form.setLatitude(30.2500); form.setLongitude(-97.7500); break; case "College Station": form.setLatitude(30.6014); form.setLongitude(-96.3144); break; case "Corpus Christi": form.setLatitude(27.7428); form.setLongitude(-97.4019); break; case "Fort Worth": form.setLatitude(32.7574); form.setLongitude(-97.3332); break; case "Houston": form.setLatitude(29.7604); form.setLongitude(-95.3698); break; case "Lubbock": form.setLatitude(33.5667); form.setLongitude(-101.8833); break; case "San Antonio": form.setLatitude(29.4167); form.setLongitude(-98.5000); break; case "Waco": form.setLatitude(31.5514); form.setLongitude(-97.1558); break; default: // init to Dallas form.setLatitude(32.806437331493); form.setLongitude(-96.802432100254); } thefacade.getForm(form); thefacade.getYelpAPIResults( YelpAPI.run( cmdArgs, form.getActivity(), form.getCity(), form.getRadius(), form.getDeals())); return "map"; }
@SuppressWarnings("unchecked") @RequestMapping(value = "/getCriteria", method = RequestMethod.POST) @ResponseBody public JSONObject sendCriteria() { JSONObject json = new JSONObject(); json.put("city", userForm.getCity()); json.put("radius", userForm.getRadius()); json.put("type", userForm.getActivity()); json.put("openStatus", userForm.getOpenStatus()); return json; }