net.rim.pushsdk.subscription
Class SubRDBMSDAOImpl

java.lang.Object
  extended by org.springframework.dao.support.DaoSupport
      extended by org.springframework.jdbc.core.support.JdbcDaoSupport
          extended by net.rim.pushsdk.commons.PushSDKBaseDAO
              extended by net.rim.pushsdk.subscription.SubRDBMSDAOImpl
All Implemented Interfaces:
SubscriptionDAO, org.springframework.beans.factory.InitializingBean

public class SubRDBMSDAOImpl
extends PushSDKBaseDAO
implements SubscriptionDAO

RDBMS implementation of the SubscriptionDAO interface.

Dependencies that must be injected to properly initialize this object for use:
- dataSource
- sqlProperties
- pushSDKProperties
- cache (optional)

Author:
mdandrea

Field Summary
protected  SQLProperties sqlProperties
          The SQL properties to use for querying the database.
 
Fields inherited from class net.rim.pushsdk.commons.PushSDKBaseDAO
DATABASE_TZ
 
Fields inherited from class org.springframework.dao.support.DaoSupport
logger
 
Constructor Summary
SubRDBMSDAOImpl()
           
 
Method Summary
 void batchIncrementConsecutiveFailedPushCount(List<SubscriberPartial> subscribers)
          Deprecated. 
 void batchResetConsecutiveFailedPushCount(List<SubscriberPartial> subscribers)
          Deprecated. 
 void deleteInactiveSubscription(String pushApplicationId, String subscriberId)
          Deletes an inactive (unsubscribed) subscription from persistent storage.
 void deleteSubscriptions(String pushApplicationId)
          Deletes all the subscriptions from storage (and potentially the cache) for a push application.
 List<SubscriberPartial> findByAddressAndIdAndNotStatus(String address, String subscriberId, SubscriberStatus status)
          Finds a list of subscribers with the specified address and the specified subscriber id and NOT the specified status.
 List<SubscriberPartial> findByAddressAndNotIdAndNotStatus(String address, String subscriberId, SubscriberStatus status)
          Finds a list of subscribers with the specified address and NOT the specified subscriber id and NOT the specified status.
 List<SubscriberPartial> findByAppId(String pushApplicationId, int startIndex, int endIndex)
          Finds a list of subscribers with the specified push application id.
 List<SubscriberPartial> findByAppIdAndAddress(String pushApplicationId, String address)
          Finds a list of subscribers with the specified address and push application id.
 Subscriber findByAppIdAndId(String pushApplicationId, String subscriberId)
          Finds the subscriber with the specified id and push application id.
 SubscriberPartial findByAppIdAndIdPartial(String pushApplicationId, String subscriberId)
          Similar to the findByAppIdAndId method, but only finds a subscriber with partial information.
 List<SubscriberPartial> findByAppIdAndIdsAndStatus(String pushApplicationId, List<String> subscriberIds, SubscriberStatus status)
          Finds a list of subscribers for the given push application id that are in the specified subscriber id list with the specified status.
 List<SubscriberPartial> findByAppIdAndStatus(String pushApplicationId, SubscriberStatus status, int startIndex, int endIndex)
          Finds a list of subscribers with the specified push application id and status.
 List<SubscriberPartial> findByAppIdAndType(String pushApplicationId, SubscriberType type, int startIndex, int endIndex)
          Finds a list of subscribers with the specified push application id and type.
 List<SubscriberPartial> findByAppIdAndTypeAndStatus(String pushApplicationId, SubscriberType type, SubscriberStatus status, int startIndex, int endIndex)
          Finds a list of subscribers with the specified push application id, type, and status.
 List<SubscriberPartial> findById(String subscriberId)
          Finds a list of subscribers with the specified id.
 List<SubscriberPartial> findByIdAndNotStatus(String subscriberId, SubscriberStatus status)
          Finds a list of subscribers with the specified id and NOT the specified status.
 List<SubscriberPartial> findByIdAndStatus(String subscriberId, SubscriberStatus status)
          Finds a list of subscribers with the specified id and status.
 List<SubscriberPartial> findByIdPattern(String subscriberIdPattern, int startIndex, int endIndex)
          Finds a list of subscribers whose id contains the given subscriberIdPattern.
 int getConsecutiveFailedPushCount(SubscriberPartial subscriber)
          Deprecated. 
 List<DeviceModelCount> getDeviceModelCount(String pushApplicationId)
          Gets a count of the number of users of a push application (regardless of status) for each BlackBerry device model.
 List<DeviceModelCount> getDeviceModelCount(String pushApplicationId, SubscriberStatus status)
          Gets a count of the number of users of a push application with a given status for each BlackBerry device model.
 List<OsVersionCount> getOsVersionCount(String pushApplicationId)
          Gets a count of the number of users of a push application (regardless of status) for each OS version running on a BlackBerry device.
 List<OsVersionCount> getOsVersionCount(String pushApplicationId, SubscriberStatus status)
          Gets a count of the number of users of a push application with a given status for each OS version running on a BlackBerry device.
 int getResumeCount(String pushApplicationId, Date fromDate, Date toDate)
          Gets a count of the number of users that had their subscriptions resumed for an application between the given date range.
 int getSizeByAppId(String pushApplicationId)
          Gets a count of all the subscribers in storage with the specified push application id.
 int getSizeByAppIdAndStatus(String pushApplicationId, SubscriberStatus status)
          Gets a count of all the subscribers in storage with the specified push application id and status.
 int getSizeByAppIdAndType(String pushApplicationId, SubscriberType type)
          Gets a count of all the subscribers in storage with the specified push application id and type.
 int getSizeByAppIdAndTypeAndStatus(String pushApplicationId, SubscriberType type, SubscriberStatus status)
          Gets a count of all the subscribers in storage with the specified push application id, type, and status.
 int getSizeByIdPattern(String subscriberIdPattern)
          Gets a count of all the subscribers in storage whose id contains the given subscriberIdPattern.
 int getSubscribeCount(String pushApplicationId, Date fromDate, Date toDate)
          Gets a count of the number of new subscribers for a given date range.
 int getSuspendCount(String pushApplicationId, Date fromDate, Date toDate)
          Gets a count of the number of users that had their subscriptions suspended for an application between the given date range.
 int getUnsubscribeCount(String pushApplicationId, Date fromDate, Date toDate)
          Gets a count of the number of users that unsubscribed between the given date range.
 void incrementConsecutiveFailedPushCount(String pushApplicationId, String subscriberId)
          Deprecated. 
 SubscriberPartial loadFromCache(String pushApplicationId, String subscriberId)
          Attempts to load a partial subscriber from the cache or from memory (for in-memory implementations).
 void removeAllFromCache()
          Removes all objects from the cache.
 void resetConsecutiveFailedPushCount(String pushApplicationId, String subscriberId)
          Deprecated. 
 void resubscribe(SubscribeRequest subRequest)
          Adds a subscriber's resubscription details to persistent storage.
 void resume(ResumeRequest resumeRequest)
          Adds a subscriber's resume subscription details to persistent storage.
 void setCache(net.sf.ehcache.Cache cache)
          Sets a cache to use to cache subscribers.
 void setPushSDKProperties(PushSDKProperties pushSDKProperties)
          Support for dependency injection.
 void setSqlProperties(SQLProperties sqlProperties)
          Sets the SQL properties to use for querying the database.
 void subscribe(SubscribeRequest subRequest)
          Adds a subscriber's subscription details to persistent storage.
 void suspend(SuspendRequest suspRequest)
          Adds a subscriber's suspended subscription details to persistent storage.
 void unsubscribe(UnsubscribeRequest unsubRequest)
          Adds a subscriber's unsubscription details to persistent storage.
 
