Class ProductVariantAssetUpdateActionUtils


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

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <D> java.util.List<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.products.Product>> buildActions​(io.sphere.sdk.models.Resource oldResource, D newResource, java.lang.Integer variantId, io.sphere.sdk.models.Asset oldAsset, io.sphere.sdk.models.AssetDraft newAsset, ProductSyncOptions syncOptions)
      Compares all the fields of an Asset and an AssetDraft and returns a list of UpdateAction<Product> as a result.
      static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.products.Product>> buildChangeAssetNameUpdateAction​(java.lang.Integer variantId, io.sphere.sdk.models.Asset oldAsset, io.sphere.sdk.models.AssetDraft newAsset)
      Compares the LocalizedString names of an Asset and an AssetDraft and returns an UpdateAction<Product> as a result in an Optional.
      static <D> java.util.List<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.products.Product>> buildCustomUpdateActions​(io.sphere.sdk.models.Resource oldResource, D newResource, java.lang.Integer variantId, io.sphere.sdk.models.Asset oldAsset, io.sphere.sdk.models.AssetDraft newAsset, ProductSyncOptions syncOptions)
      Compares the custom fields and custom types of an Asset and an AssetDraft and returns a list of UpdateAction<Product> as a result.
      static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.products.Product>> buildSetAssetDescriptionUpdateAction​(java.lang.Integer variantId, io.sphere.sdk.models.Asset oldAsset, io.sphere.sdk.models.AssetDraft newAsset)
      Compares the LocalizedString descriptions of an Asset and an AssetDraft and returns an UpdateAction<Product> as a result in an Optional.
      static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.products.Product>> buildSetAssetSourcesUpdateAction​(java.lang.Integer variantId, io.sphere.sdk.models.Asset oldAsset, io.sphere.sdk.models.AssetDraft newAsset)
      Compares the sources of an Asset and an AssetDraft and returns an UpdateAction<Product> as a result in an Optional.
      static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.products.Product>> buildSetAssetTagsUpdateAction​(java.lang.Integer variantId, io.sphere.sdk.models.Asset oldAsset, io.sphere.sdk.models.AssetDraft newAsset)
      Compares the tags of an Asset and an AssetDraft and returns an UpdateAction<Product> 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 <D> java.util.List<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.products.Product>> buildActions​(@Nonnull
                                                                                                                           io.sphere.sdk.models.Resource oldResource,
                                                                                                                           @Nonnull
                                                                                                                           D newResource,
                                                                                                                           @Nonnull
                                                                                                                           java.lang.Integer variantId,
                                                                                                                           @Nonnull
                                                                                                                           io.sphere.sdk.models.Asset oldAsset,
                                                                                                                           @Nonnull
                                                                                                                           io.sphere.sdk.models.AssetDraft newAsset,
                                                                                                                           @Nonnull
                                                                                                                           ProductSyncOptions syncOptions)
        Compares all the fields of an Asset and an AssetDraft and returns a list of UpdateAction<Product> 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.
        Type Parameters:
        D - Type of the mainresource draft
        Parameters:
        oldResource - mainresource, whose asset should be updated.
        newResource - new mainresource draft, which contains the asset to update.
        variantId - the variantId needed for building the update action.
        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<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.products.Product>> buildChangeAssetNameUpdateAction​(@Nonnull
                                                                                                                                               java.lang.Integer variantId,
                                                                                                                                               @Nonnull
                                                                                                                                               io.sphere.sdk.models.Asset oldAsset,
                                                                                                                                               @Nonnull
                                                                                                                                               io.sphere.sdk.models.AssetDraft newAsset)
        Compares the LocalizedString names of an Asset and an AssetDraft and returns an UpdateAction<Product> 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:
        variantId - the variantId needed for building the update action.
        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<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.products.Product>> buildSetAssetDescriptionUpdateAction​(@Nonnull
                                                                                                                                                   java.lang.Integer variantId,
                                                                                                                                                   @Nonnull
                                                                                                                                                   io.sphere.sdk.models.Asset oldAsset,
                                                                                                                                                   @Nonnull
                                                                                                                                                   io.sphere.sdk.models.AssetDraft newAsset)
        Compares the LocalizedString descriptions of an Asset and an AssetDraft and returns an UpdateAction<Product> 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:
        variantId - the variantId needed for building the update action.
        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<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.products.Product>> buildSetAssetTagsUpdateAction​(@Nonnull
                                                                                                                                            java.lang.Integer variantId,
                                                                                                                                            @Nonnull
                                                                                                                                            io.sphere.sdk.models.Asset oldAsset,
                                                                                                                                            @Nonnull
                                                                                                                                            io.sphere.sdk.models.AssetDraft newAsset)
        Compares the tags of an Asset and an AssetDraft and returns an UpdateAction<Product> 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:
        variantId - the variantId needed for building the update action.
        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<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.products.Product>> buildSetAssetSourcesUpdateAction​(@Nonnull
                                                                                                                                               java.lang.Integer variantId,
                                                                                                                                               @Nonnull
                                                                                                                                               io.sphere.sdk.models.Asset oldAsset,
                                                                                                                                               @Nonnull
                                                                                                                                               io.sphere.sdk.models.AssetDraft newAsset)
        Compares the sources of an Asset and an AssetDraft and returns an UpdateAction<Product> 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:
        variantId - the variantId needed for building the update action.
        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 <D> java.util.List<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.products.Product>> buildCustomUpdateActions​(@Nonnull
                                                                                                                                       io.sphere.sdk.models.Resource oldResource,
                                                                                                                                       @Nonnull
                                                                                                                                       D newResource,
                                                                                                                                       @Nonnull
                                                                                                                                       java.lang.Integer variantId,
                                                                                                                                       @Nonnull
                                                                                                                                       io.sphere.sdk.models.Asset oldAsset,
                                                                                                                                       @Nonnull
                                                                                                                                       io.sphere.sdk.models.AssetDraft newAsset,
                                                                                                                                       @Nonnull
                                                                                                                                       ProductSyncOptions syncOptions)
        Compares the custom fields and custom types of an Asset and an AssetDraft and returns a list of UpdateAction<Product> 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.
        Type Parameters:
        D - Type of the mainresource draft
        Parameters:
        oldResource - mainresource, whose asset should be updated.
        newResource - new mainresource draft, which contains the asset to update.
        variantId - the variantId needed for building the update action.
        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.