Class CategoryAssetUpdateActionUtils


  • public final class CategoryAssetUpdateActionUtils
    extends java.lang.Object
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.util.List<com.commercetools.api.models.category.CategoryUpdateAction> buildActions​(com.commercetools.api.models.category.CategoryDraft newResource, com.commercetools.api.models.common.Asset oldAsset, com.commercetools.api.models.common.AssetDraft newAsset, CategorySyncOptions syncOptions)
      Compares all the fields of an Asset and an AssetDraft and returns a list of CategoryUpdateAction as a result.
      static java.util.Optional<com.commercetools.api.models.category.CategoryUpdateAction> buildChangeAssetNameUpdateAction​(com.commercetools.api.models.common.Asset oldAsset, com.commercetools.api.models.common.AssetDraft newAsset)
      Compares the LocalizedString names of an Asset and an AssetDraft and returns an CategoryUpdateAction as a result in an Optional.
      static java.util.List<com.commercetools.api.models.category.CategoryUpdateAction> buildCustomUpdateActions​(com.commercetools.api.models.category.CategoryDraft newCategory, com.commercetools.api.models.common.Asset oldAsset, com.commercetools.api.models.common.AssetDraft newAsset, CategorySyncOptions syncOptions)
      Compares the custom fields and custom types of an Asset and an AssetDraft and returns a list of CategoryUpdateAction as a result.
      static java.util.Optional<com.commercetools.api.models.category.CategoryUpdateAction> buildSetAssetDescriptionUpdateAction​(com.commercetools.api.models.common.Asset oldAsset, com.commercetools.api.models.common.AssetDraft newAsset)
      Compares the LocalizedString descriptions of an Asset and an AssetDraft and returns an CategoryUpdateAction as a result in an Optional.
      static java.util.Optional<com.commercetools.api.models.category.CategoryUpdateAction> buildSetAssetSourcesUpdateAction​(com.commercetools.api.models.common.Asset oldAsset, com.commercetools.api.models.common.AssetDraft newAsset)
      Compares the sources of an Asset and an AssetDraft and returns an CategoryUpdateAction as a result in an Optional.
      static java.util.Optional<com.commercetools.api.models.category.CategoryUpdateAction> buildSetAssetTagsUpdateAction​(com.commercetools.api.models.common.Asset oldAsset, com.commercetools.api.models.common.AssetDraft newAsset)
      Compares the tags of an Asset and an AssetDraft and returns an CategoryUpdateAction as a result in an Optional.
      • Methods inherited from class java.lang.Object

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

      • buildActions

        @Nonnull
        public static java.util.List<com.commercetools.api.models.category.CategoryUpdateAction> buildActions​(@Nonnull
                                                                                                              com.commercetools.api.models.category.CategoryDraft newResource,
                                                                                                              @Nonnull
                                                                                                              com.commercetools.api.models.common.Asset oldAsset,
                                                                                                              @Nonnull
                                                                                                              com.commercetools.api.models.common.AssetDraft newAsset,
                                                                                                              @Nonnull
                                                                                                              CategorySyncOptions syncOptions)
        Compares all the fields of an Asset and an AssetDraft and returns a list of CategoryUpdateAction as a result. If both the Asset and the AssetDraft have identical fields, then no update action is needed and hence an empty List is returned.
        Parameters:
        newResource - new mainresource draft, which contains the asset to update.
        oldAsset - the asset which should be updated.
        newAsset - the asset draft where we get the new fields.
        syncOptions - responsible for supplying the sync options to the sync utility method. It is used for triggering the error callback within the utility, in case of errors.
        Returns:
        A list with the update actions or an empty list if the asset fields are identical.
      • buildChangeAssetNameUpdateAction

        @Nonnull
        public static java.util.Optional<com.commercetools.api.models.category.CategoryUpdateAction> buildChangeAssetNameUpdateAction​(@Nonnull
                                                                                                                                      com.commercetools.api.models.common.Asset oldAsset,
                                                                                                                                      @Nonnull
                                                                                                                                      com.commercetools.api.models.common.AssetDraft newAsset)
        Compares the LocalizedString names of an Asset and an AssetDraft and returns an CategoryUpdateAction as a result in an Optional. If both the Asset and the AssetDraft have the same name, then no update action is needed and hence an empty Optional is returned.
        Parameters:
        oldAsset - the asset which should be updated.
        newAsset - the asset draft where we get the new name.
        Returns:
        A filled optional with the update action or an empty optional if the names are identical.
      • buildSetAssetDescriptionUpdateAction

        @Nonnull
        public static java.util.Optional<com.commercetools.api.models.category.CategoryUpdateAction> buildSetAssetDescriptionUpdateAction​(@Nonnull
                                                                                                                                          com.commercetools.api.models.common.Asset oldAsset,
                                                                                                                                          @Nonnull
                                                                                                                                          com.commercetools.api.models.common.AssetDraft newAsset)
        Compares the LocalizedString descriptions of an Asset and an AssetDraft and returns an CategoryUpdateAction as a result in an Optional. If both the Asset and the AssetDraft have the same description, then no update action is needed and hence an empty Optional is returned.
        Parameters:
        oldAsset - the asset which should be updated.
        newAsset - the asset draft where we get the new description.
        Returns:
        A filled optional with the update action or an empty optional if the descriptions are identical.
      • buildSetAssetTagsUpdateAction

        @Nonnull
        public static java.util.Optional<com.commercetools.api.models.category.CategoryUpdateAction> buildSetAssetTagsUpdateAction​(@Nonnull
                                                                                                                                   com.commercetools.api.models.common.Asset oldAsset,
                                                                                                                                   @Nonnull
                                                                                                                                   com.commercetools.api.models.common.AssetDraft newAsset)
        Compares the tags of an Asset and an AssetDraft and returns an CategoryUpdateAction as a result in an Optional. If both the Asset and the AssetDraft have the same tags, then no update action is needed and hence an empty Optional is returned.
        Parameters:
        oldAsset - the asset which should be updated.
        newAsset - the asset draft where we get the new tags.
        Returns:
        A filled optional with the update action or an empty optional if the tags are identical.
      • buildSetAssetSourcesUpdateAction

        @Nonnull
        public static java.util.Optional<com.commercetools.api.models.category.CategoryUpdateAction> buildSetAssetSourcesUpdateAction​(@Nonnull
                                                                                                                                      com.commercetools.api.models.common.Asset oldAsset,
                                                                                                                                      @Nonnull
                                                                                                                                      com.commercetools.api.models.common.AssetDraft newAsset)
        Compares the sources of an Asset and an AssetDraft and returns an CategoryUpdateAction as a result in an Optional. If both the Asset and the AssetDraft have the same sources, then no update action is needed and hence an empty Optional is returned.
        Parameters:
        oldAsset - the asset which should be updated.
        newAsset - the asset draft where we get the new sources.
        Returns:
        A filled optional with the update action or an empty optional if the sources are identical.
      • buildCustomUpdateActions

        @Nonnull
        public static java.util.List<com.commercetools.api.models.category.CategoryUpdateAction> buildCustomUpdateActions​(@Nonnull
                                                                                                                          com.commercetools.api.models.category.CategoryDraft newCategory,
                                                                                                                          @Nonnull
                                                                                                                          com.commercetools.api.models.common.Asset oldAsset,
                                                                                                                          @Nonnull
                                                                                                                          com.commercetools.api.models.common.AssetDraft newAsset,
                                                                                                                          @Nonnull
                                                                                                                          CategorySyncOptions syncOptions)
        Compares the custom fields and custom types of an Asset and an AssetDraft and returns a list of CategoryUpdateAction as a result. If both the Asset and the AssetDraft have identical custom fields and types, then no update action is needed and hence an empty List is returned.
        Parameters:
        newCategory - category in a source project, which contains the updated asset.
        oldAsset - the asset which should be updated.
        newAsset - the asset draft where we get the new custom fields and types.
        syncOptions - responsible for supplying the sync options to the sync utility method. It is used for triggering the error callback within the utility, in case of errors.
        Returns:
        A list with the custom field/type update actions or an empty list if the custom fields/types are identical.