Methods inherited from class net.rim.pushsdk.commons.PushSDKBaseDAO
encodeSQLText, encodeSQLText, encodeSQLText, getSimpleJdbcTemplate
 
Methods inherited from class org.springframework.jdbc.core.support.JdbcDaoSupport
checkDaoConfig, createJdbcTemplate, getConnection, getDataSource, getExceptionTranslator, getJdbcTemplate, initTemplateConfig, releaseConnection, setDataSource, setJdbcTemplate
 
Methods inherited from class org.springframework.dao.support.DaoSupport
afterPropertiesSet, initDao
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sqlProperties

protected SQLProperties sqlProperties
The SQL properties to use for querying the database.

Constructor Detail

SubRDBMSDAOImpl

public SubRDBMSDAOImpl()
Method Detail

setSqlProperties

public void setSqlProperties(SQLProperties sqlProperties)
Sets the SQL properties to use for querying the database.

Parameters:
sqlProperties - the SQL properties

setPushSDKProperties

public void setPushSDKProperties(PushSDKProperties pushSDKProperties)
Support for dependency injection. This will override the default PushSDKProperties implementation.

Parameters:
pushSDKProperties - an instance of PushSDKProperties

setCache

public void setCache(net.sf.ehcache.Cache cache)
Sets a cache to use to cache subscribers. Optional - do not call setter if no cache should be used.

