Package com.clover.sdk.v3.order
Class LineItemEvents
- java.lang.Object
-
- com.clover.sdk.v3.order.LineItemEvents
-
public class LineItemEvents extends Object
This class provides an interface creating and readingLineItemEvent
s. To queryLineItemEvent
s useContentResolver.query(Uri, String[], String, String[], String)
. SeeLineItemEventContract
. This class is a thin wrapper over the content provider call methods defined inLineItemEventContract
. Consumers should prefer this simpler interface however.- See Also:
LineItemEvent
,LineItemEventContract
-
-
Constructor Summary
Constructors Constructor Description LineItemEvents(Context context)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
bulkInsert(Collection<LineItemEvent> events)
Insert new line item events.int
copyLineItemEvents(String fromLineItemId, String toLineItemId)
Copy line item events from one line item id to new line item events.int
copyLineItemEvents(String fromLineItemId, String toLineItemId, String orderId)
Copy line item events from one line item id to new line item events.LineItemEvent
insert(LineItemEvent event)
Insert a new line item event.
-
-
-
Constructor Detail
-
LineItemEvents
public LineItemEvents(@NonNull Context context)
-
-
Method Detail
-
insert
public LineItemEvent insert(@NonNull LineItemEvent event) throws ClientException
Insert a new line item event. Do not set the ID of the event. The ID will be available in the returnedLineItemEvent
.- Returns:
- The created
LineItemEvent
. The returnedLineItemEvent
will have its UUID set. - Throws:
ClientException
- if the event could not be inserted. InspectResultStatusException.getResultStatus()
to understand the reason.- See Also:
LineItemEventContract.METHOD_INSERT
-
bulkInsert
public int bulkInsert(@NonNull Collection<LineItemEvent> events) throws ClientException
Insert new line item events. Either all events are inserted, or none if a failure occurs. Do not set the IDs of the events as they will be generated automatically. Query the ContentProvider usingLineItemEventContract
to get a list of LineItemEvents.- Parameters:
events
- a collection of events to create.- Returns:
- The number of events created. This will always be equal to
events.size()
. - Throws:
ClientException
- if an event could not be inserted, in which case no events will be inserted. InspectResultStatusException.getResultStatus()
to understand the reason.- See Also:
LineItemEventContract.METHOD_BULK_INSERT
-
copyLineItemEvents
public int copyLineItemEvents(@NonNull String fromLineItemId, @NonNull String toLineItemId) throws ClientException
Copy line item events from one line item id to new line item events. Either all events are copied, or none if a failure occurs. ContentProvider usingLineItemEventContract
to get a list of LineItemEvents.- Parameters:
fromLineItemId
- line item id to copy line item events.toLineItemId
- line item id to set line item events.- Returns:
- The number of events created.
- Throws:
ClientException
- if an event could not be copied, in which case no events will be inserted. InspectResultStatusException.getResultStatus()
to understand the reason.- See Also:
LineItemEventContract.METHOD_COPY_EVENTS
-
copyLineItemEvents
public int copyLineItemEvents(@NonNull String fromLineItemId, @NonNull String toLineItemId, @NonNull String orderId) throws ClientException
Copy line item events from one line item id to new line item events. Either all events are copied, or none if a failure occurs. ContentProvider usingLineItemEventContract
to get a list of LineItemEvents.- Parameters:
fromLineItemId
- line item id to copy line item events.toLineItemId
- line item id to set line item events.orderId
- new line item events will be created for this order ID.- Returns:
- The number of events created.
- Throws:
ClientException
- if an event could not be copied, in which case no events will be inserted. InspectResultStatusException.getResultStatus()
to understand the reason.- See Also:
LineItemEventContract.METHOD_COPY_EVENTS
-
-