Package org.salespointframework.order
Class OrderCompletionReport
- java.lang.Object
-
- org.salespointframework.order.OrderCompletionReport
-
- All Implemented Interfaces:
Iterable<OrderCompletionReport.OrderLineCompletion>
,Supplier<Stream<OrderCompletionReport.OrderLineCompletion>>
,org.springframework.data.util.Streamable<OrderCompletionReport.OrderLineCompletion>
public class OrderCompletionReport extends Object implements org.springframework.data.util.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
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Method Detail
-
success
public static OrderCompletionReport success(Order order)
Creates anOrderCompletionReport
representing a successful verification of the givenOrder
.- Parameters:
order
- must not be null.- Returns:
- will never be null.
-
failed
public static OrderCompletionReport failed(Order order)
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 void 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
public Iterator<OrderCompletionReport.OrderLineCompletion> iterator()
- Specified by:
iterator
in interfaceIterable<OrderCompletionReport.OrderLineCompletion>
-
canEqual
protected boolean canEqual(Object other)
-
getOrder
@NonNull public @NonNull Order getOrder()
-
getStatus
@NonNull public @NonNull OrderCompletionReport.CompletionStatus getStatus()
-
-