Class SubscribersClientSideElement
java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.core.ui.StaticFileImportsClientSideElement
org.ametys.core.ui.StaticClientSideElement
org.ametys.plugins.newsletter.subscribe.SubscribersClientSideElement
- All Implemented Interfaces:
ClientSideElement,LogEnabled,PluginAware,Configurable,Serviceable
Client side element for newsletter subscribers
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.ametys.core.ui.ClientSideElement
ClientSideElement.Script, ClientSideElement.ScriptFile -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected CategoryProviderExtensionPointThe category provider extension point.protected SubscribersDAOThe subscribers DAO.Fields inherited from class org.ametys.core.ui.StaticFileImportsClientSideElement
_currentUserProvider, _dependencies, _featureName, _id, _pluginName, _rightManager, _rights, _rightsMode, _script -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddSubscribers(String siteName, String categoryId, String emailsList) Add a list of subscribers to the newsletter category of the specified siteprotected Collection<String> Extract the emails from the field.protected voidinsertSubscribers(Collection<String> emails, String categoryId, String siteName, Map<String, Object> result) Insert subscribersremoveSubscribers(String siteName, String categoryId, List<String> emails) Remove a list of subscribers from the newsletter category of the specified sitevoidservice(ServiceManager smanager) Methods inherited from class org.ametys.core.ui.StaticClientSideElement
_configureClass, _configureParameters, _configureScript, configureInitialParametersMethods inherited from class org.ametys.core.ui.StaticFileImportsClientSideElement
_configureDependencies, _configureImports, _configureRights, _configureRightsMode, configure, getDependencies, getId, getPluginName, getRights, getScripts, getScripts, hasRight, setPluginInfo, toStringMethods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
Field Details
-
_subscribersDao
The subscribers DAO. -
_categoryProviderEP
The category provider extension point.
-
-
Constructor Details
-
SubscribersClientSideElement
public SubscribersClientSideElement()
-
-
Method Details
-
service
- Specified by:
servicein interfaceServiceable- Overrides:
servicein classStaticFileImportsClientSideElement- Throws:
ServiceException
-
addSubscribers
Add a list of subscribers to the newsletter category of the specified site- Parameters:
siteName- The site namecategoryId- The category idemailsList- The list of emails. Emails can be separeted by a new line or a semicolon.- Returns:
- The result, with the count of subscribed or error emails.
-
getEmails
Extract the emails from the field.- Parameters:
emailsList- the list of emails- Returns:
- a collection of the emails.
-
insertSubscribers
protected void insertSubscribers(Collection<String> emails, String categoryId, String siteName, Map<String, Object> result) Insert subscribers- Parameters:
emails- the list of emailscategoryId- the id of the newsletter categorysiteName- the name of the sitesresult- the result map
-
removeSubscribers
public Map<String,Object> removeSubscribers(String siteName, String categoryId, List<String> emails) Remove a list of subscribers from the newsletter category of the specified site- Parameters:
siteName- The site namecategoryId- The category idemails- The list of emails.- Returns:
- The error message, or an empty map if everything is ok.
-