O
- as OrderI
- as OrderItem
public interface OrderService<O extends Order<? extends I>,I extends OrderItem> extends ChangeGenerator<Object>
Order
management
Modifier and Type | Method and Description |
---|---|
void |
adjustInventory(I item,
Number updateCnt,
String causeSource)
Using a + or a - value for countUpdate we can change the Stock position from its current position.
|
void |
checkItemProductsStillLocked(O order)
For some operations like sending invoice etc it may be necessary for the order to have a lock on all its products;
Warn by throwing
PartialTransactionException.getFailed() of all Products that are not locked. |
OrderDao<O> |
getDao()
The Actions on the service layer can trigger events.
Useful if we want to easily create intermediate save points without having to worry about triggering events. |
boolean |
isExists(Long orderId)
Check to see if an Order exists or not
|
O |
load(Long orderId)
Load an existing Order
|
void |
lockProductsForOrder(O order,
String causeSource)
Order s maintain referential integrity over Products that are used by them. |
<D extends DeliveryDetails> |
save(D deliveryDetails,
String causeSource)
Explicitly update the Delivery Details only
|
<T extends O> |
save(T order,
String causeSource,
Object... context)
|
void |
unlockProductsForOrder(O order,
String causeSource)
Order s maintain referential integrity over Products that are used by them. |
I |
update(I item,
String causeSource)
|
addChangeListener, getListeners, notifyAllListeners, setListeners
<T extends O> T save(T order, String causeSource, Object... context) throws OrderPlacementException
order
- as Order
causeSource
- as Source of Change @nullable true will cause no subsequent event firingpropagateNotificatons
- as boolean; if false will NOT call event listeners. This can be useful to prevent recursion from Event-Listenerscontext
- as Object varags; typically sent to the ChangeGenerator.getListeners()
Order
objectOrderPlacementException
boolean isExists(Long orderId)
orderId
- I update(I item, String causeSource) throws OrderPlacementException
item
- as OrderItem
causeSource
- as Source of Change @nullable true will cause no subsequent event firingOrderItem
objectOrderPlacementException
<D extends DeliveryDetails> D save(D deliveryDetails, String causeSource)
deliveryDetails
- as DeliveryDetails
causeSource
- as Source of Change @nullable true will cause no subsequent event firingvoid lockProductsForOrder(O order, String causeSource) throws PartialTransactionException, OrderPlacementException
Order
s maintain referential integrity over Products that are used by them. OrderItem
s in the Order
order
- as Order
causeSource
- as String @nullable true will cause no subsequent event firingPartialTransactionException
OrderPlacementException
void unlockProductsForOrder(O order, String causeSource) throws OrderPlacementException
Order
s maintain referential integrity over Products that are used by them. OrderItem
s in the Order
order
- as Order
causeSource
- @nullable true will cause no subsequent event firingOrderPlacementException
void checkItemProductsStillLocked(O order) throws PartialTransactionException
PartialTransactionException.getFailed()
of all Products that are not locked.order
- PartialTransactionException
void adjustInventory(I item, Number updateCnt, String causeSource)
adjustInventory(OrderItem, Number, String)
for an Order
ensure they are called within one Transaction.
RuntimeException
s if Products don't exist, difficulty in modifying count on underlying DB etc; so any calling API Post Order
placement should ideally account
for RuntimeException use casesitem
- as OrderItem
updateCnt
- as Number (Integer) that will be adjusted from the current stock position. A position # will ADD to current position, Negative will deduct from current position.
Note: The update count is not an absolute position; this is to ensure in high volume cases the Adjustments dont overwrite each other and each transaction is responsible for its own adjustment.causeSource
- as String @nullable true will cause no subsequent event firingCopyright © 2018. All rights reserved.