Class AbstractOrder

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable
    Direct Known Subclasses:
    GeneratedCart, GeneratedOrder, GeneratedQuote

    public abstract class AbstractOrder
    extends GeneratedAbstractOrder
    This is the general superclass of all order objects. An abstract order keeps all information which is necessary to describe a user - vendor - contract.

    Mainly an order consists of several entries which represents ordered products of a certain quantity and unit. Further it holds delivery, payment, discount and tax information.
    An order does not provide pricing information unless it was calculated explicitly via calculate(), calculate(Date), recalculate() or recalculate(Date). Once prices have been set you may also use calculateTotals(boolean) which does not fetch new prices, taxes or discounts but consolidates all totals according to price relevant changes of this order ( e.g. entry quantities, base prices etc. ). After calculation the order is marked as calculated. Please note that all values are fixed and do not change automatically upon changes in the price model ( via PriceFactory ). You have to recalculate the order to see these changes.

    Since prices, taxes and discounts are retrieved from the installed pricefactory refer to its documentation how to manage prices, taxes and discounts.
    Similar refer to the installed payment and delivery mode extension documentation for how to manager payment and delivery prices. the order calculation process fetches payment and delivery prices from them.

    If you like to bypass the pricefactory and implement you own logic within a special jalo order type you have to override findDeliveryCosts(), findGlobalDiscounts() and findPaymentCosts(). Further you have to provide a own jalo type for order entries which overrides AbstractOrderEntry.findPrice(), AbstractOrderEntry.findTaxes() and AbstractOrderEntry.findDiscounts().

    See Also:
    Serialized Form
    • Constructor Detail

      • AbstractOrder

        public AbstractOrder()
    • Method Detail

      • createItem

        protected Item createItem​(SessionContext ctx,
                                  ComposedType type,
                                  Item.ItemAttributeMap allAttributes)
                           throws JaloBusinessException
        Description copied from class: Item
        Has to be implemented for each concrete subtype of item. This method is responsible for creating a new item instance ( by calling managers, ejb homes, etc. ) during ComposedType.newInstance(Map).

        In case this method uses any of the attribute values during creation it is required to override Item.getNonInitialAttributes(SessionContext, ItemAttributeMap) too.
        Sn example:

        
         public static final String MY_ATTRIBUTE = "someAttribute"; ... protected Item createItem(SessionContext
         ctx, ComposedType type, Map allAttributes ) throws JaloBusinessException { MyManager man = ... return
         man.createMyItem( (String)allAttributes.get(MY_ATTRIBUTE) );
         // here MY_ATTRIBUTE is used for creation, so it must not be set again } protected Map getNonInitialAttributes(
         SessionContext ctx, Map allAttributes ) { // let superclass remove its own initial attributes Map ret =
         super.getNonInitialAttributes( ctx, allAttributes );
         // remove MY_ATTRIBUTE from all attributes since if has already been set ret.remove(MY_ATTRIBUTE); return ret; }
        
         
        Overrides:
        createItem in class GenericItem
        Parameters:
        ctx - the current session context which this item is created within
        type - the actual item type ( since subtypes may not provide a own jalo class this may be different from the type which this method was implemented for )
        Returns:
        the new item instance
        Throws:
        JaloBusinessException - indicates an error during creation - any changes will be rollbacked
      • getAbstractOrderEntryTypeCode

        protected abstract java.lang.String getAbstractOrderEntryTypeCode()
      • getAllEntries

        @Deprecated
        public java.util.List getAllEntries()
        Deprecated.
        All order positions. These are ordered product quantities, described by a number and a unit.
      • setAllEntries

        protected void setAllEntries​(SessionContext ctx,
                                     java.util.List value)
      • getEntry

        @Deprecated
        public AbstractOrderEntry getEntry​(int index)
                                    throws JaloItemNotFoundException
        Deprecated.
        since ages - Use OrderService.getEntryForNumber(de.hybris.platform.core.model.order.AbstractOrderModel, int) instead.
        Returns the order entry at a specified position.
        Parameters:
        index -
        Throws:
        JaloItemNotFoundException
      • getEntries

        public java.util.Collection getEntries​(int startIdx,
                                               int endIdx)
      • getEntriesByProduct

        public java.util.List getEntriesByProduct​(Product product)
        Returns all entries which belong to a specified product.
        Parameters:
        product -
      • createNewEntryNumber

        protected int createNewEntryNumber​(int requested)
      • shuffleEntriesOnInsertNew

        protected void shuffleEntriesOnInsertNew​(java.util.List<AbstractOrderEntry> all,
                                                 int newEntryNumber)
      • getNewEntryNumberForAppending

        protected int getNewEntryNumberForAppending​(java.util.List<AbstractOrderEntry> all)
      • addNewEntry

        @Deprecated
        public AbstractOrderEntry addNewEntry​(Product prod,
                                              long qtd,
                                              Unit unit)
        Deprecated.
        since 4.3, please use suitable OrderService.addNewEntry() method
        Adds a new entry to this order. A new entry is created for this reason. You can create multiple entries whith the same product: there is no automatic summing-up of similar entries.
        Parameters:
        prod - - must not be null
        qtd -
        unit - - must not be null
        Throws:
        java.lang.IllegalArgumentException - if eighter given Product or Unit was null
      • addNewEntry

        @Deprecated
        public AbstractOrderEntry addNewEntry​(Product prod,
                                              long qtd,
                                              Unit unit,
                                              boolean addToPresent)
        Deprecated.
        since 4.3, please use suitable OrderService.addNewEntry() method
        Adds a new entry to this order. A new entry is created for this reason. You can create multiple entries whith the same product: there is no automatic summing-up of similar entries.
        Parameters:
        prod - - must not be null
        qtd -
        unit - - must not be null
        addToPresent - if true an existing entry with matching product and unit will get its quantity increased; otherwise a new entry is created
        Throws:
        java.lang.IllegalArgumentException - if eighter given Product or Unit was null
      • addNewEntry

        @Deprecated
        public AbstractOrderEntry addNewEntry​(Product prod,
                                              long qtd,
                                              Unit unit,
                                              int position,
                                              boolean addToPresent)
        Deprecated.
        since 4.3, please use suitable OrderService.addNewEntry() method
        Adds a new entry to this order. A new entry is created for this reason. You can create multiple entries whith the same product: there is no automatic summing-up of similar entries.
        Parameters:
        prod - - must not be null
        qtd -
        unit - - must not be null
        addToPresent - if true an existing entry with matching product and unit will get its quantity increased; otherwise a new entry is created
        Throws:
        java.lang.IllegalArgumentException - if eighter given Product or Unit was null
      • addNewEntry

        @Deprecated
        public AbstractOrderEntry addNewEntry​(ComposedType type,
                                              Product prod,
                                              long qtd,
                                              Unit unit,
                                              int position,
                                              boolean addToPresent)
        Deprecated.
        since 4.3, please use suitable OrderService.addNewEntry() method
        Adds a new entry to this order. A new entry is created for this reason. You can create multiple entries whith the same product: there is no automatic summing-up of similar entries.
        Parameters:
        type - the item type of the new entry (note that the type is not changed if a existing entry is just increased!)
        prod - - must not be null
        qtd -
        unit - - must not be null
        addToPresent - if true an existing entry with matching product and unit will get its quantity increased; otherwise a new entry is created
        Throws:
        java.lang.IllegalArgumentException - if eighter given Product or Unit was null
      • getCustomEntryType

        protected ComposedType getCustomEntryType()
        when overriding abstract order type this defines the corresponding entry type
        Returns:
        null as default; subtypes may return their corresponding entry type
      • setComposedType

        public Item setComposedType​(ComposedType type)
                             throws JaloInvalidParameterException
        Changes this order's composed type and the composed type of its entries provided that getCustomEntryType() returns a valid entry class.
        Overrides:
        setComposedType in class Item
        Parameters:
        type - the new type of the item
        Returns:
        the new version of this item - the new type may require a new jalo class type !!!
        Throws:
        JaloInvalidParameterException - in case the new type is not compatible with the current type. this happens a) if the type is abstract, b) the new type's class is not compatible with the current class, or c) if the new type has a different deployment (JNDI name, Table) than the current one
      • createEntryInformation

        @Deprecated
        protected java.lang.String createEntryInformation​(AbstractOrderEntry newEntry)
        Deprecated.
        since 4.3 order entry info is set in prepare interceptor.
        Creates the info field text for a newly create entry of this order. This method could be overwritten in subtypes of AbstractOrder but it isnt useful anymore. With an entry in file local.properties (or project.properties) you can define the text and attributes for each itemtype individually.

        The entry in the property file is like orderentry.infofield.your_type = your pattern with this ${attribute_of_your_type}

        samples:
        orderentry.infofield.product = product "${code}" with name "${name}" generates in the info field the entry product "P000010" with name "bett"

        orderentry.infofield.shirt = product ${code} in color ${color} and size ${size.code} generates in the info field the entry product P000123 in color green and size m

        For MyProduct, which is a subtyp from Product, the same pattern as product is used, not the pattern for shirt.

        rules:
        - orderentry.infofield.xxxxxx <- all in lower case !
        - if you want to use an attribute of a type where the type itself is an attribute of a type use all (path)attributes seperated with a dot (.). For example to use the unit iso code in MyVariantTyp use ${myVariantUnitAttributeName.unit.code}


        If no pattern is defined, the product code is used in info field. Alternatively, override this method.
        Parameters:
        newEntry - the newly created (and added) entry of this order
        Returns:
        the text for the AbstractOrderEntry.info field
      • removeEntry

        @Deprecated
        public void removeEntry​(AbstractOrderEntry entry)
        Deprecated.
        since ages - Use ModelService.remove() instead. All the remove logic is handled by dedicated RemoveInterceptors.
        Removes an entry from this order. Since entries can per definition not exists without a containing order the entry object is permanently deleted, so be careful.
        Parameters:
        entry -
      • removeEntries

        @Deprecated
        protected void removeEntries​(SessionContext ctx,
                                     java.util.Set<AbstractOrderEntry> entries)
        Deprecated.
        since ages - Use ModelService.remove() instead. All the remove logic is handled by dedicated RemoveInterceptors.
      • removeAllEntries

        @Deprecated
        public void removeAllEntries()
        Deprecated.
        since ages - Use ModelService.remove() instead. All the remove logic is handled by dedicated RemoveInterceptors.
        Removes all entries from this order. Since entries can per definition not exists without a containing order they are permanently deleted. Please use this method with care.
      • setCode

        public void setCode​(java.lang.String code)
        Sets the order code. Used for easier picking of orders without dealing with pk's. Besides code has no special meaning so you can map any information in it.
        Overrides:
        setCode in class GeneratedAbstractOrder
        Parameters:
        code -
      • setCode

        public void setCode​(SessionContext ctx,
                            java.lang.String code)
        Sets the order code. Used for easier picking of orders without dealing with pk's. Besides code has no special meaning so you can map any information in it.
        Overrides:
        setCode in class GeneratedAbstractOrder
        Parameters:
        ctx - can be used for cached access of 'code' value may be outdated!
        code -
      • setDate

        public void setDate​(java.util.Date date)
        Changes creation date of an order. This has no immediate affects on this orders informations, though a re-calculation might give varying prices, so use with care.
        Overrides:
        setDate in class GeneratedAbstractOrder
        Parameters:
        date -
      • getDate

        public java.util.Date getDate​(SessionContext ctx)
        The creation date of an order.
        Overrides:
        getDate in class GeneratedAbstractOrder
        Parameters:
        ctx - can be used for cached access of 'date' value may be outdated!
        Returns:
        the date
      • setDate

        public void setDate​(SessionContext ctx,
                            java.util.Date date)
        Changes creation date of an order. This has no immediate affects on this orders informations, though a re-calculation might give varying prices, so use with care.
        Overrides:
        setDate in class GeneratedAbstractOrder
        Parameters:
        ctx - can be used for cached access of 'date' value may be outdated!
        date -
      • setUser

        public void setUser​(User user)
        Changes the user which this order belongs to. Please note that this results in a uncalculated order since pricing informations are user - specific and therefore not convertible.
        Overrides:
        setUser in class GeneratedAbstractOrder
        Parameters:
        user -
      • setUser

        public void setUser​(SessionContext ctx,
                            User user)
        Changes the user which this order belongs to. Please note that this results in a uncalculated order since pricing informations are user - specific and therefore not convertible.
        Overrides:
        setUser in class GeneratedAbstractOrder
        Parameters:
        ctx - can be used for cached access of the user object object may be outdated!
        user -
      • setCurrency

        public void setCurrency​(Currency curr)
        Changes the currency for all pricing informations of this order. Please not that this result in a uncalculated order since prices are currency - dependant and therefore not convertible.
        Overrides:
        setCurrency in class GeneratedAbstractOrder
        Parameters:
        curr -
      • setCurrency

        public void setCurrency​(SessionContext ctx,
                                Currency curr)
        Changes the currency for all pricing informations of this order. Please not that this result in a uncalculated order since prices are currency - dependant and therefore not convertible.
        Overrides:
        setCurrency in class GeneratedAbstractOrder
        Parameters:
        ctx - can be used for cached access of the currency object object may be outdated!
        curr -
      • setStatus

        public void setStatus​(EnumerationValue status)
        Changes the order status. Since status has no deeper meaning (from core view) the order remains unchanged.
        Overrides:
        setStatus in class GeneratedAbstractOrder
        Parameters:
        status - the status of this order.
      • setStatus

        public void setStatus​(SessionContext ctx,
                              EnumerationValue status)
        Changes the order status. Since status has no deeper meaning (from core view) the order remains unchanged.
        Overrides:
        setStatus in class GeneratedAbstractOrder
        Parameters:
        ctx - can be used for cached access of status value may be outdated!
        status - the status of this order
      • isNet

        public java.lang.Boolean isNet()
        The gross / net status of this order. An order has generally to be seen as 'gross' or 'net'. All calculated prices depend on base prices which are either gross or net (including rounding if prices must be computed to fut gross - net status ).
        Overrides:
        isNet in class GeneratedAbstractOrder
        Returns:
        the net
      • setNet

        public void setNet​(boolean net)
        Changes the gross / net status of this order. Please note that this result in an uncalculated order, since prices also depend on gross / net status. This is because of the fact that prices may be just kept in one form (e.g. 'net') and must be converted (and of course rounded to the currencies correct digits) if the other one is requested (e.g. 'gross').
        Overrides:
        setNet in class GeneratedAbstractOrder
        Parameters:
        net -
      • setNet

        public void setNet​(SessionContext ctx,
                           boolean net)
        Changes the gross / net status of this order. Please note that this result in an uncalculated order, since prices also depend on gross / net status. This is because of the fact that prices may be just kept in one form (e.g. 'net') and muste be converted (and of course rounded to the currencies correct digits) if the other one is requested (e.g. 'gross').
        Overrides:
        setNet in class GeneratedAbstractOrder
        Parameters:
        ctx - can be used for cached access of net status value may be outdated!
        net -
      • setDeliveryMode

        public void setDeliveryMode​(DeliveryMode mode)
        Changes the chosen delivery mode for this order. Please note that this un-calculates this order, though all entries keep their calculation status.
        Overrides:
        setDeliveryMode in class GeneratedAbstractOrder
        Parameters:
        mode -
      • setDeliveryMode

        public void setDeliveryMode​(SessionContext ctx,
                                    DeliveryMode mode)
        Changes the chosen delivery mode for this order. Please note that this un-calculates this order, though all entries keep their calculation status.
        Overrides:
        setDeliveryMode in class GeneratedAbstractOrder
        Parameters:
        ctx - can be used for cached access of delivery mode object object may be outdated!
        mode -
      • setDeliveryAddress

        public void setDeliveryAddress​(Address address)
        Changes the delivery address. This does not cause any other changes in the order.
        Overrides:
        setDeliveryAddress in class GeneratedAbstractOrder
        Parameters:
        address -
      • createNewDeliveryAddress

        public Address createNewDeliveryAddress()
        creates a new address which is set as this orders delivery address.
      • createNewDeliveryAddress

        public Address createNewDeliveryAddress​(SessionContext ctx)
        creates a new address which is set as this orders delivery address.
      • setDeliveryAddress

        public void setDeliveryAddress​(SessionContext ctx,
                                       Address address)
        Changes the delivery address. This does not cause any other changes in the order.
        Overrides:
        setDeliveryAddress in class GeneratedAbstractOrder
        Parameters:
        ctx - can be used for cached access of address object object may be outdated!
        address -
      • doSetDeliveryAddress

        protected void doSetDeliveryAddress​(SessionContext ctx,
                                            Address newOne)
        Performs changing of delivery address. In case the current address is a duplicate it will be removed.
      • getDeliveryCosts

        public double getDeliveryCosts()
        The calculated delivery costs of this order. Only valid if isCalculated() returns true and/or it was set by your own using the method setDeliveryCosts(double).
      • setDeliveryCosts

        public void setDeliveryCosts​(double deliveryCost)
        Sets The calculated delivery costs of this order.
        Parameters:
        deliveryCost -
      • setPaymentMode

        public void setPaymentMode​(PaymentMode mode)
        Changes the payment mode of this order. Please note that this results in an uncalculated order, though all entries keep their calculation status.
        Overrides:
        setPaymentMode in class GeneratedAbstractOrder
        Parameters:
        mode -
      • setPaymentMode

        public void setPaymentMode​(SessionContext ctx,
                                   PaymentMode mode)
        Changes the payment mode of this order. Please note that this results in an uncalculated order, though all entries keep their calculation status.
        Overrides:
        setPaymentMode in class GeneratedAbstractOrder
        Parameters:
        ctx - can be used for cached access object may be outdated!
        mode -
      • setPaymentAddress

        public void setPaymentAddress​(Address adr)
        Changes the payment address of this order. This does not cause any other changes in the order.
        Overrides:
        setPaymentAddress in class GeneratedAbstractOrder
        Parameters:
        adr -
      • createNewPaymentAddress

        public Address createNewPaymentAddress()
        creates a new address which is set as this orders payment address.
      • createNewPaymentAddress

        public Address createNewPaymentAddress​(SessionContext ctx)
        creates a new address which is set as this orders payment address.
      • setPaymentAddress

        public void setPaymentAddress​(SessionContext ctx,
                                      Address adr)
        Changes the payment address of this order. This does not cause any other changes in the order.
        Overrides:
        setPaymentAddress in class GeneratedAbstractOrder
        Parameters:
        ctx - can be used for cached access object may be outdated!
        adr -
      • doSetPaymentAddress

        protected void doSetPaymentAddress​(SessionContext ctx,
                                           Address newOne)
        Performs changing of payment address. In case the current address is a duplicate it will be removed.
      • getPaymentCosts

        public double getPaymentCosts()
        The calculated costs according to the chosen payment mode.
      • setPaymentCosts

        public void setPaymentCosts​(double paymentCost)
        Sets the costs of the chosen payment mode.
        Parameters:
        paymentCost -
      • addAllTotalTaxValues

        @Deprecated
        public void addAllTotalTaxValues​(java.util.Collection values)
        Deprecated.
        since ages - Use OrderService.addAllTotalTaxValues(de.hybris.platform.core.model.order.AbstractOrderModel, List) instead.
        Adds a collection of tax values into this order. please note that this field is overwritten each time calculate(), calculate(Date), recalculate(), recalculate(Date) or calculateTotals(boolean) is called.
        Parameters:
        values -
      • removeTotalTaxValue

        @Deprecated
        public void removeTotalTaxValue​(TaxValue taxValue)
        Deprecated.
        since ages - Use OrderService.removeTotalTaxValue(de.hybris.platform.core.model.order.AbstractOrderModel, TaxValue) instead.
        Removes a tax value of this order. please note that this field is overwritten each time calculate(), calculate(Date), recalculate(), recalculate(Date) or calculateTotals(boolean) is called.
        Parameters:
        taxValue -
      • removeAllTotalTaxValues

        @Deprecated
        public void removeAllTotalTaxValues()
        Deprecated.
        since ages - Use model setter AbstractOrderModel.setTotalTaxValues(Collection) and ModelService.save() method instead.
        Removes all tax values of this order. please note that this field is overwritten each time calculate() , calculate(Date), recalculate(), recalculate(Date) or calculateTotals(boolean) is called.
      • getTotalTaxValues

        @Deprecated
        public java.util.Collection getTotalTaxValues()
        Deprecated.
        since ages - Use model getter AbstractOrderModel.getTotalTaxValues() instead.
        Returns all tax values ( see TaxValue) of this order. These values represent the grouped taxes of all entries.
      • getTotalTaxValues

        @Deprecated
        public java.util.Collection getTotalTaxValues​(SessionContext ctx)
        Deprecated.
        since ages - Use model getter AbstractOrderModel.getTotalTaxValues() instead.
        Returns all tax values ( see TaxValue) of this order. These values represent the grouped taxes of all entries.
      • addAllTotalTaxValues

        @Deprecated
        public void addAllTotalTaxValues​(SessionContext ctx,
                                         java.util.Collection values)
        Deprecated.
        since ages - Use OrderService.addAllTotalTaxValues(de.hybris.platform.core.model.order.AbstractOrderModel, List) instead.
        Adds a collection of tax values into this order. please note that this field is overwritten each time calculate(), calculate(Date), recalculate(), recalculate(Date) or calculateTotals(boolean) is called.
        Parameters:
        values -
      • setTotalTaxValues

        @Deprecated
        public void setTotalTaxValues​(java.util.Collection totalTaxValues)
        Deprecated.
        since ages - Use model setter AbstractOrderModel.setTotalTaxValues(Collection) and ModelService.save() method instead.
      • setTotalTaxValues

        @Deprecated
        public void setTotalTaxValues​(SessionContext ctx,
                                      java.util.Collection totalTaxValues)
        Deprecated.
        since ages - Use model setter AbstractOrderModel.setTotalTaxValues(Collection) and ModelService.save() method instead.
      • addGlobalDiscountValue

        @Deprecated
        public void addGlobalDiscountValue​(DiscountValue discountValue)
        Deprecated.
        since ages - Use OrderService.addGlobalDiscountValue(de.hybris.platform.core.model.order.AbstractOrderModel, DiscountValue) instead.
        Adds a global discount value into this order.
        Parameters:
        discountValue -
      • addAllGlobalDiscountValues

        @Deprecated
        public void addAllGlobalDiscountValues​(java.util.Collection values)
        Deprecated.
        since ages - Use OrderService.addAllGlobalDiscountValues(de.hybris.platform.core.model.order.AbstractOrderModel, List) instead.
        Adds a collection of global discount values into this order.
        Parameters:
        values -
      • removeGlobalDiscountValue

        @Deprecated
        public void removeGlobalDiscountValue​(DiscountValue discountValue)
        Deprecated.
        since ages - Use OrderService.removeGlobalDiscountValue(de.hybris.platform.core.model.order.AbstractOrderModel, DiscountValue) instead.
        Removes a global discount value of this order.
        Parameters:
        discountValue -
      • removeAllGlobalDiscountValues

        @Deprecated
        public void removeAllGlobalDiscountValues()
        Deprecated.
        since ages - Use model setter AbstractOrderModel.setGlobalDiscountValues(List) and ModelService.save() method instead.
        Removes all global discount values of this order.
      • getGlobalDiscountValues

        @Deprecated
        public java.util.List getGlobalDiscountValues()
        Deprecated.
        since ages - Use model getter AbstractOrderModel.getGlobalDiscountValues() instead.
        Returns a list of all global discount values (this are discount which are applied to on order level instead of entry level). Since this might include absolute discounts the order is important, so we chose a List.
      • getGlobalDiscountValues

        @Deprecated
        public java.util.List getGlobalDiscountValues​(SessionContext ctx)
        Deprecated.
        since ages - Use model getter AbstractOrderModel.getGlobalDiscountValues() instead.
        Returns a list of all global discount values (this are discount which are applied to on order level instead of entry level). Since this might include absolute discounts the order is important, so we chose a List.
      • addGlobalDiscountValue

        @Deprecated
        public void addGlobalDiscountValue​(SessionContext ctx,
                                           DiscountValue discountValue)
        Deprecated.
        since ages - Use OrderService.addGlobalDiscountValue(de.hybris.platform.core.model.order.AbstractOrderModel, DiscountValue) instead.
        Adds a global discount value to this order.
        Parameters:
        discountValue -
      • addAllGlobalDiscountValues

        @Deprecated
        public void addAllGlobalDiscountValues​(SessionContext ctx,
                                               java.util.Collection values)
        Deprecated.
        since ages - Use OrderService.addAllGlobalDiscountValues(de.hybris.platform.core.model.order.AbstractOrderModel, List) instead.
        Adds a collection of global discount values into this order.
        Parameters:
        values -
      • removeGlobalDiscountValue

        @Deprecated
        public void removeGlobalDiscountValue​(SessionContext ctx,
                                              DiscountValue discountValue)
        Deprecated.
        since ages - Use OrderService.removeGlobalDiscountValue(de.hybris.platform.core.model.order.AbstractOrderModel, DiscountValue) instead.
        Removes a global discount value of this order.
        Parameters:
        discountValue -
      • removeAllGlobalDiscountValues

        @Deprecated
        public void removeAllGlobalDiscountValues​(SessionContext ctx)
        Deprecated.
        since ages - Use model setter AbstractOrderModel.setGlobalDiscountValues(List) and ModelService.save() method instead.
        Removes all global discount values of this order.
      • setGlobalDiscountValues

        @Deprecated
        public void setGlobalDiscountValues​(java.util.List globalDiscounts)
        Deprecated.
        since ages - Use model setter AbstractOrderModel.setGlobalDiscountValues(List) and ModelService.save() method instead.
      • setGlobalDiscountValues

        @Deprecated
        public void setGlobalDiscountValues​(SessionContext ctx,
                                            java.util.List globalDiscounts)
        Deprecated.
        since ages - Use model setter AbstractOrderModel.setGlobalDiscountValues(List) and ModelService.save() method instead.
      • discountsIncludePaymentCosts

        @Deprecated
        public boolean discountsIncludePaymentCosts()
        tells whether payment costs should be included in discount calculation or not. in other words: if this field is true payment costs are changed the same way as product costs if discount values are set at this order.
      • setDiscountsIncludePaymentCosts

        @Deprecated
        public void setDiscountsIncludePaymentCosts​(boolean includes)
        Deprecated.
        changes whether payment costs should be included in discount calculation or not. in other words: if this field is true payment costs are changed the same way as product costs if discount values are set at this order.
      • setDiscountsIncludePaymentCost

        public void setDiscountsIncludePaymentCost​(SessionContext ctx,
                                                   java.lang.Boolean value)
        Description copied from class: GeneratedAbstractOrder
        Generated method - Setter of the AbstractOrder.discountsIncludePaymentCost attribute.
        Overrides:
        setDiscountsIncludePaymentCost in class GeneratedAbstractOrder
        value - the discountsIncludePaymentCost - Tells whether payment costs should be included in discount calculation or not. If this field is true payment costs are changed the same way as product costs if discount values are set at this order.
      • discountsIncludeDeliveryCosts

        @Deprecated
        public boolean discountsIncludeDeliveryCosts()
        tells whether delivery costs should be included in discount calculation or not. in other words: if this field is true delivery costs are changed the same way as product costs if discount values are set at this order.
      • setDiscountsIncludeDeliveryCosts

        @Deprecated
        public void setDiscountsIncludeDeliveryCosts​(boolean includes)
        changes whether delivery costs should be included in discount calculation or not. in other words: if this field is true delivery costs are changed the same way as product costs if discount values are set at this order.
      • setDiscountsIncludeDeliveryCost

        public void setDiscountsIncludeDeliveryCost​(SessionContext ctx,
                                                    java.lang.Boolean value)
        Description copied from class: GeneratedAbstractOrder
        Generated method - Setter of the AbstractOrder.discountsIncludeDeliveryCost attribute.
        Overrides:
        setDiscountsIncludeDeliveryCost in class GeneratedAbstractOrder
        value - the discountsIncludeDeliveryCost - Tells whether delivery costs should be included in discount calculation or not. If this field is true delivery costs are changed the same way as product costs if discount values are set at this order.
      • calculateTotals

        @Deprecated
        public void calculateTotals​(boolean recalculate)
                             throws JaloPriceFactoryException
        Deprecated.
        since ages - Use CalculationService#calculateTotals(de.hybris.platform.core.model.order.AbstractOrderModel, boolean) instead
        (re)calculates all totals. this does not trigger price, tax and discount calculation but takes all currently set price, tax and discount values as base.
        Parameters:
        recalculate - forces setting total even if order is marked as calculated
        Throws:
        JaloPriceFactoryException
      • calculateTotals

        protected void calculateTotals​(boolean recalculate,
                                       java.util.Map<TaxValue,​java.util.Map<java.util.Set<TaxValue>,​java.lang.Double>> taxValueMap)
                                throws JaloPriceFactoryException
        calculates all totals. this does not trigger price, tax and discount calculation but takes all currently set price, tax and discount values as base. this method requires the correct subtotal to be set before and the correct tax value map.
        Parameters:
        recalculate - if false calculation is done only if the calculated flag is not set
        taxValueMap - the map { tax value -> Double( sum of all entry totals for this tax ) } obtainable via calculateSubtotal(boolean)
        Throws:
        JaloPriceFactoryException
      • getTotalDiscounts

        public java.lang.Double getTotalDiscounts()
        returns the sum of all discounts of this (calculated) order.
        Overrides:
        getTotalDiscounts in class GeneratedAbstractOrder
        Returns:
        the totalDiscounts
      • calculateSubtotal

        protected java.util.Map<TaxValue,​java.util.Map<java.util.Set<TaxValue>,​java.lang.Double>> calculateSubtotal​(boolean recalculate)
        Calculates this order's subtotal and returns a total tax value map.

        The map groups entry totals per applied tax values. This is necessary to support multiple (relative) taxes per entry:

        One example

                entry 1: base price = 10 EUR, tax values = [ VAT_FULL 19%, CUSTOM 2% ]
                entry 2: base price = 20 EUR, tax values = [ VAT_FULL 19% ]
                entry 3: base price = 30 EUR, tax values = [ VAT_HALF 7% ]
         ==>
            {
                        VAT_FULL 19% -> {
                                ( VAT_FULL 19% , CUSTOM 2% ) -> 10 EUR
                                ( VAT_FULL 19% ) -> 20 EUR
                }
                        VAT_HALF 7% -> {
                                ( VAT_HALF 7% ) -> 30 EUR
                }
                        CUSTOM 2% -> {
                                ( VAT_FULL 19% , CUSTOM 2% ) -> 10 EUR
                }
            }
         
        Parameters:
        recalculate -
        Returns:
        a map holding { TaxValue -> Double( sum of entries with this tax value ) }, means these are the total tax values mapped to the total price they apply to
      • addRelativeEntryTaxValue

        protected void addRelativeEntryTaxValue​(double entryTotal,
                                                TaxValue taxValue,
                                                java.util.Set<TaxValue> relativeEntryTaxValues,
                                                java.util.Map<TaxValue,​java.util.Map<java.util.Set<TaxValue>,​java.lang.Double>> taxValueMap)
      • addAbsoluteEntryTaxValue

        protected void addAbsoluteEntryTaxValue​(long entryQuantity,
                                                TaxValue taxValue,
                                                java.util.Map<TaxValue,​java.util.Map<java.util.Set<TaxValue>,​java.lang.Double>> taxValueMap)
      • calculateDiscountValues

        protected double calculateDiscountValues​(boolean recalculate)
        Returns the total discount for this abstract order.
        Parameters:
        recalculate - true forces a recalculation
        Returns:
        totalDiscounts
      • convertDiscountValues

        protected java.util.List convertDiscountValues​(java.util.List dvs)
      • calculateTotalTaxValues

        protected double calculateTotalTaxValues​(boolean recalculate,
                                                 int digits,
                                                 double taxAdjustmentFactor,
                                                 java.util.Map<TaxValue,​java.util.Map<java.util.Set<TaxValue>,​java.lang.Double>> taxValueMap)
        Parameters:
        recalculate -
        digits -
        taxAdjustmentFactor -
        taxValueMap -
        Returns:
        total taxes
      • calculateAbsoluteTotalTaxValue

        protected TaxValue calculateAbsoluteTotalTaxValue​(Currency curr,
                                                          java.lang.String currencyIso,
                                                          int digits,
                                                          boolean net,
                                                          TaxValue taxValue,
                                                          double cumulatedEntryQuantities)
      • calculate

        @Deprecated
        public void calculate()
                       throws JaloPriceFactoryException
        Deprecated.
        since ages - Use CalculationService.calculate(de.hybris.platform.core.model.order.AbstractOrderModel) instead.
        Calculates the whole order and all its entries unless they're already calculated and the order has not been modified.

        So this method will fetch prices, taxes and discounts for uncalculated or modified entries only - all other will remain unchanged. If at least one entry has been calculated or the order itself has been modified the totals will be calculated as well.

        if you merely like to adjust totals while keeping prices, taxes and discounts you should call calculateTotals(boolean) instead (e.g. if just a quantity has changed or prices have been imported and cannot be found via price factory ).

        Throws:
        JaloPriceFactoryException - if a pricefactory error occured
      • notifyDiscountsAboutCalculation

        protected void notifyDiscountsAboutCalculation()
      • notifyDiscountsAboutRemoval

        protected void notifyDiscountsAboutRemoval()
      • calculate

        @Deprecated
        public void calculate​(java.util.Date date)
                       throws JaloPriceFactoryException
        Deprecated.
        since ages - Use CalculationService#calculate(de.hybris.platform.core.model.order.AbstractOrderModel, Date)
        Calculates the whole order and all its entries unless they're already calculated and the order has not been modified.

        So this method will fetch prices, taxes and discounts for uncalculated or modified entries only - all other will remain unchanged. If at least one entry has been calculated or the order itself has been modified the totals will be calculated as well.

        if you merely like to adjust totals while keeping prices, taxes and discounts you should call calculateTotals(boolean) instead (e.g. if just a quantity has changed or prices have been imported and cannot be found via price factory ).

        Parameters:
        date - assumes a given date to perform calculations for - be careful with that since this method will calculate modified or uncalculated entries only, so the given date may not apply to all entries!
        Throws:
        JaloPriceFactoryException - if a pricefactory error occured
      • recalculate

        @Deprecated
        public void recalculate()
                         throws JaloPriceFactoryException
        Deprecated.
        since ages - Use CalculationService#recalculate(de.hybris.platform.core.model.order.AbstractOrderModel) instead.
        recalculates the whole order and all its entries. this includes finding prices, taxes, discounts, payment and delivery costs by calling the currently installed price factory.

        if you merely like to adjust totals while keeping prices, taxes and discounts you should call calculateTotals(boolean) instead (e.g. if just a quantity has changed or prices have been imported and cannot be found via price factory ).

        Throws:
        JaloPriceFactoryException - if a pricefactory error occured
      • recalculate

        @Deprecated
        public void recalculate​(java.util.Date date)
                         throws JaloPriceFactoryException
        Deprecated.
        since ages - Use CalculationService#recalculate(de.hybris.platform.core.model.order.AbstractOrderModel, java.util.Date) instead.
        recalculates the whole order and all its entries. this includes finding prices, taxes, discounts, payment and delivery costs by calling the currently installed price factory.

        if you merely like to adjust totals while keeping prices, taxes and discounts you should call calculateTotals(boolean) instead (e.g. if just a quantity has changed or prices have been imported and cannot be found via price factory ).

        Parameters:
        date - the date to calculate prices for
        Throws:
        JaloPriceFactoryException - if a pricefactory error occured
      • setChanged

        protected void setChanged​(boolean entriesToo)
      • remove

        public void remove​(SessionContext ctx)
                    throws ConsistencyCheckException
        Description copied from class: Item
        Removes this item.

        This method is using the following attributes of the given SessionContext:

        CacheUsage   Language   StagingMethod
        n/a (this is a setter method)   no, language doesn't matter for removal   yes if called on a StageableItem, no otherwise


        Overrides:
        remove in class Item
        Parameters:
        ctx - A SessionContext object
        Throws:
        ConsistencyCheckException - if this item could not be removed for some reason