Interface ContactModifier
- All Superinterfaces:
IntermediateStorageProvider
Contact
- Since:
- 12.14
-
Method Summary
Modifier and TypeMethodDescriptionaddAssignedAddresses
(jakarta.mail.internet.InternetAddress... emailAddresses) Add email addresses to the associatedContact
.addAssignedPhoneNumbers
(String... phoneNumbers) Add phone numbers to the associatedContact
.addAttributes
(String attributeName, String... attributeValues) Add attributes which can be used for identification to the associatedContact
(seeContactIdentifier
for further information).Set
<jakarta.mail.internet.InternetAddress> Returns an unmodifiable cached view of the assigned email addresses.Returns an unmodifiable cached view of the assigned phone numbers as Fully Qualified Telephone Numbers according to ITU-T standard E.164 (e.g.Returns an unmodifiable cached view of attributes which can be used to identify the contact (seeContactIdentifier
for further information).Get theContact
which is modified in thisContactModifier
.Get the current external id which is held in thisContactModifier
.getName()
Get the current contact name which is held in thisContactModifier
.Get the current tenant which is held in thisContactModifier
.removeAssignedAddresses
(jakarta.mail.internet.InternetAddress... emailAddresses) Remove email addresses from the associatedContact
.removeAssignedPhoneNumbers
(String... phoneNumbers) Remove phone numbers from the associatedContact
.removeAttributes
(String attributeName, String... attributeValues) Remove attributes which can be used for identification from the associatedContact
(seeContactIdentifier
for further information).setExternalId
(String externalId) Change the external id of the associatedContact
.Change the name of the associatedContact
.Change the tenant of the associatedContact
.boolean
validateAssignedAddresses
(jakarta.mail.internet.InternetAddress... emailAddresses) Validate the given email addresses.boolean
validateAssignedPhoneNumbers
(String... phoneNumbers) Validate the given phone numbers.boolean
validateAttributes
(String attributeName, String... attributeValues) Validate the attributes which can be used for identification (seeContactIdentifier
for further information).boolean
validateName
(String name) Validate the given name.boolean
validateTenant
(Tenant tenant) Validate the given tenant.write()
Writes the changes done in thisContactModifier
Methods inherited from interface com.novomind.ecom.api.iagent.provider.IntermediateStorageProvider
getIntermediateStorage
-
Method Details
-
getContact
Get theContact
which is modified in thisContactModifier
.- Returns:
- An
Optional
with the contact which is modified in thisContactModifier
- Since:
- 12.14
-
getName
String getName()Get the current contact name which is held in thisContactModifier
.- 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
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
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
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
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
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
Returns an unmodifiable cached view of attributes which can be used to identify the contact (seeContactIdentifier
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
(seeContactIdentifier
for further information).The change is applied after the
write()
method is called.- Parameters:
attributeName
- the name of the attributes to be addedattributeValues
- 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
(seeContactIdentifier
for further information).The change is applied after the
write()
method is called.- Parameters:
attributeName
- the name of the attributes to be removedattributeValues
- 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 (seeContactIdentifier
for further information).- Parameters:
attributeName
- the name of the attributes to validateattributeValues
- 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
Get the current external id which is held in thisContactModifier
.- Returns:
- the external id as String
- Since:
- 12.14
-
setExternalId
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
Get the current tenant which is held in thisContactModifier
.- Returns:
- the current tenant
- Since:
- 12.14
-
setTenant
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
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 thisContactModifier
- Returns:
- the persisted instance of the
Contact
- Throws:
PersistencyException
- if theContact
could not be written.- Since:
- 12.14
-