public final class TextLineItemUpdateActionUtils
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.shoppinglists.ShoppingList>> |
buildChangeTextLineItemNameUpdateAction(io.sphere.sdk.shoppinglists.TextLineItem oldTextLineItem,
io.sphere.sdk.shoppinglists.TextLineItemDraft newTextLineItem)
Compares the
LocalizedString names of TextLineItem and a TextLineItemDraft and returns an Optional of update action, which would contain the
"changeTextLineItemName" UpdateAction. |
static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.shoppinglists.ShoppingList>> |
buildChangeTextLineItemQuantityUpdateAction(io.sphere.sdk.shoppinglists.TextLineItem oldTextLineItem,
io.sphere.sdk.shoppinglists.TextLineItemDraft newTextLineItem)
Compares the
quantity values of a TextLineItem and a TextLineItemDraft
and returns an Optional of update action, which would contain the "changeTextLineItemQuantity" UpdateAction. |
static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.shoppinglists.ShoppingList>> |
buildSetTextLineItemDescriptionUpdateAction(io.sphere.sdk.shoppinglists.TextLineItem oldTextLineItem,
io.sphere.sdk.shoppinglists.TextLineItemDraft newTextLineItem)
Compares the
LocalizedString descriptions of TextLineItem and a TextLineItemDraft and returns an Optional of update action, which would contain the
"setTextLineItemDescription" UpdateAction. |
static java.util.List<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.shoppinglists.ShoppingList>> |
buildTextLineItemCustomUpdateActions(io.sphere.sdk.shoppinglists.ShoppingList oldShoppingList,
io.sphere.sdk.shoppinglists.ShoppingListDraft newShoppingList,
io.sphere.sdk.shoppinglists.TextLineItem oldTextLineItem,
io.sphere.sdk.shoppinglists.TextLineItemDraft newTextLineItem,
ShoppingListSyncOptions syncOptions)
Compares the custom fields and custom types of a
TextLineItem and a TextLineItemDraft and returns a list of UpdateAction<ShoppingList> as a
result. |
static java.util.List<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.shoppinglists.ShoppingList>> |
buildTextLineItemsUpdateActions(io.sphere.sdk.shoppinglists.ShoppingList oldShoppingList,
io.sphere.sdk.shoppinglists.ShoppingListDraft newShoppingList,
ShoppingListSyncOptions syncOptions)
Compares a list of
TextLineItems with a list of TextLineItemDrafts. |
static java.util.List<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.shoppinglists.ShoppingList>> |
buildTextLineItemUpdateActions(io.sphere.sdk.shoppinglists.ShoppingList oldShoppingList,
io.sphere.sdk.shoppinglists.ShoppingListDraft newShoppingList,
io.sphere.sdk.shoppinglists.TextLineItem oldTextLineItem,
io.sphere.sdk.shoppinglists.TextLineItemDraft newTextLineItem,
ShoppingListSyncOptions syncOptions)
Compares all the fields of a
TextLineItem and a TextLineItemDraft 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>> buildTextLineItemsUpdateActions(@Nonnull
io.sphere.sdk.shoppinglists.ShoppingList oldShoppingList,
@Nonnull
io.sphere.sdk.shoppinglists.ShoppingListDraft newShoppingList,
@Nonnull
ShoppingListSyncOptions syncOptions)
TextLineItems with a list of TextLineItemDrafts. The method
takes in functions for building the required update actions (AddTextLineItem,
RemoveTextLineItem and 1-1 update actions on text line items (e.g. changeTextLineItemQuantity,
setTextLineItemCustomType, etc..).
If the list of new TextLineItemDrafts is null, then remove actions are built
for every existing text line item.
oldShoppingList - shopping list resource, whose text line items should be updated.newShoppingList - new shopping list draft, which contains the text line items 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>> buildTextLineItemUpdateActions(@Nonnull
io.sphere.sdk.shoppinglists.ShoppingList oldShoppingList,
@Nonnull
io.sphere.sdk.shoppinglists.ShoppingListDraft newShoppingList,
@Nonnull
io.sphere.sdk.shoppinglists.TextLineItem oldTextLineItem,
@Nonnull
io.sphere.sdk.shoppinglists.TextLineItemDraft newTextLineItem,
@Nonnull
ShoppingListSyncOptions syncOptions)
TextLineItem and a TextLineItemDraft and returns a
list of UpdateAction<ShoppingList> as a result. If both the TextLineItem and the TextLineItemDraft 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.oldTextLineItem - the text line item which should be updated.newTextLineItem - the text line item draft where we get the new fields (i.e. quantity,
custom fields).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>> buildChangeTextLineItemNameUpdateAction(@Nonnull
io.sphere.sdk.shoppinglists.TextLineItem oldTextLineItem,
@Nonnull
io.sphere.sdk.shoppinglists.TextLineItemDraft newTextLineItem)
LocalizedString names of TextLineItem and a TextLineItemDraft and returns an Optional of update action, which would contain the
"changeTextLineItemName" UpdateAction. If both the TextLineItem and the
TextLineItemDraft have the same description values, then no update action is
needed and hence an empty optional will be returned.oldTextLineItem - the text line item which should be updated.newTextLineItem - the text line item draft where we get the new name.@Nonnull
public static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.shoppinglists.ShoppingList>> buildSetTextLineItemDescriptionUpdateAction(@Nonnull
io.sphere.sdk.shoppinglists.TextLineItem oldTextLineItem,
@Nonnull
io.sphere.sdk.shoppinglists.TextLineItemDraft newTextLineItem)
LocalizedString descriptions of TextLineItem and a TextLineItemDraft and returns an Optional of update action, which would contain the
"setTextLineItemDescription" UpdateAction. If both the TextLineItem and
the TextLineItemDraft have the same description values, then no update action
is needed and hence an empty optional will be returned.oldTextLineItem - the text line item which should be updated.newTextLineItem - the text line item draft where we get the new description.@Nonnull
public static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.shoppinglists.ShoppingList>> buildChangeTextLineItemQuantityUpdateAction(@Nonnull
io.sphere.sdk.shoppinglists.TextLineItem oldTextLineItem,
@Nonnull
io.sphere.sdk.shoppinglists.TextLineItemDraft newTextLineItem)
quantity values of a TextLineItem and a TextLineItemDraft
and returns an Optional of update action, which would contain the "changeTextLineItemQuantity" UpdateAction. If both TextLineItem and TextLineItemDraft have the same quantity values, then no update action is needed and
empty optional will be returned.
Note: If quantity from the newTextLineItem is null, the new quantity will be set to default value 1L. If quantity from the newTextLineItem is 0, then it means removing the text line item.
oldTextLineItem - the text line item which should be updated.newTextLineItem - the text 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>> buildTextLineItemCustomUpdateActions(@Nonnull
io.sphere.sdk.shoppinglists.ShoppingList oldShoppingList,
@Nonnull
io.sphere.sdk.shoppinglists.ShoppingListDraft newShoppingList,
@Nonnull
io.sphere.sdk.shoppinglists.TextLineItem oldTextLineItem,
@Nonnull
io.sphere.sdk.shoppinglists.TextLineItemDraft newTextLineItem,
@Nonnull
ShoppingListSyncOptions syncOptions)
TextLineItem and a TextLineItemDraft and returns a list of UpdateAction<ShoppingList> as a
result. If both the TextLineItem and the TextLineItemDraft have identical
custom fields and types, then no update action is needed and hence an empty List is
returned.oldShoppingList - shopping list resource, whose text line item should be updated.newShoppingList - new shopping list draft, which contains the text line item to update.oldTextLineItem - the text line item which should be updated.newTextLineItem - the text 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.