public abstract class DefaultAbstractOrderService<O extends AbstractOrderModel,E extends AbstractOrderEntryModel> extends AbstractBusinessService implements AbstractOrderService<O,E>
AbstractOrderService. Implements its contract on the AbstractOrderModel
type level. Any order related services should extend it (i.e. DefaultOrderService, DefaultCartService
, or a dedicated service for a custom order type).AbstractService.SerializableDTOmodelService, sessionService, txManagertenant| Constructor and Description |
|---|
DefaultAbstractOrderService() |
| 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.
|
protected int |
addEntryAtPosition(AbstractOrderModel order,
AbstractOrderEntryModel entry,
int requested) |
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. |
protected AbstractOrderEntryService<E> |
getAbstractOrderEntryService() |
protected AbstractOrderEntryTypeService |
getAbstractOrderEntryTypeService() |
protected CloneAbstractOrderStrategy |
getCloneAbstractOrderStrategy() |
protected AbstractOrderEntryModel |
getCollidingEntry(int requested,
O order) |
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. |
protected java.lang.String |
getEntryTypeCode(AbstractOrderModel order) |
DiscountValue |
getGlobalDiscountValue(O order,
DiscountValue discountValue)
Searches for complete discount value (with calculated applied value) object created using given discountValue.
|
protected OrderDao |
getOrderDao() |
protected SaveAbstractOrderStrategy<O> |
getSaveAbstractOrderStrategy() |
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. |
void |
setAbstractOrderEntryService(AbstractOrderEntryService<E> abstractOrderEntryService) |
void |
setAbstractOrderEntryTypeService(AbstractOrderEntryTypeService abstractOrderEntryTypeService) |
void |
setCloneAbstractOrderStrategy(CloneAbstractOrderStrategy cloneAbstractOrderStrategy) |
void |
setOrderDao(OrderDao orderDao) |
void |
setSaveAbstractOrderStrategy(SaveAbstractOrderStrategy<O> saveAbstractOrderStrategy) |
getModelService, getSessionService, getTxManager, setModelService, setSessionService, setTxManagerafterPropertiesSet, getCurrentTenant, setBeanName, setCurrentTenant, writeReplaceclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitclonepublic E addNewEntry(O order, ProductModel product, long qty, UnitModel unit)
AbstractOrderServiceAbstractOrderEntryTypeService
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.addNewEntry in interface AbstractOrderService<O extends AbstractOrderModel,E extends AbstractOrderEntryModel>order - - target orderproduct - -product to add, must not be nullqty - - quantityunit - - must not be nullAbstractOrderEntryModel - newly created order entryAbstractOrderEntryTypeService.getAbstractOrderEntryType(AbstractOrderModel)public E addNewEntry(O order, ProductModel product, long qty, UnitModel unit, int number, boolean addToPresent)
AbstractOrderServiceAbstractOrderEntryTypeService 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
AbstractOrderService.saveOrder(AbstractOrderModel) method in order to persist the changes.addNewEntry in interface AbstractOrderService<O extends AbstractOrderModel,E extends AbstractOrderEntryModel>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 entryAbstractOrderEntryTypeService.getAbstractOrderEntryType(AbstractOrderModel)public AbstractOrderEntryModel addNewEntry(ComposedTypeModel entryType, O order, ProductModel product, long qty, UnitModel unit, int number, boolean addToPresent)
AbstractOrderServiceComposedTypeModel 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
AbstractOrderService.saveOrder(AbstractOrderModel) method in order to persist the changes.addNewEntry in interface AbstractOrderService<O extends AbstractOrderModel,E extends AbstractOrderEntryModel>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 entryprotected int addEntryAtPosition(AbstractOrderModel order, AbstractOrderEntryModel entry, int requested)
public E getEntryForNumber(O order, int number)
AbstractOrderServiceAbstractOrderEntryModel.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.getEntryForNumber in interface AbstractOrderService<O extends AbstractOrderModel,E extends AbstractOrderEntryModel>AbstractOrderEntryModelpublic java.util.List<E> getEntriesForNumber(O order, int start, int end)
AbstractOrderServiceAbstractOrderEntryModel.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.getEntriesForNumber in interface AbstractOrderService<O extends AbstractOrderModel,E extends AbstractOrderEntryModel>start - start of the rangeend - end of the rangeAbstractOrderEntryModelpublic java.util.List<E> getEntriesForProduct(O order, ProductModel product)
AbstractOrderServicegetEntriesForProduct in interface AbstractOrderService<O extends AbstractOrderModel,E extends AbstractOrderEntryModel>order - - target orderproduct - - searched productpublic O saveOrder(O order)
AbstractOrderService
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.saveOrder in interface AbstractOrderService<O extends AbstractOrderModel,E extends AbstractOrderEntryModel>order - - non persisted OrderModel that needs to be persisted.OrderModelpublic void addGlobalDiscountValue(O order, DiscountValue discountValue)
AbstractOrderServiceaddGlobalDiscountValue in interface AbstractOrderService<O extends AbstractOrderModel,E extends AbstractOrderEntryModel>order - target orderdiscountValue - discount to addpublic void addTotalTaxValue(O order, TaxValue taxValue)
AbstractOrderServiceTaxValue 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.addTotalTaxValue in interface AbstractOrderService<O extends AbstractOrderModel,E extends AbstractOrderEntryModel>order - target orderpublic void addAllGlobalDiscountValues(O order, java.util.List<DiscountValue> discountValues)
AbstractOrderServiceaddAllGlobalDiscountValues in interface AbstractOrderService<O extends AbstractOrderModel,E extends AbstractOrderEntryModel>order - target orderdiscountValues - discount values to addpublic void addAllTotalTaxValues(O order, java.util.List<TaxValue> taxValues)
AbstractOrderServiceCalculationService.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.addAllTotalTaxValues in interface AbstractOrderService<O extends AbstractOrderModel,E extends AbstractOrderEntryModel>order - target ordertaxValues - tax values to addpublic void removeGlobalDiscountValue(O order, DiscountValue discountValue)
AbstractOrderServiceremoveGlobalDiscountValue in interface AbstractOrderService<O extends AbstractOrderModel,E extends AbstractOrderEntryModel>order - target orderdiscountValue - discount to removepublic void removeTotalTaxValue(O order, TaxValue taxValue)
AbstractOrderServiceCalculationService.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.removeTotalTaxValue in interface AbstractOrderService<O extends AbstractOrderModel,E extends AbstractOrderEntryModel>order - target orderprotected java.lang.String getEntryTypeCode(AbstractOrderModel order)
protected AbstractOrderEntryModel getCollidingEntry(int requested, O order)
public void setOrderDao(OrderDao orderDao)
public void setAbstractOrderEntryTypeService(AbstractOrderEntryTypeService abstractOrderEntryTypeService)
public void setSaveAbstractOrderStrategy(SaveAbstractOrderStrategy<O> saveAbstractOrderStrategy)
public void setCloneAbstractOrderStrategy(CloneAbstractOrderStrategy cloneAbstractOrderStrategy)
public void setAbstractOrderEntryService(AbstractOrderEntryService<E> abstractOrderEntryService)
protected CloneAbstractOrderStrategy getCloneAbstractOrderStrategy()
protected AbstractOrderEntryTypeService getAbstractOrderEntryTypeService()
protected SaveAbstractOrderStrategy<O> getSaveAbstractOrderStrategy()
protected AbstractOrderEntryService<E> getAbstractOrderEntryService()
protected OrderDao getOrderDao()
public DiscountValue getGlobalDiscountValue(O order, DiscountValue discountValue)
AbstractOrderServicegetGlobalDiscountValue in interface AbstractOrderService<O extends AbstractOrderModel,E extends AbstractOrderEntryModel>Copyright © 2018 SAP SE. All Rights Reserved.