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
public class ImportSubscribersAction extends ServiceableAction
Import subscribers from a CSV or text file.
-
-
Field Summary
Fields Modifier and Type Field Description protected CategoryProviderExtensionPoint_categoryProviderEPThe category provider extension point.protected SubscribersDAO_subscribersDaoThe subscribers DAO.-
Fields inherited from class org.apache.cocoon.acting.ServiceableAction
manager
-
Fields inherited from class org.apache.cocoon.acting.AbstractAction
EMPTY_MAP
-
-
Constructor Summary
Constructors Constructor Description ImportSubscribersAction()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Mapact(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 Detail
-
_subscribersDao
protected SubscribersDAO _subscribersDao
The subscribers DAO.
-
_categoryProviderEP
protected CategoryProviderExtensionPoint _categoryProviderEP
The category provider extension point.
-
-
Constructor Detail
-
ImportSubscribersAction
public ImportSubscribersAction()
-
-
Method Detail
-
service
public void service(ServiceManager smanager) throws ServiceException
- 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
protected Collection<String> getEmails(BOMInputStream bomIS) throws IOException
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
-
-