Parameters:
cache - an instance of a cache

findByAppIdAndId

public Subscriber findByAppIdAndId(String pushApplicationId,
                                   String subscriberId)
                            throws org.springframework.dao.DataAccessException
Description copied from interface: SubscriptionDAO
Finds the subscriber with the specified id and push application id.

Specified by:
findByAppIdAndId in interface SubscriptionDAO
Parameters:
pushApplicationId - the id of the push application
subscriberId - the id of the subscriber
Returns:
the subscriber, if found; otherwise, null
Throws:
org.springframework.dao.DataAccessException - if any errors occur

findByAppIdAndAddress

public List<SubscriberPartial> findByAppIdAndAddress(String pushApplicationId,
                                                     String address)
                                              throws org.springframework.dao.DataAccessException
Description copied from interface: SubscriptionDAO
Finds a list of subscribers with the specified address and push application id.

Specified by:
findByAppIdAndAddress in interface SubscriptionDAO
Parameters:
pushApplicationId - the id of the push application
address - the address of the subscriber (case insensitive)
Returns:
a list of subscribers, if found; otherwise, an empty list
Throws:
org.springframework.dao.DataAccessException - if any errors occur

findByAddressAndNotIdAndNotStatus

public List<SubscriberPartial> findByAddressAndNotIdAndNotStatus(String address,
                                                                 String subscriberId,
                                                                 SubscriberStatus status)
                                                          throws org.springframework.dao.DataAccessException
Description copied from interface: SubscriptionDAO
Finds a list of subscribers with the specified address and NOT the specified subscriber id and NOT the specified status.

Specified by:
findByAddressAndNotIdAndNotStatus in interface SubscriptionDAO
Parameters:
address - the address of the subscriber (case insensitive)
subscriberId - the id of the subscriber
status - a subscriber status
Returns:
a list of subscribers, if found; otherwise, an empty list
Throws:
org.springframework.dao.DataAccessException - if any errors occur

findByAddressAndIdAndNotStatus

public List<SubscriberPartial> findByAddressAndIdAndNotStatus(String address,
                                                              String subscriberId,
                                                              SubscriberStatus status)
                                                       throws org.springframework.dao.DataAccessException
Description copied from interface: SubscriptionDAO
Finds a list of subscribers with the specified address and the specified subscriber id and NOT the specified status.

Specified by:
findByAddressAndIdAndNotStatus in interface SubscriptionDAO
Parameters:
address - the address of the subscriber (case insensitive)
subscriberId - the id of the subscriber
status - a subscriber status
Returns:
a list of subscribers, if found; otherwise, an empty list
Throws:
org.springframework.dao.DataAccessException - if any errors occur

findByAppIdAndStatus

public List<SubscriberPartial> findByAppIdAndStatus(String pushApplicationId,
                                                    SubscriberStatus status,
                                                    int startIndex,
                                                    int endIndex)
                                             throws org.springframework.dao.DataAccessException
Description copied from interface: SubscriptionDAO
Finds a list of subscribers with the specified push application id and status. Note: Index arguments are present to address memory concerns, since if we retrieve a full list it might be quite large. Indexes are inclusive and start at 0.

Specified by:
findByAppIdAndStatus in interface SubscriptionDAO
Parameters:
pushApplicationId - the id of the push application
status - a subscriber status
startIndex - the index of the first entry to be retrieved
endIndex - the index of the last entry to be retrieved
Returns:
a list of subscribers, if found; otherwise, an empty list
Throws:
org.springframework.dao.DataAccessException - if any errors occur

