net.rim.pushsdk.push.request
Class PushRequestDetailRDBMSDAOImpl

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.push.request.PushRequestDetailRDBMSDAOImpl
All Implemented Interfaces:
PushRequestDetailDAO, org.springframework.beans.factory.InitializingBean

public class PushRequestDetailRDBMSDAOImpl
extends PushSDKBaseDAO
implements PushRequestDetailDAO

RDBMS implementation of the PushRequestDetailDAO interface.

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

Author:
dstrelbytsky

Field Summary
 
Fields inherited from class net.rim.pushsdk.commons.PushSDKBaseDAO
DATABASE_TZ
 
Fields inherited from class org.springframework.dao.support.DaoSupport
logger
 
Constructor Summary
PushRequestDetailRDBMSDAOImpl()
           
 
Method Summary
 void addPushRequestDetail(PushRequestDetail pushRequestDetail)
          Adds the specified push request detail to the persistent store.
 void addPushRequestDetails(List<PushRequestDetail> pushRequestDetails)
          Adds the specified push request details to the persistent store.
 List<PushRequestDetail> findByDateRange(Date fromDate, Date toDate, int startIndex, int endIndex)
          Finds all push request details by the specified date range.
 List<PushRequestDetail> findById(String id)
          Finds all push request details for the specific push request.
 PushRequestDetail findByIdAndAddress(String id, String address)
          Finds a push request detail by the specified push request and address.
 List<PushRequestDetail> findByIdAndAddresses(String id, List<String> addresses)
          Finds a push request detail by the specified push request and addresses.
 List<PushRequestDetail> findByIdAndStates(String id, List<MessageState> states)
          Finds all push request details for the specific push request and given states.
 List<PushRequestDetail> findByIdAndStatusCode(String id, StatusCode statusCode)
          Finds all push request details with the given status code for a specific push request.
 List<PushRequestDetail> findByIdAndSubscriberIds(String id, List<String> subscriberIds)
          Finds push request details by the specified push request and subscriberIds.
 Set<PushIdAndApplicationId> findByIdsAndState(List<String> ids, MessageState state)
          Finds push ids and application ids for the specific push requests and given state.
 List<PushRequestDetail> findByStatusCode(StatusCode statusCode, int startIndex, int endIndex)
          Finds all push request details by the specified status code.
 List<PushRequestDetail> findIncompleteByAppIdAndSubId(String applicationId, String subscriberId)
          Finds all push requests that are incomplete for a specific subscriber id and push application.
 int getSizeByDateRange(Date fromDate, Date toDate)
          Gets size of all push request details by the specified date range.
 void setCache(net.sf.ehcache.Cache cache)
          Sets a cache to use to cache push request details.
 void setPushSDKProperties(PushSDKProperties pushSDKProperties)
           
 void setSqlProperties(SQLProperties sqlProperties)
           
 void updatePushRequestDetail(PushRequestDetail pushRequestDetail)
          Updates the specified push request detail in the persistent store.
 void updatePushRequestDetails(List<PushRequestDetail> pushRequestDetails)
          Updates the specified list of push request details in the persistent store.
 void updatePushRequestDetailsWithoutAddresses(List<PushRequestDetail> pushRequestDetails)
          Updates the specified list of push request details in the persistent store.
 
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
 

Constructor Detail

PushRequestDetailRDBMSDAOImpl

public PushRequestDetailRDBMSDAOImpl()
Method Detail

setSqlProperties

public void setSqlProperties(SQLProperties sqlProperties)

setPushSDKProperties

public void setPushSDKProperties(PushSDKProperties pushSDKProperties)

setCache

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

Parameters:
cache - an instance of a cache

addPushRequestDetail

public void addPushRequestDetail(PushRequestDetail pushRequestDetail)
                          throws org.springframework.dao.DataAccessException
Description copied from interface: PushRequestDetailDAO
Adds the specified push request detail to the persistent store.

Specified by:
addPushRequestDetail in interface PushRequestDetailDAO
Parameters:
pushRequestDetail - the push request detail to create
Throws:
org.springframework.dao.DataAccessException - if any errors occur

addPushRequestDetails

public void addPushRequestDetails(List<PushRequestDetail> pushRequestDetails)
                           throws org.springframework.dao.DataAccessException
Description copied from interface: PushRequestDetailDAO
Adds the specified push request details to the persistent store.

