Interface ContactModifier

All Superinterfaces:
IntermediateStorageProvider

public interface ContactModifier extends IntermediateStorageProvider
Defines an API to modify an instance of type Contact
Since:
12.14
  • Method Details

    • getContact

      Optional<Contact> getContact()
      Get the Contact which is modified in this ContactModifier.
      Returns:
      An Optional with the contact which is modified in this ContactModifier
      Since:
      12.14
    • getName

      String getName()
      Get the current contact name which is held in this ContactModifier.
      Returns:
      the name as String
      Since:
      12.14
    • setName

      Change the name of the associated Contact.

      The change is applied after the write() method is called.

      Parameters:
      name - the new name as String
      Returns:
      the ContactModifier
      Throws:
      ValidationException - if the name is null or empty
      Since:
      12.14
    • validateName

      boolean validateName(String name) throws ValidationException
      Validate the given name.
      Parameters:
      name - the name to validate
      Returns:
      true if the name is valid
      Throws:
      ValidationException - if the name is null or empty
      Since:
      12.14
    • getAssignedAddresses

      Set<jakarta.mail.internet.InternetAddress> getAssignedAddresses()
      Returns an unmodifiable cached view of the assigned email addresses. The returned set is not updated when assignments change.
      Returns:
      the set of currently assigned email addresses
      Since:
      12.14
    • addAssignedAddresses

      ContactModifier addAssignedAddresses(jakarta.mail.internet.InternetAddress... emailAddresses) throws ValidationException

      Add email addresses to the associated Contact.

      The change is applied after the write() method is called.

      Parameters:
      emailAddresses - the new addresses to be added - only the email address part of the InternetAddress will be used
      Returns:
      the ContactModifier
      Throws:
      ValidationException - if the new email addresses are invalid
      Since:
      12.14
    • removeAssignedAddresses

      ContactModifier removeAssignedAddresses(jakarta.mail.internet.InternetAddress... emailAddresses) throws ValidationException

      Remove email addresses from the associated Contact.

      The change is applied after the write() method is called.

      Parameters:
      emailAddresses - the addresses to be removed - only the email address part of the InternetAddress will be used
      Returns:
      the ContactModifier
      Throws:
      ValidationException - if the email addresses are invalid
      Since:
      12.14
    • validateAssignedAddresses

      boolean validateAssignedAddresses(jakarta.mail.internet.InternetAddress... emailAddresses) throws ValidationException
      Validate the given email addresses.
      Parameters:
      emailAddresses - the email addresses to validate
      Returns:
      true if the email addresses are valid
      Throws:
      ValidationException - if the email addresses are invalid
      Since:
      12.14
    • getAssignedPhoneNumbers

      Set<String> getAssignedPhoneNumbers()
      Returns an unmodifiable cached view of the assigned phone numbers as Fully Qualified Telephone Numbers according to ITU-T standard E.164 (e.g. +49401234567). The returned set is not updated when assignments change.
      Returns:
      the set of currently assigned phone numbers
      Since:
      12.14
    • addAssignedPhoneNumbers

      ContactModifier addAssignedPhoneNumbers(String... phoneNumbers) throws ValidationException

      Add phone numbers to the associated Contact.

      The change is applied after the write() method is called.

      Parameters:
      phoneNumbers - the new phone numbers to be added
      Returns:
      the ContactModifier
      Throws:
      ValidationException - if the new phone numbers are not Fully Qualified Telephone Numbers according to ITU-T standard E.164 (e.g. +49401234567).
      Since:
      12.14
    • removeAssignedPhoneNumbers

      ContactModifier removeAssignedPhoneNumbers(String... phoneNumbers) throws ValidationException

      Remove phone numbers from the associated Contact.

      The change is applied after the write() method is called.

      Parameters:
      phoneNumbers - the phone numbers to be removed
      Returns:
      the ContactModifier
      Throws:
      ValidationException - if the phone numbers are not Fully Qualified Telephone Numbers according to ITU-T standard E.164 (e.g. +49401234567).
      Since:
      12.14
    • validateAssignedPhoneNumbers

      boolean validateAssignedPhoneNumbers(String... phoneNumbers) throws ValidationException
      Validate the given phone numbers.
      Parameters:
      phoneNumbers - the phone numbers to validate
      Returns:
      true if the phone numbers are valid
      Throws:
      ValidationException - if the phone numbers are not Fully Qualified Telephone Numbers according to ITU-T standard E.164 (e.g. +49401234567).
      Since:
      12.14
    • getAttributes

      Map<String,Set<String>> getAttributes()
      Returns an unmodifiable cached view of attributes which can be used to identify the contact (see ContactIdentifier for further information). The key is the name of the attribute which maps to the associated attribute values. An example of a contact attribute would be an id which identifies the contact in an external service. The returned map is not updated when the contact attributes change.
      Returns:
      the map of attributes which can be used to identify the contact
      Since:
      12.14
    • addAttributes

      ContactModifier addAttributes(String attributeName, String... attributeValues) throws ValidationException

      Add attributes which can be used for identification to the associated Contact (see ContactIdentifier for further information).

      The change is applied after the write() method is called.

      Parameters:
      attributeName - the name of the attributes to be added
      attributeValues - the values of the attributes to be added
      Returns:
      the ContactModifier
      Throws:
      ValidationException - if the attribute name or values are invalid
      Since:
      12.14
    • removeAttributes

      ContactModifier removeAttributes(String attributeName, String... attributeValues) throws ValidationException

      Remove attributes which can be used for identification from the associated Contact (see ContactIdentifier for further information).

      The change is applied after the write() method is called.

      Parameters:
      attributeName - the name of the attributes to be removed
      attributeValues - the values of the attributes to be removed
      Returns:
      the ContactModifier
      Throws:
      ValidationException - if the attribute name or values are invalid
      Since:
      12.14
    • validateAttributes

      boolean validateAttributes(String attributeName, String... attributeValues) throws ValidationException
      Validate the attributes which can be used for identification (see ContactIdentifier for further information).
      Parameters:
      attributeName - the name of the attributes to validate
      attributeValues - the values of the attributes to validate
      Returns:
      true if the attributes are valid
      Throws:
      ValidationException - if the attribute name or values are invalid
      Since:
      12.14
    • getExternalId

      Optional<String> getExternalId()
      Get the current external id which is held in this ContactModifier.
      Returns:
      the external id as String
      Since:
      12.14
    • setExternalId

      ContactModifier setExternalId(String externalId)

      Change the external id of the associated Contact.

      The change is applied after the write() method is called.

      Parameters:
      externalId - the new external id as String
      Returns:
      the ContactModifier
      Since:
      12.14
    • getTenant

      Optional<Tenant> getTenant()
      Get the current tenant which is held in this ContactModifier.
      Returns:
      the current tenant
      Since:
      12.14
    • setTenant

      ContactModifier setTenant(Tenant tenant) throws ValidationException

      Change the tenant of the associated Contact.

      The change is applied after the write() method is called.

      Parameters:
      tenant - the new tenant
      Returns:
      the ContactModifier
      Throws:
      ValidationException - if the new tenant is invalid
      Since:
      12.14
    • validateTenant

      boolean validateTenant(Tenant tenant) throws ValidationException
      Validate the given tenant.
      Parameters:
      tenant - the tenant to validate
      Returns:
      true if the tenant is valid
      Throws:
      ValidationException - if the tenant is invalid
      Since:
      12.14
    • write

      Writes the changes done in this ContactModifier
      Returns:
      the persisted instance of the Contact
      Throws:
      PersistencyException - if the Contact could not be written.
      Since:
      12.14