findByAppIdAndType

public List<SubscriberPartial> findByAppIdAndType(String pushApplicationId,
                                                  SubscriberType type,
                                                  int startIndex,
                                                  int endIndex)
                                           throws org.springframework.dao.DataAccessException
Description copied from interface: SubscriptionDAO
Finds a list of subscribers with the specified push application id and type. Note: Index arguments are present to address memory concerns, since if we retrieve a full list it might be quite large. Indexes are inclusive and start at 0.

Specified by:
findByAppIdAndType in interface SubscriptionDAO
Parameters:
pushApplicationId - the id of the push application
type - the type of a subscriber
startIndex - the index of the first entry to be retrieved
endIndex - the index of the last entry to be retrieved
Returns:
a list of subscribers, if found; otherwise, an empty list
Throws:
org.springframework.dao.DataAccessException - if any errors occur

findByAppIdAndTypeAndStatus

public List<SubscriberPartial> findByAppIdAndTypeAndStatus(String pushApplicationId,
                                                           SubscriberType type,
                                                           SubscriberStatus status,
                                                           int startIndex,
                                                           int endIndex)
                                                    throws org.springframework.dao.DataAccessException
Description copied from interface: SubscriptionDAO
Finds a list of subscribers with the specified push application id, type, and status. Note: Index arguments are present to address memory concerns, since if we retrieve a full list it might be quite large. Indexes are inclusive and start at 0.

Specified by:
findByAppIdAndTypeAndStatus in interface SubscriptionDAO
Parameters:
pushApplicationId - the id of the push application
type - the type of a subscriber
status - the status of a subscriber
startIndex - the index of the first entry to be retrieved
endIndex - the index of the last entry to be retrieved
Returns:
a list of subscribers, if found; otherwise, an empty list
Throws:
org.springframework.dao.DataAccessException - if any errors occur

findByIdAndStatus

public List<SubscriberPartial> findByIdAndStatus(String subscriberId,
                                                 SubscriberStatus status)
                                          throws org.springframework.dao.DataAccessException
Description copied from interface: SubscriptionDAO
Finds a list of subscribers with the specified id and status.

Specified by:
findByIdAndStatus in interface SubscriptionDAO
Parameters:
subscriberId - the id of the subscriber
status - a subscriber status
Returns:
a list of subscribers, if found; otherwise, an empty list
Throws:
org.springframework.dao.DataAccessException - if any errors occur

findByIdAndNotStatus

public List<SubscriberPartial> findByIdAndNotStatus(String subscriberId,
                                                    SubscriberStatus status)
                                             throws org.springframework.dao.DataAccessException
Description copied from interface: SubscriptionDAO
Finds a list of subscribers with the specified id and NOT the specified status.

Specified by:
findByIdAndNotStatus in interface SubscriptionDAO
Parameters:
subscriberId - the id of the subscriber
status - a subscriber status
Returns:
a list of subscribers, if found; otherwise, an empty list
Throws:
org.springframework.dao.DataAccessException - if any errors occur

findByAppId

public List<SubscriberPartial> findByAppId(String pushApplicationId,
                                           int startIndex,
                                           int endIndex)
                                    throws org.springframework.dao.DataAccessException
Description copied from interface: SubscriptionDAO
Finds a list of subscribers with the specified push application id. Note: Index arguments are present to address memory concerns, since if we retrieve a full list it might be quite large. Indexes are inclusive and start at 0.

Specified by:
findByAppId in interface SubscriptionDAO
Parameters:
pushApplicationId - the id of the push application
startIndex - the index of the first entry to be retrieved
endIndex - the index of the last entry to be retrieved
Returns:
a list of subscribers, if found; otherwise, an empty list
Throws:
org.springframework.dao.DataAccessException - if any errors occur

findById

public List<SubscriberPartial> findById(String subscriberId)
                                 throws org.springframework.dao.DataAccessException
Description copied from interface: SubscriptionDAO
Finds a list of subscribers with the specified id.

Specified by:
findById in interface SubscriptionDAO
Parameters:
subscriberId - the id of the subscriber
Returns:
a list of subscribers, if found; otherwise, an empty list
Throws:
org.springframework.dao.DataAccessException - if any errors occur

