Class ImportSubscribersAction
java.lang.Object
org.apache.avalon.framework.logger.AbstractLogEnabled
org.apache.cocoon.acting.AbstractAction
org.apache.cocoon.acting.ServiceableAction
org.ametys.plugins.newsletter.subscribe.ImportSubscribersAction
- All Implemented Interfaces:
Component,LogEnabled,Serviceable,Action
Import subscribers from a CSV or text file.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected CategoryProviderExtensionPointThe category provider extension point.protected SubscribersDAOThe subscribers DAO.Fields inherited from class org.apache.cocoon.acting.ServiceableAction
managerFields inherited from class org.apache.cocoon.acting.AbstractAction
EMPTY_MAP -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionact(Redirector redirector, SourceResolver resolver, Map objectModel, String source, Parameters parameters) protected Collection<String> getEmails(BOMInputStream bomIS) Extract the emails from the file.protected voidinsertSubscribers(Collection<String> emails, String categoryId, String siteName, Map<String, Object> result) Insert subscribersvoidservice(ServiceManager smanager) Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
Field Details
-
_subscribersDao
The subscribers DAO. -
_categoryProviderEP
The category provider extension point.
-
-
Constructor Details
-
ImportSubscribersAction
public ImportSubscribersAction()
-
-
Method Details
-
service
- Specified by:
servicein interfaceServiceable- Overrides:
servicein classServiceableAction- Throws:
ServiceException
-
act
public Map act(Redirector redirector, SourceResolver resolver, Map objectModel, String source, Parameters parameters) throws Exception - Throws:
Exception
-
getEmails
Extract the emails from the file.- Parameters:
bomIS- the input stream- Returns:
- a collection of the emails.
- Throws:
IOException- if an error occurs reading the file.
-
insertSubscribers
protected void insertSubscribers(Collection<String> emails, String categoryId, String siteName, Map<String, Object> result) Insert subscribers- Parameters:
emails- the emails to insertcategoryId- the id of categorysiteName- the site name of categoryresult- the result map
-