public final class LineItemUpdateActionUtils
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.shoppinglists.ShoppingList>> |
buildChangeLineItemQuantityUpdateAction(io.sphere.sdk.shoppinglists.LineItem oldLineItem,
io.sphere.sdk.shoppinglists.LineItemDraft newLineItem)
Compares the
quantity values of a LineItem and a LineItemDraft and
returns an Optional of update action, which would contain the "changeLineItemQuantity" UpdateAction. |
static java.util.List<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.shoppinglists.ShoppingList>> |
buildLineItemCustomUpdateActions(io.sphere.sdk.shoppinglists.ShoppingList oldShoppingList,
io.sphere.sdk.shoppinglists.ShoppingListDraft newShoppingList,
io.sphere.sdk.shoppinglists.LineItem oldLineItem,
io.sphere.sdk.shoppinglists.LineItemDraft newLineItem,
ShoppingListSyncOptions syncOptions)
Compares the custom fields and custom types of a
LineItem and a LineItemDraft
and returns a list of UpdateAction<ShoppingList> as a result. |
static java.util.List<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.shoppinglists.ShoppingList>> |
buildLineItemsUpdateActions(io.sphere.sdk.shoppinglists.ShoppingList oldShoppingList,
io.sphere.sdk.shoppinglists.ShoppingListDraft newShoppingList,
ShoppingListSyncOptions syncOptions)
Compares a list of
LineItems with a list of LineItemDrafts. |
static java.util.List<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.shoppinglists.ShoppingList>> |
buildLineItemUpdateActions(io.sphere.sdk.shoppinglists.ShoppingList oldShoppingList,
io.sphere.sdk.shoppinglists.ShoppingListDraft newShoppingList,
io.sphere.sdk.shoppinglists.LineItem oldLineItem,
io.sphere.sdk.shoppinglists.LineItemDraft newLineItem,
ShoppingListSyncOptions syncOptions)
Compares all the fields of a
LineItem and a LineItemDraft and returns a list of
UpdateAction<ShoppingList> as a result. |
@Nonnull
public static java.util.List<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.shoppinglists.ShoppingList>> buildLineItemsUpdateActions(@Nonnull
io.sphere.sdk.shoppinglists.ShoppingList oldShoppingList,
@Nonnull
io.sphere.sdk.shoppinglists.ShoppingListDraft newShoppingList,
@Nonnull
ShoppingListSyncOptions syncOptions)
LineItems with a list of LineItemDrafts. The method takes in
functions for building the required update actions (AddLineItem, RemoveLineItem and 1-1 update
actions on line items (e.g. changeLineItemQuantity, setLineItemCustomType, etc..).
If the list of new LineItemDrafts is null, then remove actions are built for
every existing line item.
oldShoppingList - shopping list resource, whose line item should be updated.newShoppingList - new shopping list draft, which contains the line item to update.syncOptions - responsible for supplying the sync options to the sync utility method. It is
used for triggering the error callback within the utility, in case of errors.@Nonnull
public static java.util.List<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.shoppinglists.ShoppingList>> buildLineItemUpdateActions(@Nonnull
io.sphere.sdk.shoppinglists.ShoppingList oldShoppingList,
@Nonnull
io.sphere.sdk.shoppinglists.ShoppingListDraft newShoppingList,
@Nonnull
io.sphere.sdk.shoppinglists.LineItem oldLineItem,
@Nonnull
io.sphere.sdk.shoppinglists.LineItemDraft newLineItem,
@Nonnull
ShoppingListSyncOptions syncOptions)
LineItem and a LineItemDraft and returns a list of
UpdateAction<ShoppingList> as a result. If both the LineItem and
the LineItemDraft have identical fields, then no update action is needed and hence an
empty List is returned.oldShoppingList - shopping list resource, whose line item should be updated.newShoppingList - new shopping list draft, which contains the line item to update.oldLineItem - the line item which should be updated.newLineItem - the line item draft where we get the new fields (i.e. quantity, custom
fields and types).syncOptions - responsible for supplying the sync options to the sync utility method. It is
used for triggering the error callback within the utility, in case of errors.@Nonnull
public static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.shoppinglists.ShoppingList>> buildChangeLineItemQuantityUpdateAction(@Nonnull
io.sphere.sdk.shoppinglists.LineItem oldLineItem,
@Nonnull
io.sphere.sdk.shoppinglists.LineItemDraft newLineItem)
quantity values of a LineItem and a LineItemDraft and
returns an Optional of update action, which would contain the "changeLineItemQuantity" UpdateAction. If both LineItem and LineItemDraft have the same quantity values, then no update action is needed and empty
optional will be returned.
Note: If quantity from the newLineItem is null, the new quantity will be set to default value 1L. If quantity from the newLineItem is 0, then it means removing the line item.
oldLineItem - the line item which should be updated.newLineItem - the line item draft where we get the new quantity.@Nonnull
public static java.util.List<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.shoppinglists.ShoppingList>> buildLineItemCustomUpdateActions(@Nonnull
io.sphere.sdk.shoppinglists.ShoppingList oldShoppingList,
@Nonnull
io.sphere.sdk.shoppinglists.ShoppingListDraft newShoppingList,
@Nonnull
io.sphere.sdk.shoppinglists.LineItem oldLineItem,
@Nonnull
io.sphere.sdk.shoppinglists.LineItemDraft newLineItem,
@Nonnull
ShoppingListSyncOptions syncOptions)
LineItem and a LineItemDraft
and returns a list of UpdateAction<ShoppingList> as a result. If both the
LineItem and the LineItemDraft have identical custom fields and types, then no
update action is needed and hence an empty List is returned.oldShoppingList - shopping list resource, whose line item should be updated.newShoppingList - new shopping list draft, which contains the line item to update.oldLineItem - the line item which should be updated.newLineItem - the line item draft where we get the new custom fields and types.syncOptions - responsible for supplying the sync options to the sync utility method. It is
used for triggering the error callback within the utility, in case of errors.