net.rim.pushsdk.push.request
Class PushRequestMemoryDAOImpl

java.lang.Object
  extended by net.rim.pushsdk.push.request.PushRequestMemoryDAOImpl
All Implemented Interfaces:
PushRequestDAO

public class PushRequestMemoryDAOImpl
extends Object
implements PushRequestDAO

In-memory persistence implementation of the PushRequestDAO interface.

Warning: Data will only survive while the JVM is running. The purpose of this class is to do quick and easy testing without needing to setup a database.

 Example of using this object outside of the Spring bean factory:
 PushRequestDAO dao = new PushRequestMemoryDAOImpl();
 dao.setPushMemoryDataStore(...);
 dao.setPushAppMemoryDataStore(...);
 
 Now you can use the object...
 dao.someMethod(...);
 
Warning: This class is not intended for production use.

Dependencies that must be injected to properly initialize this object for use:
- pushCountMemoryDataStore
- pushRequestMemoryDataStore
- pushRequestDetailMemoryDataStore
- pushAppMemoryDataStore

Author:
dstrelbytsky

Constructor Summary
PushRequestMemoryDAOImpl()
           
 
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 setPushAppMemoryDataStore(PushAppMemoryDataStore pushAppMemoryDataStore)
          Sets the in-memory data store to use for storing push applications.
 void setPushCountMemoryDataStore(PushCountMemoryDataStore pushCountMemoryDataStore)
          Sets the in-memory data store to use for storing push counts.
 void setPushRequestDetailMemoryDataStore(PushRequestDetailMemoryDataStore pushRequestDetailMemoryDataStore)
          Sets the in-memory data store to use for storing push request details.
 void setPushRequestMemoryDataStore(PushRequestMemoryDataStore pushRequestMemoryDataStore)
          Sets the in-memory data store to use for storing push requests.
 void updatePushRequest(PushRequest pushRequest)
          Deprecated. 
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PushRequestMemoryDAOImpl

public PushRequestMemoryDAOImpl()
Method Detail

setPushCountMemoryDataStore

public void setPushCountMemoryDataStore(PushCountMemoryDataStore pushCountMemoryDataStore)
Sets the in-memory data store to use for storing push counts.

Parameters:
pushCountMemoryDataStore - push count in-memory data store

setPushRequestMemoryDataStore

public void setPushRequestMemoryDataStore(PushRequestMemoryDataStore pushRequestMemoryDataStore)
Sets the in-memory data store to use for storing push requests.

Parameters:
pushRequestMemoryDataStore - push request in-memory data store

setPushRequestDetailMemoryDataStore

public void setPushRequestDetailMemoryDataStore(PushRequestDetailMemoryDataStore pushRequestDetailMemoryDataStore)
Sets the in-memory data store to use for storing push request details.

Parameters:
pushRequestDetailMemoryDataStore - push request detail in-memory data store

setPushAppMemoryDataStore

public void setPushAppMemoryDataStore(PushAppMemoryDataStore pushAppMemoryDataStore)
Sets the in-memory data store to use for storing push applications.

Parameters:
pushAppMemoryDataStore - push application in-memory data store

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

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

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

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

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

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.