Class OrderManager

  • All Implemented Interfaces:
    ItemLifecycleListener, java.io.Serializable

    public class OrderManager
    extends Manager
    The general manager class for the order package.

    Orders, taxes, discounts and PaymentInfos are managed here. Payment- and delivery modes have special manager which are accessible here.

    See Also:
    Serialized Form
    • Constructor Detail

      • OrderManager

        public OrderManager()
    • Method Detail

      • setOrderCodeGenerator

        public void setOrderCodeGenerator​(KeyGenerator orderCodeGenerator)
      • getCloneOrderStrategy

        @Deprecated
        protected CloneOrderStrategy<Order> getCloneOrderStrategy()
        Deprecated.
        since ages - Use spring injected de.hybris.platform.order.strategies.ordercloning.CloneOrderStrategy instead.
      • setCloneOrderStrategy

        @Deprecated
        public void setCloneOrderStrategy​(CloneOrderStrategy<Order> cloneOrderStrategy)
        Deprecated.
        since ages - Use spring injection to set de.hybris.platform.order.strategies.ordercloning.CloneOrderStrategy instead.
      • getCloneCartStrategy

        @Deprecated
        public CloneCartStrategy<Cart> getCloneCartStrategy()
        Deprecated.
        since ages - Use spring injected de.hybris.platform.order.strategies.ordercloning.CartCloningStrategy instead.
      • setCloneCartStrategy

        @Deprecated
        public void setCloneCartStrategy​(CloneCartStrategy<Cart> cloneCartStrategy)
        Deprecated.
        since ages - Use spring injection to set de.hybris.platform.order.strategies.ordercloning.CartCloningStrategy instead.
      • setDeliveryCostsStrategy

        public void setDeliveryCostsStrategy​(DeliveryCostsStrategy deliveryCostsStrategys)
      • getInstance

        public static OrderManager getInstance()
        Returns:
        instance of this manager
      • notifyItemRemoval

        protected void notifyItemRemoval​(SessionContext ctx,
                                         Item item)
        Avoids call to ejb layer except for PaymentMode and Currency instances.
        Overrides:
        notifyItemRemoval in class Manager
        Parameters:
        ctx - the currency session context
        item - the item which is going to be removed
        Since:
        2.10
      • getDefaultPriceFactory

        public AbstractPriceFactory getDefaultPriceFactory()
        Returns the default PriceFactory.
        Returns:
        the installed PriceFactory First the setting inside the project.properties (see entry 'default.pricefactory') will be consulted.. If this fails, an instance of de.hybris.platform.jalo.order.price.DummyPriceFactory will be returned.
        Since:
        3.00
      • getPriceFactory

        public PriceFactory getPriceFactory()
        Returns the configured PriceFactory.

        At first the session property 'pricefactory' will be evaluated. If its value is , the result of getDefaultPriceFactory() will be returned.

        Returns:
        the current PriceFactory
        Since:
        3.00
      • getPaymentInfoTypeCode

        @Deprecated
        protected java.lang.String getPaymentInfoTypeCode()
        Deprecated.
        since ages - Use PaymentInfoModel._TYPECODE instead.
      • getOrderEntryTypeCode

        @Deprecated
        public java.lang.String getOrderEntryTypeCode()
        Deprecated.
        since ages - Use OrderEntryModel._TYPECODE instead.
      • getOrderTypeCode

        @Deprecated
        protected java.lang.String getOrderTypeCode()
        Deprecated.
        since ages - Use OrderModel._TYPECODE instead.
      • getTaxTypeCode

        @Deprecated
        protected java.lang.String getTaxTypeCode()
        Deprecated.
        since ages - Use TaxModel._TYPECODE instead.
      • getDiscountTypeCode

        @Deprecated
        protected java.lang.String getDiscountTypeCode()
        Deprecated.
        since ages - Use DiscountModel._TYPECODE instead.
      • getDeliveryModeTypeCode

        @Deprecated
        protected java.lang.String getDeliveryModeTypeCode()
        Deprecated.
        since ages - Use DeliveryModeModel._TYPECODE instead.
      • getPaymentModeTypeCode

        @Deprecated
        protected java.lang.String getPaymentModeTypeCode()
        Deprecated.
        since ages - Use PaymentModeModel._TYPECODE instead.
      • getCartEntryTypeCode

        @Deprecated
        public java.lang.String getCartEntryTypeCode()
        Deprecated.
        since ages - Use CartEntryModel._TYPECODE instead.
      • getCartTypeCode

        @Deprecated
        protected java.lang.String getCartTypeCode()
        Deprecated.
        since ages - Use CartModel._TYPECODE instead.
      • getAllPaymentInfos

        @Deprecated
        public java.util.Collection getAllPaymentInfos()
        Deprecated.
        since ages - Obsolete get all method. Use flexible search to fetch desired payment infos.
        Returns all PaymentInfo objects.
        Returns:
        a Collection containing all PaymentInfos.
      • getPaymentInfos

        @Deprecated
        public java.util.Collection getPaymentInfos​(int type)
        Deprecated.
        since ages - Obsolete method. Use flexible search to fetch desired PaymentInfos.
        All PaymentInfos of the specified type. The types are defined in PaymentInfo.
        Parameters:
        type - the type of the searched PaymentInfos
        Returns:
        a Collection of all PaymentInfos of the specified type.
      • getPaymentInfosByUser

        @Deprecated
        public java.util.Collection getPaymentInfosByUser​(User user)
        Deprecated.
        since ages - Use UserModel.getPaymentInfos() instead.
        Returns all PaymentInfos of the specified User.
        Parameters:
        user - the User whoes PaymentInfos should be returned.
        Returns:
        a Collection of all PaymentInfos of the specified User
      • getPaymentInfoByCode

        @Deprecated
        public PaymentInfo getPaymentInfoByCode​(java.lang.String code)
                                         throws JaloItemNotFoundException
        Deprecated.
        since payment info object are not intended to have unique codes this method makes no sense at all; further payment infos should only be accessed via their users; use getPaymentInfosByCode(String) instead
        Finds a payment info object by its code.
        Parameters:
        code -
        Returns:
        the PaymentInfo with the given code
        Throws:
        JaloItemNotFoundException
      • getPaymentInfosByCode

        @Deprecated
        public java.util.Collection getPaymentInfosByCode​(java.lang.String code)
        Deprecated.
        since ages - Obsolete method. Since payment info object are not intended to have unique codes this method makes no sense at all; further PaymentInfos should only be accessed via their users.
        Returns all PaymentInfos object which match the given code ('%' as wildcard can be used).
        Parameters:
        code - the code
        Returns:
        a Collection of PaymentInfos
      • searchPaymentInfos

        protected java.util.Collection searchPaymentInfos​(User user,
                                                          java.lang.String code,
                                                          java.lang.Integer type)
      • getSupportedDeliveryModes

        @Deprecated
        public java.util.Collection getSupportedDeliveryModes​(PaymentMode pm)
        Deprecated.
        since ages - Use PaymentModeModel.getSupportedDeliveryModes() instead.
        Gets supported delivery modes for a given PaymentMode
        Parameters:
        pm -
        Returns:
        collection with supported DeliveryModes
      • getAllOrders

        public java.util.Collection getAllOrders()
        Returns all Orders.
        Returns:
        a Collection containing all Orders
      • getOrders

        @Deprecated
        public java.util.Collection getOrders​(User user)
        Deprecated.
        since ages - please useGeneratedUser.getOrders()
        Returns all orders of the specified User.
        Parameters:
        user -
        Returns:
        a Collection containing all Orders of the specified User
      • createOrder

        @Deprecated
        public Order createOrder​(User user,
                                 Currency currency,
                                 java.util.Date date,
                                 boolean net)
                          throws JaloInvalidParameterException
        Deprecated.
        since ages - use modelService and standard model setters
        Creates new order object for one user. The order code is generated automatically.
        Parameters:
        user -
        currency -
        date -
        net -
        Returns:
        the new Order
        Throws:
        JaloInvalidParameterException
      • createOrder

        @Deprecated
        public Order createOrder​(java.lang.String code,
                                 User user,
                                 Currency currency,
                                 java.util.Date date,
                                 boolean net)
                          throws JaloInvalidParameterException
        Deprecated.
        since ages - use modelService and standard model setters
        Creates new order object for one user.
        Parameters:
        code -
        user -
        currency -
        date -
        net -
        Returns:
        the new Order
        Throws:
        JaloInvalidParameterException
      • createOrder

        @Deprecated
        public Order createOrder​(PK pk,
                                 java.lang.String code,
                                 User user,
                                 Currency currency,
                                 java.util.Date date,
                                 boolean net)
                          throws JaloInvalidParameterException
        Deprecated.
        since ages - use modelService and standard model setters
        Creates new order object for one user.
        Parameters:
        pk - the pk for the new item; it will be equipped with type code additionally (-)
        code -
        user -
        currency -
        date -
        net -
        Returns:
        the new Order
        Throws:
        JaloInvalidParameterException
      • createOrder

        @Deprecated
        public Order createOrder​(ComposedType type,
                                 PK pkBase,
                                 java.lang.String code,
                                 User user,
                                 Currency currency,
                                 java.util.Date date,
                                 boolean net)
        Deprecated.
        since ages - use modelService and standard model setters
        Creates new order object for one user.
        Parameters:
        pkBase - the pk for the new item; it will be equipped with type code additionally (-)
        code -
        user -
        currency -
        date -
        net -
        Returns:
        the new Order
        Throws:
        JaloInvalidParameterException
      • createOrder

        @Deprecated
        public Order createOrder​(AbstractOrder original)
        Deprecated.
        since ages - use de.hybris.platform.order.OrderService.createOrder(ComposedTypeModel, ComposedTypeModel , AbstractOrderModel, String );
        Creates a new Order, which takes all informations and entries from an existing AbstractOrder. This includes user, currency and gross / net status. Please note that the order is not calculated , even if the cart has been.
        Parameters:
        original - the original order which will be copied
        Returns:
        the new Order
      • createOrder

        @Deprecated
        public Order createOrder​(ComposedType type,
                                 ComposedType entryType,
                                 AbstractOrder original)
        Deprecated.
        since ages - use de.hybris.platform.order.OrderService.createOrder(ComposedTypeModel, ComposedTypeModel , AbstractOrderModel, String );
        Creates a new Order, which takes all informations and entries from an existing AbstractOrder. This includes user, currency and gross / net status. Please note that the order is not calculated , even if the cart has been.
        Parameters:
        type - the item type of the new order
        entryType - the item type of the new order entries
        original - the original order which will be copied
        Returns:
        the new Order
      • createCart

        @Deprecated
        public Cart createCart​(AbstractOrder original,
                               java.lang.String newCode)
                        throws ConsistencyCheckException
        Deprecated.
        since ages - use de.hybris.platform.order.CartService.createCart(ComposedTypeModel, ComposedTypeModel , AbstractOrderModel, String );
        Creates a new Cart, which takes all informations and entries from an existing AbstractOrder. This includes user, currency, date and gross / net status. Please note that the order is not calculated , even if the cart has been.
        Parameters:
        original - the original order which will be copied
        newCode - the code of the new Cart
        Returns:
        the new Order
        Throws:
        ConsistencyCheckException
      • createCart

        @Deprecated
        public Cart createCart​(ComposedType type,
                               ComposedType entryType,
                               AbstractOrder original,
                               java.lang.String newCode)
                        throws ConsistencyCheckException
        Deprecated.
        since ages - use de.hybris.platform.order.CartService.createCart(ComposedTypeModel, ComposedTypeModel , AbstractOrderModel, String );
        Creates a new Cart, which takes all informations and entries from an existing AbstractOrder. This includes user, currency, date and gross / net status. Please note that the order is not calculated , even if the cart has been.
        Parameters:
        original - the original order which will be copied
        newCode - the code of the new Cart
        Returns:
        the new Order
        Throws:
        ConsistencyCheckException
      • searchAbstractOrders

        @Deprecated
        protected java.util.Collection searchAbstractOrders​(java.lang.String orderTypeCode,
                                                            SearchContext context)
        Deprecated.
        since ages - Obsolete way of dynamic searching within orders. Use FlexibleSearchService to query for orders.
        Parameters:
        orderTypeCode - the actual type code of orders to search
        context - the search context holding the parameters
        Returns:
        the found orders
        Since:
        2.10
      • searchTaxes

        @Deprecated
        public java.util.Collection searchTaxes​(SearchContext context)
        Deprecated.
        since ages - Obsolete way of dynamic searching within taxes. Use FlexibleSearchService to query for taxes.
        Searches all Tax with the specified SearchContext. See tax for definition of search properties.

        Null values are equivalent to omitting the field. This has the meaning that all objects will be found, if not constricted by other fields.

        Parameters:
        context - the search context containing all search parameters
        Returns:
        the collection of found tax object
      • searchDiscounts

        @Deprecated
        public java.util.Collection searchDiscounts​(SearchContext context)
        Deprecated.
        since ages - Obsolete way of dynamic searching within discounts. Use FlexibleSearchService to query for discounts.
        Searches all Discount with the specified SearchContext. See discount for definition of search properties.

        Null values are equivalent to omitting the field. This has the meaning that all objects will be found, if not constricted by other fields.

        Parameters:
        context - the search context containing all search parameters
        Returns:
        the collection of found tax object
      • getAllTaxes

        @Deprecated
        public java.util.Collection getAllTaxes()
        Deprecated.
        since ages - Obsolete get all method. Use FlexibleSearchService to query for taxes.
        Returns all >Tax objects.
        Returns:
        a Collection of all Tax/code>es
      • getTaxesByCode

        @Deprecated
        public java.util.Collection getTaxesByCode​(java.lang.String searchString)
        Deprecated.
        since ages - Use TaxService.getTaxesForCode(String) instead.
        Returns all Tax objects which matched the specified code.
        Parameters:
        searchString - an SQL-Like statement as String
        Returns:
        a Collection of all Tax/code>es which matched the specified code
      • getTaxByCode

        @Deprecated
        public Tax getTaxByCode​(java.lang.String code)
        Deprecated.
        since ages - Use TaxService.getTaxForCode(String) instead.
        Returns the Tax with the specified code.
        Parameters:
        code - the code
        Returns:
        a Tax with the specified code
      • createTax

        @Deprecated
        public Tax createTax​(java.lang.String code)
                      throws ConsistencyCheckException
        Deprecated.
        since ages - Use ModelService to create Taxes and standard setters to set attribute values.
        Creates a new Tax object.
        Parameters:
        code - the code of the new Tax
        Returns:
        the new Tax object
        Throws:
        ConsistencyCheckException - if the specified code is already in use.
      • createTaxValue

        @Deprecated
        public TaxValue createTaxValue​(java.lang.String code,
                                       double value,
                                       boolean absolute,
                                       Tax tax)
        Deprecated.
        since ages - just instantiateTaxValue directly
        Creates a new tax value object.
        Parameters:
        code -
        value -
        absolute -
        tax -
        Returns:
        the new TaxValue
      • createDiscountValue

        @Deprecated
        public DiscountValue createDiscountValue​(java.lang.String code,
                                                 java.lang.String description,
                                                 double value,
                                                 int priority,
                                                 boolean absolute,
                                                 Discount discount)
        Deprecated.
        since ages - just instantiateDiscountValue
        Creates a new discount value object.
        Parameters:
        code -
        description -
        value -
        priority -
        absolute -
        discount -
        Returns:
        the new DiscountValue object.
      • getAllDiscounts

        @Deprecated
        public java.util.Collection getAllDiscounts()
        Deprecated.
        since ages - Obsolete get all method. Use FlexibleSearchService to query for Discounts.
        Returns all discount objects.
        Returns:
        a Collection of all Discounts
      • getAllDiscounts

        @Deprecated
        public java.util.Collection getAllDiscounts​(boolean global)
        Deprecated.
        since ages - Obsolete get all method. Use FlexibleSearchService to query for Discounts.
        Returns all discount objects which global flag is set to the specified value.
        Parameters:
        global -
        Returns:
        all global discounts if global is true; all non-global discounts otherwise
      • getDiscountByCode

        @Deprecated
        public Discount getDiscountByCode​(java.lang.String code)
        Deprecated.
        since ages - Use DiscountService.getDiscountForCode(String).
        Finds a discount object by its code.
        Parameters:
        code -
        Returns:
        the Discount with the specified code
      • getDiscountsByCode

        @Deprecated
        public java.util.Collection getDiscountsByCode​(java.lang.String searchString)
        Deprecated.
        since ages - UseDiscountService.getDiscountsForCode(String).
        Finds multiple discount objects by their code.
        Parameters:
        searchString - SQL-LIKE statement as String ( %ab% , a_b% , ... )
        Returns:
        a Collection of Discount matching the specified code
      • createDiscount

        @Deprecated
        public Discount createDiscount​(java.lang.String code)
                                throws ConsistencyCheckException
        Deprecated.
        since ages - Use ModelService to create Discounts and standard setters to provide attribute values.
        Creates a new discout object.
        Parameters:
        code -
        Returns:
        the new Discount
        Throws:
        ConsistencyCheckException - if the code is already in use
      • getAllDeliveryModes

        @Deprecated
        public java.util.Collection getAllDeliveryModes()
        Deprecated.
        since ages - Use DeliveryModeService.getAllDeliveryModes() instead.
        Returns all Delivery objects
        Returns:
        a Collection of all Delivery objects
      • getDeliveryModeByCode

        @Deprecated
        public DeliveryMode getDeliveryModeByCode​(java.lang.String code)
                                           throws JaloItemNotFoundException
        Deprecated.
        since ages - Use DeliveryModeService.getDeliveryModeForCode(String) instead.
        Returns the DeliveryMode with the specified code.
        Parameters:
        code -
        Returns:
        the DeliveryMode with the specified code
        Throws:
        JaloItemNotFoundException - if no DeliveryMode with the specified code exists
      • getPaymentModeByCode

        @Deprecated
        public PaymentMode getPaymentModeByCode​(java.lang.String code)
                                         throws JaloItemNotFoundException
        Deprecated.
        since ages - Use PaymentModeService.getPaymentModeByCode(String) instead.
        Returns the PaymentMode with the specified code.
        Parameters:
        code -
        Returns:
        the PaymentMode with the specified code
        Throws:
        JaloItemNotFoundException - if no PaymentMode with the specified code exists
      • getAllPaymentModes

        @Deprecated
        public java.util.Collection getAllPaymentModes()
        Deprecated.
        since ages - Use PaymentModeService#getAllPaymentModes() instead.
        Returns all PaymentMode objects
        Returns:
        a Collection of all PaymentMode objects
      • appendToCart

        @Deprecated
        public void appendToCart​(Cart sourceCart,
                                 Cart targetCart)
        Deprecated.
        since ages - Use CartService.appendToCart(CartModel, CartModel) instead.
        Copies all entries of one cart to another cart.
        Parameters:
        sourceCart - the cart providing the entries to copy
        targetCart - the taret cart to create new entries for
      • getOrderStatusType

        @Deprecated
        public EnumerationType getOrderStatusType()
        Deprecated.
        since ages - Use OrderStatus.getType() instead.
        Gets the order status enumeration type.
        Returns:
        the order status enumeration type.
      • getPaymentStatusType

        @Deprecated
        public EnumerationType getPaymentStatusType()
        Deprecated.
        since ages - Use PaymentStatus.getType()
        Gets the payment status enumeration type.
        Returns:
        the payment status enumeration type.
      • getDeliveryStatusType

        @Deprecated
        public EnumerationType getDeliveryStatusType()
        Deprecated.
        since ages - Use DeliveryStatus.getType()
        Gets the delivery status enumeration type.
        Returns:
        the delivery status enumeration type.
      • getExportStatusType

        @Deprecated
        public EnumerationType getExportStatusType()
        Deprecated.
        since ages - Use ExportStatus.getType() instead.
        Gets the export status enumeration type.
        Returns:
        the export status enumeration type.
      • adjustOrderCode

        @Deprecated
        protected java.lang.String adjustOrderCode​(java.lang.String presetCode)
        Deprecated.
        since ages - Since 4.3 the following is done automatically by order's DefaultAbstractOrderPrepareInterceptor
      • writeReplace

        public java.lang.Object writeReplace()
                                      throws java.io.ObjectStreamException
        Specified by:
        writeReplace in class Manager
        Throws:
        java.io.ObjectStreamException