suspend

public void suspend(SuspendRequest suspRequest)
             throws org.springframework.dao.DataAccessException
Description copied from interface: SubscriptionDAO
Adds a subscriber's suspended subscription details to persistent storage.

Specified by:
suspend in interface SubscriptionDAO
Parameters:
suspRequest - object containing all the information required for a suspend
Throws:
org.springframework.dao.DataAccessException - if any errors occur

resume

public void resume(ResumeRequest resumeRequest)
            throws org.springframework.dao.DataAccessException
Description copied from interface: SubscriptionDAO
Adds a subscriber's resume subscription details to persistent storage.

Specified by:
resume in interface SubscriptionDAO
Parameters:
resumeRequest - object containing all the information required for a resume
Throws:
org.springframework.dao.DataAccessException - if any errors occur

resubscribe

public void resubscribe(SubscribeRequest subRequest)
                 throws org.springframework.dao.DataAccessException
Description copied from interface: SubscriptionDAO
Adds a subscriber's resubscription details to persistent storage.

Specified by:
resubscribe in interface SubscriptionDAO
Parameters:
subRequest - object containing all the information required for a resubscribe
Throws:
org.springframework.dao.DataAccessException - if any errors occur

subscribe

public void subscribe(SubscribeRequest subRequest)
               throws org.springframework.dao.DataAccessException
Description copied from interface: SubscriptionDAO
Adds a subscriber's subscription details to persistent storage.

Specified by:
subscribe in interface SubscriptionDAO
Parameters:
subRequest - object containing all the information required for a subscribe
Throws:
org.springframework.dao.DataAccessException - if any errors occur

unsubscribe

public void unsubscribe(UnsubscribeRequest unsubRequest)
                 throws org.springframework.dao.DataAccessException
Description copied from interface: SubscriptionDAO
Adds a subscriber's unsubscription details to persistent storage.

Specified by:
unsubscribe in interface SubscriptionDAO
Parameters:
unsubRequest - object containing all the information required for an unsubscribe
Throws:
org.springframework.dao.DataAccessException - if any errors occur

getSizeByAppId

public int getSizeByAppId(String pushApplicationId)
                   throws org.springframework.dao.DataAccessException
Description copied from interface: SubscriptionDAO
Gets a count of all the subscribers in storage with the specified push application id.

Specified by:
getSizeByAppId in interface SubscriptionDAO
Parameters:
pushApplicationId - the id of the push application
Returns:
a count of subscribers
Throws:
org.springframework.dao.DataAccessException - if any errors occur

getSizeByAppIdAndStatus

public int getSizeByAppIdAndStatus(String pushApplicationId,
                                   SubscriberStatus status)
                            throws org.springframework.dao.DataAccessException
Description copied from interface: SubscriptionDAO
Gets a count of all the subscribers in storage with the specified push application id and status.

Specified by:
getSizeByAppIdAndStatus in interface SubscriptionDAO
Parameters:
pushApplicationId - the id of the push application
status - a subscriber status
Returns:
a count of subscribers
Throws:
org.springframework.dao.DataAccessException - if any errors occur

getSizeByAppIdAndType

public int getSizeByAppIdAndType(String pushApplicationId,
                                 SubscriberType type)
                          throws org.springframework.dao.DataAccessException
Description copied from interface: SubscriptionDAO
Gets a count of all the subscribers in storage with the specified push application id and type.

Specified by:
getSizeByAppIdAndType in interface SubscriptionDAO
Parameters:
pushApplicationId - the id of the push application
type - the type of a subscriber
Returns:
a count of subscribers
Throws:
org.springframework.dao.DataAccessException - if any errors occur

getSizeByAppIdAndTypeAndStatus

public int getSizeByAppIdAndTypeAndStatus(String pushApplicationId,
                                          SubscriberType type,
                                          SubscriberStatus status)
                                   throws org.springframework.dao.DataAccessException
Description copied from interface: SubscriptionDAO
Gets a count of all the subscribers in storage with the specified push application id, type, and status.

