Class InventoryTransformUtils


  • public final class InventoryTransformUtils
    extends java.lang.Object
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.util.concurrent.CompletableFuture<java.util.List<com.commercetools.api.models.inventory.InventoryEntryDraft>> toInventoryEntryDrafts​(com.commercetools.api.client.ProjectApiRoot client, ReferenceIdToKeyCache referenceIdToKeyCache, java.util.List<com.commercetools.api.models.inventory.InventoryEntry> inventoryEntries)
      Transforms InventoryEntries by resolving the references and map them to InventoryEntryDrafts.
      • Methods inherited from class java.lang.Object

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

      • InventoryTransformUtils

        public InventoryTransformUtils()
    • Method Detail

      • toInventoryEntryDrafts

        @Nonnull
        public static java.util.concurrent.CompletableFuture<java.util.List<com.commercetools.api.models.inventory.InventoryEntryDraft>> toInventoryEntryDrafts​(@Nonnull
                                                                                                                                                                com.commercetools.api.client.ProjectApiRoot client,
                                                                                                                                                                @Nonnull
                                                                                                                                                                ReferenceIdToKeyCache referenceIdToKeyCache,
                                                                                                                                                                @Nonnull
                                                                                                                                                                java.util.List<com.commercetools.api.models.inventory.InventoryEntry> inventoryEntries)
        Transforms InventoryEntries by resolving the references and map them to InventoryEntryDrafts.

        This method resolves(fetch key values for the reference id's) non null and unexpanded references of the InventoryEntryInventoryEntry by using cache.

        If the reference ids are already cached, key values are pulled from the cache, otherwise it executes the query to fetch the key value for the reference id's and store the idToKey value pair in the cache for reuse.

        Then maps the InventoryEntry to InventoryEntryDraft by performing reference resolution considering idToKey value from the cache.

        Parameters:
        client - commercetools client.
        referenceIdToKeyCache - the instance that manages cache.
        inventoryEntries - the inventoryEntries to resolve the references.
        Returns:
        a new list which contains InventoryEntryDrafts which have all their references resolved.