Class ShoppingListReferenceResolutionUtils
- java.lang.Object
 - 
- com.commercetools.sync.shoppinglists.utils.ShoppingListReferenceResolutionUtils
 
 
- 
public final class ShoppingListReferenceResolutionUtils extends java.lang.ObjectUtil 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 io.sphere.sdk.shoppinglists.queries.ShoppingListQuerybuildShoppingListQuery()Builds aShoppingListQueryfor fetching shopping lists from a source CTP project with only the Variants expanded for the sync: Variants of the LineItemsstatic io.sphere.sdk.shoppinglists.ShoppingListDraftmapToShoppingListDraft(io.sphere.sdk.shoppinglists.ShoppingList shoppingList, ReferenceIdToKeyCache referenceIdToKeyCache)Returns a @link ShoppingListDraft} consisting of the result of applying the mapping fromShoppingListtoShoppingListDraftwith considering reference resolution.static java.util.List<io.sphere.sdk.shoppinglists.ShoppingListDraft>mapToShoppingListDrafts(java.util.List<io.sphere.sdk.shoppinglists.ShoppingList> shoppingLists, ReferenceIdToKeyCache referenceIdToKeyCache)Returns aList<ShoppingListDraft> consisting of the results of applying the mapping fromShoppingListtoShoppingListDraftwith considering reference resolution. 
 - 
 
- 
- 
Method Detail
- 
mapToShoppingListDrafts
@Nonnull public static java.util.List<io.sphere.sdk.shoppinglists.ShoppingListDraft> mapToShoppingListDrafts(@Nonnull java.util.List<io.sphere.sdk.shoppinglists.ShoppingList> shoppingLists, @Nonnull ReferenceIdToKeyCache referenceIdToKeyCache)Returns aList<ShoppingListDraft> consisting of the results of applying the mapping fromShoppingListtoShoppingListDraftwith considering reference resolution.Mapping of Reference fields for the reference resolution Reference field from to customer Reference<Customer>ResourceIdentifier<Customer>custom.type Reference<Type>ResourceIdentifier<Type>lineItems.custom.type Set<Reference<Type>>Set<ResourceIdentifier<Type>>textLineItems.custom.type Set<Reference<Type>>Set<ResourceIdentifier<Type>>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 issues 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 
ListofShoppingListDraftbuilt from the suppliedListofShoppingList. 
 
- 
mapToShoppingListDraft
@Nonnull public static io.sphere.sdk.shoppinglists.ShoppingListDraft mapToShoppingListDraft(@Nonnull io.sphere.sdk.shoppinglists.ShoppingList shoppingList, @Nonnull ReferenceIdToKeyCache referenceIdToKeyCache)Returns a @link ShoppingListDraft} consisting of the result of applying the mapping fromShoppingListtoShoppingListDraftwith considering reference resolution.Mapping of Reference fields for the reference resolution Reference field from to customer Reference<Customer>ResourceIdentifier<Customer>custom.type Reference<Type>ResourceIdentifier<Type>lineItems.custom.type Set<Reference<Type>>Set<ResourceIdentifier<Type>>textLineItems.custom.type Set<Reference<Type>>Set<ResourceIdentifier<Type>>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 issues 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 
ShoppingListDraftbuilt from the suppliedShoppingList. 
 
- 
buildShoppingListQuery
public static io.sphere.sdk.shoppinglists.queries.ShoppingListQuery buildShoppingListQuery()
Builds aShoppingListQueryfor fetching shopping lists from a source CTP project with only the Variants expanded for the sync:- Variants of the LineItems
 
Note: Please only use this util if you desire to sync the aforementioned reference from a source commercetools project. Otherwise, it is more efficient to build the query without expansion, if it is not needed, to avoid unnecessarily bigger payloads fetched from the source project.
- Returns:
 - the query for fetching shopping lists from the source CTP project without references expanded except for Variants of the LineItems.
 
 
 - 
 
 -