Package org.ametys.plugins.sms.dao
Class SubscriberDAO
- java.lang.Object
-
- org.ametys.runtime.plugin.component.AbstractLogEnabled
-
- org.ametys.core.datasource.AbstractMyBatisDAO
-
- org.ametys.plugins.sms.dao.SubscriberDAO
-
- All Implemented Interfaces:
LogEnabled
,PluginAware
,Component
,Configurable
,Contextualizable
,Serviceable
public class SubscriberDAO extends AbstractMyBatisDAO
DAO for manipulating SMS subscribers.
-
-
Field Summary
Fields Modifier and Type Field Description static String
ROLE
The Avalon role-
Fields inherited from class org.ametys.core.datasource.AbstractMyBatisDAO
_manager
-
-
Constructor Summary
Constructors Constructor Description SubscriberDAO()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Map<String,String>
createSubscriber(String listId, String phoneNumber)
Creates a SMS subscriber.void
deleteAllNumbers(String list)
Delete every phone number of a listvoid
deleteNumber(String phoneNumber, String list)
Delete the phoneNumber in the databaseMap<String,Object>
deleteSubscribers(String listId, ArrayList<String> phoneNumbers)
Deletes the given subscribers.Map<String,Number>
getNbUserFromList()
Get the number of user in a listMap<String,Date>
getPhoneNumbersFromList(String list)
Get all the phone numbers in the database form the listvoid
insertNumber(String phoneNumber, String list)
Insert the phoneNumber in the databaseboolean
numberAlreadyExists(String phoneNumber, String list)
Check if the phoneNumber exists in the database-
Methods inherited from class org.ametys.core.datasource.AbstractMyBatisDAO
_configureDatasource, _getDataSourceId, _getMyBatisConfiguration, configure, contextualize, getSession, getSession, reload, service, setPluginInfo
-
Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
-
-
-
Constructor Detail
-
SubscriberDAO
public SubscriberDAO()
-
-
Method Detail
-
getPhoneNumbersFromList
public Map<String,Date> getPhoneNumbersFromList(String list)
Get all the phone numbers in the database form the list- Parameters:
list
- the id of the phone number list- Returns:
- A map, where keys are phone number and value are date object.
-
insertNumber
public void insertNumber(String phoneNumber, String list)
Insert the phoneNumber in the database- Parameters:
phoneNumber
- the phone numberlist
- the id of the phone number list
-
numberAlreadyExists
public boolean numberAlreadyExists(String phoneNumber, String list)
Check if the phoneNumber exists in the database- Parameters:
phoneNumber
- the phone numberlist
- the id of the list- Returns:
- true if exist
-
createSubscriber
public Map<String,String> createSubscriber(String listId, String phoneNumber)
Creates a SMS subscriber.- Parameters:
listId
- The id of the SMS list to subscribe to.phoneNumber
- The phone number to add- Returns:
- The list id and the phone number of the added subscriber, or an error
-
deleteNumber
public void deleteNumber(String phoneNumber, String list)
Delete the phoneNumber in the database- Parameters:
phoneNumber
- the phone numberlist
- the id of the phone number list
-
deleteAllNumbers
public void deleteAllNumbers(String list)
Delete every phone number of a list- Parameters:
list
- the id of the phone number list
-
deleteSubscribers
public Map<String,Object> deleteSubscribers(String listId, ArrayList<String> phoneNumbers)
Deletes the given subscribers.- Parameters:
listId
- The The id of the SMS list.phoneNumbers
- The phone numbers to delete- Returns:
- The list id, the numbers deleted, the numbers not deleted and/or an error.
-
getNbUserFromList
public Map<String,Number> getNbUserFromList()
Get the number of user in a list- Returns:
- the number of user for each sms list
-
-