Class AbstractOrder

All Implemented Interfaces:
Serializable, 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:
  • Field Details

  • Constructor Details

    • AbstractOrder

      public AbstractOrder()
  • Method Details

    • 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 String getAbstractOrderEntryTypeCode()
    • getAllEntries

      @Deprecated(since="ages", forRemoval=false) public List getAllEntries()
      Deprecated.
      All order positions. These are ordered product quantities, described by a number and a unit.
    • getEntries

      public List<AbstractOrderEntry> getEntries()
      Description copied from class: GeneratedAbstractOrder
      Generated method - Getter of the AbstractOrder.entries attribute.
      Overrides:
      getEntries in class GeneratedAbstractOrder
      Returns:
      the entries
    • getEntries

      public List<AbstractOrderEntry> getEntries(SessionContext ctx)
      Description copied from class: GeneratedAbstractOrder
      Generated method - Getter of the AbstractOrder.entries attribute.
      Overrides:
      getEntries in class GeneratedAbstractOrder
      Returns:
      the entries
    • setAllEntries

      protected void setAllEntries(SessionContext ctx, List value)
    • getEntry

      @Deprecated(since="ages", forRemoval=false) 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 Collection getEntries(int startIdx, int endIdx)
    • getEntriesByProduct

      public 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(List<AbstractOrderEntry> all, int newEntryNumber)
    • getNewEntryNumberForAppending

      protected int getNewEntryNumberForAppending(List<AbstractOrderEntry> all)
    • getNextEntryNumber

      protected int getNextEntryNumber(AbstractOrderEntry forMe)
    • addNewEntry

      @Deprecated(since="4.3", forRemoval=false) 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:
      IllegalArgumentException - if eighter given Product or Unit was null
    • addNewEntry

      @Deprecated(since="4.3", forRemoval=false) 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:
      IllegalArgumentException - if eighter given Product or Unit was null
    • addNewEntry

      @Deprecated(since="4.3", forRemoval=false) 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:
      IllegalArgumentException - if eighter given Product or Unit was null
    • addNewEntry

      @Deprecated(since="4.3", forRemoval=false) 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:
      IllegalArgumentException - if eighter given Product or Unit was null
    • createNewEntry

      protected abstract AbstractOrderEntry createNewEntry(SessionContext ctx, ComposedType entryType, Product product, long quantity, Unit unit, int position)
    • 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(since="4.3", forRemoval=false) protected 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
    • getAttributeValue

      protected Object getAttributeValue(Item item, String qualifer) throws JaloSecurityException
      Throws:
      JaloSecurityException
    • tryToFindFallbackLanguage

      protected Language tryToFindFallbackLanguage(JaloSession js)
    • removeEntry

      @Deprecated(since="ages", forRemoval=false) 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(since="ages", forRemoval=false) protected void removeEntries(SessionContext ctx, Set<AbstractOrderEntry> entries)
      Deprecated.
      since ages - Use ModelService.remove() instead. All the remove logic is handled by dedicated RemoveInterceptors.
    • removeAllEntries

      @Deprecated(since="ages", forRemoval=false) 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(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, 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(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 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, 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
    • setPaymentStatus

      public void setPaymentStatus(EnumerationValue paymentStatus)
      Changes the payment order status.
      Overrides:
      setPaymentStatus in class GeneratedAbstractOrder
      Parameters:
      paymentStatus - the payment status of this order.
    • setPaymentStatus

      public void setPaymentStatus(SessionContext ctx, EnumerationValue paymentStatus)
      Changes the order payment status.
      Overrides:
      setPaymentStatus in class GeneratedAbstractOrder
      paymentStatus - the paymentStatus
    • setDeliveryStatus

      public void setDeliveryStatus(EnumerationValue deliveryStatus)
      Changes the order delivery status.
      Overrides:
      setDeliveryStatus in class GeneratedAbstractOrder
      Parameters:
      deliveryStatus - the delivery status of this order.
    • setDeliveryStatus

      public void setDeliveryStatus(SessionContext ctx, EnumerationValue deliveryStatus)
      Changes the order delivery status.
      Overrides:
      setDeliveryStatus in class GeneratedAbstractOrder
      deliveryStatus - the deliveryStatus
    • isNet

      public 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 -
    • getDeliveryCosts

      @Deprecated(since="ages", forRemoval=false) public double getDeliveryCosts(SessionContext ctx)
      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(SessionContext, double).
    • setDeliveryCosts

      @Deprecated(since="ages", forRemoval=false) public void setDeliveryCosts(SessionContext ctx, double deliveryCost)
      Deprecated.
      Sets The calculated delivery costs of this order.
      Parameters:
      ctx -
      deliveryCost -
    • setDeliveryCost

      public void setDeliveryCost(SessionContext ctx, Double value)
      Description copied from class: GeneratedAbstractOrder
      Generated method - Setter of the AbstractOrder.deliveryCost attribute.
      Overrides:
      setDeliveryCost in class GeneratedAbstractOrder
      value - the 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 -
    • getPaymentCosts

      @Deprecated(since="ages", forRemoval=false) public double getPaymentCosts(SessionContext ctx)
      Deprecated.
      The calculated costs according to the chosen payment mode.
    • setPaymentCosts

      @Deprecated(since="ages", forRemoval=false) public void setPaymentCosts(SessionContext ctx, double paymentCost)
      Sets the costs of the chosen payment mode.
      Parameters:
      ctx -
      paymentCost -
    • setPaymentCost

      public void setPaymentCost(SessionContext ctx, Double value)
      Description copied from class: GeneratedAbstractOrder
      Generated method - Setter of the AbstractOrder.paymentCost attribute.
      Overrides:
      setPaymentCost in class GeneratedAbstractOrder
      value - the paymentCost
    • getTotalTax

      public Double getTotalTax()
      The calculated total tax amount of this order. This is the sum of all taxes accessible via getTotalTaxValues().
      Overrides:
      getTotalTax in class GeneratedAbstractOrder
      Returns:
      the totalTax
    • getTotal

      @Deprecated(since="ages", forRemoval=false) public double getTotal()
      Deprecated.
      The calculated total price of this order. Depending on gross / net status this may include taxes or not.
    • setTotal

      public void setTotal(double total)
      Sets the calculated total price of this order. please note that this field is overwritten each time calculate() , calculate(Date), recalculate(), recalculate(Date) or calculateTotals(boolean) is called.
      Parameters:
      total -
    • getTotal

      @Deprecated(since="ages", forRemoval=false) public double getTotal(SessionContext ctx)
      The calculated total price of this order. Depending on gross / net status this may include taxes or not.
    • setTotal

      @Deprecated(since="ages", forRemoval=false) public void setTotal(SessionContext ctx, double price)
      Sets the calculated total price of this order. please note that this field is overwritten each time calculate(), calculate(Date), recalculate(), recalculate(Date) or calculateTotals(boolean) is called.
      Parameters:
      ctx -
      price -
    • addTotalTaxValue

      @Deprecated(since="ages", forRemoval=false) public void addTotalTaxValue(TaxValue taxValue)
      Deprecated.
      since ages - Use OrderService.addTotalTaxValue(de.hybris.platform.core.model.order.AbstractOrderModel, TaxValue) instead.
      Adds a tax value into this order. please note that this field is overwritten each time calculate(), calculate(Date), recalculate(), recalculate(Date) or calculateTotals(boolean) is called.
      Parameters:
      taxValue -
    • addAllTotalTaxValues

      @Deprecated(since="ages", forRemoval=false) public void addAllTotalTaxValues(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(since="ages", forRemoval=false) 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(since="ages", forRemoval=false) 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(since="ages", forRemoval=false) public 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(since="ages", forRemoval=false) public 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.
    • addTotalTaxValue

      @Deprecated(since="ages", forRemoval=false) public void addTotalTaxValue(SessionContext ctx, TaxValue taxValue)
      Deprecated.
      since ages - Use OrderService.addTotalTaxValue(de.hybris.platform.core.model.order.AbstractOrderModel, TaxValue) instead.
      Adds a tax value to this order. please note that this field is overwritten each time calculate(), calculate(Date), recalculate(), recalculate(Date) or calculateTotals(boolean) is called.
      Parameters:
      taxValue -
    • addAllTotalTaxValues

      @Deprecated(since="ages", forRemoval=false) public void addAllTotalTaxValues(SessionContext ctx, 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(since="ages", forRemoval=false) public void removeTotalTaxValue(SessionContext ctx, 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(since="ages", forRemoval=false) public void removeAllTotalTaxValues(SessionContext ctx)
      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.
    • setTotalTaxValues

      @Deprecated(since="ages", forRemoval=false) public void setTotalTaxValues(Collection totalTaxValues)
      Deprecated.
      since ages - Use model setter AbstractOrderModel.setTotalTaxValues(Collection) and ModelService.save() method instead.
    • setTotalTaxValues

      @Deprecated(since="ages", forRemoval=false) public void setTotalTaxValues(SessionContext ctx, Collection totalTaxValues)
      Deprecated.
      since ages - Use model setter AbstractOrderModel.setTotalTaxValues(Collection) and ModelService.save() method instead.
    • addGlobalDiscountValue

      @Deprecated(since="ages", forRemoval=false) 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(since="ages", forRemoval=false) public void addAllGlobalDiscountValues(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(since="ages", forRemoval=false) 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(since="ages", forRemoval=false) 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(since="ages", forRemoval=false) public 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(since="ages", forRemoval=false) public 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(since="ages", forRemoval=false) 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(since="ages", forRemoval=false) public void addAllGlobalDiscountValues(SessionContext ctx, 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(since="ages", forRemoval=false) 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(since="ages", forRemoval=false) 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(since="ages", forRemoval=false) public void setGlobalDiscountValues(List globalDiscounts)
      Deprecated.
      since ages - Use model setter AbstractOrderModel.setGlobalDiscountValues(List) and ModelService.save() method instead.
    • setGlobalDiscountValues

      @Deprecated(since="ages", forRemoval=false) public void setGlobalDiscountValues(SessionContext ctx, List globalDiscounts)
      Deprecated.
      since ages - Use model setter AbstractOrderModel.setGlobalDiscountValues(List) and ModelService.save() method instead.
    • isCalculated

      public Boolean isCalculated()
      Shows if this order was calculated before. All calculated fields are only valid if this metho returns true .
      Overrides:
      isCalculated in class GeneratedAbstractOrder
      Returns:
      the calculated
      See Also:
    • isCalculated

      public Boolean isCalculated(SessionContext ctx)
      Shows if this order was calculated before. All calculated fields are only valid if this metho returns true .
      Overrides:
      isCalculated in class GeneratedAbstractOrder
      Returns:
      the calculated
      See Also:
    • discountsIncludePaymentCosts

      @Deprecated(since="ages", forRemoval=false) 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(since="ages", forRemoval=false) 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, 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(since="ages", forRemoval=false) 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(since="ages", forRemoval=false) 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, 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.
    • calculateEntries

      protected void calculateEntries() throws JaloPriceFactoryException
      calls AbstractOrderEntry.calculate() on all entries of this order and sets this orders subtotal to the sum of the entry totals. this is called at start of calculate().
      Throws:
      JaloPriceFactoryException - if a pricefactory error ocurred
    • recalculateEntries

      protected void recalculateEntries() throws JaloPriceFactoryException
      calls AbstractOrderEntry.recalculate() on all entries of this order and sets this orders subtotal to the sum of the entry totals. this is called at start of recalculate().
      Throws:
      JaloPriceFactoryException - if a pricefactory error ocurred
    • findPaymentCosts

      protected PriceValue findPaymentCosts() throws JaloPriceFactoryException
      called during calculate(), calculate(Date), recalculate() and recalculate(Date) to fetch and set the payment costs for this order.

      as default this method calls PaymentMode.getCost(AbstractOrder) when a payment mode was set. you may override this method to implement different behavior. please note that at this time no order total have been set ( except the order total which holds the entry total sum )so dont rely on these values.

      Returns:
      the payment costs of this abstract order
      Throws:
      JaloPriceFactoryException
    • findDeliveryCosts

      protected PriceValue findDeliveryCosts() throws JaloPriceFactoryException
      Called during calculate(), calculate(Date), recalculate() and recalculate(Date) to fetch and set the delivery cost for this order.

      As default this method calls DefaultDeliveryCostsStrategy.findDeliveryCosts(de.hybris.platform.jalo.SessionContext, de.hybris.platform.jalo.order.AbstractOrder) when a delivery mode was set. You may override this method to implement different behavior. Please note that at this time no order total have been set (Except the order total which holds the entry total sum) so dont rely on these values. You may replace this strtegy by configuirng your spring.xml accordingly See: Configuration: core-spring.xml

       bean id="core.orderManager" class="de.hybris.platform.jalo.order.OrderManager" scope="tenant">
       <property name="deliveryCostsStrategy" ref="core.deliverycostsstrategy.default"/>
       /bean>
       
      Returns:
      the delivery costs of this abstract order
      Throws:
      JaloPriceFactoryException
    • findGlobalDiscounts

      protected List findGlobalDiscounts() throws JaloPriceFactoryException
      Called during calculate(), calculate(Date), recalculate() and recalculate(Date) to fetch and set global discount values for this order.

      As default this method calls AbstractPriceFactory.getDiscountValues(AbstractOrder). you may override this method to implement different behavior. please note that at this time no order total have been set ( except the order total which holds the entry total sum )so dont rely on these values.

      Returns:
      a list containing all global discounts which are applied to this abstract order
      Throws:
      JaloPriceFactoryException
    • calculateTotals

      @Deprecated(since="ages", forRemoval=false) 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, Map<TaxValue,Map<Set<TaxValue>,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 Double getTotalDiscounts()
      returns the sum of all discounts of this (calculated) order.
      Overrides:
      getTotalDiscounts in class GeneratedAbstractOrder
      Returns:
      the totalDiscounts
    • calculateSubtotal

      protected Map<TaxValue,Map<Set<TaxValue>,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, Set<TaxValue> relativeEntryTaxValues, Map<TaxValue,Map<Set<TaxValue>,Double>> taxValueMap)
    • addAbsoluteEntryTaxValue

      protected void addAbsoluteEntryTaxValue(long entryQuantity, TaxValue taxValue, Map<TaxValue,Map<Set<TaxValue>,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 List convertDiscountValues(List dvs)
    • calculateTotalTaxValues

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

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

      @Deprecated(since="ages", forRemoval=false) 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()
    • resetAllValues

      protected Map resetAllValues() throws JaloPriceFactoryException
      fetches all prices, taxes, discount, payment and delivery costs and sets these fields. this method does not reset any entry values!
      Returns:
      the tax value map obtainable via calculateSubtotal(boolean) - use this for further tax calculation instead of calling calculateSubtotal(boolean) multiple times
      Throws:
      JaloPriceFactoryException
    • resetAdditionalCosts

      protected void resetAdditionalCosts(Collection<TaxValue> relativeTaxValues) throws JaloPriceFactoryException
      Throws:
      JaloPriceFactoryException
    • calculate

      @Deprecated(since="ages", forRemoval=false) public void calculate(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(since="ages", forRemoval=false) 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(since="ages", forRemoval=false) public void recalculate(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
    • addDiscount

      @Deprecated(since="ages", forRemoval=false) public void addDiscount(Discount discount)
      Assigns a discount to this order. These discounts are involved in order (re)calculation by fetching a value via Discount.getDiscountValue(AbstractOrder). Unlike all calculated values the discount collection is not cleared by (re)calculation !
      Parameters:
      discount - the discount to assign
    • removeDiscount

      @Deprecated(since="ages", forRemoval=false) public void removeDiscount(Discount discount)
      Unassigns a discount from this order. These discounts are involved in order (re)calculation by fetching a value via Discount.getDiscountValue(AbstractOrder). Unlike all calculated values the discount collection is not cleared by (re)calculation !
      Parameters:
      discount - the discount to unassign
    • 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
    • setEntries

      public void setEntries(List<AbstractOrderEntry> value)
      Description copied from class: GeneratedAbstractOrder
      Generated method - Setter of the AbstractOrder.entries attribute.
      Overrides:
      setEntries in class GeneratedAbstractOrder
      Parameters:
      value - the entries
    • setEntries

      public void setEntries(SessionContext ctx, List<AbstractOrderEntry> value)
      Description copied from class: GeneratedAbstractOrder
      Generated method - Setter of the AbstractOrder.entries attribute.
      Overrides:
      setEntries in class GeneratedAbstractOrder
      value - the entries