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 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:
      validate in interface OrderCreateRQValidationStrategy<NDCCarrierOfferData>
      Parameters:
      ndcOfferDataList - the ndcOfferDataList
      orderCreateRQ - 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 data
      selectedOffer - the selected offer
      paxList - 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 ndcPassengerDataList
      selectedOfferPaxList - the selectedOfferPaxList
      paxTypeList - 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 data
      paxSegmentList - 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 model
      paxSegment - 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 segment
      transportOfferingModel - the transport offering model
      transportOfferingCode - the transport offering code
      Throws:
      NDCException - the ndc exception
    • isTransportOfferingInThePast

      protected boolean isTransportOfferingInThePast(TransportOfferingModel transportOfferingModel)
      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

      protected void sortTransportOfferings(List<TransportOfferingModel> transportOfferings)
      Sort transport offerings.
      Parameters:
      transportOfferings - the transport offerings
    • getTransportOfferingService

      protected TransportOfferingService getTransportOfferingService()
      Gets transport offering service.
      Returns:
      the transport offering service
    • setTransportOfferingService

      public void setTransportOfferingService(TransportOfferingService transportOfferingService)
      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

      protected TravelRouteService getTravelRouteService()
      Gets travel route service.
      Returns:
      the travel route service
    • setTravelRouteService

      public void setTravelRouteService(TravelRouteService travelRouteService)
      Sets travel route service.
      Parameters:
      travelRouteService - the travel route service
    • getTransportFacilityService

      protected TransportFacilityService getTransportFacilityService()
      Gets transport facility service.
      Returns:
      the transport facility service
    • setTransportFacilityService

      public void setTransportFacilityService(TransportFacilityService transportFacilityService)
      Sets transport facility service.
      Parameters:
      transportFacilityService - the transport facility service