net.rim.pushsdk.subscription.sync
Interface SubSyncByAddressDAO

All Known Implementing Classes:
SubSyncByAddressMemoryDAOImpl, SubSyncByAddressRDBMSDAOImpl

public interface SubSyncByAddressDAO

Data access object for use during the syncing of subscriber statuses by address.

This DAO is not to be used as a singleton spring bean as it is not stateless. It maintains state.

This DAO should be used with calls of the following form:

 SubSyncByAddressDAO subSyncByAddressDAO = createSubSyncByAddressDAO(); 
 try { 
     subSyncByAddressDAO.prepareFindByAppIdAndStatus(..., ...); 
 
     SubscriberPartial subPartial = null; 
     while((subPartial = subSyncByAddressDAO.getNextResult()) != null) { 
         // Perform some processing 
     } 
 } catch(SQLException e) {
     log.error("SQLException caught: ", e);
     throw new PushSDKException(e);
 } finally { 
     subSyncByAddressDAO.close(); 
 } 
 
 

Author:
mdandrea

Method Summary
 void close()
          Closes the result set and releases the database connection.
 SubscriberPartial getNextResult()
          Gets the next result from the result set (after performing a query for subscribers).
 void prepareFindByAppIdAndStatus(String pushApplicationId, SubscriberStatus status)
          Deprecated. As of release 1.1, replaced by the prepareFindByAppIdAndStatus(String, SubscriberStatus, int, int) method instead.
 void prepareFindByAppIdAndStatus(String pushApplicationId, SubscriberStatus status, int startIndex, int endIndex)
          Performs a query for subscribers based on the given app id, status, and start and end indexes.
 void prepareFindByAppIdAndStatusAndType(String pushApplicationId, SubscriberStatus status, SubscriberType type)
          Deprecated. As of release 1.1, replaced by the prepareFindByAppIdAndStatusAndType(String, SubscriberStatus, SubscriberType, int, int) method instead.
 void prepareFindByAppIdAndStatusAndType(String pushApplicationId, SubscriberStatus status, SubscriberType type, int startIndex, int endIndex)
          Performs a query for subscribers based on the given app id, status, type, and start and end indexes.
 

Method Detail

prepareFindByAppIdAndStatus

void prepareFindByAppIdAndStatus(String pushApplicationId,
                                 SubscriberStatus status,
                                 int startIndex,
                                 int endIndex)
                                 throws SQLException
Performs a query for subscribers based on the given app id, status, and start and end indexes.

Note: When a status of INACTIVE is specified, it will only retrieve inactive subscribers for which there is not an active or suspended subscriber for that application currently using the same address (e.g. PIN).

Note: This method does not have a return value because the result set is kept alive as an instance variable. The results are accessed through the getNextResult() method. When use of the result set is done, the close() method should be called.

Note: This method uses the same result set instance variable as the prepareFindByAppIdAndStatusAndType() method and so, for a given object of this class, only one of the two methods should be called at any given time.

Parameters:
pushApplicationId - the push application id
status - the status of a subscriber
startIndex - the start index to query from
endIndex - the end index to stop querying at
Throws:
SQLException - if any errors occur executing the query

prepareFindByAppIdAndStatusAndType

void prepareFindByAppIdAndStatusAndType(String pushApplicationId,
                                        SubscriberStatus status,
                                        SubscriberType type,
                                        int startIndex,
                                        int endIndex)
                                        throws SQLException
Performs a query for subscribers based on the given app id, status, type, and start and end indexes.

Note: When a status of INACTIVE is specified, it will only retrieve inactive subscribers for which there is not an active or suspended subscriber for that application currently using the same address (e.g. PIN).

Note: This method does not have a return value because the result set is kept alive as an instance variable. The results are accessed through the getNextResult() method. When use of the result set is done, the close() method should be called.

Note: This method uses the same result set instance variable as the prepareFindByAppIdAndStatus() method and so, for a given object of this class, only one of the two methods should be called at any given time.

Parameters:
pushApplicationId - the push application id
status - the status of a subscriber
type - the type of a subscriber
startIndex - the start index to query from
endIndex - the end index to stop querying at
Throws:
SQLException - if any errors occur executing the query

getNextResult

SubscriberPartial getNextResult()
                                throws SQLException
Gets the next result from the result set (after performing a query for subscribers).

Note: This method can only be called after a call to the prepareFindByAppIdAndStatus(appid, status) method or the prepareFindByAppIdAndStatusAndType(appid, status, type) method.

Returns:
the next subscriber result
Throws:
SQLException - if any errors occur retrieving the next result from the result set

close

void close()
Closes the result set and releases the database connection.

Note: This method should only be called after first calling the prepareFindByAppIdAndStatus(appid, status) method or the prepareFindByAppIdAndStatusAndType(appid, status, type) method and getting the results of the query back by repeated calls to the getNextResult() method.

This method should be called in a finally block.


prepareFindByAppIdAndStatus

@Deprecated
void prepareFindByAppIdAndStatus(String pushApplicationId,
                                            SubscriberStatus status)
                                 throws SQLException
Deprecated. As of release 1.1, replaced by the prepareFindByAppIdAndStatus(String, SubscriberStatus, int, int) method instead.

Performs a query for subscribers based on the given app id and status.

Note: When a status of INACTIVE is specified, it will only retrieve inactive subscribers for which there is not an active or suspended subscriber for that application currently using the same address (e.g. PIN).

Note: This method does not have a return value because the result set is kept alive as an instance variable. The results are accessed through the getNextResult() method. When use of the result set is done, the close() method should be called.

Note: This method uses the same result set instance variable as the prepareFindByAppIdAndStatusAndType() method and so, for a given object of this class, only one of the two methods should be called at any given time.

Parameters:
pushApplicationId - the push application id
status - the status of a subscriber
Throws:
SQLException - if any errors occur executing the query

prepareFindByAppIdAndStatusAndType

@Deprecated
void prepareFindByAppIdAndStatusAndType(String pushApplicationId,
                                                   SubscriberStatus status,
                                                   SubscriberType type)
                                        throws SQLException
Deprecated. As of release 1.1, replaced by the prepareFindByAppIdAndStatusAndType(String, SubscriberStatus, SubscriberType, int, int) method instead.

Performs a query for subscribers based on the given app id, status, and type.

Note: When a status of INACTIVE is specified, it will only retrieve inactive subscribers for which there is not an active or suspended subscriber for that application currently using the same address (e.g. PIN).

Note: This method does not have a return value because the result set is kept alive as an instance variable. The results are accessed through the getNextResult() method. When use of the result set is done, the close() method should be called.

Note: This method uses the same result set instance variable as the prepareFindByAppIdAndStatus() method and so, for a given object of this class, only one of the two methods should be called at any given time.

Parameters:
pushApplicationId - the push application id
status - the status of a subscriber
type - the type of a subscriber
Throws:
SQLException - if any errors occur executing the query


Copyright © 2011 Research In Motion. All Rights Reserved.