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
public class SubscribersClientSideElement extends StaticClientSideElement
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
Fields Modifier and Type Field Description private static Pattern__EMAIL_VALIDATORprotected CategoryProviderExtensionPoint_categoryProviderEPThe category provider extension point.protected SubscribersDAO_subscribersDaoThe subscribers DAO.-
Fields inherited from class org.ametys.core.ui.StaticFileImportsClientSideElement
_currentUserProvider, _dependencies, _featureName, _id, _pluginName, _rightManager, _rights, _rightsMode, _script
-
-
Constructor Summary
Constructors Constructor Description SubscribersClientSideElement()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Map<String,Object>addSubscribers(String siteName, String categoryId, String emailsList)Add a list of subscribers to the newsletter category of the specified siteprotected Collection<String>getEmails(String emailsList)Extract the emails from the field.protected voidinsertSubscribers(Collection<String> emails, String categoryId, String siteName, Map<String,Object> result)Insert subscribersMap<String,Object>removeSubscribers(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, configureInitialParameters
-
Methods inherited from class org.ametys.core.ui.StaticFileImportsClientSideElement
_configureDependencies, _configureImports, _configureRights, _configureRightsMode, configure, getDependencies, getId, getPluginName, getRights, getScripts, getScripts, hasRight, setPluginInfo, toString
-
Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
-
-
-
Field Detail
-
__EMAIL_VALIDATOR
private static final Pattern __EMAIL_VALIDATOR
-
_subscribersDao
protected SubscribersDAO _subscribersDao
The subscribers DAO.
-
_categoryProviderEP
protected CategoryProviderExtensionPoint _categoryProviderEP
The category provider extension point.
-
-
Constructor Detail
-
SubscribersClientSideElement
public SubscribersClientSideElement()
-
-
Method Detail
-
service
public void service(ServiceManager smanager) throws ServiceException
- Specified by:
servicein interfaceServiceable- Overrides:
servicein classStaticFileImportsClientSideElement- Throws:
ServiceException
-
addSubscribers
public Map<String,Object> addSubscribers(String siteName, String categoryId, String emailsList)
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
protected Collection<String> getEmails(String emailsList)
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.
-
-