Class CartDiscountReferenceResolutionUtils
- java.lang.Object
-
- com.commercetools.sync.cartdiscounts.utils.CartDiscountReferenceResolutionUtils
-
public final class CartDiscountReferenceResolutionUtils extends java.lang.Object
Util class which provides utilities that can be used when syncing resources 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.cartdiscounts.queries.CartDiscountQuery
buildCartDiscountQuery()
Builds aCartDiscountQuery
for fetching cart discounts from a source CTP project with all the needed references expanded for the sync: Custom Typestatic java.util.List<io.sphere.sdk.cartdiscounts.CartDiscountDraft>
mapToCartDiscountDrafts(java.util.List<io.sphere.sdk.cartdiscounts.CartDiscount> cartDiscounts)
Returns anList
<CartDiscountDraft
> consisting of the results of applying the mapping fromCartDiscount
toCartDiscountDraft
with considering reference resolution.
-
-
-
Method Detail
-
mapToCartDiscountDrafts
@Nonnull public static java.util.List<io.sphere.sdk.cartdiscounts.CartDiscountDraft> mapToCartDiscountDrafts(@Nonnull java.util.List<io.sphere.sdk.cartdiscounts.CartDiscount> cartDiscounts)
Returns anList
<CartDiscountDraft
> consisting of the results of applying the mapping fromCartDiscount
toCartDiscountDraft
with considering reference resolution.Mapping of Reference fields for the reference resolution Reference field from to custom.type Reference
<Type
>ResourceIdentifier
<Type
>Note: The
Type
reference should has an expanded reference with a key. Any reference that is not expanded will have its id in place and not replaced by the key 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:
cartDiscounts
- the cart discounts with expanded references.- Returns:
- a
List
ofCartDiscountDraft
built from the suppliedList
ofCartDiscount
.
-
buildCartDiscountQuery
public static io.sphere.sdk.cartdiscounts.queries.CartDiscountQuery buildCartDiscountQuery()
Builds aCartDiscountQuery
for fetching cart discounts from a source CTP project with all the needed references expanded for the sync:- Custom Type
Note: Please only use this util if you desire to sync all the aforementioned references from a source commercetools project. Otherwise, it is more efficient to build the query without expansions, if they are not needed, to avoid unnecessarily bigger payloads fetched from the source project.
- Returns:
- the query for fetching cart discounts from the source CTP project with all the aforementioned references expanded.
-
-