Class ProductTypeUpdateActionUtils


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

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.util.List<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.producttypes.ProductType>> buildAttributesUpdateActions​(io.sphere.sdk.producttypes.ProductType oldProductType, io.sphere.sdk.producttypes.ProductTypeDraft newProductType, ProductTypeSyncOptions syncOptions)
      Compares the attributes of a ProductType and a ProductTypeDraft and returns a list of UpdateAction<ProductType> as a result.
      static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.producttypes.ProductType>> buildChangeDescriptionAction​(io.sphere.sdk.producttypes.ProductType oldProductType, io.sphere.sdk.producttypes.ProductTypeDraft newProductType)
      Compares the description values of a ProductType and a ProductTypeDraft and returns an Optional of update action, which would contain the "changeDescription" UpdateAction.
      static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.producttypes.ProductType>> buildChangeNameAction​(io.sphere.sdk.producttypes.ProductType oldProductType, io.sphere.sdk.producttypes.ProductTypeDraft newProductType)
      Compares the name values of a ProductType and a ProductTypeDraft and returns an Optional of update action, which would contain the "changeName" UpdateAction.
      • Methods inherited from class java.lang.Object

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

      • buildChangeNameAction

        @Nonnull
        public static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.producttypes.ProductType>> buildChangeNameAction​(@Nonnull
                                                                                                                                            io.sphere.sdk.producttypes.ProductType oldProductType,
                                                                                                                                            @Nonnull
                                                                                                                                            io.sphere.sdk.producttypes.ProductTypeDraft newProductType)
        Compares the name values of a ProductType and a ProductTypeDraft and returns an Optional of update action, which would contain the "changeName" UpdateAction. If both ProductType and ProductTypeDraft have the same name values, then no update action is needed and empty optional will be returned.
        Parameters:
        oldProductType - the product type that should be updated.
        newProductType - the product type draft which contains the new name.
        Returns:
        optional containing update action or empty optional if names are identical.
      • buildChangeDescriptionAction

        @Nonnull
        public static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.producttypes.ProductType>> buildChangeDescriptionAction​(@Nonnull
                                                                                                                                                   io.sphere.sdk.producttypes.ProductType oldProductType,
                                                                                                                                                   @Nonnull
                                                                                                                                                   io.sphere.sdk.producttypes.ProductTypeDraft newProductType)
        Compares the description values of a ProductType and a ProductTypeDraft and returns an Optional of update action, which would contain the "changeDescription" UpdateAction. If both ProductType and ProductTypeDraft have the same description values, then no update action is needed and empty optional will be returned.
        Parameters:
        oldProductType - the product type that should be updated.
        newProductType - the product type draft which contains the new description.
        Returns:
        optional containing update action or empty optional if descriptions are identical.
      • buildAttributesUpdateActions

        @Nonnull
        public static java.util.List<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.producttypes.ProductType>> buildAttributesUpdateActions​(@Nonnull
                                                                                                                                               io.sphere.sdk.producttypes.ProductType oldProductType,
                                                                                                                                               @Nonnull
                                                                                                                                               io.sphere.sdk.producttypes.ProductTypeDraft newProductType,
                                                                                                                                               @Nonnull
                                                                                                                                               ProductTypeSyncOptions syncOptions)
        Compares the attributes of a ProductType and a ProductTypeDraft and returns a list of UpdateAction<ProductType> as a result. If both the ProductType and the ProductTypeDraft have identical attributes, then no update action is needed and hence an empty List is returned. In case, the new product type draft has a list of attributes in which a duplicate name exists, the error callback is triggered and an empty list is returned.
        Parameters:
        oldProductType - the product type which should be updated.
        newProductType - the product type draft where we get the key.
        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 attributes are identical.