Package org.ametys.plugins.sms.broker
Class EtoileDieseBroker
- java.lang.Object
-
- org.apache.avalon.framework.logger.AbstractLogEnabled
-
- org.ametys.plugins.sms.broker.LoggerBroker
-
- org.ametys.plugins.sms.broker.EtoileDieseBroker
-
- All Implemented Interfaces:
Broker,Configurable,Contextualizable,LogEnabled,Serviceable
public class EtoileDieseBroker extends LoggerBroker implements Configurable, Contextualizable
Broker implementation using the "etoile diese" web service
-
-
Field Summary
Fields Modifier and Type Field Description private static SimpleDateFormat__DATE_FORMATprivate Context_contextThe Avalon contextprivate String_etoileDieseBulkWSUrlUrl of Etoile diese's send sms web service in bulk mode (the recipients are listed in a CSV file)private UserManager_userManagerThe users manager-
Fields inherited from class org.ametys.plugins.sms.broker.LoggerBroker
_ametysObjectResolver, _currentUserProvider
-
-
Constructor Summary
Constructors Constructor Description EtoileDieseBroker()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private InputStream_getCSVFile(Set<String> phoneNumbersList, String message)Creates and return a CSV file from a list of numbers and a messagevoidconfigure(Configuration configuration)voidcontextualize(Context context)StringgetPhoneNumberFromStopRequest()When a stop request is arriving from broker, the implementation extract the phone number associatedvoidsend(Set<String> phoneNumbersList, String message, String listId)Send the message from the sender to all the phones in the listvoidservice(ServiceManager manager)-
Methods inherited from class org.ametys.plugins.sms.broker.LoggerBroker
getCategory
-
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
-
-
-
Field Detail
-
__DATE_FORMAT
private static SimpleDateFormat __DATE_FORMAT
-
_etoileDieseBulkWSUrl
private String _etoileDieseBulkWSUrl
Url of Etoile diese's send sms web service in bulk mode (the recipients are listed in a CSV file)
-
_userManager
private UserManager _userManager
The users manager
-
-
Constructor Detail
-
EtoileDieseBroker
public EtoileDieseBroker()
-
-
Method Detail
-
configure
public void configure(Configuration configuration) throws ConfigurationException
- Specified by:
configurein interfaceConfigurable- Throws:
ConfigurationException
-
contextualize
public void contextualize(Context context) throws ContextException
- Specified by:
contextualizein interfaceContextualizable- Throws:
ContextException
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
servicein interfaceServiceable- Overrides:
servicein classLoggerBroker- Throws:
ServiceException
-
send
public void send(Set<String> phoneNumbersList, String message, String listId) throws Exception
Description copied from interface:BrokerSend the message from the sender to all the phones in the list- Specified by:
sendin interfaceBroker- Overrides:
sendin classLoggerBroker- Parameters:
phoneNumbersList- the list of phone numbersmessage- the message to sendlistId- the jcr id of the list to send mail to- Throws:
Exception- If the message was not sent correctly
-
getPhoneNumberFromStopRequest
public String getPhoneNumberFromStopRequest() throws Exception
Description copied from interface:BrokerWhen a stop request is arriving from broker, the implementation extract the phone number associated- Specified by:
getPhoneNumberFromStopRequestin interfaceBroker- Overrides:
getPhoneNumberFromStopRequestin classLoggerBroker- Returns:
- the phone number from the 'stop' sender at format +{countryCode}{number} (ex: +33612345678), it can be null if the phone number cannot be extracted from the stop request
- Throws:
Exception- if the phone number was not provided within the stop request
-
_getCSVFile
private InputStream _getCSVFile(Set<String> phoneNumbersList, String message) throws IOException
Creates and return a CSV file from a list of numbers and a message- Parameters:
phoneNumbersList- the list of phone numbers to send a SMS tomessage- the message to send- Returns:
- the csv file
- Throws:
IOException- if an error occurs while converting the list of phone numbers to an input stream
-
-