public final class ProductTypeReferenceResolutionUtils
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static io.sphere.sdk.producttypes.queries.ProductTypeQuery |
buildProductTypeQuery()
Builds a
ProductTypeQuery for fetching products from a source CTP project with an expansion to the
ProductType reference of any
NestedType Attribute |
static io.sphere.sdk.producttypes.queries.ProductTypeQuery |
buildProductTypeQuery(int maximumSetDepth)
Builds a
ProductTypeQuery for fetching products from a source CTP project with an expansion to the
ProductType reference of any
NestedType Attribute and
also any SetType Attribute
that has an elementType of NestedType depending on the given maximumSetDepth will provide
an expansion for the nestedType of this set depth and all nested types of smaller depths. |
static java.util.List<io.sphere.sdk.producttypes.ProductTypeDraft> |
mapToProductTypeDrafts(java.util.List<io.sphere.sdk.producttypes.ProductType> productTypes)
Returns an
List<ProductTypeDraft> consisting of the results of applying the
mapping from ProductType to ProductTypeDraft with considering reference resolution. |
@Nonnull
public static java.util.List<io.sphere.sdk.producttypes.ProductTypeDraft> mapToProductTypeDrafts(@Nonnull
java.util.List<io.sphere.sdk.producttypes.ProductType> productTypes)
List<ProductTypeDraft> consisting of the results of applying the
mapping from ProductType to ProductTypeDraft with considering reference resolution.
| Reference field | from | to |
|---|---|---|
| productType references (in case it has NestedType or set of NestedType) | Set<Reference<ProductType>> |
Set<Reference<ProductType>> (with key replaced with id field) |
Note:If some references are not expanded for an attributeDefinition of a productType, the method will
throw a ReferenceReplacementException containing the root causes of the exceptions that occurred in any
of the supplied productTypes.
productTypes - the product types with expanded references.List of ProductTypeDraft built from the
supplied List of ProductType.@Nonnull public static io.sphere.sdk.producttypes.queries.ProductTypeQuery buildProductTypeQuery()
ProductTypeQuery for fetching products from a source CTP project with an expansion to the
ProductType reference of any
NestedType Attribute
Note: Please only use this util if you have nestedType attributes in the productTypes that you will fetch 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.
ProductType
reference of any NestedType Attribute.@Nonnull public static io.sphere.sdk.producttypes.queries.ProductTypeQuery buildProductTypeQuery(int maximumSetDepth)
ProductTypeQuery for fetching products from a source CTP project with an expansion to the
ProductType reference of any
NestedType Attribute and
also any SetType Attribute
that has an elementType of NestedType depending on the given maximumSetDepth will provide
an expansion for the nestedType of this set depth and all nested types of smaller depths. For example:
maximumSetDepth is 0, it means there is no atttribute that is a type of set of nestedType.
Therefore, the built query will have the following expansion paths:maximumSetDepth is 1, it means the maximum nesting of sets is set of a NestedType.
Therefore, the built query will have the following expansion paths:maximumSetDepth is 2, it means the maximum nesting of sets is set of set of a NestedType.
Therefore, the built query will have the following expansion paths:Note: Please only use this util if you have nestedType attributes in the productTypes that you will fetch 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.
maximumSetDepth - defines the maximum nesting of SetType attributes. If there are no setType of
NestedType attributes in source productTypes then this number should be 0. If there is an
attribute of type setType of a NestedType then this number should be 1. If the maximum
nesting is a setType of a setType attribute, then this number should be 2, and so on.