Пример #1
0
 @RequestMapping(
     value = "/shortPrimaryContainer/{brandCode}/{productCode}",
     method = RequestMethod.POST)
 public @ResponseBody List<PrimaryContainer> getShortPrimaryContainer(
     @PathVariable(value = "brandCode") String brandCode,
     @PathVariable(value = "productCode") String productCode) {
   return repository.getShortPrimaryContainers(brandCode, productCode);
 }
Пример #2
0
 @RequestMapping(
     value = "/primaryContainer/{beverageCategoryCode}/{brandCode}",
     method = RequestMethod.POST)
 public @ResponseBody List<PrimaryContainer> getPrimaryContainer(
     @PathVariable(value = "beverageCategoryCode") String beverageCategoryCode,
     @PathVariable(value = "brandCode") String brandCode) {
   return repository.getPrimaryContainers(beverageCategoryCode, brandCode);
 }
Пример #3
0
 @RequestMapping(
     value = "/subTradeChannel/{tradeChannelCode}/{includeFoodService}",
     method = RequestMethod.POST)
 public @ResponseBody List<SubTradeChannel> getSubTradeChannels(
     @PathVariable(value = "tradeChannelCode") String tradeChannelCode,
     @PathVariable(value = "includeFoodService") boolean includeFoodService) {
   return repository.getSubTradeChannels(tradeChannelCode, includeFoodService);
 }
Пример #4
0
 @RequestMapping(
     value = "/beverageFlavor/{beverageCategoryCode}/{beverageBrandCode}",
     method = RequestMethod.POST)
 public @ResponseBody List<Flavor> getBeverageFlavors(
     @PathVariable(value = "beverageCategoryCode") String beverageCategoryCode,
     @PathVariable(value = "beverageBrandCode") String beverageBrandCode) {
   return repository.getFlavors(beverageCategoryCode, beverageBrandCode);
 }
Пример #5
0
 @RequestMapping(
     value = "/secondaryPackage/{beverageCategoryCode}/{brandCode}/{primaryContainerCode}",
     method = RequestMethod.POST)
 public @ResponseBody List<SecondaryPackage> getSecondaryPackages(
     @PathVariable(value = "primaryContainerCode") String primaryContainerCode,
     @PathVariable(value = "beverageCategoryCode") String beverageCategoryCode,
     @PathVariable(value = "brandCode") String brandCode) {
   return repository.getSecondaryPackages(beverageCategoryCode, brandCode, primaryContainerCode);
 }
Пример #6
0
 @RequestMapping(
     value = "/shortSecondaryPackage/{brandCode}/{productCode}/{primaryContainerShortCode}",
     method = RequestMethod.POST)
 public @ResponseBody List<BaseDictionaryItem> getPackageSizes(
     @PathVariable(value = "brandCode") String brandCode,
     @PathVariable(value = "productCode") String productCode,
     @PathVariable(value = "primaryContainerShortCode") String primaryContainerShortCode) {
   primaryContainerShortCode = primaryContainerShortCode.replace("strange", ".");
   brandCode = brandCode.replace("strange", ".");
   return repository.getShortSecondaryPackages(brandCode, productCode, primaryContainerShortCode);
 }
Пример #7
0
  /** Simply selects the home view to render by returning its name. */
  @RequestMapping(
      value = "/",
      method = {RequestMethod.GET, RequestMethod.POST})
  public String home(
      /* Locale locale, */ Model model, HttpServletRequest request, HttpSession session) {
    // logger.info("Welcome home! the client locale is " +
    // locale.toString());
    if (request.getRequestURI() != null && !request.getRequestURI().endsWith("/")) {
      return "redirect:/";
    }
    // utility.initUser(session);

    model.addAttribute("beverageCategories", repository.getBeverageCategories());
    model.addAttribute("beverageBrands", repository.getBrandsAll());
    model.addAttribute("products", repository.getProdsAll());
    model.addAttribute("beverageFlavors", repository.getFlavorsAll());
    model.addAttribute("physicalStates", repository.getPhysicalStates());
    model.addAttribute("tradeChannels", repository.getTradeChannelsAll());
    model.addAttribute("subTradeChannels", repository.getSubTradeChannelsAll());

    /*
    model.addAttribute("primaryContainers", repository.getPrimaryContainersAll());
    model.addAttribute("secondaryPackages", repository.getSecondaryPackagesAll());
    */

    model.addAttribute("shortPrimaryContainers", repository.getShortPrimaryContainersAll());
    model.addAttribute("shortSecondaryPackages", repository.getShortSecondaryPackagesAll());

    model.addAttribute("productPackageTypes", repository.getProductPackageTypes());
    model.addAttribute("businessTypes", repository.getBusinessTypes());
    model.addAttribute("states", repository.getStatesAll());
    model.addAttribute("countries", repository.getCountries());
    model.addAttribute("itemPerPage", Integer.valueOf(DEFAULT_ITEM_PER_PAGE));
    model.addAttribute("countPage", Integer.valueOf(DEFAULT_COUNT_PAGE));
    model.addAttribute("numPage", Integer.valueOf(DEFAULT_NUMBER_PAGE));
    model.addAttribute("pageList", getPageList(DEFAULT_COUNT_PAGE));
    model.addAttribute("distanceUnits", DistanceUnits.values());
    model.addAttribute("googleAPIClientId", repository.getGoogleAPIClientId());
    model.addAttribute("googleAPIChannel", repository.getGoogleAPIChannel());
    LocatorForm form = new LocatorForm();
    model.addAttribute("locatorForm", form);

    return "home";
  }
