public final class SyncUtils
extends java.lang.Object
| Constructor and Description |
|---|
SyncUtils() |
| Modifier and Type | Method and Description |
|---|---|
static <T> java.util.List<java.util.List<T>> |
batchDrafts(java.util.List<T> drafts,
int batchSize)
Given a list of resource (e.g.
|
static io.sphere.sdk.products.ProductDraftBuilder |
getDraftBuilderFromStagedProduct(io.sphere.sdk.products.Product product)
Given a
Product this method creates a ProductDraftBuilder based on the staged projection
values of the supplied product. |
static java.util.List<io.sphere.sdk.categories.CategoryDraft> |
replaceCategoriesReferenceIdsWithKeys(java.util.List<io.sphere.sdk.categories.Category> categories)
Takes a list of Categories that are supposed to have their custom type and parent category reference expanded
in order to be able to fetch the keys and replace the reference ids with the corresponding keys and then return
a new list of category drafts with their references containing keys instead of the ids.
|
static io.sphere.sdk.products.CategoryOrderHints |
replaceCategoryOrderHintCategoryIdsWithKeys(io.sphere.sdk.products.CategoryOrderHints categoryOrderHints,
java.util.Set<io.sphere.sdk.models.ResourceIdentifier<io.sphere.sdk.categories.Category>> categoryResourceIdentifiers)
Given a
CategoryOrderHints instance and a set of Category ResourceIdentifier, this method
replaces all the categoryOrderHint ids with the Category keys. |
static java.util.List<io.sphere.sdk.inventory.InventoryEntryDraft> |
replaceInventoriesReferenceIdsWithKeys(java.util.List<io.sphere.sdk.inventory.InventoryEntry> inventoryEntries)
Takes a list of inventoryEntries that are supposed to have their custom type reference expanded
in order to be able to fetch the keys and replace the reference ids with the corresponding keys and then return
a new list of inventory entry drafts with their references containing keys instead of the ids.
|
static io.sphere.sdk.products.ProductDraft |
replaceProductDraftCategoryReferenceIdsWithKeys(io.sphere.sdk.products.ProductDraft productDraft)
Takes a product draft that is supposed to have its category references expanded
in order to be able to fetch the keys and replace the reference ids with the corresponding keys and then return
a new product drafts with the references containing keys instead of the ids.
|
static java.util.List<io.sphere.sdk.products.ProductDraft> |
replaceProductDraftsCategoryReferenceIdsWithKeys(java.util.List<io.sphere.sdk.products.ProductDraft> productDrafts)
Takes a list of product drafts that are supposed to have their category references expanded in order to be able
to fetch the keys and replace the reference ids with the corresponding keys and then return a new list of product
drafts with their references containing keys instead of the ids.
|
static java.util.List<io.sphere.sdk.products.ProductDraft> |
replaceProductsReferenceIdsWithKeys(java.util.List<io.sphere.sdk.products.Product> products)
Takes a list of Products that are supposed to have their product type and category references expanded
in order to be able to fetch the keys and replace the reference ids with the corresponding keys and then return
a new list of product drafts with their references containing keys instead of the ids.
|
public static <T> java.util.List<java.util.List<T>> batchDrafts(@Nonnull
java.util.List<T> drafts,
int batchSize)
batchSize, this method separates
the drafts into batches with the batchSize. Each batch is represented by a
List of resources and all the batches are grouped and represented by an
List<List> of resources, which is returned by the method.T - the type of the draft resources.drafts - the list of drafts to split into batches.batchSize - the size of each batch.@Nonnull
public static java.util.List<io.sphere.sdk.categories.CategoryDraft> replaceCategoriesReferenceIdsWithKeys(@Nonnull
java.util.List<io.sphere.sdk.categories.Category> categories)
categories - the categories to replace their reference ids with keys@Nonnull
public static java.util.List<io.sphere.sdk.inventory.InventoryEntryDraft> replaceInventoriesReferenceIdsWithKeys(@Nonnull
java.util.List<io.sphere.sdk.inventory.InventoryEntry> inventoryEntries)
inventoryEntries - the inventory entries to replace their reference ids with keys@Nonnull
public static java.util.List<io.sphere.sdk.products.ProductDraft> replaceProductsReferenceIdsWithKeys(@Nonnull
java.util.List<io.sphere.sdk.products.Product> products)
products - the products to replace their reference ids with keys@Nonnull
public static java.util.List<io.sphere.sdk.products.ProductDraft> replaceProductDraftsCategoryReferenceIdsWithKeys(@Nonnull
java.util.List<io.sphere.sdk.products.ProductDraft> productDrafts)
productDrafts - the product drafts to replace their reference ids with keys@Nonnull
public static io.sphere.sdk.products.ProductDraft replaceProductDraftCategoryReferenceIdsWithKeys(@Nonnull
io.sphere.sdk.products.ProductDraft productDraft)
productDraft - the product drafts to replace its reference ids with keys@Nonnull
public static io.sphere.sdk.products.CategoryOrderHints replaceCategoryOrderHintCategoryIdsWithKeys(@Nonnull
io.sphere.sdk.products.CategoryOrderHints categoryOrderHints,
@Nonnull
java.util.Set<io.sphere.sdk.models.ResourceIdentifier<io.sphere.sdk.categories.Category>> categoryResourceIdentifiers)
CategoryOrderHints instance and a set of Category ResourceIdentifier, this method
replaces all the categoryOrderHint ids with the Category keys.
TODO: EITHER TO BE MOVED INTO IT UTILS OR REUSED IN #replaceProductDraftCategoryReferenceIdsWithKeys.categoryOrderHints - the categoryOrderHints that should have its keys replaced with ids.categoryResourceIdentifiers - the category resource identifiers which contains the ids and keys of the
categories.CategoryOrderHints instance with keys replacing the category ids.@Nonnull
public static io.sphere.sdk.products.ProductDraftBuilder getDraftBuilderFromStagedProduct(@Nonnull
io.sphere.sdk.products.Product product)
Product this method creates a ProductDraftBuilder based on the staged projection
values of the supplied product.product - the product to create a ProductDraftBuilder based on it's staged data.ProductDraftBuilder based on the staged projection values of the supplied product.