public class EtoileDieseBroker extends LoggerBroker implements Configurable, Contextualizable
Modifier and Type | Field and Description |
---|---|
private static SimpleDateFormat |
__DATE_FORMAT |
private Context |
_context
The Avalon context
|
private String |
_etoileDieseBulkWSUrl
Url of Etoile diese's send sms web service in bulk mode (the recipients are listed in a CSV file)
|
private UserManager |
_userManager
The users manager
|
_ametysObjectResolver, _currentUserProvider
Constructor and Description |
---|
EtoileDieseBroker() |
Modifier and Type | Method and Description |
---|---|
private InputStream |
_getCSVFile(Set<String> phoneNumbersList,
String message)
Creates and return a CSV file from a list of numbers and a message
|
void |
configure(Configuration configuration) |
void |
contextualize(Context context) |
String |
getPhoneNumberFromStopRequest()
When a stop request is arriving from broker, the implementation extract the phone number associated
|
void |
send(Set<String> phoneNumbersList,
String message,
String listId)
Send the message from the sender to all the phones in the list
|
void |
service(ServiceManager manager) |
getCategory
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
private static SimpleDateFormat __DATE_FORMAT
private String _etoileDieseBulkWSUrl
private UserManager _userManager
public EtoileDieseBroker()
public void configure(Configuration configuration) throws ConfigurationException
configure
in interface Configurable
ConfigurationException
public void contextualize(Context context) throws ContextException
contextualize
in interface Contextualizable
ContextException
public void service(ServiceManager manager) throws ServiceException
service
in interface Serviceable
service
in class LoggerBroker
ServiceException
public void send(Set<String> phoneNumbersList, String message, String listId) throws Exception
Broker
send
in interface Broker
send
in class LoggerBroker
phoneNumbersList
- the list of phone numbersmessage
- the message to sendlistId
- the jcr id of the list to send mail toException
- If the message was not sent correctlypublic String getPhoneNumberFromStopRequest() throws Exception
Broker
getPhoneNumberFromStopRequest
in interface Broker
getPhoneNumberFromStopRequest
in class LoggerBroker
Exception
- if the phone number was not provided within the stop requestprivate InputStream _getCSVFile(Set<String> phoneNumbersList, String message) throws IOException
phoneNumbersList
- the list of phone numbers to send a SMS tomessage
- the message to sendIOException
- if an error occurs while converting the list of phone numbers to an input stream