Class InventorySyncUtils


  • public final class InventorySyncUtils
    extends java.lang.Object
    This class provides factory methods for assembling update actions of inventory entries.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.util.List<com.commercetools.api.models.inventory.InventoryEntryUpdateAction> buildActions​(com.commercetools.api.models.inventory.InventoryEntry oldEntry, com.commercetools.api.models.inventory.InventoryEntryDraft newEntry, InventorySyncOptions syncOptions)
      Compares the quantityOnStock, the restockableInDays, the expectedDelivery, the supply channel and Custom fields/ type fields of an InventoryEntry and an InventoryEntryDraft.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • buildActions

        @Nonnull
        public static java.util.List<com.commercetools.api.models.inventory.InventoryEntryUpdateAction> buildActions​(@Nonnull
                                                                                                                     com.commercetools.api.models.inventory.InventoryEntry oldEntry,
                                                                                                                     @Nonnull
                                                                                                                     com.commercetools.api.models.inventory.InventoryEntryDraft newEntry,
                                                                                                                     @Nonnull
                                                                                                                     InventorySyncOptions syncOptions)
        Compares the quantityOnStock, the restockableInDays, the expectedDelivery, the supply channel and Custom fields/ type fields of an InventoryEntry and an InventoryEntryDraft. It returns a List of InventoryEntryUpdateAction as a result. If no update action is needed an empty List is returned.
        Parameters:
        oldEntry - the inventory entry which should be updated
        newEntry - the inventory entry draft that contains new data that should be applied to oldEntry
        syncOptions - the sync options wrapper which contains options related to the sync process supplied by the user. For example, custom callbacks to call in case of warnings or errors occurring on the build update action process. And other options (See BaseSyncOptions for more info.
        Returns:
        list containing InventoryEntryUpdateAction that need to be performed on oldEntry resource so that it will be synced with newEntry or empty list when both entries are already in sync.