Package org.ametys.plugins.sms.action
Class ImportSMSListSubscribersAction
- java.lang.Object
-
- org.apache.avalon.framework.logger.AbstractLogEnabled
-
- org.apache.cocoon.acting.AbstractAction
-
- org.apache.cocoon.acting.ServiceableAction
-
- org.ametys.plugins.sms.action.ImportSMSListSubscribersAction
-
- All Implemented Interfaces:
Component
,LogEnabled
,Serviceable
,Action
public class ImportSMSListSubscribersAction extends ServiceableAction
Action importing subscribers from a CSV file supposedly containing one valid number per line
-
-
Field Summary
Fields Modifier and Type Field Description private static String[]
__ALLOWED_EXTENSIONS
private AmetysObjectResolver
_ametysObjectResolver
The Ametys object resolverprivate SubscriberDAO
_subscriberDAO
The 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 ImportSMSListSubscribersAction()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private Set<String>
_getPhoneNumbers(BOMInputStream bomIS, Map<String,String> result)
Extract the phone numbers from the file.private void
_insertSubscribers(Collection<String> phoneNumbers, String smsListId, Map<String,String> result)
Insert subscribers in the broadcasting listMap
act(Redirector redirector, SourceResolver resolver, Map objectModel, String source, Parameters parameters)
void
service(ServiceManager smanager)
-
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
-
-
-
Field Detail
-
__ALLOWED_EXTENSIONS
private static final String[] __ALLOWED_EXTENSIONS
-
_subscriberDAO
private SubscriberDAO _subscriberDAO
The subscribers DAO.
-
_ametysObjectResolver
private AmetysObjectResolver _ametysObjectResolver
The Ametys object resolver
-
-
Constructor Detail
-
ImportSMSListSubscribersAction
public ImportSMSListSubscribersAction()
-
-
Method Detail
-
service
public void service(ServiceManager smanager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Overrides:
service
in classServiceableAction
- Throws:
ServiceException
-
act
public Map act(Redirector redirector, SourceResolver resolver, Map objectModel, String source, Parameters parameters) throws Exception
- Throws:
Exception
-
_getPhoneNumbers
private Set<String> _getPhoneNumbers(BOMInputStream bomIS, Map<String,String> result) throws IOException
Extract the phone numbers from the file.- Parameters:
bomIS
- the BOM input streamresult
- the result map- Returns:
- the collection of phone numbers.
- Throws:
IOException
- if an error occurs reading the file.
-
_insertSubscribers
private void _insertSubscribers(Collection<String> phoneNumbers, String smsListId, Map<String,String> result)
Insert subscribers in the broadcasting list- Parameters:
phoneNumbers
- the list of phone numbers to insertsmsListId
- the id of the sms listresult
- the server call result
-
-