Class CategoryUpdateActionUtils


  • public final class CategoryUpdateActionUtils
    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> buildAssetsUpdateActions​(com.commercetools.api.models.category.Category oldCategory, com.commercetools.api.models.category.CategoryDraft newCategory, CategorySyncOptions syncOptions)
      Compares the assets of a Category and a CategoryDraft and returns a list of CategoryUpdateAction as a result.
      static java.util.Optional<com.commercetools.api.models.category.CategoryUpdateAction> buildChangeNameUpdateAction​(com.commercetools.api.models.category.Category oldCategory, com.commercetools.api.models.category.CategoryDraft newCategory)
      Compares the LocalizedString names of a Category and a CategoryDraft and returns an CategoryUpdateAction as a result in an Optional.
      static java.util.Optional<com.commercetools.api.models.category.CategoryUpdateAction> buildChangeOrderHintUpdateAction​(com.commercetools.api.models.category.Category oldCategory, com.commercetools.api.models.category.CategoryDraft newCategory, CategorySyncOptions syncOptions)
      Compares the orderHint values of a Category and a CategoryDraft and returns an CategoryUpdateAction as a result in an Optional.
      static java.util.Optional<com.commercetools.api.models.category.CategoryUpdateAction> buildChangeParentUpdateAction​(com.commercetools.api.models.category.Category oldCategory, com.commercetools.api.models.category.CategoryDraft newCategory, CategorySyncOptions syncOptions)
      Compares the parents CategoryReference of a Category and a CategoryDraft and returns an CategoryUpdateAction as a result in an Optional.
      static java.util.Optional<com.commercetools.api.models.category.CategoryUpdateAction> buildChangeSlugUpdateAction​(com.commercetools.api.models.category.Category oldCategory, com.commercetools.api.models.category.CategoryDraft newCategory)
      Compares the LocalizedString slugs of a Category and a CategoryDraft and returns an CategoryUpdateAction as a result in an Optional.
      static java.util.Optional<com.commercetools.api.models.category.CategoryUpdateAction> buildSetDescriptionUpdateAction​(com.commercetools.api.models.category.Category oldCategory, com.commercetools.api.models.category.CategoryDraft newCategory)
      Compares the LocalizedString descriptions of a Category and a CategoryDraft and returns an CategoryUpdateAction as a result in an Optional.
      static java.util.Optional<com.commercetools.api.models.category.CategoryUpdateAction> buildSetExternalIdUpdateAction​(com.commercetools.api.models.category.Category oldCategory, com.commercetools.api.models.category.CategoryDraft newCategory)
      Compares the externalId values of a Category and a CategoryDraft and returns an CategoryUpdateAction as a result in an Optional.
      static java.util.Optional<com.commercetools.api.models.category.CategoryUpdateAction> buildSetMetaDescriptionUpdateAction​(com.commercetools.api.models.category.Category oldCategory, com.commercetools.api.models.category.CategoryDraft newCategory)
      Compares the LocalizedString meta description of a Category and a CategoryDraft and returns an CategoryUpdateAction as a result in an Optional.
      static java.util.Optional<com.commercetools.api.models.category.CategoryUpdateAction> buildSetMetaKeywordsUpdateAction​(com.commercetools.api.models.category.Category oldCategory, com.commercetools.api.models.category.CategoryDraft newCategory)
      Compares the LocalizedString meta keywords of a Category and a CategoryDraft and returns an CategoryUpdateAction as a result in an Optional.
      static java.util.Optional<com.commercetools.api.models.category.CategoryUpdateAction> buildSetMetaTitleUpdateAction​(com.commercetools.api.models.category.Category oldCategory, com.commercetools.api.models.category.CategoryDraft newCategory)
      Compares the LocalizedString meta title of a Category and a CategoryDraft 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

      • buildChangeNameUpdateAction

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

        @Nonnull
        public static java.util.Optional<com.commercetools.api.models.category.CategoryUpdateAction> buildChangeSlugUpdateAction​(@Nonnull
                                                                                                                                 com.commercetools.api.models.category.Category oldCategory,
                                                                                                                                 @Nonnull
                                                                                                                                 com.commercetools.api.models.category.CategoryDraft newCategory)
        Compares the LocalizedString slugs of a Category and a CategoryDraft and returns an CategoryUpdateAction as a result in an Optional. If both the Category and the CategoryDraft have the same slug, then no update action is needed and hence an empty Optional is returned.
        Parameters:
        oldCategory - the category which should be updated.
        newCategory - the category draft where we get the new slug.
        Returns:
        A filled optional with the update action or an empty optional if the slugs are identical.
      • buildSetDescriptionUpdateAction

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

        @Nonnull
        public static java.util.Optional<com.commercetools.api.models.category.CategoryUpdateAction> buildChangeParentUpdateAction​(@Nonnull
                                                                                                                                   com.commercetools.api.models.category.Category oldCategory,
                                                                                                                                   @Nonnull
                                                                                                                                   com.commercetools.api.models.category.CategoryDraft newCategory,
                                                                                                                                   @Nonnull
                                                                                                                                   CategorySyncOptions syncOptions)
        Compares the parents CategoryReference of a Category and a CategoryDraft and returns an CategoryUpdateAction as a result in an Optional. If both the Category and the CategoryDraft have the same parents, then no update action is needed and hence an empty Optional is returned.

        Note: If the parent CategoryReference of the new CategoryDraft is null, an empty Optional is returned with no update actions and a custom callback function, if set on the supplied CategorySyncOptions, is called.

        Parameters:
        oldCategory - the category which should be updated.
        newCategory - the category draft where we get the new parent.
        syncOptions - the sync syncOptions with which a custom callback function is called in case the parent is null.
        Returns:
        A filled optional with the update action or an empty optional if the parent references are identical.
      • buildChangeOrderHintUpdateAction

        @Nonnull
        public static java.util.Optional<com.commercetools.api.models.category.CategoryUpdateAction> buildChangeOrderHintUpdateAction​(@Nonnull
                                                                                                                                      com.commercetools.api.models.category.Category oldCategory,
                                                                                                                                      @Nonnull
                                                                                                                                      com.commercetools.api.models.category.CategoryDraft newCategory,
                                                                                                                                      @Nonnull
                                                                                                                                      CategorySyncOptions syncOptions)
        Compares the orderHint values of a Category and a CategoryDraft and returns an CategoryUpdateAction as a result in an Optional. If both the Category and the CategoryDraft have the same orderHint, then no update action is needed and hence an empty Optional is returned.

        Note: If the orderHint of the new CategoryDraft is null, an empty Optional is returned with no update actions and a custom callback function, if set on the supplied CategorySyncOptions, is called.

        Parameters:
        oldCategory - the category which should be updated.
        newCategory - the category draft where we get the new orderHint.
        syncOptions - the sync syncOptions with which a custom callback function is called in case the orderHint is null.
        Returns:
        A filled optional with the update action or an empty optional if the orderHint values are identical.
      • buildSetMetaTitleUpdateAction

        @Nonnull
        public static java.util.Optional<com.commercetools.api.models.category.CategoryUpdateAction> buildSetMetaTitleUpdateAction​(@Nonnull
                                                                                                                                   com.commercetools.api.models.category.Category oldCategory,
                                                                                                                                   @Nonnull
                                                                                                                                   com.commercetools.api.models.category.CategoryDraft newCategory)
        Compares the LocalizedString meta title of a Category and a CategoryDraft and returns an CategoryUpdateAction as a result in an Optional. If both the Category and the CategoryDraft have the same meta title, then no update action is needed and hence an empty Optional is returned.
        Parameters:
        oldCategory - the category which should be updated.
        newCategory - the category draft where we get the new meta title.
        Returns:
        A filled optional with the update action or an empty optional if the meta titles values are identical.
      • buildSetMetaKeywordsUpdateAction

        @Nonnull
        public static java.util.Optional<com.commercetools.api.models.category.CategoryUpdateAction> buildSetMetaKeywordsUpdateAction​(@Nonnull
                                                                                                                                      com.commercetools.api.models.category.Category oldCategory,
                                                                                                                                      @Nonnull
                                                                                                                                      com.commercetools.api.models.category.CategoryDraft newCategory)
        Compares the LocalizedString meta keywords of a Category and a CategoryDraft and returns an CategoryUpdateAction as a result in an Optional. If both the Category and the CategoryDraft have the same meta keywords, then no update action is needed and hence an empty Optional is returned.
        Parameters:
        oldCategory - the category which should be updated.
        newCategory - the category draft where we get the new meta keywords.
        Returns:
        A filled optional with the update action or an empty optional if the meta keywords values are identical.
      • buildSetMetaDescriptionUpdateAction

        @Nonnull
        public static java.util.Optional<com.commercetools.api.models.category.CategoryUpdateAction> buildSetMetaDescriptionUpdateAction​(@Nonnull
                                                                                                                                         com.commercetools.api.models.category.Category oldCategory,
                                                                                                                                         @Nonnull
                                                                                                                                         com.commercetools.api.models.category.CategoryDraft newCategory)
        Compares the LocalizedString meta description of a Category and a CategoryDraft and returns an CategoryUpdateAction as a result in an Optional. If both the Category and the CategoryDraft have the same meta description, then no update action is needed and hence an empty Optional is returned.
        Parameters:
        oldCategory - the category which should be updated.
        newCategory - the category draft where we get the new meta description.
        Returns:
        A filled optional with the update action or an empty optional if the meta description values are identical.
      • buildSetExternalIdUpdateAction

        @Nonnull
        public static java.util.Optional<com.commercetools.api.models.category.CategoryUpdateAction> buildSetExternalIdUpdateAction​(@Nonnull
                                                                                                                                    com.commercetools.api.models.category.Category oldCategory,
                                                                                                                                    @Nonnull
                                                                                                                                    com.commercetools.api.models.category.CategoryDraft newCategory)
        Compares the externalId values of a Category and a CategoryDraft and returns an CategoryUpdateAction as a result in an Optional. If both the Category and the CategoryDraft have the same externalId, then no update action is needed and hence an empty Optional is returned.
        Parameters:
        oldCategory - the category which should be updated.
        newCategory - the category draft where we get the new externalId.
        Returns:
        A filled optional with the update action or an empty optional if the externalId values are identical.
      • buildAssetsUpdateActions

        @Nonnull
        public static java.util.List<com.commercetools.api.models.category.CategoryUpdateAction> buildAssetsUpdateActions​(@Nonnull
                                                                                                                          com.commercetools.api.models.category.Category oldCategory,
                                                                                                                          @Nonnull
                                                                                                                          com.commercetools.api.models.category.CategoryDraft newCategory,
                                                                                                                          @Nonnull
                                                                                                                          CategorySyncOptions syncOptions)
        Compares the assets of a Category and a CategoryDraft and returns a list of CategoryUpdateAction as a result. If both the Category and the CategoryDraft have the identical assets, then no update action is needed and hence an empty List is returned. In case, the new category draft has a list of assets in which a duplicate key exists, the error callback is triggered and an empty list is returned.
        Parameters:
        oldCategory - the category which should be updated.
        newCategory - the category draft where we get the new externalId.
        syncOptions - the sync options with which a custom callback function is called in case errors exists while building assets custom field/type actions.
        Returns:
        A list with the update actions or an empty list if the assets are identical.