net.rim.pushsdk.push.request
Class PushRequestRDBMSDAOImpl

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.PushRequestRDBMSDAOImpl
All Implemented Interfaces:
PushRequestDAO, org.springframework.beans.factory.InitializingBean

public class PushRequestRDBMSDAOImpl
extends PushSDKBaseDAO
implements PushRequestDAO

RDBMS implementation of the PushRequestDAO interface.

This implementation requires that the supplied schema be installed in a database server. A connection to that database can be injected as a DataSource.

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
PushRequestRDBMSDAOImpl()
           
 
Method Summary
 void addPushRequest(PushRequest pushRequest)
          Adds the specified push request to the persistent store.
 void deletePushRequest(String pushId)
          Deletes a push request with the given id.
 void deletePushRequests(boolean completed, String deletedBy)
          Deletes all push requests.
 void deletePushRequests(List<String> pushIds)
          Deletes push requests with the given ids.
 void deletePushRequestsByDate(Date toDate, boolean completed, String deletedBy)
          Deletes push requests that are older than the provided date.
 void deletePushRequestsByPushAppId(String pushApplicationId, boolean completed, String deletedBy)
          Deletes push requests for the specified push application.
 void deletePushRequestsByPushAppIdAndDate(String pushApplicationId, Date toDate, boolean completed, String deletedBy)
          Deletes push requests for the specified push application that are older than the provided date.
 List<PushRequest> findAll()
          Finds all push requests.
 List<PushRequest> findByAppId(String id)
          Finds all push requests associated with a specified push application.
 List<PushRequest> findByDateRange(Date fromDate, Date toDate, int startIndex, int endIndex)
          Finds all push requests by the specified date range.
 PushRequest findById(String id)
          Finds push request by the specified id.
 List<PushRequest> findByStatusCode(StatusCode statusCode)
          Deprecated. 
 List<PushRequest> findIncomplete(String applicationId)
          Finds all push requests that are incomplete for a given push application.
 int getSizeByDateRange(Date fromDate, Date toDate)
          Gets size of all push requests by the specified date range.
 void setPushSDKProperties(PushSDKProperties pushSDKProperties)
           
 void setSqlProperties(SQLProperties sqlProperties)
           
 void updatePushRequest(PushRequest pushRequest)
          Deprecated. 
 
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

PushRequestRDBMSDAOImpl

public PushRequestRDBMSDAOImpl()
Method Detail

setSqlProperties

public void setSqlProperties(SQLProperties sqlProperties)

setPushSDKProperties

public void setPushSDKProperties(PushSDKProperties pushSDKProperties)

addPushRequest

public void addPushRequest(PushRequest pushRequest)
                    throws org.springframework.dao.DataAccessException
Description copied from interface: PushRequestDAO
Adds the specified push request to the persistent store.

Specified by:
addPushRequest in interface PushRequestDAO
Parameters:
pushRequest - the push request to create
Throws:
org.springframework.dao.DataAccessException - if any errors occur

updatePushRequest

@Deprecated
public void updatePushRequest(PushRequest pushRequest)
                       throws org.springframework.dao.DataAccessException
Deprecated. 

Description copied from interface: PushRequestDAO
Updates the status code and status description specified push request in the persistent store.

Specified by:
updatePushRequest in interface PushRequestDAO
Parameters:
pushRequest - the push request to update
Throws:
org.springframework.dao.DataAccessException - if any errors occur

deletePushRequestsByPushAppIdAndDate

public void deletePushRequestsByPushAppIdAndDate(String pushApplicationId,
                                                 Date toDate,
                                                 boolean completed,
                                                 String deletedBy)
                                          throws org.springframework.dao.DataAccessException
Description copied from interface: PushRequestDAO
Deletes push requests for the specified push application that are older than the provided date.

Specified by:
deletePushRequestsByPushAppIdAndDate in interface PushRequestDAO
Parameters:
pushApplicationId - id of the push application for which the corresponding push requests should be deleted
toDate - specifies the cut off date for the push request deletion
completed - if true, delete only completed requests
deletedBy - the id of the user deleting the push requests; used for logging purposes only
Throws:
org.springframework.dao.DataAccessException - if any errors occur

deletePushRequestsByPushAppId

public void deletePushRequestsByPushAppId(String pushApplicationId,
                                          boolean completed,
                                          String deletedBy)
                                   throws org.springframework.dao.DataAccessException
Description copied from interface: PushRequestDAO
Deletes push requests for the specified push application.

