Package org.salespointframework.order
Class OrderCompletionReport
java.lang.Object
org.salespointframework.order.OrderCompletionReport
- All Implemented Interfaces:
Iterable<OrderCompletionReport.OrderLineCompletion>
,Supplier<Stream<OrderCompletionReport.OrderLineCompletion>>
,Streamable<OrderCompletionReport.OrderLineCompletion>
public class OrderCompletionReport extends Object implements Streamable<OrderCompletionReport.OrderLineCompletion>
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
OrderCompletionReport.CompletionStatus
The status of a completion.static class
OrderCompletionReport.OrderLineCompletion
The completion status of anOrderLine
. -
Method Summary
-
Method Details
-
success
Creates anOrderCompletionReport
representing a successful verification of the givenOrder
.- Parameters:
order
- must not be null.- Returns:
- will never be null.
-
failed
Creates anOrderCompletionReport
for anOrder
that's marked as failed.- Parameters:
order
- must not be null.- Returns:
- will never be null.
-
forCompletions
public static OrderCompletionReport forCompletions(Order order, Iterable<OrderCompletionReport.OrderLineCompletion> completions)Creates a newOrderCompletionReport
for the givenOrder
andOrderCompletionReport.OrderLineCompletion
s.- Parameters:
order
- must not be null.completions
- must not be null.- Returns:
- will never be null.
-
hasErrors
public boolean hasErrors()Returns whether there report contains any errors. If true, clients should go ahead and inspect the report forOrderCompletionReport.OrderLineCompletion
(e.g. usingStreamable.stream()
to access the individual completions).- Returns:
-
onError
public OrderCompletionReport onError(Function<OrderCompletionReport,? extends RuntimeException> exception)Applies the givenFunction
to produce an exception in case the report has errors.- Parameters:
exception
- must not be null.- Since:
- 7.1
-
iterator
- Specified by:
iterator
in interfaceIterable<OrderCompletionReport.OrderLineCompletion>
-
toString
-
equals
-
canEqual
-
hashCode
public int hashCode() -
getOrder
-
getStatus
-