Class StubBrevoSynchronisationService
java.lang.Object
ch.tocco.nice2.optional.newsletterbrevo.impl.BrevoSynchronisationServiceImpl
ch.tocco.nice2.optional.newsletterbrevo.impl.StubBrevoSynchronisationService
- All Implemented Interfaces:
BrevoSynchronisationService
@ConditionalOnExpression("'${spring.profiles.active}' == 'development' && ${nice2.brevo.disableDevelopmentSync:true}")
@Component
public class StubBrevoSynchronisationService
extends BrevoSynchronisationServiceImpl
-
Nested Class Summary
Nested classes/interfaces inherited from interface BrevoSynchronisationService
BrevoSynchronisationService.AttributePath, BrevoSynchronisationService.AttributeType, BrevoSynchronisationService.SimpleContact -
Constructor Summary
ConstructorsConstructorDescriptionStubBrevoSynchronisationService(PersistenceService persistenceService, org.slf4j.Logger logger, QueryBuilderResultHelperService queryBuilderResultHelperService) -
Method Summary
Modifier and TypeMethodDescriptionvoidcreateAttribute(String name, BrevoSynchronisationService.AttributeType type, EntityList values) creates a new attributevoiddelete an attributevoidgetAllContacts(long batchSize, Consumer<Tuple2<Long, List<BrevoSynchronisationService.SimpleContact>>> contactConsumer) This method will retrieve all contacts of the current brevo account.brevoModel.GetExtendedContactDetailsgetContactInfo(String email) Returns the contact details for a given email addressvoidimportUsers(long listId, Condition synchronisationCondition, List<BrevoSynchronisationService.AttributePath> attributes) Import users to brevo.voidremoveUsersFromList(long listId, Condition synchronisationCondition) longsynchroniseFolder(Entity folder) Synchronises a tocco folder to brevo.longsynchroniseList(long folderId, Entity newsletterCategory) Synchronises a newsletter category with brevo.voidupdateAttribute(String name, BrevoSynchronisationService.AttributeType type, EntityList values) update attribute, only useful for category attributes, others need to be deleted and recreated for changesvoidupdateBlocklists(String email, List<String> selectedBlocklists) update blocklist entries in brevo make sure that the email address exist in Brevo before updating it, seeBrevoSynchronisationService.isEmailAddressInUse(String)voidupdateEmailAddresses(Map<String, String> changes) update email addresses in brevo make sure that the email addresses exist in Brevo before updating them, seeBrevoSynchronisationService.isEmailAddressInUse(String)Methods inherited from class BrevoSynchronisationServiceImpl
isEmailAddressInUse, normalizeAttributeName, setImportLimit, setRemoveFromListLimit
-
Constructor Details
-
StubBrevoSynchronisationService
public StubBrevoSynchronisationService(PersistenceService persistenceService, org.slf4j.Logger logger, QueryBuilderResultHelperService queryBuilderResultHelperService)
-
-
Method Details
-
synchroniseFolder
Description copied from interface:BrevoSynchronisationServiceSynchronises a tocco folder to brevo.- Specified by:
synchroniseFolderin interfaceBrevoSynchronisationService- Overrides:
synchroniseFolderin classBrevoSynchronisationServiceImpl- Parameters:
folder- the brevo folder entity to be synchronised- Returns:
- id of the folder in brevo
-
synchroniseList
Description copied from interface:BrevoSynchronisationServiceSynchronises a newsletter category with brevo. Newsletter categories are mapped to lists in brevo.- Specified by:
synchroniseListin interfaceBrevoSynchronisationService- Overrides:
synchroniseListin classBrevoSynchronisationServiceImpl- Parameters:
folderId- the folder id to be used to create new newsletter categoriesnewsletterCategory- the newsletter category to be synchronised- Returns:
- id of the list in brevo
-
importUsers
public void importUsers(long listId, Condition synchronisationCondition, List<BrevoSynchronisationService.AttributePath> attributes) Description copied from interface:BrevoSynchronisationServiceImport users to brevo. Users are transformed to "contacts" and then imported to brevo using the import endpoint. The import endpoint handles creating / updating users and maps users using the email address.- Specified by:
importUsersin interfaceBrevoSynchronisationService- Overrides:
importUsersin classBrevoSynchronisationServiceImpl- Parameters:
listId- the list id to which the users should be added.synchronisationCondition- query builder condition to be used to select the users to be synchronised
-
removeUsersFromList
- Specified by:
removeUsersFromListin interfaceBrevoSynchronisationService- Overrides:
removeUsersFromListin classBrevoSynchronisationServiceImpl
-
getAttributes
- Specified by:
getAttributesin interfaceBrevoSynchronisationService- Overrides:
getAttributesin classBrevoSynchronisationServiceImpl- Returns:
- names of all attributes configured in brevo
-
createAttribute
public void createAttribute(String name, BrevoSynchronisationService.AttributeType type, EntityList values) Description copied from interface:BrevoSynchronisationServicecreates a new attribute- Specified by:
createAttributein interfaceBrevoSynchronisationService- Overrides:
createAttributein classBrevoSynchronisationServiceImpl- Parameters:
name- the name of the attribute, make sure it is normalized withBrevoSynchronisationService.normalizeAttributeName(String)type- the type of the attributevalues- the Brevo_attribute_value entities the attribute can take, only relevant for category attributes
-
updateAttribute
public void updateAttribute(String name, BrevoSynchronisationService.AttributeType type, EntityList values) Description copied from interface:BrevoSynchronisationServiceupdate attribute, only useful for category attributes, others need to be deleted and recreated for changes- Specified by:
updateAttributein interfaceBrevoSynchronisationService- Overrides:
updateAttributein classBrevoSynchronisationServiceImpl- Parameters:
name- the name of the attribute, make sure it is normalized withBrevoSynchronisationService.normalizeAttributeName(String)type- the type of the attributevalues- the Brevo_attribute_value entities the attribute can take, only relevant for category attributes
-
deleteAttribute
Description copied from interface:BrevoSynchronisationServicedelete an attribute- Specified by:
deleteAttributein interfaceBrevoSynchronisationService- Overrides:
deleteAttributein classBrevoSynchronisationServiceImpl- Parameters:
name- the name of the attribute, make sure it is normalized withBrevoSynchronisationService.normalizeAttributeName(String)type- the type of the attribute
-
updateEmailAddresses
Description copied from interface:BrevoSynchronisationServiceupdate email addresses in brevo make sure that the email addresses exist in Brevo before updating them, seeBrevoSynchronisationService.isEmailAddressInUse(String)- Specified by:
updateEmailAddressesin interfaceBrevoSynchronisationService- Overrides:
updateEmailAddressesin classBrevoSynchronisationServiceImpl- Parameters:
changes- a map containing the current email addresses as keys, and the new email addresses as values
-
updateBlocklists
Description copied from interface:BrevoSynchronisationServiceupdate blocklist entries in brevo make sure that the email address exist in Brevo before updating it, seeBrevoSynchronisationService.isEmailAddressInUse(String)- Specified by:
updateBlocklistsin interfaceBrevoSynchronisationService- Overrides:
updateBlocklistsin classBrevoSynchronisationServiceImpl- Parameters:
email- the email for which the blocklist entries should be updatedselectedBlocklists- a list of strings of the selected blocklist unique_ids (possible values: "email", "sms")
-
getContactInfo
Description copied from interface:BrevoSynchronisationServiceReturns the contact details for a given email address- Specified by:
getContactInfoin interfaceBrevoSynchronisationService- Overrides:
getContactInfoin classBrevoSynchronisationServiceImpl
-
getAllContacts
public void getAllContacts(long batchSize, Consumer<Tuple2<Long, List<BrevoSynchronisationService.SimpleContact>>> contactConsumer) Description copied from interface:BrevoSynchronisationServiceThis method will retrieve all contacts of the current brevo account. It uses paging and will call the consumer with each "page".- Specified by:
getAllContactsin interfaceBrevoSynchronisationService- Overrides:
getAllContactsin classBrevoSynchronisationServiceImpl- Parameters:
batchSize- the batch size to use when retrieving all contacts.contactConsumer- the consumer that processes the batches. It consumes a tuple containing the count (all contacts) and the current page of contacts.
-