Class 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 the quantityOnStock values of an InventoryEntry and an InventoryEntryDraft and returns an Optional 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 the expectedDelivery values of an InventoryEntry and an InventoryEntryDraft and returns an Optional 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 the restockableInDays values of an InventoryEntry and an InventoryEntryDraft and returns an Optional 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 the supplyChannels of an InventoryEntry and an InventoryEntryDraft and returns an Optional of update action, which would contain the "setSupplyChannel" UpdateAction.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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 the quantityOnStock values of an InventoryEntry and an InventoryEntryDraft and returns an Optional of update action, which would contain the "changeQuantity" UpdateAction. If both InventoryEntry and InventoryEntryDraft have the same quantityOnStock values, then no update action is needed and empty optional will be returned. If the quantityOnStock from the newEntry is null, the new quantityOnStock will have a value of 0L.
        Parameters:
        oldEntry - the inventory entry that should be updated
        newEntry - 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 the restockableInDays values of an InventoryEntry and an InventoryEntryDraft and returns an Optional of update action, which would contain the "setRestockableInDays" UpdateAction. If both InventoryEntry and the InventoryEntryDraft have the same restockableInDays values, then no update action is needed and empty optional will be returned.
        Parameters:
        oldEntry - the inventory entry that should be updated
        newEntry - the inventory entry draft which contains a new restockableInDays 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 the expectedDelivery values of an InventoryEntry and an InventoryEntryDraft and returns an Optional of update action, which would contain the "setExpectedDelivery" UpdateAction. If both InventoryEntry and InventoryEntryDraft have the same expectedDelivery values, then no update action is needed and empty optional will be returned.
        Parameters:
        oldEntry - the inventory entry that should be updated
        newEntry - 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 the supplyChannels of an InventoryEntry and an InventoryEntryDraft and returns an Optional of update action, which would contain the "setSupplyChannel" UpdateAction. If both InventoryEntry and InventoryEntryDraft 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 updated
        newEntry - the inventory entry draft which contains new supply channel
        Returns:
        optional containing update action or empty optional if supply channels are identical