Class DefaultEvaluateChangeSolutionResponseFilterSolutionsHandler

java.lang.Object
de.hybris.platform.prosfacades.repricer.handler.impl.DefaultEvaluateChangeSolutionResponseFilterSolutionsHandler
All Implemented Interfaces:
EvaluateChangeSolutionResponseHandler

public class DefaultEvaluateChangeSolutionResponseFilterSolutionsHandler extends Object implements EvaluateChangeSolutionResponseHandler
Filter the RepricedSolutionData and clean the ChangeSolutionDataReference of the EvaluateChangeSolutionResponseData by checking the showBundles rules.
  • Constructor Details

    • DefaultEvaluateChangeSolutionResponseFilterSolutionsHandler

      public DefaultEvaluateChangeSolutionResponseFilterSolutionsHandler()
  • Method Details

    • handle

      public void handle(AbstractOrderModel orderModel, RepricingRequestData repricingRequestData, RepricerRequest repricerRequest, RepricerResponse repricerResponse, EvaluateChangeSolutionResponseData evaluateChangeSolutionResponseData)
      Description copied from interface: EvaluateChangeSolutionResponseHandler
      Handler to populate the reference data section and the repriced solutions.
      Specified by:
      handle in interface EvaluateChangeSolutionResponseHandler
      Parameters:
      orderModel - the abstract order model
      repricingRequestData - the repricingRequestData
      repricerRequest - the repricer request
      repricerResponse - the repricer response
    • filterSolutions

      protected void filterSolutions(List<String> bundlesToShow, EvaluateChangeSolutionResponseData evaluateChangeSolutionResponseData)
      Filters the solutions having invalid bundles. When a repriced solution has at least one invalid fare, then the entire solution has to be removed, together with its data reference information.
      Parameters:
      bundlesToShow - the bundles to show
      evaluateChangeSolutionResponseData - the evaluate change solution response data
    • cleanDataReference

      protected void cleanDataReference(Set<Integer> faresToRemove, Set<String> fareBundleProductsToRemove, Set<Integer> allowancesToRemove, Set<Integer> carryOnToRemove, Set<Integer> chargesToRemove, Set<Integer> solutionsToRemove, EvaluateChangeSolutionResponseData evaluateChangeSolutionResponseData)
      Cleans the data reference from all the invalid data linked to the filtered bundles.
      Parameters:
      faresToRemove - the fares to remove
      fareBundleProductsToRemove - the fare bundle products to remove
      allowancesToRemove - the allowances to remove
      carryOnToRemove - the carry on to remove
      chargesToRemove - the charges to remove
      solutionsToRemove - the solutions to remove
      evaluateChangeSolutionResponseData - the evaluate change solution response data
    • isBundleFiltered

      protected boolean isBundleFiltered(List<String> bundlesToShow, FareBundlesData fareBundlesData)
      Checks if the bundle template exists in the system and if ignoreRule is false and the bundleTemplateid is contained in the list of showBundles.
      Parameters:
      bundlesToShow - the bundles to show
      fareBundlesData - the fare bundles data
      Returns:
      true if the bundle template has ignoreRule set to false and its Id is not contained in the list of bundleToShow
    • createFareSearchRequestData

      protected FareSearchRequestData createFareSearchRequestData(AbstractOrderModel orderModel, RepricingRequestData repricingRequestData, RepricerRequest repricerRequest, RepricerResponse repricerResponse)
      Creates the fare search request data from the cart and the repricer request.
      Parameters:
      orderModel - the order model
      repricingRequestData - the repricing request data
      repricerRequest - the repricer request
      repricerResponse - the repricer response
      Returns:
      the fare search request data
    • isReturnJourney

      protected boolean isReturnJourney(FareSearchRequestData fareSearchRequestData)
      Checks if the type of the journey is SINGLE or RETURN. If the number of the origin destination group is greater than one, then is a RETURN journey.
      Parameters:
      fareSearchRequestData - the fare search request data
      Returns:
      true if the journey is a RETURN one.
    • populatePassengerTypes

      protected void populatePassengerTypes(AbstractOrderModel orderModel, Integer solutionId, RepricerRequest repricerRequest, FareSearchRequestData fareSearchRequestData)
      Populate passenger types.
      Parameters:
      orderModel - the order model
      solutionId - the solution id
      repricerRequest - the repricer request
      fareSearchRequestData - the fare search request data
    • populateOriginDestination

      protected void populateOriginDestination(AbstractOrderModel orderModel, RepricingRequestData repricingRequestData, FareSearchRequestData fareSearchRequestData, RepricerResponse repricerResponse)
      Populates the origin destination of the fareSearchRequestData.
      Parameters:
      orderModel - the order model
      repricingRequestData - the repricing request data
      fareSearchRequestData - the fare search request data
      repricerResponse - the repricer response
    • getChangedAndOriginalTransportOfferings

      protected List<TransportOfferingModel> getChangedAndOriginalTransportOfferings(RepricingRequestData repricingRequestData, RepricerResponse repricerResponse, List<TransportOfferingModel> notFlownTransportOfferings)
      Gets changed and original transport offerings.
      Parameters:
      repricingRequestData - the repricing request data
      repricerResponse - the repricer response
      notFlownTransportOfferings - the not flown transport offerings
      Returns:
      the changed and original transport offerings
    • getNewFlight

      protected List<TransportOfferingModel> getNewFlight(ChangeOriginDestinationGroupData changeOriginDestinationGroupData, RepricerResponse repricerResponse)
      Gets new flight.
      Parameters:
      changeOriginDestinationGroupData - the change origin destination group data
      repricerResponse - the repricer response
      Returns:
      the new flight
    • getValidOrderEntries

      protected List<AbstractOrderEntryModel> getValidOrderEntries(AbstractOrderModel orderModel, Integer solutionId)
      Gets valid order entries.
      Parameters:
      orderModel - the cart model
      solutionId - the solution id
      Returns:
      the valid order entries
    • distinctByKey

      protected static <T> Predicate<T> distinctByKey(Function<? super T,?> keyExtractor)
      Filter the entries in a stream by one unique field of the object.
      Type Parameters:
      T - the type parameter
      Parameters:
      keyExtractor - the key extractor
      Returns:
      the predicate
    • getSessionService

      protected de.hybris.platform.servicelayer.session.SessionService getSessionService()
      Gets session service.
      Returns:
      the session service
    • setSessionService

      public void setSessionService(de.hybris.platform.servicelayer.session.SessionService sessionService)
      Sets session service.
      Parameters:
      sessionService - the session service
    • getPaxToPassengerCodeTypeMapping

      protected Map<String,String> getPaxToPassengerCodeTypeMapping()
      Gets pax to passenger code type mapping.
      Returns:
      the pax to passenger code type mapping
    • setPaxToPassengerCodeTypeMapping

      public void setPaxToPassengerCodeTypeMapping(Map<String,String> paxToPassengerCodeTypeMapping)
      Sets pax to passenger code type mapping.
      Parameters:
      paxToPassengerCodeTypeMapping - the pax to passenger code type mapping
    • getNotAllowedStatusesForConsignmentEntries

      protected List<String> getNotAllowedStatusesForConsignmentEntries()
      Gets not allowed statuses for consignment entries.
      Returns:
      the not allowed statuses for consignment entries
    • setNotAllowedStatusesForConsignmentEntries

      public void setNotAllowedStatusesForConsignmentEntries(List<String> notAllowedStatusesForConsignmentEntries)
      Sets not allowed statuses for consignment entries.
      Parameters:
      notAllowedStatusesForConsignmentEntries - the not allowed statuses for consignment entries
    • getProsTransportOfferingService

      protected DefaultPROSTransportOfferingService getProsTransportOfferingService()
      Gets pros transport offering service.
      Returns:
      the pros transport offering service
    • setProsTransportOfferingService

      public void setProsTransportOfferingService(DefaultPROSTransportOfferingService prosTransportOfferingService)
      Sets pros transport offering service.
      Parameters:
      prosTransportOfferingService - the pros transport offering service
    • getTravelRulesService

      protected TravelRulesService getTravelRulesService()
      Gets travel rules service.
      Returns:
      the travel rules service
    • setTravelRulesService

      public void setTravelRulesService(TravelRulesService travelRulesService)
      Sets travel rules service.
      Parameters:
      travelRulesService - the travel rules service
    • getProsTravelBundleTemplateService

      protected PROSTravelBundleTemplateService getProsTravelBundleTemplateService()
      Gets pros travel bundle template service.
      Returns:
      the pros travel bundle template service
    • setProsTravelBundleTemplateService

      public void setProsTravelBundleTemplateService(PROSTravelBundleTemplateService prosTravelBundleTemplateService)
      Sets pros travel bundle template service.
      Parameters:
      prosTravelBundleTemplateService - the pros travel bundle template service