Interface ContactModifier
-
- All Superinterfaces:
IntermediateStorageProvider
public interface ContactModifier extends IntermediateStorageProvider
Defines an API to modify an instance of typeContact
- Since:
- 12.14
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description ContactModifier
addAssignedAddresses(javax.mail.internet.InternetAddress... emailAddresses)
Add email addresses to the associatedContact
.ContactModifier
addAssignedPhoneNumbers(java.lang.String... phoneNumbers)
Add phone numbers to the associatedContact
.ContactModifier
addAttributes(java.lang.String attributeName, java.lang.String... attributeValues)
Add attributes which can be used for identification to the associatedContact
(seeContactIdentifier
for further information).java.util.Set<javax.mail.internet.InternetAddress>
getAssignedAddresses()
Returns an unmodifiable cached view of the assigned email addresses.java.util.Set<java.lang.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.java.util.Map<java.lang.String,java.util.Set<java.lang.String>>
getAttributes()
Returns an unmodifiable cached view of attributes which can be used to identify the contact (seeContactIdentifier
for further information).java.util.Optional<Contact>
getContact()
Get theContact
which is modified in thisContactModifier
.java.util.Optional<java.lang.String>
getExternalId()
Get the current external id which is held in thisContactModifier
.java.lang.String
getName()
Get the current contact name which is held in thisContactModifier
.java.util.Optional<Tenant>
getTenant()
Get the current tenant which is held in thisContactModifier
.ContactModifier
removeAssignedAddresses(javax.mail.internet.InternetAddress... emailAddresses)
Remove email addresses from the associatedContact
.ContactModifier
removeAssignedPhoneNumbers(java.lang.String... phoneNumbers)
Remove phone numbers from the associatedContact
.ContactModifier
removeAttributes(java.lang.String attributeName, java.lang.String... attributeValues)
Remove attributes which can be used for identification from the associatedContact
(seeContactIdentifier
for further information).ContactModifier
setExternalId(java.lang.String externalId)
Change the external id of the associatedContact
.ContactModifier
setName(java.lang.String name)
Change the name of the associatedContact
.ContactModifier
setTenant(Tenant tenant)
Change the tenant of the associatedContact
.boolean
validateAssignedAddresses(javax.mail.internet.InternetAddress... emailAddresses)
Validate the given email addresses.boolean
validateAssignedPhoneNumbers(java.lang.String... phoneNumbers)
Validate the given phone numbers.boolean
validateAttributes(java.lang.String attributeName, java.lang.String... attributeValues)
Validate the attributes which can be used for identification (seeContactIdentifier
for further information).boolean
validateName(java.lang.String name)
Validate the given name.boolean
validateTenant(Tenant tenant)
Validate the given tenant.Contact
write()
Writes the changes done in thisContactModifier
-
Methods inherited from interface com.novomind.ecom.api.iagent.provider.IntermediateStorageProvider
getIntermediateStorage
-
-
-
-
Method Detail
-
getContact
java.util.Optional<Contact> getContact()
Get theContact
which is modified in thisContactModifier
.- Returns:
- An
Optional
with the contact which is modified in thisContactModifier
- Since:
- 12.14
-
getName
java.lang.String getName()
Get the current contact name which is held in thisContactModifier
.- Returns:
- the name as String
- Since:
- 12.14
-
setName
ContactModifier setName(java.lang.String name) throws ValidationException
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(java.lang.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
java.util.Set<javax.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(javax.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(javax.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(javax.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
java.util.Set<java.lang.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(java.lang.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(java.lang.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(java.lang.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
java.util.Map<java.lang.String,java.util.Set<java.lang.String>> 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(java.lang.String attributeName, java.lang.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(java.lang.String attributeName, java.lang.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(java.lang.String attributeName, java.lang.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
java.util.Optional<java.lang.String> getExternalId()
Get the current external id which is held in thisContactModifier
.- Returns:
- the external id as String
- Since:
- 12.14
-
setExternalId
ContactModifier setExternalId(java.lang.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
java.util.Optional<Tenant> getTenant()
Get the current tenant which is held in thisContactModifier
.- 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
Contact write() throws PersistencyException
Writes the changes done in thisContactModifier
- Returns:
- the persisted instance of the
Contact
- Throws:
PersistencyException
- if theContact
could not be written.- Since:
- 12.14
-
-