Class InventoryUpdateActionUtils
- java.lang.Object
-
- com.commercetools.sync.inventories.utils.InventoryUpdateActionUtils
-
public final class InventoryUpdateActionUtils extends java.lang.Object
This class provides static utility methods for building update actions related to inventories.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.inventory.InventoryEntry>>
buildChangeQuantityAction(io.sphere.sdk.inventory.InventoryEntry oldEntry, io.sphere.sdk.inventory.InventoryEntryDraft newEntry)
Compares thequantityOnStock
values of anInventoryEntry
and anInventoryEntryDraft
and returns anOptional
of update action, which would contain the"changeQuantity"
UpdateAction
.static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.inventory.InventoryEntry>>
buildSetExpectedDeliveryAction(io.sphere.sdk.inventory.InventoryEntry oldEntry, io.sphere.sdk.inventory.InventoryEntryDraft newEntry)
Compares theexpectedDelivery
values of anInventoryEntry
and anInventoryEntryDraft
and returns anOptional
of update action, which would contain the"setExpectedDelivery"
UpdateAction
.static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.inventory.InventoryEntry>>
buildSetRestockableInDaysAction(io.sphere.sdk.inventory.InventoryEntry oldEntry, io.sphere.sdk.inventory.InventoryEntryDraft newEntry)
Compares therestockableInDays
values of anInventoryEntry
and anInventoryEntryDraft
and returns anOptional
of update action, which would contain the"setRestockableInDays"
UpdateAction
.static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.inventory.InventoryEntry>>
buildSetSupplyChannelAction(io.sphere.sdk.inventory.InventoryEntry oldEntry, io.sphere.sdk.inventory.InventoryEntryDraft newEntry)
Compares thesupplyChannel
s of anInventoryEntry
and anInventoryEntryDraft
and returns anOptional
of update action, which would contain the"setSupplyChannel"
UpdateAction
.
-
-
-
Method Detail
-
buildChangeQuantityAction
@Nonnull public static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.inventory.InventoryEntry>> buildChangeQuantityAction(@Nonnull io.sphere.sdk.inventory.InventoryEntry oldEntry, @Nonnull io.sphere.sdk.inventory.InventoryEntryDraft newEntry)
Compares thequantityOnStock
values of anInventoryEntry
and anInventoryEntryDraft
and returns anOptional
of update action, which would contain the"changeQuantity"
UpdateAction
. If bothInventoryEntry
andInventoryEntryDraft
have the samequantityOnStock
values, then no update action is needed and empty optional will be returned. If thequantityOnStock
from thenewEntry
isnull
, the newquantityOnStock
will have a value of 0L.- Parameters:
oldEntry
- the inventory entry that should be updatednewEntry
- the inventory entry draft which contains new quantity on stock- Returns:
- optional containing update action or empty optional if quantities on stock are identical
-
buildSetRestockableInDaysAction
@Nonnull public static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.inventory.InventoryEntry>> buildSetRestockableInDaysAction(@Nonnull io.sphere.sdk.inventory.InventoryEntry oldEntry, @Nonnull io.sphere.sdk.inventory.InventoryEntryDraft newEntry)
Compares therestockableInDays
values of anInventoryEntry
and anInventoryEntryDraft
and returns anOptional
of update action, which would contain the"setRestockableInDays"
UpdateAction
. If bothInventoryEntry
and theInventoryEntryDraft
have the samerestockableInDays
values, then no update action is needed and empty optional will be returned.- Parameters:
oldEntry
- the inventory entry that should be updatednewEntry
- the inventory entry draft which contains a newrestockableInDays
value- Returns:
- optional containing update action or empty optional if restockable in days are identical
-
buildSetExpectedDeliveryAction
@Nonnull public static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.inventory.InventoryEntry>> buildSetExpectedDeliveryAction(@Nonnull io.sphere.sdk.inventory.InventoryEntry oldEntry, @Nonnull io.sphere.sdk.inventory.InventoryEntryDraft newEntry)
Compares theexpectedDelivery
values of anInventoryEntry
and anInventoryEntryDraft
and returns anOptional
of update action, which would contain the"setExpectedDelivery"
UpdateAction
. If bothInventoryEntry
andInventoryEntryDraft
have the sameexpectedDelivery
values, then no update action is needed and empty optional will be returned.- Parameters:
oldEntry
- the inventory entry that should be updatednewEntry
- the inventory entry draft which contains new expected delivery- Returns:
- optional containing update action or empty optional if expected deliveries are identical
-
buildSetSupplyChannelAction
@Nonnull public static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.inventory.InventoryEntry>> buildSetSupplyChannelAction(@Nonnull io.sphere.sdk.inventory.InventoryEntry oldEntry, @Nonnull io.sphere.sdk.inventory.InventoryEntryDraft newEntry)
Compares thesupplyChannel
s of anInventoryEntry
and anInventoryEntryDraft
and returns anOptional
of update action, which would contain the"setSupplyChannel"
UpdateAction
. If bothInventoryEntry
andInventoryEntryDraft
have the same supply channel, then no update action is needed and empty optional will be returned.- Parameters:
oldEntry
- the inventory entry that should be updatednewEntry
- the inventory entry draft which contains new supply channel- Returns:
- optional containing update action or empty optional if supply channels are identical
-
-