Specified by:
addPushRequestDetails in interface PushRequestDetailDAO
Parameters:
pushRequestDetails - the list of push request details to create
Throws:
org.springframework.dao.DataAccessException - if any errors occur

updatePushRequestDetail

public void updatePushRequestDetail(PushRequestDetail pushRequestDetail)
                             throws org.springframework.dao.DataAccessException
Description copied from interface: PushRequestDetailDAO
Updates the specified push request detail in the persistent store.

Note: Not all fields are updated, only the following fields are: messageState, statusCode, statusDesc, senderName, senderAddress and completedDate.

Specified by:
updatePushRequestDetail in interface PushRequestDetailDAO
Parameters:
pushRequestDetail - the push request detail to update
Throws:
org.springframework.dao.DataAccessException - if any errors occur

updatePushRequestDetails

public void updatePushRequestDetails(List<PushRequestDetail> pushRequestDetails)
                              throws org.springframework.dao.DataAccessException
Description copied from interface: PushRequestDetailDAO
Updates the specified list of push request details in the persistent store.

Note: Not all fields are updated, only the following fields are: messageState, statusCode, statusDesc, senderName, senderAddress and completedDate.

Specified by:
updatePushRequestDetails in interface PushRequestDetailDAO
Parameters:
pushRequestDetails - the push request details to update
Throws:
org.springframework.dao.DataAccessException - if any errors occur

updatePushRequestDetailsWithoutAddresses

public void updatePushRequestDetailsWithoutAddresses(List<PushRequestDetail> pushRequestDetails)
                                              throws org.springframework.dao.DataAccessException
Description copied from interface: PushRequestDetailDAO
Updates the specified list of push request details in the persistent store.

For each given PushRequestDetail, updates all details in the store with the same push-id, regardless of address.

Note: Not all fields are updated, only the following fields are: messageState, statusCode, statusDesc, senderName, senderAddress and completedDate.

Specified by:
updatePushRequestDetailsWithoutAddresses in interface PushRequestDetailDAO
Parameters:
pushRequestDetails - the push request details to update
Throws:
org.springframework.dao.DataAccessException - if any errors occur

findByIdAndAddress

public PushRequestDetail findByIdAndAddress(String id,
                                            String address)
                                     throws org.springframework.dao.DataAccessException
Description copied from interface: PushRequestDetailDAO
Finds a push request detail by the specified push request and address.

Specified by:
findByIdAndAddress in interface PushRequestDetailDAO
Parameters:
id - id of the push request
address - address for the device the push was made to
Returns:
the pushRequestDetail, null if not found
Throws:
org.springframework.dao.DataAccessException - if any errors occur

findByIdAndAddresses

public List<PushRequestDetail> findByIdAndAddresses(String id,
                                                    List<String> addresses)
                                             throws org.springframework.dao.DataAccessException
Description copied from interface: PushRequestDetailDAO
Finds a push request detail by the specified push request and addresses.

Specified by:
findByIdAndAddresses in interface PushRequestDetailDAO
Parameters:
id - id of the push request
addresses - addresses for the device the push was made to
Returns:
the pushRequestDetails, empty if none found
Throws:
org.springframework.dao.DataAccessException - if any errors occur

findByIdAndSubscriberIds

public List<PushRequestDetail> findByIdAndSubscriberIds(String id,
                                                        List<String> subscriberIds)
                                                 throws org.springframework.dao.DataAccessException
Description copied from interface: PushRequestDetailDAO
Finds push request details by the specified push request and subscriberIds.

Specified by:
findByIdAndSubscriberIds in interface PushRequestDetailDAO
Parameters:
id - id of the push request
subscriberIds - subscriberIds for the device the push was made to
Returns:
the pushRequestDetails, empty if none found
Throws:
org.springframework.dao.DataAccessException - if any errors occur

findById

public List<PushRequestDetail> findById(String id)
                                 throws org.springframework.dao.DataAccessException
Description copied from interface: PushRequestDetailDAO
Finds all push request details for the specific push request.

Specified by:
findById in interface PushRequestDetailDAO
Parameters:
id - id of the push request
Returns:
list of pushRequestDetails, empty if not found
Throws:
org.springframework.dao.DataAccessException - if any errors occur

findByIdAndStates

public List<PushRequestDetail> findByIdAndStates(String id,
                                                 List<MessageState> states)
                                          throws org.springframework.dao.DataAccessException
