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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcleanDataReference(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.protected FareSearchRequestDatacreateFareSearchRequestData(AbstractOrderModel orderModel, RepricingRequestData repricingRequestData, RepricerRequest repricerRequest, RepricerResponse repricerResponse) Creates the fare search request data from the cart and the repricer request.protected static <T> Predicate<T>distinctByKey(Function<? super T, ?> keyExtractor) Filter the entries in a stream by one unique field of the object.protected voidfilterSolutions(List<String> bundlesToShow, EvaluateChangeSolutionResponseData evaluateChangeSolutionResponseData) Filters the solutions having invalid bundles.protected List<TransportOfferingModel>getChangedAndOriginalTransportOfferings(RepricingRequestData repricingRequestData, RepricerResponse repricerResponse, List<TransportOfferingModel> notFlownTransportOfferings) Gets changed and original transport offerings.protected List<TransportOfferingModel>getNewFlight(ChangeOriginDestinationGroupData changeOriginDestinationGroupData, RepricerResponse repricerResponse) Gets new flight.Gets not allowed statuses for consignment entries.Gets pax to passenger code type mapping.protected DefaultPROSTransportOfferingServiceGets pros transport offering service.protected PROSTravelBundleTemplateServiceGets pros travel bundle template service.protected de.hybris.platform.servicelayer.session.SessionServiceGets session service.protected TravelRulesServiceGets travel rules service.protected List<AbstractOrderEntryModel>getValidOrderEntries(AbstractOrderModel orderModel, Integer solutionId) Gets valid order entries.voidhandle(AbstractOrderModel orderModel, RepricingRequestData repricingRequestData, RepricerRequest repricerRequest, RepricerResponse repricerResponse, EvaluateChangeSolutionResponseData evaluateChangeSolutionResponseData) Handler to populate the reference data section and the repriced solutions.protected booleanisBundleFiltered(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.protected booleanisReturnJourney(FareSearchRequestData fareSearchRequestData) Checks if the type of the journey is SINGLE or RETURN.protected voidpopulateOriginDestination(AbstractOrderModel orderModel, RepricingRequestData repricingRequestData, FareSearchRequestData fareSearchRequestData, RepricerResponse repricerResponse) Populates the origin destination of the fareSearchRequestData.protected voidpopulatePassengerTypes(AbstractOrderModel orderModel, Integer solutionId, RepricerRequest repricerRequest, FareSearchRequestData fareSearchRequestData) Populate passenger types.voidsetNotAllowedStatusesForConsignmentEntries(List<String> notAllowedStatusesForConsignmentEntries) Sets not allowed statuses for consignment entries.voidsetPaxToPassengerCodeTypeMapping(Map<String, String> paxToPassengerCodeTypeMapping) Sets pax to passenger code type mapping.voidsetProsTransportOfferingService(DefaultPROSTransportOfferingService prosTransportOfferingService) Sets pros transport offering service.voidsetProsTravelBundleTemplateService(PROSTravelBundleTemplateService prosTravelBundleTemplateService) Sets pros travel bundle template service.voidsetSessionService(de.hybris.platform.servicelayer.session.SessionService sessionService) Sets session service.voidsetTravelRulesService(TravelRulesService travelRulesService) Sets travel rules service.
-
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:EvaluateChangeSolutionResponseHandlerHandler to populate the reference data section and the repriced solutions.- Specified by:
handlein interfaceEvaluateChangeSolutionResponseHandler- Parameters:
orderModel- the abstract order modelrepricingRequestData- the repricingRequestDatarepricerRequest- the repricer requestrepricerResponse- 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 showevaluateChangeSolutionResponseData- 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 removefareBundleProductsToRemove- the fare bundle products to removeallowancesToRemove- the allowances to removecarryOnToRemove- the carry on to removechargesToRemove- the charges to removesolutionsToRemove- the solutions to removeevaluateChangeSolutionResponseData- the evaluate change solution response data
-
isBundleFiltered
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 showfareBundlesData- 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 modelrepricingRequestData- the repricing request datarepricerRequest- the repricer requestrepricerResponse- the repricer response- Returns:
- the fare search request data
-
isReturnJourney
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 modelsolutionId- the solution idrepricerRequest- the repricer requestfareSearchRequestData- 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 modelrepricingRequestData- the repricing request datafareSearchRequestData- the fare search request datarepricerResponse- 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 datarepricerResponse- the repricer responsenotFlownTransportOfferings- 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 datarepricerResponse- the repricer response- Returns:
- the new flight
-
getValidOrderEntries
protected List<AbstractOrderEntryModel> getValidOrderEntries(AbstractOrderModel orderModel, Integer solutionId) Gets valid order entries.- Parameters:
orderModel- the cart modelsolutionId- the solution id- Returns:
- the valid order entries
-
distinctByKey
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
Gets pax to passenger code type mapping.- Returns:
- the pax to passenger code type mapping
-
setPaxToPassengerCodeTypeMapping
Sets pax to passenger code type mapping.- Parameters:
paxToPassengerCodeTypeMapping- the pax to passenger code type mapping
-
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
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
Gets travel rules service.- Returns:
- the travel rules service
-
setTravelRulesService
Sets travel rules service.- Parameters:
travelRulesService- the travel rules service
-
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
-