Class CategoryReferenceResolutionUtils


  • public final class CategoryReferenceResolutionUtils
    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 java.util.List<com.commercetools.api.models.category.CategoryDraft> mapToCategoryDrafts​(java.util.List<com.commercetools.api.models.category.Category> categories, ReferenceIdToKeyCache referenceIdToKeyCache)
      Returns an List<CategoryDraft> consisting of the results of applying the mapping from Category to CategoryDraft with considering reference resolution.
      • Methods inherited from class java.lang.Object

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

      • mapToCategoryDrafts

        @Nonnull
        public static java.util.List<com.commercetools.api.models.category.CategoryDraft> mapToCategoryDrafts​(@Nonnull
                                                                                                              java.util.List<com.commercetools.api.models.category.Category> categories,
                                                                                                              @Nonnull
                                                                                                              ReferenceIdToKeyCache referenceIdToKeyCache)
        Returns an List<CategoryDraft> consisting of the results of applying the mapping from Category to CategoryDraft with considering reference resolution.
        Mapping of Reference fields for the reference resolution
        Reference field from to
        parent CategoryReference CategoryResourceIdentifier
        custom.type TypeReference TypeResourceIdentifier
        asset.custom.type TypeReference TypeResourceIdentifier

        Note: The Category and Type references should contain Id in the map(cache) with a key value. Any reference that is not available in the map will have its id in place and not replaced by the key. 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:
        categories - the categories without expansion of references.
        referenceIdToKeyCache - the instance that manages cache.
        Returns:
        a List of CategoryDraft built from the supplied List of Category.