de.janrufmonitor.repository.db
Class AbstractCallerDatabaseHandler

java.lang.Object
  extended by de.janrufmonitor.repository.db.AbstractDatabaseHandler
      extended by de.janrufmonitor.repository.db.AbstractCallerDatabaseHandler
All Implemented Interfaces:
ICallerDatabaseHandler, IDatabaseHandler
Direct Known Subclasses:
HsqldbCallerDatabaseHandler

public abstract class AbstractCallerDatabaseHandler
extends AbstractDatabaseHandler
implements ICallerDatabaseHandler

This abstract class can be used as base class for a database related caller managers. It contains methods for database creation and prepared statements for caller manager handling.

Author:
Thilo Brandt

Field Summary
 
Fields inherited from class de.janrufmonitor.repository.db.AbstractDatabaseHandler
commit_count, m_con, m_logger, m_preparedStatements
 
Constructor Summary
AbstractCallerDatabaseHandler(String driver, String connection, String user, String password, boolean initialize)
           
 
Method Summary
protected  void addPreparedStatements()
          Add all required prepares statements to the m_preparedStatements map.
protected abstract  ICallerList buildCallerList(IFilter[] filters)
          Create the caller list from a query of the database.
protected  void createTables()
          Creates the database table.
 void deleteCallerList(ICallerList cl)
          Deletes all callers of the submitted caller list.
 boolean existsCaller(ICaller c)
          Checks if the caller with the provided UUID exists
 ICaller getCaller(IPhonenumber pn)
           
 ICallerList getCallerList(IFilter[] filters)
          Selects the callers by the applied filters from the database
 void insertOrUpdateCallerList(ICallerList cl)
          Insert the callers in the list or update the callers if it already exists.
 
Methods inherited from class de.janrufmonitor.repository.db.AbstractDatabaseHandler
commit, connect, createAttributes, deleteAttributes, disconnect, getRuntime, getStatement, isConnected, isInitializing, isKeepAlive, rollback, setCommitCount, setInitializing, setKeepAlive, updateAttributes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface de.janrufmonitor.repository.db.IDatabaseHandler
commit, connect, disconnect, isConnected, isKeepAlive, rollback, setCommitCount, setKeepAlive
 

Constructor Detail

AbstractCallerDatabaseHandler

public AbstractCallerDatabaseHandler(String driver,
                                     String connection,
                                     String user,
                                     String password,
                                     boolean initialize)
Method Detail

createTables

protected void createTables()
                     throws SQLException
Description copied from class: AbstractDatabaseHandler
Creates the database table.

Specified by:
createTables in class AbstractDatabaseHandler
Throws:
SQLException

addPreparedStatements

protected void addPreparedStatements()
                              throws SQLException
Description copied from class: AbstractDatabaseHandler
Add all required prepares statements to the m_preparedStatements map. The key should be provided as a String.

Specified by:
addPreparedStatements in class AbstractDatabaseHandler
Throws:
SQLException

insertOrUpdateCallerList

public void insertOrUpdateCallerList(ICallerList cl)
                              throws SQLException
Insert the callers in the list or update the callers if it already exists.

Specified by:
insertOrUpdateCallerList in interface ICallerDatabaseHandler
Parameters:
cl -
Throws:
SQLException

deleteCallerList

public void deleteCallerList(ICallerList cl)
                      throws SQLException
Deletes all callers of the submitted caller list.

Specified by:
deleteCallerList in interface ICallerDatabaseHandler
Parameters:
cl - a list with callers, must not be null.
Throws:
SQLException

existsCaller

public boolean existsCaller(ICaller c)
                     throws SQLException
Checks if the caller with the provided UUID exists

Specified by:
existsCaller in interface ICallerDatabaseHandler
Parameters:
c - a valid caller object
Returns:
Throws:
SQLException

getCaller

public ICaller getCaller(IPhonenumber pn)
                  throws SQLException
Specified by:
getCaller in interface ICallerDatabaseHandler
Throws:
SQLException

getCallerList

public ICallerList getCallerList(IFilter[] filters)
                          throws SQLException
Selects the callers by the applied filters from the database

Specified by:
getCallerList in interface ICallerDatabaseHandler
Parameters:
filters - filetrs applied to the result
Returns:
Throws:
SQLException

buildCallerList

protected abstract ICallerList buildCallerList(IFilter[] filters)
                                        throws SQLException
Create the caller list from a query of the database. This abstract method must be implemented by all CallerDatabaseHandler.

Parameters:
filters - filetrs applied to the result
Returns:
Throws:
SQLException


Copyright © 2010 by Thilo Brandt. All Rights Reserved.