Specified by:
getSizeByAppIdAndTypeAndStatus in interface SubscriptionDAO
Parameters:
pushApplicationId - the id of the push application
type - the type of a subscriber
status - the status of a subscriber
Returns:
a count of subscribers
Throws:
org.springframework.dao.DataAccessException - if any errors occur

findByAppIdAndIdsAndStatus

public List<SubscriberPartial> findByAppIdAndIdsAndStatus(String pushApplicationId,
                                                          List<String> subscriberIds,
                                                          SubscriberStatus status)
                                                   throws org.springframework.dao.DataAccessException
Description copied from interface: SubscriptionDAO
Finds a list of subscribers for the given push application id that are in the specified subscriber id list with the specified status. (e.g. find all subscribers that match the ids in the passed in list that for the given push application are active)

Specified by:
findByAppIdAndIdsAndStatus in interface SubscriptionDAO
Parameters:
pushApplicationId - the id of the push application
subscriberIds - only subscribers with one of these ids will be returned
status - only subscribers that match this status will be returned
Returns:
a list of subscribers, if found; otherwise, an empty list
Throws:
org.springframework.dao.DataAccessException - if any errors occur

incrementConsecutiveFailedPushCount

@Deprecated
public void incrementConsecutiveFailedPushCount(String pushApplicationId,
                                                           String subscriberId)
                                         throws org.springframework.dao.DataAccessException
Deprecated. 

Description copied from interface: SubscriptionDAO
Increments the count of consecutive failed push counts for a subscriber by 1.

Specified by:
incrementConsecutiveFailedPushCount in interface SubscriptionDAO
Parameters:
pushApplicationId - the id of the push application
subscriberId - the id of the subscriber
Throws:
org.springframework.dao.DataAccessException - if any errors occur

resetConsecutiveFailedPushCount

@Deprecated
public void resetConsecutiveFailedPushCount(String pushApplicationId,
                                                       String subscriberId)
                                     throws org.springframework.dao.DataAccessException
Deprecated. 

Description copied from interface: SubscriptionDAO
Resets the count of consecutive failed push counts for a subscriber back to 0.

Specified by:
resetConsecutiveFailedPushCount in interface SubscriptionDAO
Parameters:
pushApplicationId - the id of the push application
subscriberId - the id of the subscriber
Throws:
org.springframework.dao.DataAccessException - if any errors occur

batchIncrementConsecutiveFailedPushCount

@Deprecated
public void batchIncrementConsecutiveFailedPushCount(List<SubscriberPartial> subscribers)
                                              throws org.springframework.dao.DataAccessException
Deprecated. 

Description copied from interface: SubscriptionDAO
Batch increments the count of consecutive failed push counts for subscribers by 1.

Specified by:
batchIncrementConsecutiveFailedPushCount in interface SubscriptionDAO
Parameters:
subscribers - list of subscribers to increment count
Throws:
org.springframework.dao.DataAccessException - if any errors occur

batchResetConsecutiveFailedPushCount

@Deprecated
public void batchResetConsecutiveFailedPushCount(List<SubscriberPartial> subscribers)
                                          throws org.springframework.dao.DataAccessException
Deprecated. 

Description copied from interface: SubscriptionDAO
Batch resets the count of consecutive failed push counts for subscribers back to 0.

Specified by:
batchResetConsecutiveFailedPushCount in interface SubscriptionDAO
Parameters:
subscribers - list of subscribers to reset count
Throws:
org.springframework.dao.DataAccessException - if any errors occur

getConsecutiveFailedPushCount

@Deprecated
public int getConsecutiveFailedPushCount(SubscriberPartial subscriber)
                                  throws org.springframework.dao.DataAccessException
Deprecated. 

Description copied from interface: SubscriptionDAO
Gets the count of consecutive failed push for a subscriber.

Specified by:
getConsecutiveFailedPushCount in interface SubscriptionDAO
Parameters:
subscriber - SubscriberPartial object with push application id and subscriber id set
Returns:
consecutive failed push count
Throws:
org.springframework.dao.DataAccessException - if any errors occur

deleteInactiveSubscription

public void deleteInactiveSubscription(String pushApplicationId,
                                       String subscriberId)
                                throws org.springframework.dao.DataAccessException
