Class DefaultBolCartFacade

    • Constructor Detail

      • DefaultBolCartFacade

        public DefaultBolCartFacade()
    • Method Detail

      • getGenericFactory

        public GenericFactory getGenericFactory()
        Returns:
        the genericFactory
      • setGenericFactory

        public void setGenericFactory​(GenericFactory genericFactory)
        Parameters:
        genericFactory - the genericFactory to set
      • getCart

        public Basket getCart()
        Description copied from interface: BolCartFacade
        Return current cart from BOL.
        Specified by:
        getCart in interface BolCartFacade
        Returns:
        Current cart, might be null if not created yet.
      • hasCart

        public java.lang.Boolean hasCart()
        Description copied from interface: BolCartFacade
        Does a session cart exist? This cart is connected to a (non-persisted) order in the SAP back end.
        Specified by:
        hasCart in interface BolCartFacade
        Returns:
        Does a session cart exist?
      • getAllowedDeliveryTypes

        public java.util.Map<java.lang.String,​java.lang.String> getAllowedDeliveryTypes()
        Description copied from interface: BolCartFacade
        Fetches available delivery types from the cache. Cache is filled from the SAP back end customizing (ERP customizing table TVSB)
        Specified by:
        getAllowedDeliveryTypes in interface BolCartFacade
        Returns:
        Map of delivery types. Key is the shipping condition code, value the language dependent description
      • createCart

        public Basket createCart()
        Description copied from interface: BolCartFacade
        Creates a new session cart. This call creates a (non-persisted) order in the SAP back end. At this point in time, the sold-to party needs to be known.
        Specified by:
        createCart in interface BolCartFacade
        Returns:
        Newly created cart BO instance
      • placeOrderFromCart

        public Order placeOrderFromCart​(Basket cart)
        Description copied from interface: BolCartFacade
        Places an order based on a cart, and returns this order. At this point in time, the order is persisted in the SAP back end.
        Specified by:
        placeOrderFromCart in interface BolCartFacade
        Parameters:
        cart - SAP representation of a cart
        Returns:
        SAP representation of an order which has been submitted
      • getCartItem

        public Item getCartItem​(int itemNumber)
        Description copied from interface: BolCartFacade
        Fetches cart item per item number
        Specified by:
        getCartItem in interface BolCartFacade
        Parameters:
        itemNumber - Internal item number
        Returns:
        BOL representation of cart item
      • getCartItem

        protected Item getCartItem​(java.lang.String code)
        Fetches cart item per product id
        Parameters:
        code - Product ID
        Returns:
        BOL representation of cart item
      • getOrder

        public Order getOrder()
        Returns:
        The BOL representation of the order
      • getCartBE

        public BasketBackend getCartBE()
        Returns:
        The cart backend object which establishes the connection to the ERP system
      • getCartErrors

        protected MessageList getCartErrors()
        Filters the list of messages attached to the cart and just returns the error ones.
        Returns:
        Error messages related to the cart
      • updateCart

        public void updateCart()
        Description copied from interface: BolCartFacade
        Updates the session cart and re-reads it from the SAP back end.
        Specified by:
        updateCart in interface BolCartFacade
      • addToCart

        public Item addToCart​(java.lang.String code,
                              long quantity)
        Description copied from interface: BolCartFacade
        Adds a product to the cart
        Specified by:
        addToCart in interface BolCartFacade
        Parameters:
        code - Product ID to be added to the cart
        quantity - Quantity to be added to the cart
        Returns:
        BOL representation of new item
      • createNewItem

        protected Item createNewItem​(java.lang.String code,
                                     long quantity,
                                     java.lang.String handle)
        Creates a new BOL cart item from the attributes provided. Creates the cart if this has not happened yet.
        Parameters:
        code - Product code (SAP material number)
        quantity - Quantity
        handle - Handle to be set into new item. Can be provided as null, in this case a new handle will be created
        Returns:
        handle of newly created item
      • createNewItem

        protected Item createNewItem​(java.lang.String code,
                                     long quantity,
                                     java.lang.String handle,
                                     Basket currentCart)
        Creates a new BOL cart item from the attributes provided.
        Parameters:
        code - Product code (SAP material number)
        quantity - Quantity
        handle - Handle to be set into new item. Can be provided as null, in this case a new handle will be created
        currentCart - The BOL cart object the items will be attached to
        Returns:
        handle of newly created item
      • releaseCart

        public void releaseCart()
        Description copied from interface: BolCartFacade
        Releases the current session cart. A new, initial session cart will be created. An existing session in the SAP back end is released as well, therefore reservations are gone.
        Specified by:
        releaseCart in interface BolCartFacade
      • setSapPartnerService

        public void setSapPartnerService​(SapPartnerService sapPartnerService)
        Parameters:
        sapPartnerService - the sapPartnerService to set
      • validateCart

        public MessageList validateCart()
        Description copied from interface: BolCartFacade
        Validates the cart and compiles the list of cart error messages. Performs a back end call and touches all items to be sure all error situations are handled. Depending on the customizing in the back end, this can be avoided by either redefining this method or the corresponding one in SalesDocument
        Specified by:
        validateCart in interface BolCartFacade
        Returns:
        List of cart error messages arising from validation.
      • formatProductIdForBOL

        protected java.lang.String formatProductIdForBOL​(java.lang.String input)
        Formats product ID taken from hybris catalog and prepares it for sending to LO-API. Adds leading zeros.
        Parameters:
        input -
        Returns:
        Formatted product ID
      • addItemsToCart

        public void addItemsToCart​(java.util.List<Item> items)
        Description copied from interface: BolCartFacade
        Adds a list of items to the cart, keeping their handles
        Specified by:
        addItemsToCart in interface BolCartFacade
        Parameters:
        items - BOL items
      • addEntriesToCart

        public java.util.List<Item> addEntriesToCart​(java.util.List<Item> items)
        Description copied from interface: BolCartFacade
        Adds a list of items to the cart, keeping their handles
        Specified by:
        addEntriesToCart in interface BolCartFacade
        Parameters:
        items - BOL items item list
        Returns:
        list of items
      • isBackendDown

        public boolean isBackendDown()
        Specified by:
        isBackendDown in interface BolCartFacade
        Returns:
        Is back end not available for a planned downtime?