Description copied from interface: PushRequestDetailDAO
Finds all push request details for the specific push request and given states.

Specified by:
findByIdAndStates in interface PushRequestDetailDAO
Parameters:
id - id of the push request
states - a list of message states
Returns:
list of pushRequestDetails, empty if not found
Throws:
org.springframework.dao.DataAccessException - if any errors occur

findByStatusCode

public List<PushRequestDetail> findByStatusCode(StatusCode statusCode,
                                                int startIndex,
                                                int endIndex)
                                         throws org.springframework.dao.DataAccessException
Description copied from interface: PushRequestDetailDAO
Finds all push request details by the specified status code.

Specified by:
findByStatusCode in interface PushRequestDetailDAO
Parameters:
statusCode - status code of the push request details to look up
startIndex - the index of the first entry to be retrieved
endIndex - the index of the last entry to be retrieved
Returns:
list of pushRequestDetails, empty if not found
Throws:
org.springframework.dao.DataAccessException - if any errors occur

findByIdAndStatusCode

public List<PushRequestDetail> findByIdAndStatusCode(String id,
                                                     StatusCode statusCode)
                                              throws org.springframework.dao.DataAccessException
Description copied from interface: PushRequestDetailDAO
Finds all push request details with the given status code for a specific push request.

Specified by:
findByIdAndStatusCode in interface PushRequestDetailDAO
Parameters:
id - id of the push request
statusCode - status code of the push request details to look up
Returns:
list of pushRequestDetails, empty if not found
Throws:
org.springframework.dao.DataAccessException - if any errors occur

findByDateRange

public List<PushRequestDetail> findByDateRange(Date fromDate,
                                               Date toDate,
                                               int startIndex,
                                               int endIndex)
                                        throws org.springframework.dao.DataAccessException
Description copied from interface: PushRequestDetailDAO
Finds all push request details by the specified date range.

Specified by:
findByDateRange in interface PushRequestDetailDAO
Parameters:
fromDate - inclusive from date parameter of the range
toDate - inclusive to date parameter of the range
startIndex - the index of the first entry to be retrieved
endIndex - the index of the last entry to be retrieved
Returns:
list of pushRequestDetails, empty if not found
Throws:
org.springframework.dao.DataAccessException - if any errors occur

getSizeByDateRange

public int getSizeByDateRange(Date fromDate,
                              Date toDate)
                       throws org.springframework.dao.DataAccessException
Description copied from interface: PushRequestDetailDAO
Gets size of all push request details by the specified date range.

Specified by:
getSizeByDateRange in interface PushRequestDetailDAO
Parameters:
fromDate - inclusive from date parameter of the range
toDate - inclusive to date parameter of the range
Returns:
number of details in the date range
Throws:
org.springframework.dao.DataAccessException - if any errors occur

findByIdsAndState

public Set<PushIdAndApplicationId> findByIdsAndState(List<String> ids,
                                                     MessageState state)
Description copied from interface: PushRequestDetailDAO
Finds push ids and application ids for the specific push requests and given state.

Specified by:
findByIdsAndState in interface PushRequestDetailDAO
Parameters:
ids - ids of the push requests
state - a message state
Returns:
list of PushIdAndApplicationId, empty if not found

findIncompleteByAppIdAndSubId

public List<PushRequestDetail> findIncompleteByAppIdAndSubId(String applicationId,
                                                             String subscriberId)
                                                      throws org.springframework.dao.DataAccessException
Description copied from interface: PushRequestDetailDAO
Finds all push requests that are incomplete for a specific subscriber id and push application. In other words, finds all push requests for a given subscriber for a given push application that is still in a pending state.

Note: This method will only return push request details where the push application is of type 'Push Plus' and has its 'storePushRequests' flag set to 'true'.

If the original push request was not accepted by the PPG, there may be no details to return.

Note: A large number of push request/push request details in the persistent store may make this query take a long time to complete.

Specified by:
findIncompleteByAppIdAndSubId in interface PushRequestDetailDAO
Parameters:
applicationId - application for which to find the incomplete pushes
subscriberId - the subscriber id for which to find incomplete pushes
Returns:
list of incomplete push request details
Throws:
org.springframework.dao.DataAccessException - if any errors occur


Copyright © 2011 Research In Motion. All Rights Reserved.