Specified by:
deletePushRequestsByPushAppId in interface PushRequestDAO
Parameters:
pushApplicationId - id of the push application for which the corresponding push requests should be deleted
completed - if true, delete only completed requests
deletedBy - the id of the user deleting the push requests; used for logging purposes only
Throws:
org.springframework.dao.DataAccessException - if any errors occur

deletePushRequestsByDate

public void deletePushRequestsByDate(Date toDate,
                                     boolean completed,
                                     String deletedBy)
                              throws org.springframework.dao.DataAccessException
Description copied from interface: PushRequestDAO
Deletes push requests that are older than the provided date.

Specified by:
deletePushRequestsByDate in interface PushRequestDAO
Parameters:
toDate - specifies the cut off date for the push request deletion.
completed - if true, delete only completed requests
deletedBy - the id of the user deleting the push requests; used for logging purposes only
Throws:
org.springframework.dao.DataAccessException - if any errors occur

deletePushRequests

public void deletePushRequests(boolean completed,
                               String deletedBy)
                        throws org.springframework.dao.DataAccessException
Description copied from interface: PushRequestDAO
Deletes all push requests.

Specified by:
deletePushRequests in interface PushRequestDAO
Parameters:
completed - if true, delete only completed requests
deletedBy - the id of the user deleting the push requests; used for logging purposes only
Throws:
org.springframework.dao.DataAccessException - if any errors occur

deletePushRequests

public void deletePushRequests(List<String> pushIds)
                        throws org.springframework.dao.DataAccessException
Description copied from interface: PushRequestDAO
Deletes push requests with the given ids.

Specified by:
deletePushRequests in interface PushRequestDAO
Parameters:
pushIds - ids of the requests to be deleted
Throws:
org.springframework.dao.DataAccessException - if any errors occur

deletePushRequest

public void deletePushRequest(String pushId)
                       throws org.springframework.dao.DataAccessException
Description copied from interface: PushRequestDAO
Deletes a push request with the given id.

Specified by:
deletePushRequest in interface PushRequestDAO
Parameters:
pushId - id of the request to be deleted
Throws:
org.springframework.dao.DataAccessException - if any errors occur

findById

public PushRequest findById(String id)
                     throws org.springframework.dao.DataAccessException
Description copied from interface: PushRequestDAO
Finds push request by the specified id.

Specified by:
findById in interface PushRequestDAO
Parameters:
id - id of the push request to find
Returns:
the pushRequest, null if not found
Throws:
org.springframework.dao.DataAccessException - if any errors occur

findAll

public List<PushRequest> findAll()
                          throws org.springframework.dao.DataAccessException
Description copied from interface: PushRequestDAO
Finds all push requests.

Specified by:
findAll in interface PushRequestDAO
Returns:
list of pushRequests, empty if not found
Throws:
org.springframework.dao.DataAccessException - if any errors occur

findByAppId

public List<PushRequest> findByAppId(String id)
                              throws org.springframework.dao.DataAccessException
Description copied from interface: PushRequestDAO
Finds all push requests associated with a specified push application.

Specified by:
findByAppId in interface PushRequestDAO
Parameters:
id - id of the push application
Returns:
list of pushRequests, empty if not found
Throws:
org.springframework.dao.DataAccessException - if any errors occur

findByStatusCode

@Deprecated
public List<PushRequest> findByStatusCode(StatusCode statusCode)
                                   throws org.springframework.dao.DataAccessException
Deprecated. 

Description copied from interface: PushRequestDAO
Finds all push requests by the specified status code.

Specified by:
findByStatusCode in interface PushRequestDAO
Parameters:
statusCode - status code of the push request
Returns:
list of pushRequests, empty if not found
Throws:
org.springframework.dao.DataAccessException - if any errors occur

findByDateRange

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

Specified by:
findByDateRange in interface PushRequestDAO
Parameters:
fromDate - from date parameter of the range
toDate - 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 pushRequests, 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: PushRequestDAO
Gets size of all push requests by the specified date range.

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

findIncomplete

public List<PushRequest> findIncomplete(String applicationId)
                                 throws org.springframework.dao.DataAccessException
Description copied from interface: PushRequestDAO
Finds all push requests that are incomplete for a given push application. In other words, finds all push requests that have at least one push request detail (one address) that is still in a pending state.

Specified by:
findIncomplete in interface PushRequestDAO
Parameters:
applicationId - application for which to find the incomplete pushes
Returns:
list of incomplete push requests
Throws:
org.springframework.dao.DataAccessException - if any errors occur


Copyright © 2011 Research In Motion. All Rights Reserved.