Class DefaultNDCCarrierOfferDataValidationStrategy
java.lang.Object
de.hybris.platform.ndc182facades.facades.order.strategies.impl.DefaultNDCCarrierOfferDataValidationStrategy
- All Implemented Interfaces:
OrderCreateRQValidationStrategy<NDCCarrierOfferData>
public class DefaultNDCCarrierOfferDataValidationStrategy
extends Object
implements OrderCreateRQValidationStrategy<NDCCarrierOfferData>
The ndc 18.2 implementation of
OrderCreateRQValidationStrategy interface.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanareValidOriginDestinationRefNumbers(List<NDCCarrierOfferData> ndcCarrierOfferDataList) Validates origin destination ref numbers.protected de.hybris.platform.servicelayer.time.TimeServiceGets time service.protected TransportFacilityServiceGets transport facility service.protected TransportOfferingServiceGets transport offering service.protected TravelRouteServiceGets travel route service.protected booleanisTransportOfferingInThePast(TransportOfferingModel transportOfferingModel) Return true if the transport offering provided is in the pastvoidsetTimeService(de.hybris.platform.servicelayer.time.TimeService timeService) Sets time service.voidsetTransportFacilityService(TransportFacilityService transportFacilityService) Sets transport facility service.voidsetTransportOfferingService(TransportOfferingService transportOfferingService) Sets transport offering service.voidsetTravelRouteService(TravelRouteService travelRouteService) Sets travel route service.protected voidsortTransportOfferings(List<TransportOfferingModel> transportOfferings) Sort transport offerings.voidvalidate(List<NDCCarrierOfferData> ndcOfferDataList, IATAOrderCreateRQ orderCreateRQ) This method validates a NDCCarrierOfferData.protected voidvalidateArrivalDepartureTime(List<NDCCarrierOfferData> carrierOfferDataList) Validates if the departure time of the inbound journey is after the arrival time of the outbound journeyprotected voidvalidateNdcOfferDataByPaxList(List<NDCPassengerData> ndcPassengerDataList, List<String> selectedOfferPaxList, List<PaxType> paxTypeList) Validates the ndc offer data by pax list.protected voidvalidateOffer(NDCCarrierOfferData carrierOfferData, SelectedOfferType selectedOffer, List<PaxType> paxList) This method checks if each offer listed in the orderCreateRQ message is identical to the offer (with the same ID) retrieved from the cache.protected voidvalidateOfferJourney(List<NDCCarrierOfferData> carrierOfferDataList) Validates the journey of the orderprotected voidvalidateOriginDestinationLocation(List<NDCCarrierOfferData> carrierOfferDataList) Validate origin destination location.protected voidvalidatePaxSegment(TransportOfferingModel transportOfferingModel, PaxSegmentType paxSegment) This method verifies if the paxSegment associated to the transport offering has the same informations (dep/arrival date, flight number, origin/destination location codes and carrierDesignCode).protected voidvalidatePaxSegmentDepartureAndArrivalDate(PaxSegmentType paxSegment, TransportOfferingModel transportOfferingModel, String transportOfferingCode) Validates pax segment departure and arrival date.protected voidvalidateTransportOfferings(NDCCarrierOfferData ndcCarrierOfferData, List<PaxSegmentType> paxSegmentList) Validates all the (distinct) transport offerings included in the offer.
-
Constructor Details
-
DefaultNDCCarrierOfferDataValidationStrategy
public DefaultNDCCarrierOfferDataValidationStrategy()
-
-
Method Details
-
validate
public void validate(List<NDCCarrierOfferData> ndcOfferDataList, IATAOrderCreateRQ orderCreateRQ) throws NDCException This method validates a NDCCarrierOfferData. Checks if 1) the offer is identical to the one in the orderCreateRQ message, 2) all the distinct transport offerings included in the offer are present in the paxSegmentList of the request message, 3) the journey is not an open journey (the destination of the inbound (if present) is equal to the origin of the outbound.- Specified by:
validatein interfaceOrderCreateRQValidationStrategy<NDCCarrierOfferData>- Parameters:
ndcOfferDataList- the ndcOfferDataListorderCreateRQ- the orderCreateRQ- Throws:
NDCException
-
validateOffer
protected void validateOffer(NDCCarrierOfferData carrierOfferData, SelectedOfferType selectedOffer, List<PaxType> paxList) throws NDCException This method checks if each offer listed in the orderCreateRQ message is identical to the offer (with the same ID) retrieved from the cache.- Parameters:
carrierOfferData- the carrier offer dataselectedOffer- the selected offerpaxList- the pax list- Throws:
NDCException- the ndc exception
-
validateNdcOfferDataByPaxList
protected void validateNdcOfferDataByPaxList(List<NDCPassengerData> ndcPassengerDataList, List<String> selectedOfferPaxList, List<PaxType> paxTypeList) throws NDCException Validates the ndc offer data by pax list. For each offerItem checks if the list of the passengers (and the type) is the same. Note that an offerItem has the type of passenger in its paxList.- Parameters:
ndcPassengerDataList- the ndcPassengerDataListselectedOfferPaxList- the selectedOfferPaxListpaxTypeList- the pax type list- Throws:
NDCException- the ndc exception
-
validateTransportOfferings
protected void validateTransportOfferings(NDCCarrierOfferData ndcCarrierOfferData, List<PaxSegmentType> paxSegmentList) throws NDCException Validates all the (distinct) transport offerings included in the offer. For each transport offering retrieves the transport offering model from the db and (if exists) verifies if: 1) the departure date is in the future, 2) the transport offering is listed in the paxSegmentList and all the informations in the paxSegment are identical.- Parameters:
ndcCarrierOfferData- the ndc carrier offer datapaxSegmentList- the pax segment list- Throws:
NDCException- the ndc exception
-
validatePaxSegment
protected void validatePaxSegment(TransportOfferingModel transportOfferingModel, PaxSegmentType paxSegment) throws NDCException This method verifies if the paxSegment associated to the transport offering has the same informations (dep/arrival date, flight number, origin/destination location codes and carrierDesignCode).- Parameters:
transportOfferingModel- the transport offering modelpaxSegment- the pax segment- Throws:
NDCException- the ndc exception
-
validatePaxSegmentDepartureAndArrivalDate
protected void validatePaxSegmentDepartureAndArrivalDate(PaxSegmentType paxSegment, TransportOfferingModel transportOfferingModel, String transportOfferingCode) throws NDCException Validates pax segment departure and arrival date.- Parameters:
paxSegment- the pax segmenttransportOfferingModel- the transport offering modeltransportOfferingCode- the transport offering code- Throws:
NDCException- the ndc exception
-
isTransportOfferingInThePast
Return true if the transport offering provided is in the past- Parameters:
transportOfferingModel- the TransportOfferingModel- Returns:
- true if the departure date of the transport offering is in the past.
-
areValidOriginDestinationRefNumbers
protected boolean areValidOriginDestinationRefNumbers(List<NDCCarrierOfferData> ndcCarrierOfferDataList) Validates origin destination ref numbers. Throws an NDCException if one of the originDestinRefNumber in the selectedOffer is not present in the cached offer.- Parameters:
ndcCarrierOfferDataList- the ndc carrier offer data list- Returns:
- true if all the originDestRefNumber are included in the cached offers.
-
validateOfferJourney
protected void validateOfferJourney(List<NDCCarrierOfferData> carrierOfferDataList) throws NDCException Validates the journey of the order- Parameters:
carrierOfferDataList- the carrier offer data list- Throws:
NDCException- the ndc exception
-
validateOriginDestinationLocation
protected void validateOriginDestinationLocation(List<NDCCarrierOfferData> carrierOfferDataList) throws NDCException Validate origin destination location. if the number of the offers is greater than one - not a one way journey: 1) checks if the destination location of a route is equal to origin location of the next one, 2) for the last route checks if the destination location is equal to the origin location of the first sorted route..- Parameters:
carrierOfferDataList- the carrier offer data list- Throws:
NDCException- the ndc exception
-
validateArrivalDepartureTime
protected void validateArrivalDepartureTime(List<NDCCarrierOfferData> carrierOfferDataList) throws NDCException Validates if the departure time of the inbound journey is after the arrival time of the outbound journey- Parameters:
carrierOfferDataList- the carrier offer data list- Throws:
NDCException- the ndc exception
-
sortTransportOfferings
Sort transport offerings.- Parameters:
transportOfferings- the transport offerings
-
getTransportOfferingService
Gets transport offering service.- Returns:
- the transport offering service
-
setTransportOfferingService
Sets transport offering service.- Parameters:
transportOfferingService- the transport offering service
-
getTimeService
protected de.hybris.platform.servicelayer.time.TimeService getTimeService()Gets time service.- Returns:
- the time service
-
setTimeService
public void setTimeService(de.hybris.platform.servicelayer.time.TimeService timeService) Sets time service.- Parameters:
timeService- the time service
-
getTravelRouteService
Gets travel route service.- Returns:
- the travel route service
-
setTravelRouteService
Sets travel route service.- Parameters:
travelRouteService- the travel route service
-
getTransportFacilityService
Gets transport facility service.- Returns:
- the transport facility service
-
setTransportFacilityService
Sets transport facility service.- Parameters:
transportFacilityService- the transport facility service
-