Description copied from interface: SubscriptionDAO
Deletes an inactive (unsubscribed) subscription from persistent storage.

Specified by:
deleteInactiveSubscription in interface SubscriptionDAO
Parameters:
pushApplicationId - the id of the push application
subscriberId - the id of the subscriber
Throws:
org.springframework.dao.DataAccessException - if any errors occur

deleteSubscriptions

public void deleteSubscriptions(String pushApplicationId)
                         throws org.springframework.dao.DataAccessException
Description copied from interface: SubscriptionDAO
Deletes all the subscriptions from storage (and potentially the cache) for a push application.

Note: This method should be used with caution as it will remove ALL subscriptions regardless of their status.

Specified by:
deleteSubscriptions in interface SubscriptionDAO
Parameters:
pushApplicationId - the id of the push application
Throws:
org.springframework.dao.DataAccessException - if any errors occur

findByIdPattern

public List<SubscriberPartial> findByIdPattern(String subscriberIdPattern,
                                               int startIndex,
                                               int endIndex)
                                        throws org.springframework.dao.DataAccessException
Description copied from interface: SubscriptionDAO
Finds a list of subscribers whose id contains the given subscriberIdPattern.

Note: Index arguments are present to address memory concerns, since if we retrieve a full list it might be quite large. Indexes are inclusive and start at 0.

Specified by:
findByIdPattern in interface SubscriptionDAO
Parameters:
subscriberIdPattern - a whole or partial subscriberId to match
startIndex - the index of the first entry to be retrieved
endIndex - the index of the last entry to be retrieved
Returns:
a list of subscribers, if found; otherwise, an empty list
Throws:
org.springframework.dao.DataAccessException - if any errors occur

getSizeByIdPattern

public int getSizeByIdPattern(String subscriberIdPattern)
                       throws org.springframework.dao.DataAccessException
Description copied from interface: SubscriptionDAO
Gets a count of all the subscribers in storage whose id contains the given subscriberIdPattern.

Specified by:
getSizeByIdPattern in interface SubscriptionDAO
Parameters:
subscriberIdPattern - a whole or partial subscriberId to match
Returns:
a count of subscribers
Throws:
org.springframework.dao.DataAccessException - if any errors occur

findByAppIdAndIdPartial

public SubscriberPartial findByAppIdAndIdPartial(String pushApplicationId,
                                                 String subscriberId)
                                          throws org.springframework.dao.DataAccessException
Description copied from interface: SubscriptionDAO
Similar to the findByAppIdAndId method, but only finds a subscriber with partial information.

Specified by:
findByAppIdAndIdPartial in interface SubscriptionDAO
Parameters:
pushApplicationId - the id of the push application
subscriberId - the id of the subscriber
Returns:
a partial subscriber
Throws:
org.springframework.dao.DataAccessException - if any errors occur

loadFromCache

public SubscriberPartial loadFromCache(String pushApplicationId,
                                       String subscriberId)
Description copied from interface: SubscriptionDAO
Attempts to load a partial subscriber from the cache or from memory (for in-memory implementations). Returns null if the partial subscriber could not be found in the cache or if no cache is being used.

Specified by:
loadFromCache in interface SubscriptionDAO
Parameters:
pushApplicationId - the id of the push application
subscriberId - the id of the subscriber
Returns:
a partial subscriber from the cache, or null if it cannot be found

getSubscribeCount

public int getSubscribeCount(String pushApplicationId,
                             Date fromDate,
                             Date toDate)
                      throws org.springframework.dao.DataAccessException
Description copied from interface: SubscriptionDAO
Gets a count of the number of new subscribers for a given date range.

This will be determined based on those individuals that have a subscribe date between the two dates specified.

Specified by:
getSubscribeCount in interface SubscriptionDAO
Parameters:
pushApplicationId - the id of the push application
fromDate - inclusive from date parameter of the range
toDate - inclusive to date parameter of the range
Returns:
a count of the number of new subscribers
Throws:
org.springframework.dao.DataAccessException - if any errors occur

getUnsubscribeCount

public int getUnsubscribeCount(String pushApplicationId,
                               Date fromDate,
                               Date toDate)
                        throws org.springframework.dao.DataAccessException
