Class UpdateActionsSortUtils


  • public final class UpdateActionsSortUtils
    extends java.lang.Object
    This class is only meant for the internal use of the commercetools-sync-java library.
    • 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.products.Product>> sortPriceActions​(java.util.List<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.products.Product>> updateActions)
      Given a list of update actions, this method returns a copy of the supplied list but sorted with the following precedence: RemovePrice ChangePrice or SetProductPriceCustomType or SetProductPriceCustomField AddPrice
      • Methods inherited from class java.lang.Object

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

      • sortPriceActions

        @Nonnull
        public static java.util.List<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.products.Product>> sortPriceActions​(@Nonnull
                                                                                                                           java.util.List<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.products.Product>> updateActions)
        Given a list of update actions, this method returns a copy of the supplied list but sorted with the following precedence:
        1. RemovePrice
        2. ChangePrice or SetProductPriceCustomType or SetProductPriceCustomField
        3. AddPrice

        This is to ensure that there are no conflicts when adding a new price that might have a duplicate value for a unique field, which could already be changed or removed.

        Parameters:
        updateActions - list of update actions to sort.
        Returns:
        a new sorted list of update actions (remove, change, add).