Interface AddressService

    • Method Detail

      • createAddressForUser

        AddressModel createAddressForUser​(UserModel user)
        Creates a new, not persisted AddressModel for the given user.
        Parameters:
        user - creates an address for this UserModel
        Returns:
        a new, not persisted AddressModel
        Throws:
        java.lang.IllegalArgumentException - if the given user is null
      • createAddressForOwner

        AddressModel createAddressForOwner​(ItemModel owner)
        Creates a new, not persisted AddressModel for the given owner.
        Parameters:
        owner - the owner (can be any item) for the address, as example: can be a UserModel, CartModel or OrderModel
        Returns:
        a new, not persisted address
        Throws:
        java.lang.IllegalArgumentException - if the given owner is null
      • getAddressesForOwner

        java.util.Collection<AddressModel> getAddressesForOwner​(ItemModel owner)
        Gets a Collection of addresses for the given owner e.g. a user or an order.

        The owner can be any item.

        Parameters:
        owner - the given owner, can be an order, a cart or a user
        Returns:
        an empty collection if nothing was found
        Throws:
        java.lang.IllegalArgumentException - if the given owner is null
      • cloneAddress

        AddressModel cloneAddress​(AddressModel address)
        Clones an address and sets a link on the new address to the original address.

        The new address has the same owner as the given address.

        Parameters:
        address - the address to clone
        Returns:
        a new created, not persisted clone of the given address
        Throws:
        java.lang.IllegalArgumentException - if the given address is null
      • cloneAddressForOwner

        AddressModel cloneAddressForOwner​(AddressModel address,
                                          ItemModel owner)
        Clones an address but for the given owner and sets a link on the new address to the original address.
        Parameters:
        address - the address to clone
        owner - the owner of the new cloned address
        Returns:
        a new created, not persisted clone of the given address
        Throws:
        java.lang.IllegalArgumentException - if the given address is null or the given owner is null