Class FareSelectionPageController


@Controller @RequestMapping("/fare-selection") public class FareSelectionPageController extends TravelAbstractPageController
Controller for Fare Selection page
  • Constructor Details

    • FareSelectionPageController

      public FareSelectionPageController()
  • Method Details

    • getFareSelectionPage

      @RequestMapping(method=GET) public String getFareSelectionPage(@Valid @ModelAttribute("fareFinderForm") @Valid FareFinderForm fareFinderForm, org.springframework.validation.BindingResult bindingResult, org.springframework.ui.Model model, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws de.hybris.platform.cms2.exceptions.CMSItemNotFoundException
      Method responsible for handling GET request on Fare Selection page
      Parameters:
      fareFinderForm -
      bindingResult -
      model -
      request -
      response -
      Returns:
      fare selection page
      Throws:
      de.hybris.platform.cms2.exceptions.CMSItemNotFoundException
    • saveCustomerSearch

      @RequestMapping(value="/save-search", method=POST) @ResponseBody public Map<String,String> saveCustomerSearch(@Valid @Valid FareFinderForm fareFinderForm, org.springframework.validation.BindingResult bindingResult, org.springframework.ui.Model model, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws de.hybris.platform.cms2.exceptions.CMSItemNotFoundException
      Method responsible for handling POST request to save Customer Search.
      Parameters:
      fareFinderForm -
      bindingResult -
      model -
      request -
      response -
      Returns:
      the JSON object representing the Success/Failure message.
      Throws:
      de.hybris.platform.cms2.exceptions.CMSItemNotFoundException
    • populateSavedSearchData

      protected SavedSearchData populateSavedSearchData(FareFinderForm fareFinderForm)
      Method responsible for populating SavedSearchData from FareFinderForm.
      Parameters:
      fareFinderForm -
      Returns:
      savedSearchData
    • populateModel

      protected void populateModel(org.springframework.ui.Model model, FareFinderForm fareFinderForm, FareSelectionData fareSelectionData)
      Method handles the preparation of the Model object
      Parameters:
      fareFinderForm -
      model -
      fareSelectionData -
    • prepareFareSearchRequestData

      protected FareSearchRequestData prepareFareSearchRequestData(FareFinderForm fareFinderForm, javax.servlet.http.HttpServletRequest request)
      Method handles the preparation of a FareSearchRequestData object using the FareFinderForm.
      Parameters:
      fareFinderForm -
      Returns:
    • sortFareSelectionData

      public void sortFareSelectionData(FareSelectionData fareSelectionData, String displayOrder, org.springframework.ui.Model model)
      Method to sort the FareSelectionData based on the displayOrder. If displayOrder is null, empty or not a valid FareSelectionDisplayOrder enum, the default sorting by departureDate is applied.
      Parameters:
      fareSelectionData - as the FareSelectionData to be sorted
      displayOrder - as the String corresponding to a sortingStrategy
      model -
    • sortingFareSelectionResults

      @RequestMapping(value="/sorting-fare-selection-results", method=POST) public String sortingFareSelectionResults(@Valid @Valid FareFinderForm fareFinderForm, org.springframework.validation.BindingResult bindingResult, @RequestParam String refNumber, @RequestParam String displayOrder, org.springframework.ui.Model model, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws de.hybris.platform.cms2.exceptions.CMSItemNotFoundException
      Method called to sort the FareSelectionData based on a selected sorting parameter.
      Parameters:
      fareFinderForm - as the fareFinderForm
      bindingResult - as the bindingResult of the fareFinderForm
      refNumber - as the refNumber of the leg to order
      displayOrder - as the selected parameter used to order the fareSelectionData
      model -
      request -
      response -
      Returns:
      the JSON object to refresh the result section with the sorted results
      Throws:
      de.hybris.platform.cms2.exceptions.CMSItemNotFoundException
    • disableCachingForResponse

      protected void disableCachingForResponse(javax.servlet.http.HttpServletResponse response)
    • getLowestPriceForDay

      protected PriceData getLowestPriceForDay(FareSelectionData fareSelectionData, int refNumber, String priceDisplayPassengerType)
      Calculates the lowest price for the date selected for particular leg of the journey
      Parameters:
      fareSelectionData - - full response object
      refNumber - - identifier of the leg
      Returns:
      lowest price for day
    • getDatesForTabs

      protected List<Date> getDatesForTabs(String selectedDateString)
      Creates a list of dates which will be displayed in Fare Selection table tabs
      Parameters:
      selectedDateString - - date selected for a leg
      Returns:
      a list of dates for tabs
    • countJourneyOptions

      protected int countJourneyOptions(FareSelectionData fareSelectionData, int referenceNumber)
      Checks how many priced itineraries are available for the relevant journey
      Parameters:
      fareSelectionData - - full response object
      referenceNumber - - specifies which leg of the journey it is
      Returns:
      number of options for the journey
    • createPassengerTypes

      protected List<PassengerTypeQuantityData> createPassengerTypes(javax.servlet.http.HttpServletRequest request)
      Method takes the request URL and extracts the passenger type and passenger quantity to create a list of PassengerTypeQuantityData
      Parameters:
      request -
      Returns:
      List
    • getLinksForTabs

      protected List<String> getLinksForTabs(List<Date> dates, FareFinderForm fareFinderForm, int refNumber)
      Returns links for tabs so that if users wants to change a date, new set of results is generated.
      Parameters:
      dates - - dates that will be displayed for tabs
      fareFinderForm -
      refNumber -
      Returns:
      links to fare selection page with updated date
    • buildRequestParameters

      protected String buildRequestParameters(FareFinderForm fareFinderForm, String newDate, int refNumber)
      Builds fare selection current request parameters
      Parameters:
      fareFinderForm -
      newDate -
      refNumber -
      Returns:
    • getOriginDestination

      protected Map<String,TransportFacilityData> getOriginDestination(FareSelectionData fareSelectionData)
      Provides travel route for the first leg of the journey based on response object
      Parameters:
      fareSelectionData -
      Returns:
      travel route