Class ProductTypeUpdateActionUtils
- java.lang.Object
-
- com.commercetools.sync.producttypes.utils.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 aProductTypeand aProductTypeDraftand returns a list ofUpdateAction<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 thedescriptionvalues of aProductTypeand aProductTypeDraftand returns anOptionalof 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 thenamevalues of aProductTypeand aProductTypeDraftand returns anOptionalof update action, which would contain the"changeName"UpdateAction.
-
-
-
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 thenamevalues of aProductTypeand aProductTypeDraftand returns anOptionalof update action, which would contain the"changeName"UpdateAction. If bothProductTypeandProductTypeDrafthave the samenamevalues, 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 thedescriptionvalues of aProductTypeand aProductTypeDraftand returns anOptionalof update action, which would contain the"changeDescription"UpdateAction. If bothProductTypeandProductTypeDrafthave the samedescriptionvalues, 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 aProductTypeand aProductTypeDraftand returns a list ofUpdateAction<ProductType> as a result. If both theProductTypeand theProductTypeDrafthave identical attributes, then no update action is needed and hence an emptyListis 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.
-
-