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<com.commercetools.api.models.inventory.InventoryEntryUpdateAction> buildChangeQuantityAction​(com.commercetools.api.models.inventory.InventoryEntry oldEntry, com.commercetools.api.models.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" InventoryEntryUpdateAction.
      static java.util.Optional<com.commercetools.api.models.inventory.InventoryEntryUpdateAction> buildSetExpectedDeliveryAction​(com.commercetools.api.models.inventory.InventoryEntry oldEntry, com.commercetools.api.models.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" InventoryEntryUpdateAction.
      static java.util.Optional<com.commercetools.api.models.inventory.InventoryEntryUpdateAction> buildSetRestockableInDaysAction​(com.commercetools.api.models.inventory.InventoryEntry oldEntry, com.commercetools.api.models.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" InventoryEntryUpdateAction.
      static java.util.Optional<com.commercetools.api.models.inventory.InventoryEntryUpdateAction> buildSetSupplyChannelAction​(com.commercetools.api.models.inventory.InventoryEntry oldEntry, com.commercetools.api.models.inventory.InventoryEntryDraft newEntry)
      Compares the supplyChannels of an InventoryEntry and an InventoryEntryDraft and returns an Optional of update action, which would contain the "setSupplyChannel" InventoryEntryUpdateAction.
      • 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<com.commercetools.api.models.inventory.InventoryEntryUpdateAction> buildChangeQuantityAction​(@Nonnull
                                                                                                                                      com.commercetools.api.models.inventory.InventoryEntry oldEntry,
                                                                                                                                      @Nonnull
                                                                                                                                      com.commercetools.api.models.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" InventoryEntryUpdateAction. 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<com.commercetools.api.models.inventory.InventoryEntryUpdateAction> buildSetRestockableInDaysAction​(@Nonnull
                                                                                                                                            com.commercetools.api.models.inventory.InventoryEntry oldEntry,
                                                                                                                                            @Nonnull
                                                                                                                                            com.commercetools.api.models.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" InventoryEntryUpdateAction. 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<com.commercetools.api.models.inventory.InventoryEntryUpdateAction> buildSetExpectedDeliveryAction​(@Nonnull
                                                                                                                                           com.commercetools.api.models.inventory.InventoryEntry oldEntry,
                                                                                                                                           @Nonnull
                                                                                                                                           com.commercetools.api.models.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" InventoryEntryUpdateAction. 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<com.commercetools.api.models.inventory.InventoryEntryUpdateAction> buildSetSupplyChannelAction​(@Nonnull
                                                                                                                                        com.commercetools.api.models.inventory.InventoryEntry oldEntry,
                                                                                                                                        @Nonnull
                                                                                                                                        com.commercetools.api.models.inventory.InventoryEntryDraft newEntry)
        Compares the supplyChannels of an InventoryEntry and an InventoryEntryDraft and returns an Optional of update action, which would contain the "setSupplyChannel" InventoryEntryUpdateAction. 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