Пример #8
0
  @RequestMapping(
      value =
          "/search/{latitude}/{longitude}/{distance}/{distanceUnit}/"
              + "{beverageCategoryCode}/{productTypeCode}/{brandCode}/{flavorCode}/{productCode}/"
              + "{primaryContainerShortCode}/{secondaryPackageShortCode}/{businessTypeCode}/"
              + "{physicalStateCode}/{tradeChannelCode}/{subTradeChannelCode}/{outletName}/"
              + "{includeFoodService}/{isKosherProduct}/{pageNumber}/{recordCount}/{sortColumn}/{sortOrder}",
      method = RequestMethod.POST)
  public @ResponseBody Locations search(
      @PathVariable(value = "latitude") double latitude,
      @PathVariable(value = "longitude") double longitude,
      @PathVariable(value = "distance") int distance,
      @PathVariable(value = "distanceUnit") String distanceUnit,
      @PathVariable(value = "beverageCategoryCode") String beverageCategoryCode,
      @PathVariable(value = "productTypeCode") String productTypeCode,
      @PathVariable(value = "brandCode") String brandCode,
      @PathVariable(value = "flavorCode") String flavorCode,
      @PathVariable(value = "productCode") String productCode,
      @PathVariable(value = "primaryContainerShortCode") String primaryContainerShortCode,
      @PathVariable(value = "secondaryPackageShortCode") String secondaryPackageShortCode,
      @PathVariable(value = "businessTypeCode") String businessTypeCode,
      @PathVariable(value = "physicalStateCode") String physicalStateCode,
      @PathVariable(value = "tradeChannelCode") String tradeChannelCode,
      @PathVariable(value = "subTradeChannelCode") String subTradeChannelCode,
      @PathVariable(value = "outletName") String outletName,
      @PathVariable(value = "includeFoodService") boolean includeFoodService,
      @PathVariable(value = "isKosherProduct") boolean isKosherProduct,
      @PathVariable(value = "pageNumber") int pageNumber,
      @PathVariable(value = "recordCount") int recordCount,
      @PathVariable(value = "sortColumn") String sortColumn,
      @PathVariable(value = "sortOrder") String sortOrder,
      HttpServletRequest request)
      throws InvalidKeyException, NoSuchAlgorithmException, IllegalStateException,
          UnsupportedEncodingException {

    if (LocatorConstants.MAX_OUTLET_RECORDS_COUNT < pageNumber * recordCount) {
      recordCount = (pageNumber * recordCount) - LocatorConstants.MAX_OUTLET_RECORDS_COUNT;
    }
    Locations locations =
        repository.getSearchLocations(
            latitude,
            longitude,
            distance,
            distanceUnit,
            beverageCategoryCode,
            productTypeCode,
            brandCode,
            flavorCode,
            productCode,
            primaryContainerShortCode,
            secondaryPackageShortCode,
            businessTypeCode,
            physicalStateCode,
            tradeChannelCode,
            subTradeChannelCode,
            outletName,
            includeFoodService,
            isKosherProduct,
            pageNumber,
            recordCount,
            sortColumn,
            sortOrder);
    setSessionSearchLocations(request, locations);
    return locations;
  }
Пример #9
0
 @RequestMapping(value = "/keywordDictionary", method = RequestMethod.POST)
 public @ResponseBody List<DictionaryItem> getKeywordDictionary() {
   return repository.getKeywordDictionary();
 }
Пример #10
0
 @RequestMapping(value = "/country/{stateCode}", method = RequestMethod.POST)
 public @ResponseBody Country getCountry(@PathVariable(value = "stateCode") String stateCode) {
   return repository.getCountryByState(stateCode);
 }
Пример #11
0
 @RequestMapping(value = "/state/{countryCode}", method = RequestMethod.POST)
 public @ResponseBody List<State> getStates(
     @PathVariable(value = "countryCode") String countryCode) {
   return repository.getStates(countryCode);
 }
Пример #12
0
 @RequestMapping(value = "/tradeChannel/{includeFoodService}", method = RequestMethod.POST)
 public @ResponseBody List<TradeChannel> getTradeChannels(
     @PathVariable(value = "includeFoodService") boolean includeFoodService) {
   return repository.getTradeChannels(includeFoodService);
 }