@RequestMapping(value = STORE_CODE_PATH_VARIABLE_PATTERN + "/map", method = RequestMethod.GET) public String viewMap(@PathVariable("storeCode") final String storeCode, final Model model) throws GeoLocatorException, MapServiceException, CMSItemNotFoundException { final StoreFinderForm storeFinderForm = new StoreFinderForm(); model.addAttribute("storeFinderForm", storeFinderForm); final StorePositionForm storePositionForm = new StorePositionForm(); model.addAttribute("storePositionForm", storePositionForm); final PointOfServiceData pointOfServiceData = storeFinderFacade.getPointOfServiceForName(storeCode); pointOfServiceData.setUrl("/store/" + pointOfServiceData.getName()); model.addAttribute("store", pointOfServiceData); storeCmsPageInModel(model, getStoreFinderPage()); model.addAttribute( WebConstants.BREADCRUMBS_KEY, storeBreadcrumbBuilder.getBreadcrumbsForSubPage( pointOfServiceData, "storeDetails.map.link")); return ControllerConstants.Views.Pages.StoreFinder.StoreFinderViewMapPage; }
@RequestMapping(value = STORE_CODE_PATH_VARIABLE_PATTERN, method = RequestMethod.GET) public String storeDetail( @PathVariable("storeCode") final String storeCode, @RequestParam(value = "lat", required = false) final Double sourceLatitude, @RequestParam(value = "long", required = false) final Double sourceLongitude, @RequestParam(value = "q", required = false) final String locationQuery, final Model model) throws CMSItemNotFoundException { final StoreFinderForm storeFinderForm = new StoreFinderForm(); model.addAttribute("storeFinderForm", storeFinderForm); final StorePositionForm storePositionForm = new StorePositionForm(); model.addAttribute("storePositionForm", storePositionForm); if (sourceLatitude != null && sourceLongitude != null) { final GeoPoint geoPoint = new GeoPoint(); geoPoint.setLatitude(sourceLatitude); geoPoint.setLongitude(sourceLongitude); // Get the point of service data with the formatted distance final PointOfServiceData pointOfServiceData = storeFinderFacade.getPointOfServiceForNameAndPosition(storeCode, geoPoint); pointOfServiceData.setUrl("/store/" + pointOfServiceData.getName()); model.addAttribute("store", pointOfServiceData); if (locationQuery != null && !locationQuery.isEmpty()) { model.addAttribute("locationQuery", locationQuery); // Build URL to location query final String storeFinderSearchUrl = UriComponentsBuilder.fromPath("/store-finder") .queryParam("q", locationQuery) .build() .toString(); model.addAttribute( WebConstants.BREADCRUMBS_KEY, storeBreadcrumbBuilder.getBreadcrumbs(pointOfServiceData, storeFinderSearchUrl)); } else { // Build URL to position query final String storeFinderSearchUrl = UriComponentsBuilder.fromPath("/store-finder/position") .queryParam("lat", sourceLatitude) .queryParam("long", sourceLongitude) .build() .toString(); model.addAttribute( WebConstants.BREADCRUMBS_KEY, storeBreadcrumbBuilder.getBreadcrumbs(pointOfServiceData, storeFinderSearchUrl)); } setUpMetaData(model, pointOfServiceData); } else { // No source point specified - just lookup the POS by name final PointOfServiceData pointOfServiceData = storeFinderFacade.getPointOfServiceForName(storeCode); pointOfServiceData.setUrl("/store/" + pointOfServiceData.getName()); model.addAttribute("store", pointOfServiceData); model.addAttribute( WebConstants.BREADCRUMBS_KEY, storeBreadcrumbBuilder.getBreadcrumbs(pointOfServiceData)); setUpMetaData(model, pointOfServiceData); } storeCmsPageInModel(model, getStoreFinderPage()); return ControllerConstants.Views.Pages.StoreFinder.StoreFinderDetailsPage; }