Class ShoppingListReferenceResolutionUtils


  • public final class ShoppingListReferenceResolutionUtils
    extends java.lang.Object
    Util class which provides utilities that can be used when syncing shopping lists from a source commercetools project to a target one.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static com.commercetools.api.models.shopping_list.ShoppingListDraft mapToShoppingListDraft​(com.commercetools.api.models.shopping_list.ShoppingList shoppingList, ReferenceIdToKeyCache referenceIdToKeyCache)
      Returns a @link ShoppingListDraft} consisting of the result of applying the mapping from ShoppingList to ShoppingListDraft with considering reference resolution.
      static java.util.List<com.commercetools.api.models.shopping_list.ShoppingListDraft> mapToShoppingListDrafts​(java.util.List<com.commercetools.api.models.shopping_list.ShoppingList> shoppingLists, ReferenceIdToKeyCache referenceIdToKeyCache)
      Returns a List<ShoppingListDraft> consisting of the results of applying the mapping from ShoppingList to ShoppingListDraft with considering reference resolution.
      • Methods inherited from class java.lang.Object

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

      • mapToShoppingListDrafts

        @Nonnull
        public static java.util.List<com.commercetools.api.models.shopping_list.ShoppingListDraft> mapToShoppingListDrafts​(@Nonnull
                                                                                                                           java.util.List<com.commercetools.api.models.shopping_list.ShoppingList> shoppingLists,
                                                                                                                           @Nonnull
                                                                                                                           ReferenceIdToKeyCache referenceIdToKeyCache)
        Returns a List<ShoppingListDraft> consisting of the results of applying the mapping from ShoppingList to ShoppingListDraft with considering reference resolution.
        Mapping of Reference fields for the reference resolution
        Reference field from to
        customer CustomerReference CustomerResourceIdentifier
        custom.type TypeReference TypeResourceIdentifier
        lineItems.custom.type List<TypeReference> List<TypeResourceIdentifier>
        textLineItems.custom.type List<TypeReference> List<TypeResourceIdentifier>

        Note: The aforementioned references should contain ID in the map(cache) with a key value. Any reference, which have its id in place and not replaced by the key, it would not be found in the map. In this case, this reference will be considered as existing resources on the target commercetools project and the library will issue an update/create API request without reference resolution.

        Parameters:
        shoppingLists - the shopping lists without expansion of references.
        referenceIdToKeyCache - the instance that manages cache.
        Returns:
        a List of ShoppingListDraft built from the supplied List of ShoppingList.
      • mapToShoppingListDraft

        @Nonnull
        public static com.commercetools.api.models.shopping_list.ShoppingListDraft mapToShoppingListDraft​(@Nonnull
                                                                                                          com.commercetools.api.models.shopping_list.ShoppingList shoppingList,
                                                                                                          @Nonnull
                                                                                                          ReferenceIdToKeyCache referenceIdToKeyCache)
        Returns a @link ShoppingListDraft} consisting of the result of applying the mapping from ShoppingList to ShoppingListDraft with considering reference resolution.
        Mapping of Reference fields for the reference resolution
        Reference field from to
        customer CustomerReference CustomerResourceIdentifier
        custom.type TypeReference TypeResourceIdentifier
        lineItems.custom.type List<TypeReference> List<TypeResourceIdentifier>
        textLineItems.custom.type List<TypeReference> List<TypeResourceIdentifier>

        Note: The aforementioned references should contain ID in the map(cache) with a key value. Any reference, which have its id in place and not replaced by the key, it would not be found in the map. In this case, this reference will be considered as existing resources on the target commercetools project and the library will issue an update/create API request without reference resolution.

        Parameters:
        shoppingList - the shopping list without expansion of references.
        referenceIdToKeyCache - the instance that manages cache.
        Returns:
        a ShoppingListDraft built from the supplied ShoppingList.