Class PackageListingPageController


@Controller @RequestMapping("/package-listing") public class PackageListingPageController extends AbstractPackagePageController
Controller for Accommodation Search page
  • Field Details

  • Constructor Details

    • PackageListingPageController

      public PackageListingPageController()
  • Method Details

    • getPackageListingPage

      @RequestMapping(method=GET) public String getPackageListingPage(@ModelAttribute("accommodationFinderForm") AccommodationFinderForm accommodationFinderForm, org.springframework.validation.BindingResult accommodationBindingResult, @ModelAttribute("fareFinderForm") FareFinderForm fareFinderForm, org.springframework.validation.BindingResult fareBindingResult, @RequestParam(value="propertyName",required=false) String propertyName, @RequestParam(value="q",required=false) String query, @RequestParam(value="sort",required=false) String sortCode, @RequestParam(value="pageNum",required=false,defaultValue="1") Integer pageNumber, @RequestParam(value="resultsViewType",required=false,defaultValue="listView") String resultsViewType, @RequestParam(value="priceRange",required=false) String priceRange, org.springframework.validation.BindingResult bindingResult, org.springframework.ui.Model model, javax.servlet.http.HttpServletRequest request) throws de.hybris.platform.cms2.exceptions.CMSItemNotFoundException
      Gets accommodation search page.
      Parameters:
      accommodationFinderForm - the accommodation finder form
      propertyName - the property name
      query - the query
      sortCode - the sort code
      pageNumber - the page number
      bindingResult - the binding result
      model - the model
      request - the request
      Returns:
      the accommodation search page
      Throws:
      de.hybris.platform.cms2.exceptions.CMSItemNotFoundException - the cms item not found exception
    • initializeForms

      protected void initializeForms(FareFinderForm fareFinderForm, AccommodationFinderForm accommodationFinderForm, javax.servlet.http.HttpServletRequest request) throws NumberFormatException
      Initialize forms.
      Parameters:
      fareFinderForm - the fare finder form
      accommodationFinderForm - the accommodation finder form
      request - the request
      Throws:
      NumberFormatException
    • resolveLocationFields

      protected void resolveLocationFields(FareFinderForm fareFinderForm)
      Resolve location name fields for fareFinderForm.
      Parameters:
      fareFinderForm - the fare finder form
    • resolveDestinationLocation

      protected void resolveDestinationLocation(String arrivalLocation, String arrivalLocationSuggestionType, AccommodationFinderForm accommodationFinderForm)
      This method resolves the destination location fields for accommodationFinderForm. It tries to resolve the location from the transport facility, if no result is found we fall back to Google search and use geographic coordinates
      Parameters:
      arrivalLocation -
      arrivalLocationSuggestionType -
      accommodationFinderForm -
    • getResultViewType

      protected String getResultViewType(String resultViewType)
      Gets the result view type.
      Parameters:
      resultViewType - the result view type
      Returns:
      the result view type
    • getCriterionData

      protected CriterionData getCriterionData(AccommodationFinderForm accommodationFinderForm, javax.servlet.http.HttpServletRequest request, String propertyName, String query, String sortCode)
      Prepare accommodation search request data accommodation search request data.
      Parameters:
      accommodationFinderForm - the accommodation finder form
      request - the request
      propertyName - the property name
      query - the query
      sortCode - the sort code
      Returns:
      the accommodation search request data
    • buildPackageDetailsPageUrlParameters

      protected String buildPackageDetailsPageUrlParameters(AccommodationFinderForm accommodationFinderForm, FareFinderForm fareFinderForm)
      Build package details page url parameters string.
      Parameters:
      accommodationFinderForm - accommodationFinderForm
      fareFinderForm - fareFinderForm
      Returns:
      the string
    • appendParameter

      protected void appendParameter(StringBuilder urlParameters, String parameter, String value)
    • populateModelWithPackagePriceRange

      protected void populateModelWithPackagePriceRange(PackageSearchResponseData packageSearchResponseData, org.springframework.ui.Model model, String priceRange)
      Update criterion data for price range filter.
      Parameters:
      packageSearchResponseData - the package search response data
      model - the model
    • prepareCustomerReviewData

      @RequestMapping("/customer-review/{accommodationOfferingCode}") public String prepareCustomerReviewData(@PathVariable String accommodationOfferingCode, org.springframework.ui.Model model)
      Prepare customer review data json response.
      Parameters:
      accommodationOfferingCode - the accommodation offering code
      model - the model
      Returns:
      the string
    • displayView

      @RequestMapping("/display-view") public String displayView(org.springframework.ui.Model model, @RequestParam(value="resultsViewType",required=false,defaultValue="listView") String resultsViewType, @RequestParam(value="pageNum",required=false,defaultValue="1") Integer pageNumber, @RequestParam(value="priceRange",required=false) String priceRange, javax.servlet.http.HttpServletRequest request)
      Display method to return the properties to mark on Map.
      Returns:
      the string
    • showMore

      @RequestMapping("/show-more") public String showMore(@RequestParam(value="pageNumber",required=false) int pageNumber, @RequestParam(value="resultsViewType",required=false,defaultValue="listView") String resultsViewType, @RequestParam(value="priceRange",required=false) String priceRange, org.springframework.ui.Model model)
      Show more method to return lazy loaded properties.
      Parameters:
      pageNumber - the page number
      model - the model
      Returns:
      the string
    • getPackageSearchResultsPageSize

      protected int getPackageSearchResultsPageSize(String resultsViewType)
      Gets the package search results page size.
      Parameters:
      resultsViewType - the results view type
      Returns:
      the package search results page size
    • populateCommonModelAttributes

      protected void populateCommonModelAttributes(int startIndex, int pageNumber, String resultsViewType, PackageSearchResponseData packageSearchResponseData, org.springframework.ui.Model model)
      Populate common model attributes.
      Parameters:
      pageNumber - the page number
      resultsViewType - the results view type
      packageSearchResponseData - the package search response data
      model - the model
    • getModifiedQueryString

      protected String getModifiedQueryString(javax.servlet.http.HttpServletRequest request)
      Below method clears the q and propertyName request parameters from the query string as they are supposed to be cleared on currency change
      Parameters:
      request -
      Returns:
    • getPriceRangeFilteredPackages

      @RequestMapping("/filter-price-range") public String getPriceRangeFilteredPackages(@RequestParam(value="priceRange",required=false) String priceRange, @RequestParam(value="resultsViewType",required=false,defaultValue="listView") String resultsViewType, @RequestParam(value="pageNum",required=false,defaultValue="1") Integer pageNumber, org.springframework.ui.Model model)
      Gets the price range filtered packages.
      Parameters:
      resultsViewType - the results view type
      pageNumber - the page number
      model - the model
      Returns:
      the price range filtered packages
    • getPackageSearchWithAppliedPriceRange

      protected PackageSearchResponseData getPackageSearchWithAppliedPriceRange(String priceRange)
      Gets the package search with applied price range.
      Parameters:
      priceRange - the price range
      Returns:
      the package search with applied price range
    • validateFieldPattern

      protected Boolean validateFieldPattern(String attribute, String pattern)
      Validate field pattern boolean.
      Parameters:
      attribute - the attribute
      pattern - the pattern
      Returns:
      the boolean
    • validateAccommodationFinderForm

      protected void validateAccommodationFinderForm(AbstractTravelValidator accommodationFinderValidator, AccommodationFinderForm accommodationFinderForm, org.springframework.validation.BindingResult bindingResult, String formName)
      Validate accommodation finder form.
      Parameters:
      accommodationFinderValidator - the accommodation finder validator
      accommodationFinderForm - the accommodation finder form
      bindingResult - the binding result
      formName - the form name
    • validateFareFinderForm

      protected void validateFareFinderForm(AbstractTravelValidator fareFinderValidator, FareFinderForm fareFinderForm, org.springframework.validation.BindingResult bindingResult, String formName)
      Validate fare finder form.
      Parameters:
      fareFinderValidator - the fare finder validator
      fareFinderForm - the fare finder form
      bindingResult - the binding result
      formName - the form name