Class DefaultTravelCommerceCartService

java.lang.Object
de.hybris.platform.commerceservices.order.impl.DefaultCommerceCartService
de.hybris.platform.subscriptionservices.subscription.impl.DefaultSubscriptionCommerceCartService
de.hybris.platform.travelservices.order.impl.DefaultTravelCommerceCartService
All Implemented Interfaces:
de.hybris.platform.commerceservices.order.CommerceCartService, de.hybris.platform.subscriptionservices.subscription.SubscriptionCommerceCartService, TravelCommerceCartService
Direct Known Subclasses:
DefaultShoppingTravelCommerceCartService

public class DefaultTravelCommerceCartService extends de.hybris.platform.subscriptionservices.subscription.impl.DefaultSubscriptionCommerceCartService implements TravelCommerceCartService
The class overrides the DefaultSubscriptionCommerceCartService addToCart to handle more than one bundle entry.Cart entry is created for each transport offering per passenger with a new bundle no.
  • Constructor Details

    • DefaultTravelCommerceCartService

      public DefaultTravelCommerceCartService()
  • Method Details

    • updateCartEntryWithTravelDetails

      public void updateCartEntryWithTravelDetails(AbstractOrderEntryModel orderEntryModel, PriceLevel priceLevel, List<TransportOfferingModel> transportOfferingModels) throws de.hybris.platform.commerceservices.order.CommerceCartModificationException
      Description copied from interface: TravelCommerceCartService
      Method to update the cart entry with travel specific values and specific transportOfferings.
      Specified by:
      updateCartEntryWithTravelDetails in interface TravelCommerceCartService
      Parameters:
      orderEntryModel - the order entry to update
      priceLevel - the price
      transportOfferingModels - the transport offering
      Throws:
      de.hybris.platform.commerceservices.order.CommerceCartModificationException
    • updateCartEntryWithTravelDetails

      protected void updateCartEntryWithTravelDetails(AbstractOrderEntryModel orderEntryModel, PriceLevel priceLevel) throws de.hybris.platform.commerceservices.order.CommerceCartModificationException
      Method to update the cart entry with travel specific values
      Parameters:
      orderEntryModel - the order entry to update
      priceLevel - the price
      Throws:
      de.hybris.platform.commerceservices.order.CommerceCartModificationException - the commerce cart modification exception
    • updateCartEntryWithTravelDetails

      protected void updateCartEntryWithTravelDetails(AbstractOrderEntryModel orderEntryModel, PriceLevel priceLevel, List<TransportOfferingModel> transportOfferings, boolean saveTravellerDetails) throws de.hybris.platform.commerceservices.order.CommerceCartModificationException
      Update cart entry with travel details.
      Parameters:
      orderEntryModel - the order entry model
      priceLevel - the price level
      transportOfferings - the transport offerings
      saveTravellerDetails - the save traveller details
      Throws:
      de.hybris.platform.commerceservices.order.CommerceCartModificationException - the commerce cart modification exception
    • populateBoundId

      protected void populateBoundId(Map<String,Object> params, CartModel cartModel, List<TransportOfferingModel> transportOfferingModels)
      Populate the bound id, if the bound id exists use the same for a bound or create one
      Parameters:
      params - the params
      cartModel - the cart model
      transportOfferingModels - the transport offering model
    • getBoundIdFromEntry

      protected AbstractOrderEntryModel getBoundIdFromEntry(Map<String,Object> params, CartModel cartModel)
      Get bound id for entry
      Parameters:
      params - the params
      cartModel - the cart model
      Returns:
      bound id from entry
    • addAutopickProductsForRoute

      protected void addAutopickProductsForRoute(int bundleEntryGroupNo, List<TransportOfferingModel> transportOfferingModels, TravelRouteModel travelRouteModel, TravellerModel travellerModel, List<CommerceCartModification> modificationList, BundleTemplateModel childTemplate, ProductModel autoPickProduct) throws de.hybris.platform.commerceservices.order.CommerceCartModificationException
      Add autopick products for route.
      Parameters:
      bundleEntryGroupNo - the bundle entry group no
      transportOfferingModels - the transport offering models
      travelRouteModel - the travel route model
      travellerModel - the traveller model
      modificationList - the modification list
      childTemplate - the child template
      autoPickProduct - the auto pick product
      Throws:
      de.hybris.platform.commerceservices.order.CommerceCartModificationException - the commerce cart modification exception
    • getCommerceCartParameter

      protected CommerceCartParameter getCommerceCartParameter(BundleTemplateModel childTemplate, ProductModel autoPickProduct, Set<Integer> singleton)
      Gets commerce cart parameter.
      Parameters:
      childTemplate - the child template
      autoPickProduct - the auto pick product
      singleton - the singleton
      Returns:
      the commerce cart parameter
    • addAutopickProductsForTransportOfferings

      protected void addAutopickProductsForTransportOfferings(int bundleEntryGroupNo, List<TransportOfferingModel> transportOfferingModels, TravelRouteModel travelRouteModel, TravellerModel travellerModel, List<CommerceCartModification> modificationList, BundleTemplateModel childTemplate, ProductModel autoPickProduct) throws de.hybris.platform.commerceservices.order.CommerceCartModificationException
      Add autopick products for transport offerings.
      Parameters:
      bundleEntryGroupNo - the bundle entry group no
      transportOfferingModels - the transport offering models
      travelRouteModel - the travel route model
      travellerModel - the traveller model
      modificationList - the modification list
      childTemplate - the child template
      autoPickProduct - the auto pick product
      Throws:
      de.hybris.platform.commerceservices.order.CommerceCartModificationException - the commerce cart modification exception
    • populateTravelRouteForEntry

      protected void populateTravelRouteForEntry(TravelRouteModel travelRouteModel, Map<String,Object> params)
      Populate travel route for entry.
      Parameters:
      travelRouteModel - the travel route model
      params - the params
    • populateTravellerForEntry

      protected void populateTravellerForEntry(AbstractOrderEntryModel orderEntryModel, TravellerModel travellerModel, Map<String,Object> params)
      Populate traveller for entry.
      Parameters:
      orderEntryModel - the order entry model
      travellerModel - the traveller model
      params - the params
    • populatePriceLevelForEntry

      protected void populatePriceLevelForEntry(PriceLevel priceLevel, Map<String,Object> params)
      Populate price level for entry.
      Parameters:
      priceLevel - the price level
      params - the params
    • populateTransportOfferingForEntry

      protected void populateTransportOfferingForEntry(List<TransportOfferingModel> transportOfferings, Map<String,Object> params)
      Populate transport offering for entry.
      Parameters:
      transportOfferings - the transport offerings
      params - the params
    • populateActiveFlagForEntry

      protected void populateActiveFlagForEntry(Boolean active, Map<String,Object> params)
      Populate active flag for entry.
      Parameters:
      active - the active
      params - the params
    • populateAmendStatusForEntry

      protected void populateAmendStatusForEntry(AmendStatus amendStatus, Map<String,Object> params)
      Populate amend status for entry.
      Parameters:
      amendStatus - the amend status
      params - the params
    • isTravellerEligibleForProduct

      protected boolean isTravellerEligibleForProduct(ProductModel product, String passengerType)
      Is traveller eligible for product boolean.
      Parameters:
      product - the product
      passengerType - the passenger type
      Returns:
      the boolean
    • addPropertiesToCartEntry

      public void addPropertiesToCartEntry(CartModel masterCartModel, int orderEntryNo, ProductModel product, Map<String,Object> propertiesMap)
      Add properties to cart entry.
      Specified by:
      addPropertiesToCartEntry in interface TravelCommerceCartService
      Parameters:
      masterCartModel - the cart model. It must exist and it must be a master cart.
      orderEntryNo - entryNo for cart entry
      product - the product model that will be added to the cart
      propertiesMap - Map containing all the properties to be added to the cart Entry
    • getOrderEntriesForCategory

      public List<AbstractOrderEntryModel> getOrderEntriesForCategory(CartModel cartModel, CategoryModel categoryModel, String travelRouteCode, List<String> transportOfferingCodes, String travellerUid)
      Description copied from interface: TravelCommerceCartService
      Method to retrieve all the cart entries for a specified categoryModel
      Specified by:
      getOrderEntriesForCategory in interface TravelCommerceCartService
      Parameters:
      cartModel - as the cartModel
      categoryModel - as the categoryModel to use to retrieve the cart entries
      travelRouteCode - as the travelRoute code
      transportOfferingCodes - as the list of transportOffering codes
      travellerUid - as the Traveller unique id
      Returns:
      list of AbstractOrderEntryModel
    • checkBundleAndCategory

      protected boolean checkBundleAndCategory(AbstractOrderEntryModel orderEntry, CategoryModel categoryModel)
      Verifies if order entry bundle and product's category match
      Parameters:
      orderEntry - the order entry
      categoryModel - the category
      Returns:
      true if bundle and product category match
    • checkTraveller

      protected boolean checkTraveller(AbstractOrderEntryModel orderEntry, String travellerUid)
      Verifies if order entry has a matching traveller
      Parameters:
      orderEntry - the order entry
      travellerUid - the traveller uid
      Returns:
      true if traveller matches
    • checkTransportOfferings

      protected boolean checkTransportOfferings(AbstractOrderEntryModel orderEntry, List<String> transportOfferingCodes)
      Verifies if order entry has a matching list of transport offerings
      Parameters:
      orderEntry - the order entry
      transportOfferingCodes - the list of transport offering codes
      Returns:
      true if the order entry contains all the transport offering codes
    • persistProperties

      protected void persistProperties(Map<String,Object> propertiesMap, AbstractOrderEntryModel orderEntry)
      Persist properties.
      Parameters:
      propertiesMap - the properties map
      orderEntry - the order entry
    • addSelectedAccommodationToCart

      public void addSelectedAccommodationToCart(String transportOfferingCode, String travellerCode, ConfiguredAccommodationModel configuredAccommodation)
      Description copied from interface: TravelCommerceCartService
      This method adds a configured accommodation as a selected accommodation to the cart
      Specified by:
      addSelectedAccommodationToCart in interface TravelCommerceCartService
      Parameters:
      transportOfferingCode - the transport offering code
      travellerCode - the traveller code
      configuredAccommodation - the configured accommodation
    • createSelectedAccommodationModel

      protected SelectedAccommodationModel createSelectedAccommodationModel(String transportOfferingCode, String travellerCode, CartModel sessionCart, ConfiguredAccommodationModel configuredAccommodation)
      Create selected accommodation model selected accommodation model.
      Parameters:
      transportOfferingCode - the transport offering code
      travellerCode - the traveller code
      sessionCart - the session cart
      configuredAccommodation - the configured accommodation
      Returns:
      the selected accommodation model
    • removeSelectedAccommodationFromCart

      public void removeSelectedAccommodationFromCart(String transportOfferingCode, String travellerCode, String configuredAccommodationUid)
      Description copied from interface: TravelCommerceCartService
      This method removes a selected accommodation from the cart
      Specified by:
      removeSelectedAccommodationFromCart in interface TravelCommerceCartService
      Parameters:
      transportOfferingCode - the transport offering code
      travellerCode - the traveller code
      configuredAccommodationUid - the configured accommodation Uid
    • removeCartEntriesForMinODRefNumber

      public void removeCartEntriesForMinODRefNumber(Integer odRefNum)
      Description copied from interface: TravelCommerceCartService
      Cleans up the cart from bundles before a new bundle addition. It removes all the entries of type TRANSPORT with originDestinationRefNumber greater than the given odRefNum and the related entry groups.
      Specified by:
      removeCartEntriesForMinODRefNumber in interface TravelCommerceCartService
      Parameters:
      odRefNum - as the minimum originDestinationRefNumber
    • removeCartEntriesForBoundId

      public void removeCartEntriesForBoundId(String boundId) throws de.hybris.platform.servicelayer.exceptions.UnknownIdentifierException
      Description copied from interface: TravelCommerceCartService
      Cleans up the cart from the boundId. It removes all the entries associated to the boundId and the related entry groups.
      Specified by:
      removeCartEntriesForBoundId in interface TravelCommerceCartService
      Parameters:
      boundId - the boundId which needs to be removed
      Throws:
      de.hybris.platform.servicelayer.exceptions.UnknownIdentifierException
    • normalizeEntryNumbers

      public void normalizeEntryNumbers(CartModel cartModel)
      Description copied from interface: TravelCommerceCartService
      Normalize the cart entry numbers
      Specified by:
      normalizeEntryNumbers in interface TravelCommerceCartService
      Parameters:
      cartModel - the cart model
    • removeEntryGroupsFromCart

      public void removeEntryGroupsFromCart(CartModel sessionCart, Set<Integer> entryGroupNumbers)
      Description copied from interface: TravelCommerceCartService
      Remove cart entry group from the cart taking the set of entry group number from the order entries that needs to be removed and looking up for their parent groups.
      Specified by:
      removeEntryGroupsFromCart in interface TravelCommerceCartService
      Parameters:
      sessionCart - the session cart
      entryGroupNumbers - the entry group numbers
    • removeCartEntryGroupNumbers

      protected void removeCartEntryGroupNumbers(CartModel sessionCart, Set<Integer> entryGroupNumbers)
      Remove cart entry group from the cart taking the set of entry group number from the order entries that needs to be removed and looking up for their parent groups.
      Parameters:
      sessionCart - the session cart
      entryGroupNumbers - the entry group numbers
    • removeCartEntriesForODRefNumber

      public void removeCartEntriesForODRefNumber(Integer odRefNum, CartModel cartModel)
      Description copied from interface: TravelCommerceCartService
      Removes all cart entries matching specified origin destination ref number and the related entry groups.
      Specified by:
      removeCartEntriesForODRefNumber in interface TravelCommerceCartService
      Parameters:
      odRefNum - origin destination ref number
      cartModel - cart model
    • setEntryAsCalculatedAndInitializePriceLevel

      public void setEntryAsCalculatedAndInitializePriceLevel(Integer entryNumberToUpdate) throws de.hybris.platform.commerceservices.order.CommerceCartModificationException
      Description copied from interface: TravelCommerceCartService
      Set cart entry as calculated and initialize price level to null.
      Specified by:
      setEntryAsCalculatedAndInitializePriceLevel in interface TravelCommerceCartService
      Parameters:
      entryNumberToUpdate - the entry number to update
      Throws:
      de.hybris.platform.commerceservices.order.CommerceCartModificationException
    • addAutoPickProductsToCart

      public List<CommerceCartModification> addAutoPickProductsToCart(ProductModel productModel, String bundleTemplateId, int bundleEntryGroupNo) throws de.hybris.platform.commerceservices.order.CommerceCartModificationException
      Description copied from interface: TravelCommerceCartService
      Add auto picks products to cart using hybris 6.4 bundle APIs
      Specified by:
      addAutoPickProductsToCart in interface TravelCommerceCartService
      Parameters:
      productModel - the product
      bundleTemplateId - the bundle template id
      bundleEntryGroupNo - the bundle entry group number
      Returns:
      a list of commerce cart modification
      Throws:
      de.hybris.platform.commerceservices.order.CommerceCartModificationException
    • addPerLegBundleProductToCart

      public List<CommerceCartModification> addPerLegBundleProductToCart(String bundleTemplateId) throws de.hybris.platform.commerceservices.order.CommerceCartModificationException
      Description copied from interface: TravelCommerceCartService
      Add per leg products to cart using Hybris 6.4 bundle APIs
      Specified by:
      addPerLegBundleProductToCart in interface TravelCommerceCartService
      Parameters:
      bundleTemplateId - the bundle template id
      Returns:
      a list of commerce cart modification
      Throws:
      de.hybris.platform.commerceservices.order.CommerceCartModificationException
    • addAutopickPerLegProducts

      protected void addAutopickPerLegProducts(List<TransportOfferingModel> transportOfferingModels, TravelRouteModel travelRouteModel, List<CommerceCartModification> modificationList, BundleTemplateModel childTemplate, ProductModel autoPickProduct) throws de.hybris.platform.commerceservices.order.CommerceCartModificationException
      Add autopick per leg products.
      Parameters:
      transportOfferingModels - the transport offering models
      travelRouteModel - the travel route model
      modificationList - the modification list
      childTemplate - the child template
      autoPickProduct - the auto pick product
      Throws:
      de.hybris.platform.commerceservices.order.CommerceCartModificationException - the commerce cart modification exception
    • removeTravelOrderEntries

      protected void removeTravelOrderEntries(List<AbstractOrderEntryModel> abstractOrderEntries)
      Removes the given list of AbstractOrderEntryModel and their TravelOrderEntryInfoModel.
      Parameters:
      abstractOrderEntries - the list of abstract order entry models
    • removeTravellers

      protected void removeTravellers(AbstractOrderModel abstractOrderModel)
      Removes the list of TravellerModel and TravellerInfoModel linked to the given AbstractOrderModel.
      Parameters:
      abstractOrderModel - the abstract order model
    • removeFeeOrderEntries

      protected void removeFeeOrderEntries(AbstractOrderModel abstractOrderModel)
      Removes the list of AbstractOrderEntryModel that corresponds to a product of ProductType FEE.
      Parameters:
      abstractOrderModel - the abstract order model
    • getTravellerService

      protected TravellerService getTravellerService()
      Gets traveller service.
      Returns:
      TravellerService traveller service
    • setTravellerService

      public void setTravellerService(TravellerService travellerService)
      Sets traveller service.
      Parameters:
      travellerService - the traveller service
    • getTransportOfferingService

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

      public void setTransportOfferingService(TransportOfferingService transportOfferingService)
      Sets transport offering service.
      Parameters:
      transportOfferingService - the transport offering service
    • getCartService

      protected de.hybris.platform.order.CartService getCartService()
      Gets cart service.
      Returns:
      the cartService
    • setCartService

      public void setCartService(de.hybris.platform.order.CartService cartService)
      Sets cart service.
      Parameters:
      cartService - the cartService to set
    • getOfferGroupToOriginDestinationMapping

      protected Map<String,String> getOfferGroupToOriginDestinationMapping()
      Gets offer group to origin destination mapping.
      Returns:
      the offerGroupToOriginDestinationMapping
    • setOfferGroupToOriginDestinationMapping

      public void setOfferGroupToOriginDestinationMapping(Map<String,String> offerGroupToOriginDestinationMapping)
      Sets offer group to origin destination mapping.
      Parameters:
      offerGroupToOriginDestinationMapping - the offerGroupToOriginDestinationMapping to set
    • getSessionService

      public de.hybris.platform.servicelayer.session.SessionService getSessionService()
      Overrides:
      getSessionService in class de.hybris.platform.commerceservices.order.impl.DefaultCommerceCartService
      Returns:
      the sessionService
    • setSessionService

      public void setSessionService(de.hybris.platform.servicelayer.session.SessionService sessionService)
      Overrides:
      setSessionService in class de.hybris.platform.commerceservices.order.impl.DefaultCommerceCartService
      Parameters:
      sessionService - the sessionService to set
    • getTravelCommercePriceService

      protected TravelCommercePriceService getTravelCommercePriceService()
      Gets travel commerce price service.
      Returns:
      the travel commerce price service
    • setTravelCommercePriceService

      public void setTravelCommercePriceService(TravelCommercePriceService travelCommercePriceService)
      Sets travel commerce price service.
      Parameters:
      travelCommercePriceService - the travel commerce price 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
    • getBundleTemplateService

      protected de.hybris.platform.configurablebundleservices.bundle.BundleTemplateService getBundleTemplateService()
      Gets bundle template service.
      Returns:
      the bundle template service
    • setBundleTemplateService

      @Autowired public void setBundleTemplateService(de.hybris.platform.configurablebundleservices.bundle.BundleTemplateService bundleTemplateService)
      Sets bundle template service.
      Parameters:
      bundleTemplateService - the bundle template service
    • getTravelKeyGeneratorService

      protected TravelKeyGeneratorService getTravelKeyGeneratorService()
      Gets travel key generator service.
      Returns:
      the travelKeyGeneratorService
    • setTravelKeyGeneratorService

      public void setTravelKeyGeneratorService(TravelKeyGeneratorService travelKeyGeneratorService)
      Sets travel key generator service.
      Parameters:
      travelKeyGeneratorService - the travelKeyGeneratorService to set
    • getTravelCartService

      protected TravelCartService getTravelCartService()
      Gets travel cart service.
      Returns:
      the travel cart service
    • setTravelCartService

      public void setTravelCartService(TravelCartService travelCartService)
      Sets travel cart service.
      Parameters:
      travelCartService - the travel cart service