Class CustomerUpdateActionUtils


  • public final class CustomerUpdateActionUtils
    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.customers.Customer>> buildAddAddressUpdateActions​(io.sphere.sdk.customers.Customer oldCustomer, io.sphere.sdk.customers.CustomerDraft newCustomer)
      Compares the List of a CustomerDraft.getAddresses() and a Customer.getAddresses().
      static java.util.List<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> buildAddBillingAddressUpdateActions​(io.sphere.sdk.customers.Customer oldCustomer, io.sphere.sdk.customers.CustomerDraft newCustomer)
      Compares the List of a Customer.getBillingAddresses() and a CustomerDraft.getBillingAddresses().
      static java.util.List<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> buildAddShippingAddressUpdateActions​(io.sphere.sdk.customers.Customer oldCustomer, io.sphere.sdk.customers.CustomerDraft newCustomer)
      Compares the List of a Customer.getShippingAddresses() and a CustomerDraft.getShippingAddresses().
      static java.util.List<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> buildAddStoreUpdateActions​(java.util.List<io.sphere.sdk.models.KeyReference<io.sphere.sdk.stores.Store>> oldStores, java.util.List<io.sphere.sdk.models.ResourceIdentifier<io.sphere.sdk.stores.Store>> newStores)
      Compares the List of Store KeyReferences and Store ResourceIdentifiers of a CustomerDraft and a Customer.
      static java.util.List<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> buildAllAddressUpdateActions​(io.sphere.sdk.customers.Customer oldCustomer, io.sphere.sdk.customers.CustomerDraft newCustomer)
      Compares the addresses of a Customer and a CustomerDraft.
      static java.util.List<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> buildChangeAddressUpdateActions​(io.sphere.sdk.customers.Customer oldCustomer, io.sphere.sdk.customers.CustomerDraft newCustomer)
      Compares the List of a CustomerDraft.getAddresses() and a Customer.getAddresses().
      static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> buildChangeEmailUpdateAction​(io.sphere.sdk.customers.Customer oldCustomer, io.sphere.sdk.customers.CustomerDraft newCustomer)
      Compares the email values of a Customer and a CustomerDraft and returns an Optional of update action, which would contain the "changeEmail" UpdateAction.
      static java.util.List<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> buildRemoveAddressUpdateActions​(io.sphere.sdk.customers.Customer oldCustomer, io.sphere.sdk.customers.CustomerDraft newCustomer)
      Compares the List of a CustomerDraft.getAddresses() and a Customer.getAddresses().
      static java.util.List<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> buildRemoveBillingAddressUpdateActions​(io.sphere.sdk.customers.Customer oldCustomer, io.sphere.sdk.customers.CustomerDraft newCustomer)
      Compares the List of a Customer.getBillingAddresses() and a CustomerDraft.getBillingAddresses().
      static java.util.List<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> buildRemoveShippingAddressUpdateActions​(io.sphere.sdk.customers.Customer oldCustomer, io.sphere.sdk.customers.CustomerDraft newCustomer)
      Compares the List of a Customer.getShippingAddresses() and a CustomerDraft.getShippingAddresses().
      static java.util.List<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> buildRemoveStoreUpdateActions​(java.util.List<io.sphere.sdk.models.KeyReference<io.sphere.sdk.stores.Store>> oldStores, java.util.List<io.sphere.sdk.models.ResourceIdentifier<io.sphere.sdk.stores.Store>> newStores)
      Compares the List of Store KeyReferences and Store ResourceIdentifiers of a CustomerDraft and a Customer.
      static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> buildSetCompanyNameUpdateAction​(io.sphere.sdk.customers.Customer oldCustomer, io.sphere.sdk.customers.CustomerDraft newCustomer)
      Compares the companyName values of a Customer and a CustomerDraft and returns an Optional of update action, which would contain the "setCompanyName" UpdateAction.
      static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> buildSetCustomerGroupUpdateAction​(io.sphere.sdk.customers.Customer oldCustomer, io.sphere.sdk.customers.CustomerDraft newCustomer)
      Compares the CustomerGroup references of an old Customer and new CustomerDraft.
      static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> buildSetCustomerNumberUpdateAction​(io.sphere.sdk.customers.Customer oldCustomer, io.sphere.sdk.customers.CustomerDraft newCustomer, CustomerSyncOptions syncOptions)
      Compares the customerNumber values of a Customer and a CustomerDraft and returns an Optional of update action, which would contain the "setCustomerNumber" UpdateAction.
      static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> buildSetDateOfBirthUpdateAction​(io.sphere.sdk.customers.Customer oldCustomer, io.sphere.sdk.customers.CustomerDraft newCustomer)
      Compares the dateOfBirth values of a Customer and a CustomerDraft and returns an Optional of update action, which would contain the "setDateOfBirth" UpdateAction.
      static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> buildSetDefaultBillingAddressUpdateAction​(io.sphere.sdk.customers.Customer oldCustomer, io.sphere.sdk.customers.CustomerDraft newCustomer)
      Compares the Customer.getDefaultBillingAddress() and CustomerDraft.getDefaultBillingAddress().
      static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> buildSetDefaultShippingAddressUpdateAction​(io.sphere.sdk.customers.Customer oldCustomer, io.sphere.sdk.customers.CustomerDraft newCustomer)
      Compares the Customer.getDefaultShippingAddress() and CustomerDraft.getDefaultShippingAddress().
      static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> buildSetExternalIdUpdateAction​(io.sphere.sdk.customers.Customer oldCustomer, io.sphere.sdk.customers.CustomerDraft newCustomer)
      Compares the externalId values of a Customer and a CustomerDraft and returns an Optional of update action, which would contain the "setExternalId" UpdateAction.
      static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> buildSetFirstNameUpdateAction​(io.sphere.sdk.customers.Customer oldCustomer, io.sphere.sdk.customers.CustomerDraft newCustomer)
      Compares the firstName values of a Customer and a CustomerDraft and returns an Optional of update action, which would contain the "setFirstName" UpdateAction.
      static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> buildSetLastNameUpdateAction​(io.sphere.sdk.customers.Customer oldCustomer, io.sphere.sdk.customers.CustomerDraft newCustomer)
      Compares the lastName values of a Customer and a CustomerDraft and returns an Optional of update action, which would contain the "setLastName" UpdateAction.
      static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> buildSetLocaleUpdateAction​(io.sphere.sdk.customers.Customer oldCustomer, io.sphere.sdk.customers.CustomerDraft newCustomer)
      Compares the locale values of a Customer and a CustomerDraft and returns an Optional of update action, which would contain the "setLocale" UpdateAction.
      static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> buildSetMiddleNameUpdateAction​(io.sphere.sdk.customers.Customer oldCustomer, io.sphere.sdk.customers.CustomerDraft newCustomer)
      Compares the middleName values of a Customer and a CustomerDraft and returns an Optional of update action, which would contain the "setMiddleName" UpdateAction.
      static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> buildSetSalutationUpdateAction​(io.sphere.sdk.customers.Customer oldCustomer, io.sphere.sdk.customers.CustomerDraft newCustomer)
      Compares the salutation values of a Customer and a CustomerDraft and returns an Optional of update action, which would contain the "SetSalutation" UpdateAction.
      static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> buildSetTitleUpdateAction​(io.sphere.sdk.customers.Customer oldCustomer, io.sphere.sdk.customers.CustomerDraft newCustomer)
      Compares the title values of a Customer and a CustomerDraft and returns an Optional of update action, which would contain the "setTitle" UpdateAction.
      static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> buildSetVatIdUpdateAction​(io.sphere.sdk.customers.Customer oldCustomer, io.sphere.sdk.customers.CustomerDraft newCustomer)
      Compares the vatId values of a Customer and a CustomerDraft and returns an Optional of update action, which would contain the "setVatId" UpdateAction.
      static java.util.List<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> buildStoreUpdateActions​(io.sphere.sdk.customers.Customer oldCustomer, io.sphere.sdk.customers.CustomerDraft newCustomer)
      Compares the stores of a Customer and a CustomerDraft.
      • Methods inherited from class java.lang.Object

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

      • CUSTOMER_NUMBER_EXISTS_WARNING

        public static final java.lang.String CUSTOMER_NUMBER_EXISTS_WARNING
        See Also:
        Constant Field Values
    • Method Detail

      • buildChangeEmailUpdateAction

        @Nonnull
        public static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> buildChangeEmailUpdateAction​(@Nonnull
                                                                                                                                             io.sphere.sdk.customers.Customer oldCustomer,
                                                                                                                                             @Nonnull
                                                                                                                                             io.sphere.sdk.customers.CustomerDraft newCustomer)
        Compares the email values of a Customer and a CustomerDraft and returns an Optional of update action, which would contain the "changeEmail" UpdateAction. If both Customer and CustomerDraft have the same email values, then no update action is needed and empty optional will be returned.
        Parameters:
        oldCustomer - the customer that should be updated.
        newCustomer - the customer draft that contains the new email.
        Returns:
        optional containing update action or empty optional if emails are identical.
      • buildSetFirstNameUpdateAction

        @Nonnull
        public static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> buildSetFirstNameUpdateAction​(@Nonnull
                                                                                                                                              io.sphere.sdk.customers.Customer oldCustomer,
                                                                                                                                              @Nonnull
                                                                                                                                              io.sphere.sdk.customers.CustomerDraft newCustomer)
        Compares the firstName values of a Customer and a CustomerDraft and returns an Optional of update action, which would contain the "setFirstName" UpdateAction. If both Customer and CustomerDraft have the same firstName values, then no update action is needed and empty optional will be returned.
        Parameters:
        oldCustomer - the customer that should be updated.
        newCustomer - the customer draft that contains the new first name.
        Returns:
        optional containing update action or empty optional if first names are identical.
      • buildSetLastNameUpdateAction

        @Nonnull
        public static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> buildSetLastNameUpdateAction​(@Nonnull
                                                                                                                                             io.sphere.sdk.customers.Customer oldCustomer,
                                                                                                                                             @Nonnull
                                                                                                                                             io.sphere.sdk.customers.CustomerDraft newCustomer)
        Compares the lastName values of a Customer and a CustomerDraft and returns an Optional of update action, which would contain the "setLastName" UpdateAction. If both Customer and CustomerDraft have the same lastName values, then no update action is needed and empty optional will be returned.
        Parameters:
        oldCustomer - the customer that should be updated.
        newCustomer - the customer draft that contains the new last name.
        Returns:
        optional containing update action or empty optional if last names are identical.
      • buildSetMiddleNameUpdateAction

        @Nonnull
        public static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> buildSetMiddleNameUpdateAction​(@Nonnull
                                                                                                                                               io.sphere.sdk.customers.Customer oldCustomer,
                                                                                                                                               @Nonnull
                                                                                                                                               io.sphere.sdk.customers.CustomerDraft newCustomer)
        Compares the middleName values of a Customer and a CustomerDraft and returns an Optional of update action, which would contain the "setMiddleName" UpdateAction. If both Customer and CustomerDraft have the same middleName values, then no update action is needed and empty optional will be returned.
        Parameters:
        oldCustomer - the customer that should be updated.
        newCustomer - the customer draft that contains the new middle name.
        Returns:
        optional containing update action or empty optional if middle names are identical.
      • buildSetTitleUpdateAction

        @Nonnull
        public static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> buildSetTitleUpdateAction​(@Nonnull
                                                                                                                                          io.sphere.sdk.customers.Customer oldCustomer,
                                                                                                                                          @Nonnull
                                                                                                                                          io.sphere.sdk.customers.CustomerDraft newCustomer)
        Compares the title values of a Customer and a CustomerDraft and returns an Optional of update action, which would contain the "setTitle" UpdateAction. If both Customer and CustomerDraft have the same title values, then no update action is needed and empty optional will be returned.
        Parameters:
        oldCustomer - the customer that should be updated.
        newCustomer - the customer draft that contains the new title.
        Returns:
        optional containing update action or empty optional if titles are identical.
      • buildSetSalutationUpdateAction

        @Nonnull
        public static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> buildSetSalutationUpdateAction​(@Nonnull
                                                                                                                                               io.sphere.sdk.customers.Customer oldCustomer,
                                                                                                                                               @Nonnull
                                                                                                                                               io.sphere.sdk.customers.CustomerDraft newCustomer)
        Compares the salutation values of a Customer and a CustomerDraft and returns an Optional of update action, which would contain the "SetSalutation" UpdateAction. If both Customer and CustomerDraft have the same salutation values, then no update action is needed and empty optional will be returned.
        Parameters:
        oldCustomer - the Customer that should be updated.
        newCustomer - the Customer draft that contains the new salutation.
        Returns:
        optional containing update action or empty optional if salutations are identical.
      • buildSetCustomerNumberUpdateAction

        @Nonnull
        public static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> buildSetCustomerNumberUpdateAction​(@Nonnull
                                                                                                                                                   io.sphere.sdk.customers.Customer oldCustomer,
                                                                                                                                                   @Nonnull
                                                                                                                                                   io.sphere.sdk.customers.CustomerDraft newCustomer,
                                                                                                                                                   @Nonnull
                                                                                                                                                   CustomerSyncOptions syncOptions)
        Compares the customerNumber values of a Customer and a CustomerDraft and returns an Optional of update action, which would contain the "setCustomerNumber" UpdateAction. If both Customer and CustomerDraft have the same customerNumber values, then no update action is needed and empty optional will be returned.

        Note: Customer number should be unique across a project. Once it's set it cannot be changed. For this case, warning callback will be triggered and an empty optional will be returned.

        Parameters:
        oldCustomer - the customer that should be updated.
        newCustomer - the customer draft that contains the new customer number.
        syncOptions - responsible for supplying the sync options to the sync utility method. It is used for triggering the warning callback when trying to change an existing customer number.
        Returns:
        optional containing update action or empty optional if customer numbers are identical.
      • buildSetExternalIdUpdateAction

        @Nonnull
        public static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> buildSetExternalIdUpdateAction​(@Nonnull
                                                                                                                                               io.sphere.sdk.customers.Customer oldCustomer,
                                                                                                                                               @Nonnull
                                                                                                                                               io.sphere.sdk.customers.CustomerDraft newCustomer)
        Compares the externalId values of a Customer and a CustomerDraft and returns an Optional of update action, which would contain the "setExternalId" UpdateAction. If both Customer and CustomerDraft have the same externalId values, then no update action is needed and empty optional will be returned.
        Parameters:
        oldCustomer - the customer that should be updated.
        newCustomer - the customer draft that contains the new external id.
        Returns:
        optional containing update action or empty optional if external ids are identical.
      • buildSetCompanyNameUpdateAction

        @Nonnull
        public static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> buildSetCompanyNameUpdateAction​(@Nonnull
                                                                                                                                                io.sphere.sdk.customers.Customer oldCustomer,
                                                                                                                                                @Nonnull
                                                                                                                                                io.sphere.sdk.customers.CustomerDraft newCustomer)
        Compares the companyName values of a Customer and a CustomerDraft and returns an Optional of update action, which would contain the "setCompanyName" UpdateAction. If both Customer and CustomerDraft have the same companyName values, then no update action is needed and empty optional will be returned.
        Parameters:
        oldCustomer - the customer that should be updated.
        newCustomer - the customer draft that contains the new company name.
        Returns:
        optional containing update action or empty optional if company names are identical.
      • buildSetDateOfBirthUpdateAction

        @Nonnull
        public static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> buildSetDateOfBirthUpdateAction​(@Nonnull
                                                                                                                                                io.sphere.sdk.customers.Customer oldCustomer,
                                                                                                                                                @Nonnull
                                                                                                                                                io.sphere.sdk.customers.CustomerDraft newCustomer)
        Compares the dateOfBirth values of a Customer and a CustomerDraft and returns an Optional of update action, which would contain the "setDateOfBirth" UpdateAction. If both Customer and CustomerDraft have the same dateOfBirth values, then no update action is needed and empty optional will be returned.
        Parameters:
        oldCustomer - the customer that should be updated.
        newCustomer - the customer draft that contains the new date of birth.
        Returns:
        optional containing update action or empty optional if dates of birth are identical.
      • buildSetVatIdUpdateAction

        @Nonnull
        public static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> buildSetVatIdUpdateAction​(@Nonnull
                                                                                                                                          io.sphere.sdk.customers.Customer oldCustomer,
                                                                                                                                          @Nonnull
                                                                                                                                          io.sphere.sdk.customers.CustomerDraft newCustomer)
        Compares the vatId values of a Customer and a CustomerDraft and returns an Optional of update action, which would contain the "setVatId" UpdateAction. If both Customer and CustomerDraft have the same vatId values, then no update action is needed and empty optional will be returned.
        Parameters:
        oldCustomer - the customer that should be updated.
        newCustomer - the customer draft that contains the new vat id.
        Returns:
        optional containing update action or empty optional if vat ids are identical.
      • buildSetLocaleUpdateAction

        @Nonnull
        public static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> buildSetLocaleUpdateAction​(@Nonnull
                                                                                                                                           io.sphere.sdk.customers.Customer oldCustomer,
                                                                                                                                           @Nonnull
                                                                                                                                           io.sphere.sdk.customers.CustomerDraft newCustomer)
        Compares the locale values of a Customer and a CustomerDraft and returns an Optional of update action, which would contain the "setLocale" UpdateAction. If both Customer and CustomerDraft have the same locale values, then no update action is needed and empty optional will be returned.
        Parameters:
        oldCustomer - the customer that should be updated.
        newCustomer - the customer draft that contains the new locale.
        Returns:
        optional containing update action or empty optional if locales are identical.
      • buildSetCustomerGroupUpdateAction

        @Nonnull
        public static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> buildSetCustomerGroupUpdateAction​(@Nonnull
                                                                                                                                                  io.sphere.sdk.customers.Customer oldCustomer,
                                                                                                                                                  @Nonnull
                                                                                                                                                  io.sphere.sdk.customers.CustomerDraft newCustomer)
        Compares the CustomerGroup references of an old Customer and new CustomerDraft. If they are different - return SetCustomerGroup update action.

        If the old value is set, but the new one is empty - the command will unset the customer group.

        Parameters:
        oldCustomer - the customer that should be updated.
        newCustomer - the customer draft with new CustomerGroup reference.
        Returns:
        An optional with SetCustomerGroup update action.
      • buildStoreUpdateActions

        @Nonnull
        public static java.util.List<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> buildStoreUpdateActions​(@Nonnull
                                                                                                                                    io.sphere.sdk.customers.Customer oldCustomer,
                                                                                                                                    @Nonnull
                                                                                                                                    io.sphere.sdk.customers.CustomerDraft newCustomer)
        Compares the stores of a Customer and a CustomerDraft. It returns a List of UpdateAction<Customer> as a result. If no update action is needed, for example in case where both the Customer and the CustomerDraft have the identical stores, an empty List is returned.

        Note: Null values of the stores are filtered out.

        Parameters:
        oldCustomer - the customer which should be updated.
        newCustomer - the customer draft where we get the new data.
        Returns:
        A list of customer store-related update actions.
      • buildRemoveStoreUpdateActions

        @Nonnull
        public static java.util.List<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> buildRemoveStoreUpdateActions​(@Nonnull
                                                                                                                                          java.util.List<io.sphere.sdk.models.KeyReference<io.sphere.sdk.stores.Store>> oldStores,
                                                                                                                                          @Nonnull
                                                                                                                                          java.util.List<io.sphere.sdk.models.ResourceIdentifier<io.sphere.sdk.stores.Store>> newStores)
        Compares the List of Store KeyReferences and Store ResourceIdentifiers of a CustomerDraft and a Customer. It returns a List of RemoveStore update actions as a result, if the old store needs to be removed from a customer to have the same set of stores as the new customer. If both the Customer and the CustomerDraft have the same set of stores, then no update actions are needed and hence an empty List is returned.

        Note: Null values of the stores are filtered out.

        Parameters:
        oldStores - the stores which should be updated.
        newStores - the stores where we get the new store.
        Returns:
        A list containing the update actions or an empty list if the store references are identical.
      • buildAddStoreUpdateActions

        @Nonnull
        public static java.util.List<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> buildAddStoreUpdateActions​(@Nonnull
                                                                                                                                       java.util.List<io.sphere.sdk.models.KeyReference<io.sphere.sdk.stores.Store>> oldStores,
                                                                                                                                       @Nonnull
                                                                                                                                       java.util.List<io.sphere.sdk.models.ResourceIdentifier<io.sphere.sdk.stores.Store>> newStores)
        Compares the List of Store KeyReferences and Store ResourceIdentifiers of a CustomerDraft and a Customer. It returns a List of AddStore update actions as a result, if the old store needs to be added to a customer to have the same set of stores as the new customer. If both the Customer and the CustomerDraft have the same set of stores, then no update actions are needed and hence an empty List is returned.

        Note: Null values of the stores are filtered out.

        Parameters:
        oldStores - the stores which should be updated.
        newStores - the stores where we get the new store.
        Returns:
        A list containing the update actions or an empty list if the store references are identical.
      • buildAllAddressUpdateActions

        @Nonnull
        public static java.util.List<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> buildAllAddressUpdateActions​(@Nonnull
                                                                                                                                         io.sphere.sdk.customers.Customer oldCustomer,
                                                                                                                                         @Nonnull
                                                                                                                                         io.sphere.sdk.customers.CustomerDraft newCustomer)
        Compares the addresses of a Customer and a CustomerDraft. It returns a List of UpdateAction<Customer> as a result. If both the Customer and the CustomerDraft have the same set of addresses, then no update actions are needed and hence an empty List is returned.
        Parameters:
        oldCustomer - the customer which should be updated.
        newCustomer - the customer draft where we get the new data.
        Returns:
        A list of customer address-related update actions.
      • buildRemoveAddressUpdateActions

        @Nonnull
        public static java.util.List<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> buildRemoveAddressUpdateActions​(@Nonnull
                                                                                                                                            io.sphere.sdk.customers.Customer oldCustomer,
                                                                                                                                            @Nonnull
                                                                                                                                            io.sphere.sdk.customers.CustomerDraft newCustomer)
        Compares the List of a CustomerDraft.getAddresses() and a Customer.getAddresses(). It returns a List of RemoveAddress update actions as a result, if the old address needs to be removed from the oldCustomer to have the same set of addresses as the newCustomer. If both the Customer and the CustomerDraft have the same set of addresses, then no update actions are needed and hence an empty List is returned.

        Notes:

        • Addresses are matching by their keys.
        • Null values of the new addresses are filtered out.
        • Address values without keys are filtered out.
        Parameters:
        oldCustomer - the customer which should be updated.
        newCustomer - the customer draft where we get the new addresses.
        Returns:
        A list containing the update actions or an empty list if the addresses are identical.
      • buildChangeAddressUpdateActions

        @Nonnull
        public static java.util.List<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> buildChangeAddressUpdateActions​(@Nonnull
                                                                                                                                            io.sphere.sdk.customers.Customer oldCustomer,
                                                                                                                                            @Nonnull
                                                                                                                                            io.sphere.sdk.customers.CustomerDraft newCustomer)
        Compares the List of a CustomerDraft.getAddresses() and a Customer.getAddresses(). It returns a List of ChangeAddress update actions as a result, if the old address needs to be changed/updated from the oldCustomer to have the same set of addresses as the newCustomer. If both the Customer and the CustomerDraft have the same set of addresses, then no update actions are needed and hence an empty List is returned.

        Notes:

        • Addresses are matching by their keys.
        • Null values of the new addresses are filtered out.
        • Address values without keys are filtered out.
        Parameters:
        oldCustomer - the customer which should be updated.
        newCustomer - the customer draft where we get the new addresses.
        Returns:
        A list containing the update actions or an empty list if the addresses are identical.
      • buildAddAddressUpdateActions

        @Nonnull
        public static java.util.List<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> buildAddAddressUpdateActions​(@Nonnull
                                                                                                                                         io.sphere.sdk.customers.Customer oldCustomer,
                                                                                                                                         @Nonnull
                                                                                                                                         io.sphere.sdk.customers.CustomerDraft newCustomer)
        Compares the List of a CustomerDraft.getAddresses() and a Customer.getAddresses(). It returns a List of AddAddress update actions as a result, if the new address needs to be added to have the same set of addresses as the newCustomer. If both the Customer and the CustomerDraft have the same set of addresses, then no update actions are needed and hence an empty List is returned.

        Notes:

        • Addresses are matching by their keys.
        • Null values of the new addresses are filtered out.
        • Address values without keys are filtered out.
        Parameters:
        oldCustomer - the customer which should be updated.
        newCustomer - the customer draft where we get the new addresses.
        Returns:
        A list containing the update actions or an empty list if the addresses are identical.
      • buildSetDefaultShippingAddressUpdateAction

        @Nonnull
        public static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> buildSetDefaultShippingAddressUpdateAction​(@Nonnull
                                                                                                                                                           io.sphere.sdk.customers.Customer oldCustomer,
                                                                                                                                                           @Nonnull
                                                                                                                                                           io.sphere.sdk.customers.CustomerDraft newCustomer)
        Compares the Customer.getDefaultShippingAddress() and CustomerDraft.getDefaultShippingAddress(). If they are different - return SetDefaultShippingAddress update action. If the old shipping address is set, but the new one is empty - the command will unset the default shipping address.
        Parameters:
        oldCustomer - the customer that should be updated.
        newCustomer - the customer draft with new default shipping address.
        Returns:
        An optional with SetDefaultShippingAddress update action.
      • buildSetDefaultBillingAddressUpdateAction

        @Nonnull
        public static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> buildSetDefaultBillingAddressUpdateAction​(@Nonnull
                                                                                                                                                          io.sphere.sdk.customers.Customer oldCustomer,
                                                                                                                                                          @Nonnull
                                                                                                                                                          io.sphere.sdk.customers.CustomerDraft newCustomer)
        Compares the Customer.getDefaultBillingAddress() and CustomerDraft.getDefaultBillingAddress(). If they are different - return SetDefaultBillingAddress update action. If the old billing address id value is set, but the new one is empty - the command will unset the default billing address.
        Parameters:
        oldCustomer - the customer that should be updated.
        newCustomer - the customer draft with new default billing address.
        Returns:
        An optional with SetDefaultBillingAddress update action.
      • buildAddShippingAddressUpdateActions

        @Nonnull
        public static java.util.List<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> buildAddShippingAddressUpdateActions​(@Nonnull
                                                                                                                                                 io.sphere.sdk.customers.Customer oldCustomer,
                                                                                                                                                 @Nonnull
                                                                                                                                                 io.sphere.sdk.customers.CustomerDraft newCustomer)
        Compares the List of a Customer.getShippingAddresses() and a CustomerDraft.getShippingAddresses(). It returns a List of AddShippingAddressId update actions as a result, if the new shipping address needs to be added to have the same set of addresses as the newCustomer. If both the Customer and the CustomerDraft have the same set of shipping addresses, then no update actions are needed and hence an empty List is returned.

        Notes:

        • Addresses are matching by their keys.
        • Old address values without keys are filtered out.
        • Each address in the new addresses list satisfies the following conditions:
          1. It is not null
          2. It has a key which is not blank (null/empty)
          Otherwise, a IllegalArgumentException will be thrown.
        Parameters:
        oldCustomer - the customer which should be updated.
        newCustomer - the customer draft where we get the new shipping addresses.
        Returns:
        A list containing the update actions or an empty list if the shipping addresses are identical.
      • buildRemoveShippingAddressUpdateActions

        @Nonnull
        public static java.util.List<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> buildRemoveShippingAddressUpdateActions​(@Nonnull
                                                                                                                                                    io.sphere.sdk.customers.Customer oldCustomer,
                                                                                                                                                    @Nonnull
                                                                                                                                                    io.sphere.sdk.customers.CustomerDraft newCustomer)
        Compares the List of a Customer.getShippingAddresses() and a CustomerDraft.getShippingAddresses(). It returns a List of RemoveShippingAddressId update actions as a result, if the old shipping address needs to be removed to have the same set of addresses as the newCustomer. If both the Customer and the CustomerDraft have the same set of shipping addresses, then no update actions are needed and hence an empty List is returned.

        Notes:

        • Addresses are matching by their keys.
        • Old shipping addresses without keys will be removed.
        • Each address in the new addresses list satisfies the following conditions:
          1. It exists in the given index.
          2. It has a key which is not blank (null/empty)
          Otherwise, a IllegalArgumentException will be thrown.
        Parameters:
        oldCustomer - the customer which should be updated.
        newCustomer - the customer draft where we get the new shipping addresses.
        Returns:
        A list containing the update actions or an empty list if the shipping addresses are identical.
      • buildAddBillingAddressUpdateActions

        @Nonnull
        public static java.util.List<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> buildAddBillingAddressUpdateActions​(@Nonnull
                                                                                                                                                io.sphere.sdk.customers.Customer oldCustomer,
                                                                                                                                                @Nonnull
                                                                                                                                                io.sphere.sdk.customers.CustomerDraft newCustomer)
        Compares the List of a Customer.getBillingAddresses() and a CustomerDraft.getBillingAddresses(). It returns a List of AddBillingAddressId update actions as a result, if the new billing address needs to be added to have the same set of addresses as the newCustomer. If both the Customer and the CustomerDraft have the same set of billing addresses, then no update actions are needed and hence an empty List is returned.

        Notes:

        • Addresses are matching by their keys.
        • Old address values without keys are filtered out.
        • Each address in the new addresses list satisfies the following conditions:
          1. It is not null
          2. It has a key which is not blank (null/empty)
          Otherwise, a IllegalArgumentException will be thrown.
        Parameters:
        oldCustomer - the customer which should be updated.
        newCustomer - the customer draft where we get the new billing addresses.
        Returns:
        A list containing the update actions or an empty list if the billing addresses are identical.
      • buildRemoveBillingAddressUpdateActions

        @Nonnull
        public static java.util.List<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> buildRemoveBillingAddressUpdateActions​(@Nonnull
                                                                                                                                                   io.sphere.sdk.customers.Customer oldCustomer,
                                                                                                                                                   @Nonnull
                                                                                                                                                   io.sphere.sdk.customers.CustomerDraft newCustomer)
        Compares the List of a Customer.getBillingAddresses() and a CustomerDraft.getBillingAddresses(). It returns a List of RemoveBillingAddressId update actions as a result, if the old billing address needs to be removed to have the same set of addresses as the newCustomer. If both the Customer and the CustomerDraft have the same set of billing addresses, then no update actions are needed and hence an empty List is returned.

        Notes:

        • Addresses are matching by their keys.
        • Null values of the old addresses are filtered out.
        • Old shipping address values without keys are filtered out.
        • Each address in the new addresses list satisfies the following conditions:
          1. It exists in the given index.
          2. It has a key which is not blank (null/empty)
          Otherwise, a IllegalArgumentException will be thrown.
        Parameters:
        oldCustomer - the customer which should be updated.
        newCustomer - the customer draft where we get the new shipping addresses.
        Returns:
        A list containing the update actions or an empty list if the shipping addresses are identical.