Class OrderValidationServiceImpl
java.lang.Object
ch.tocco.nice2.optional.debitor.impl.action.order.OrderValidationServiceImpl
- All Implemented Interfaces:
OrderValidationService
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncom.google.common.collect.Multimap
<Entity, OrderError> areOrdersReadyFor
(EntityList orders, OrderErrorContribution.OrderErrorAction action) callsOrderValidationService.isOrderReadyFor
for every entity inorders
isOrderReadyFor
(Entity order, OrderErrorContribution.OrderErrorAction action) check if the givenaction
may be executed on the givenorder
.
May be used to verify that a order can be booked/cancelled/etc.
If the action is not valid on the given entity, a list of the errors is returned.void
setErrorsContributions
(List<OrderErrorContribution> errorContributions)
-
Constructor Details
-
OrderValidationServiceImpl
public OrderValidationServiceImpl()
-
-
Method Details
-
isOrderReadyFor
public List<OrderError> isOrderReadyFor(Entity order, OrderErrorContribution.OrderErrorAction action) throws PersistException Description copied from interface:OrderValidationService
check if the givenaction
may be executed on the givenorder
.
May be used to verify that a order can be booked/cancelled/etc.
If the action is not valid on the given entity, a list of the errors is returned.- Specified by:
isOrderReadyFor
in interfaceOrderValidationService
- Parameters:
order
- the order to checkaction
- action to verify is valid fororder
in its current state- Returns:
- a list of
OrderError
, which describe the things wrong with . List is empty when order can be cancelled - Throws:
PersistException
-
areOrdersReadyFor
public com.google.common.collect.Multimap<Entity,OrderError> areOrdersReadyFor(EntityList orders, OrderErrorContribution.OrderErrorAction action) throws PersistException Description copied from interface:OrderValidationService
callsOrderValidationService.isOrderReadyFor
for every entity inorders
- Specified by:
areOrdersReadyFor
in interfaceOrderValidationService
- Parameters:
orders
- entity list with orders to checkaction
- action to verify is valid fororders
in their current state- Returns:
- a map, containing a failing order entity as key and a list of errors as value. Entity does not appear in map, if it can be cancelled
- Throws:
PersistException
-
setErrorsContributions
-