Description copied from interface: SubscriptionDAO
Gets a count of the number of users that unsubscribed between the given date range.

This will be determined based on those individuals that have an unsubscribe date between the two dates specified.

Specified by:
getUnsubscribeCount in interface SubscriptionDAO
Parameters:
pushApplicationId - the id of the push application
fromDate - inclusive from date parameter of the range
toDate - inclusive to date parameter of the range
Returns:
a count of the number of users that unsubscribed
Throws:
org.springframework.dao.DataAccessException - if any errors occur

getResumeCount

public int getResumeCount(String pushApplicationId,
                          Date fromDate,
                          Date toDate)
                   throws org.springframework.dao.DataAccessException
Description copied from interface: SubscriptionDAO
Gets a count of the number of users that had their subscriptions resumed for an application between the given date range.

This will be determined based on those individuals that have a resume date between the two dates specified.

Specified by:
getResumeCount in interface SubscriptionDAO
Parameters:
pushApplicationId - the id of the push application
fromDate - inclusive from date parameter of the range
toDate - inclusive to date parameter of the range
Returns:
a count of the number of users that had their subscriptions resumed
Throws:
org.springframework.dao.DataAccessException - if any errors occur

getSuspendCount

public int getSuspendCount(String pushApplicationId,
                           Date fromDate,
                           Date toDate)
                    throws org.springframework.dao.DataAccessException
Description copied from interface: SubscriptionDAO
Gets a count of the number of users that had their subscriptions suspended for an application between the given date range.

This will be determined based on those individuals that have a suspend date between the two dates specified.

Specified by:
getSuspendCount in interface SubscriptionDAO
Parameters:
pushApplicationId - the id of the push application
fromDate - inclusive from date parameter of the range
toDate - inclusive to date parameter of the range
Returns:
a count of the number of users that had their subscriptions suspended
Throws:
org.springframework.dao.DataAccessException - if any errors occur

getDeviceModelCount

public List<DeviceModelCount> getDeviceModelCount(String pushApplicationId)
                                           throws org.springframework.dao.DataAccessException
Description copied from interface: SubscriptionDAO
Gets a count of the number of users of a push application (regardless of status) for each BlackBerry device model.

Specified by:
getDeviceModelCount in interface SubscriptionDAO
Parameters:
pushApplicationId - the id of the push application
Returns:
a list of device model count objects
Throws:
org.springframework.dao.DataAccessException - if any errors occur

getDeviceModelCount

public List<DeviceModelCount> getDeviceModelCount(String pushApplicationId,
                                                  SubscriberStatus status)
                                           throws org.springframework.dao.DataAccessException
Description copied from interface: SubscriptionDAO
Gets a count of the number of users of a push application with a given status for each BlackBerry device model.

Specified by:
getDeviceModelCount in interface SubscriptionDAO
Parameters:
pushApplicationId - the id of the push application
status - the status of a subscriber
Returns:
a list of device model count objects
Throws:
org.springframework.dao.DataAccessException - if any errors occur

getOsVersionCount

public List<OsVersionCount> getOsVersionCount(String pushApplicationId)
                                       throws org.springframework.dao.DataAccessException
Description copied from interface: SubscriptionDAO
Gets a count of the number of users of a push application (regardless of status) for each OS version running on a BlackBerry device.

Specified by:
getOsVersionCount in interface SubscriptionDAO
Parameters:
pushApplicationId - the id of the push application
Returns:
a list of OS version count objects
Throws:
org.springframework.dao.DataAccessException - if any errors occur

getOsVersionCount

public List<OsVersionCount> getOsVersionCount(String pushApplicationId,
                                              SubscriberStatus status)
                                       throws org.springframework.dao.DataAccessException
Description copied from interface: SubscriptionDAO
Gets a count of the number of users of a push application with a given status for each OS version running on a BlackBerry device.

Specified by:
getOsVersionCount in interface SubscriptionDAO
Parameters:
pushApplicationId - the id of the push application
status - the status of a subscriber
Returns:
a list of OS version count objects
Throws:
org.springframework.dao.DataAccessException - if any errors occur

removeAllFromCache

public void removeAllFromCache()
Removes all objects from the cache.



Copyright © 2011 Research In Motion. All Rights Reserved.