public interface AbstractOrderService<O extends AbstractOrderModel,E extends AbstractOrderEntryModel>
AbstractOrderModel. Extend this
service with a typed interface (like OrderService, or CartService) to obtain a set of it's contract
methods for your type (like OrderModel, or CartModel correspondingly). Default implementation -
DefaultAbstractOrderService - provides shared implementation on the AbstractOrderModel.| Modifier and Type | Method and Description |
|---|---|
void |
addAllGlobalDiscountValues(O order,
java.util.List<DiscountValue> discountValues)
Adds a collection of global discount values to the given order.
|
void |
addAllTotalTaxValues(O order,
java.util.List<TaxValue> taxValues)
Adds a collection of tax values into given order.
|
void |
addGlobalDiscountValue(O order,
DiscountValue discountValue)
Adds a global discount value to the given order.
|
AbstractOrderEntryModel |
addNewEntry(ComposedTypeModel entryType,
O order,
ProductModel product,
long qty,
UnitModel unit,
int number,
boolean addToPresent)
Adds a new entry of the given
ComposedTypeModel to the given order. |
E |
addNewEntry(O order,
ProductModel product,
long qty,
UnitModel unit)
Adds a new entry to the given order.
|
E |
addNewEntry(O order,
ProductModel product,
long qty,
UnitModel unit,
int number,
boolean addToPresent)
Adds a new entry to the given order on the required entry number.
|
void |
addTotalTaxValue(O order,
TaxValue taxValue)
Convenience method to add a
TaxValue to the given order. |
O |
clone(ComposedTypeModel orderType,
ComposedTypeModel entryType,
AbstractOrderModel original,
java.lang.String code)
Creates new order from given original and change its type and type for entry.
|
java.util.List<E> |
getEntriesForNumber(O order,
int start,
int end)
Returns order entries with the given
AbstractOrderEntryModel.ENTRYNUMBER. |
java.util.List<E> |
getEntriesForProduct(O order,
ProductModel product)
Returns order entries having the target product.
|
E |
getEntryForNumber(O order,
int number)
Returns an order entry with the given
AbstractOrderEntryModel.ENTRYNUMBER. |
DiscountValue |
getGlobalDiscountValue(O order,
DiscountValue discountValue)
Searches for complete discount value (with calculated applied value) object created using given discountValue.
|
void |
removeGlobalDiscountValue(O order,
DiscountValue discountValue)
Removes a global discount value from this order.
|
void |
removeTotalTaxValue(O order,
TaxValue taxValue)
Removes a tax value from the given order.
|
O |
saveOrder(O order)
Persist the model and all it's members and entries within one transaction using
SaveAbstractOrderStrategy. |
E addNewEntry(O order, ProductModel product, long qty, UnitModel unit)
AbstractOrderEntryTypeService
and the spring configuration behind it. When a product already exists, the corresponding entry quantity is
increased. If a null Unit is specified, a unit according to given product will be chosen. The new entry is neither
saved nor calculated.order - - target orderproduct - -product to add, must not be nullqty - - quantityunit - - must not be nullAbstractOrderEntryModel - newly created order entryjava.lang.IllegalArgumentException - if either order or product is null or quantity is negativeAbstractOrderEntryTypeService.getAbstractOrderEntryType(AbstractOrderModel)E addNewEntry(O order, ProductModel product, long qty, UnitModel unit, int number, boolean addToPresent)
AbstractOrderEntryTypeService and the spring configuration behind it. The new entry is neither saved nor
calculated. If your new entry has caused entries shuffling you may need to call
saveOrder(AbstractOrderModel) method in order to persist the changes.order - - target orderproduct - -product to add, must not be nullqty - - quantityunit - - must not be nullnumber - - entry number of the new entry in the order. Entries are indexed starting from 0. Set number to -1 if
you want to append the entry as the last one. You can request any non-negative position.addToPresent - - if true an existing entry with matching product and unit will get its quantity increased;
otherwise a new entry is createdAbstractOrderEntryModel - newly created order entryjava.lang.IllegalArgumentException - if either order or product is null or quantity is negative.AbstractOrderEntryTypeService.getAbstractOrderEntryType(AbstractOrderModel)AbstractOrderEntryModel addNewEntry(ComposedTypeModel entryType, O order, ProductModel product, long qty, UnitModel unit, int number, boolean addToPresent)
ComposedTypeModel to the given order. The new entry is neither saved nor
calculated. If your new entry has caused entries shuffling you may need to call
saveOrder(AbstractOrderModel) method in order to persist the changes.entryType - - the requested sub-type AbstractOrderEntryorder - - target orderproduct - -product to add, must not be nullqty - - quantityunit - - must not be nullnumber - - entry number of the new entry in the order. Entries are indexed starting from 0. Set number to -1 if
you want to append the entry as the last one. You can request any non-negative position.addToPresent - - if true an existing entry with matching product and unit will get its quantity increased;
otherwise a new entry is createdAbstractOrderEntryModel - newly created order entryjava.lang.IllegalArgumentException - if either entryType or order or product is null or quantity is negative.O clone(ComposedTypeModel orderType, ComposedTypeModel entryType, AbstractOrderModel original, java.lang.String code)
CloneAbstractOrderStrategy injected strategy. Resulting order remains not persisted.orderType - type of result order (OrderModel will be chosen if null is passed)entryType - type of entry (if null will use service to get proper type)original - original ordercode - code for new orderE getEntryForNumber(O order, int number)
AbstractOrderEntryModel.ENTRYNUMBER. The method delegates to data
access object and checks the actual persisted order in the data base, not the order state represented by the
model.order - number - AbstractOrderEntryModelUnknownIdentifierException - if no entry with the requested number existsjava.lang.IllegalArgumentException - if either order is null or number is negativejava.util.List<E> getEntriesForNumber(O order, int start, int end)
AbstractOrderEntryModel.ENTRYNUMBER. The method delegates to data
access object and checks the actual persisted order in the data base, not the order state represented by the
model.order - start - start of the rangeend - end of the rangeAbstractOrderEntryModelUnknownIdentifierException - if no entry from the requested range number existsjava.lang.IllegalArgumentException - if either order is null or start is negative or start is greater than endjava.util.List<E> getEntriesForProduct(O order, ProductModel product)
order - - target orderproduct - - searched productjava.lang.IllegalArgumentException - if either order or product is nullO saveOrder(O order)
Persist the model and all it's members and entries within one transaction using SaveAbstractOrderStrategy.
After this method call the order and it's entries are refreshed.
AbstractOrderEntryModel on the already occupied entryNumber
position, which caused order entries shuffling. In other, trivial cases, the regular call to
ModelService.save(Object) is sufficient. Please mind that the concrete typed service must allow entries
shuffling (like CartService does). Tying to put OrderEntryModel on an occupied entryNumber using
OrderService would throw an exception in the first place.
The method call is delegated to the spring configurable SaveAbstractOrderStrategy.order - - non persisted OrderModel that needs to be persisted.OrderModeljava.lang.IllegalArgumentException - if order is null.void addTotalTaxValue(O order, TaxValue taxValue)
TaxValue to the given order. please note that the order's tax values are
overwritten each time CalculationService.calculate(AbstractOrderModel),
CalculationService.calculate(AbstractOrderModel, java.util.Date),
CalculationService.recalculate(AbstractOrderModel),
CalculationService.recalculate(AbstractOrderModel, java.util.Date) is called. Those calls fetch the
tax information from the price factory and overwrites the previous state. The content of the
AbstractOrderModel.TOTALTAXVALUES represents all tax values introduced by the order entries. After this
method call, the order model remains not persisted.taxValue - order - target orderjava.lang.IllegalArgumentException - if either order or taxValue is null.void addAllTotalTaxValues(O order, java.util.List<TaxValue> taxValues)
CalculationService.calculate(AbstractOrderModel),
CalculationService.calculate(AbstractOrderModel, java.util.Date),
CalculationService.recalculate(AbstractOrderModel),
CalculationService.recalculate(AbstractOrderModel, java.util.Date) is called. Those calls fetch the
tax information from the price factory and overwrites the previous state. The content of the
AbstractOrderModel.TOTALTAXVALUES represents all tax values introduced by the order entries. After this
method call, the order model remains not persisted.order - target ordertaxValues - tax values to addjava.lang.IllegalArgumentException - if either order or taxValues is null.void removeTotalTaxValue(O order, TaxValue taxValue)
CalculationService.calculate(AbstractOrderModel),
CalculationService.calculate(AbstractOrderModel, java.util.Date),
CalculationService.recalculate(AbstractOrderModel),
CalculationService.recalculate(AbstractOrderModel, java.util.Date) is called. Those calls fetch the
tax information from the price factory and overwrites the previous state. The content of the
AbstractOrderModel.TOTALTAXVALUES represents all tax values introduced by the order entries. After this
method call, the order model remains not persisted.taxValue - order - target orderjava.lang.IllegalArgumentException - if either order or taxValue is null.void addGlobalDiscountValue(O order, DiscountValue discountValue)
discountValue - discount to addorder - target orderjava.lang.IllegalArgumentException - if either order or discountValue is null.void addAllGlobalDiscountValues(O order, java.util.List<DiscountValue> discountValues)
discountValues - discount values to addorder - target orderjava.lang.IllegalArgumentException - if either order or discountValues is null.void removeGlobalDiscountValue(O order, DiscountValue discountValue)
discountValue - discount to removeorder - target orderjava.lang.IllegalArgumentException - if either order or discountValue is null.DiscountValue getGlobalDiscountValue(O order, DiscountValue discountValue)
Copyright © 2018 SAP SE. All Rights Reserved.