com.uwyn.rife.database.querymanagers.generic
Class AbstractGenericQueryManager<BeanType>

java.lang.Object
  extended by com.uwyn.rife.database.DbQueryManager
      extended by com.uwyn.rife.database.querymanagers.generic.AbstractGenericQueryManager<BeanType>
All Implemented Interfaces:
GenericQueryManager<BeanType>, ValidationContext, Cloneable

public abstract class AbstractGenericQueryManager<BeanType>
extends DbQueryManager
implements GenericQueryManager<BeanType>


Field Summary
protected  Class<BeanType> mBaseClass
           
protected  Method mGetPrimaryKeyMethod
           
protected  List<GenericQueryManagerListener> mListeners
           
protected  String mPrimaryKey
           
protected  Method mSetPrimaryKeyMethod
           
protected  boolean mSparseIdentifier
           
 
Constructor Summary
AbstractGenericQueryManager(Datasource datasource, Class<BeanType> beanClass, String primaryKey)
           
 
Method Summary
protected  int _count(Select count)
           
protected  boolean _delete(Delete delete)
           
protected  boolean _delete(Delete delete, int objectId)
           
protected  int _insert(SequenceValue nextId, Insert save, BeanType bean)
           
protected  int _insertWithoutCallbacks(SequenceValue nextId, Insert save, BeanType bean)
           
protected  void _install(CreateSequence createSequence, CreateTable createTable)
           
protected  void _remove(DropSequence dropSequence, DropTable dropTable)
           
protected  List<BeanType> _restore(Select restore)
           
protected  boolean _restore(Select restore, DbRowProcessor rowProcessor)
           
protected  BeanType _restore(Select restore, int objectId)
           
protected  BeanType _restoreFirst(Select restore)
           
protected  int _save(SequenceValue nextId, Insert save, Update saveUpdate, BeanType bean)
           
protected  int _update(Update saveUpdate, BeanType bean)
           
protected  int _updateWithoutCallbacks(Update saveUpdate, BeanType bean)
           
protected  void _validateWithoutCallbacks(Validated validated)
           
 void addListener(GenericQueryManagerListener listener)
          Add the listener to the manager to get notifications when actions were successful.
<OtherBeanType>
GenericQueryManager<OtherBeanType>
createNewManager(Class<OtherBeanType> beanClass)
          Create a new generic query manager of the same kind but for another bean class.
protected  void deleteManyToMany(int objectId)
           
protected  void deleteManyToOne(int objectId)
           
protected  void fireDeleted(int objectId)
           
protected  void fireInserted(BeanType bean)
           
protected  void fireInstalled()
           
protected  void fireRemoved()
           
protected  void fireRestored(BeanType bean)
           
protected  void fireUpdated(BeanType bean)
           
 Class getBaseClass()
          Get the handled class
protected  Callbacks getCallbacks(BeanType bean)
           
 String getIdentifierName()
          Get the name of the property defined as the identifier.
 int getIdentifierValue(BeanType bean)
          Get the value of the property defined as the identifier.
protected  void installManyToMany()
           
 boolean isIdentifierSparse()
           
 void removeListeners()
          Remove all the listeners that are registered to the manager.
protected  void removeManyToMany()
           
protected  void restoreManyToMany(BeanType bean, int objectId)
           
protected  void restoreManyToOne(BeanType bean)
           
protected  void restoreManyToOneAssociations(BeanType bean, int objectId)
           
protected  void setManyToOneJoinParameters(DbPreparedStatement statement, BeanType bean)
           
protected  void storeManyToMany(BeanType bean, int objectId)
           
protected  void storeManyToOne(BeanType bean)
           
protected  void storeManyToOneAssociations(BeanType bean, int objectId)
           
 void validate(Validated validated)
          Validates a Validated in this context.
 
Methods inherited from class com.uwyn.rife.database.DbQueryManager
clone, executeFetchAll, executeFetchAll, executeFetchAllBeans, executeFetchAllBeans, executeFetchFirst, executeFetchFirst, executeFetchFirstBean, executeFetchFirstBean, executeGetFirstBoolean, executeGetFirstBoolean, executeGetFirstByte, executeGetFirstByte, executeGetFirstBytes, executeGetFirstBytes, executeGetFirstDate, executeGetFirstDate, executeGetFirstDate, executeGetFirstDate, executeGetFirstDouble, executeGetFirstDouble, executeGetFirstFloat, executeGetFirstFloat, executeGetFirstInt, executeGetFirstInt, executeGetFirstLong, executeGetFirstLong, executeGetFirstShort, executeGetFirstShort, executeGetFirstString, executeGetFirstString, executeGetFirstTime, executeGetFirstTime, executeGetFirstTime, executeGetFirstTime, executeGetFirstTimestamp, executeGetFirstTimestamp, executeGetFirstTimestamp, executeGetFirstTimestamp, executeHasResultRows, executeHasResultRows, executeQuery, executeQuery, executeQuery, executeUpdate, executeUpdate, executeUpdate, executeUseFirstAsciiStream, executeUseFirstAsciiStream, executeUseFirstBinaryStream, executeUseFirstBinaryStream, executeUseFirstCharacterStream, executeUseFirstCharacterStream, fetch, fetch, fetchAll, getConnection, getDatasource, inTransaction, reserveConnection
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.uwyn.rife.database.querymanagers.generic.GenericQueryManager
count, count, delete, delete, getCountQuery, getDeleteQuery, getDeleteQuery, getInstallTableQuery, getRestoreQuery, getRestoreQuery, getTable, insert, install, install, remove, restore, restore, restore, restore, restore, restoreFirst, save, update
 

Field Detail

mBaseClass

protected Class<BeanType> mBaseClass

mPrimaryKey

protected String mPrimaryKey

mGetPrimaryKeyMethod

protected Method mGetPrimaryKeyMethod

mSetPrimaryKeyMethod

protected Method mSetPrimaryKeyMethod

mSparseIdentifier

protected boolean mSparseIdentifier

mListeners

protected List<GenericQueryManagerListener> mListeners
Constructor Detail

AbstractGenericQueryManager

public AbstractGenericQueryManager(Datasource datasource,
                                   Class<BeanType> beanClass,
                                   String primaryKey)
                            throws DatabaseException
Throws:
DatabaseException
Method Detail

getBaseClass

public Class getBaseClass()
Description copied from interface: GenericQueryManager
Get the handled class

Specified by:
getBaseClass in interface GenericQueryManager<BeanType>
Returns:
the handled class

getIdentifierName

public String getIdentifierName()
Description copied from interface: GenericQueryManager
Get the name of the property defined as the identifier.

Defaults to "id".

Specified by:
getIdentifierName in interface GenericQueryManager<BeanType>
Returns:
the name of the property defined as the identifier

getIdentifierValue

public int getIdentifierValue(BeanType bean)
                       throws DatabaseException
Description copied from interface: GenericQueryManager
Get the value of the property defined as the identifier.

The property defaults to "id".

Specified by:
getIdentifierValue in interface GenericQueryManager<BeanType>
Parameters:
bean - the bean to retrieve the identifier value for
Returns:
the value of the property defined as the identifier
Throws:
DatabaseException

isIdentifierSparse

public boolean isIdentifierSparse()

validate

public void validate(Validated validated)
Description copied from interface: ValidationContext
Validates a Validated in this context.

This method is not suppossed to reset the validation errors or to start the validation from scratch, but it's intended to add additional errors to an existing collection.

Specified by:
validate in interface ValidationContext
Parameters:
validated - the Validated instance that will be validated

_validateWithoutCallbacks

protected void _validateWithoutCallbacks(Validated validated)

getCallbacks

protected Callbacks getCallbacks(BeanType bean)

_update

protected int _update(Update saveUpdate,
                      BeanType bean)

_updateWithoutCallbacks

protected int _updateWithoutCallbacks(Update saveUpdate,
                                      BeanType bean)

_insert

protected int _insert(SequenceValue nextId,
                      Insert save,
                      BeanType bean)

_insertWithoutCallbacks

protected int _insertWithoutCallbacks(SequenceValue nextId,
                                      Insert save,
                                      BeanType bean)

setManyToOneJoinParameters

protected void setManyToOneJoinParameters(DbPreparedStatement statement,
                                          BeanType bean)

storeManyToOne

protected void storeManyToOne(BeanType bean)

storeManyToOneAssociations

protected void storeManyToOneAssociations(BeanType bean,
                                          int objectId)

storeManyToMany

protected void storeManyToMany(BeanType bean,
                               int objectId)

_save

protected int _save(SequenceValue nextId,
                    Insert save,
                    Update saveUpdate,
                    BeanType bean)
             throws DatabaseException
Throws:
DatabaseException

_delete

protected boolean _delete(Delete delete)
                   throws DatabaseException
Throws:
DatabaseException

_delete

protected boolean _delete(Delete delete,
                          int objectId)
                   throws DatabaseException
Throws:
DatabaseException

deleteManyToOne

protected void deleteManyToOne(int objectId)

deleteManyToMany

protected void deleteManyToMany(int objectId)

_restore

protected BeanType _restore(Select restore,
                            int objectId)
                     throws DatabaseException
Throws:
DatabaseException

_restoreFirst

protected BeanType _restoreFirst(Select restore)
                          throws DatabaseException
Throws:
DatabaseException

_restore

protected List<BeanType> _restore(Select restore)
                           throws DatabaseException
Throws:
DatabaseException

_restore

protected boolean _restore(Select restore,
                           DbRowProcessor rowProcessor)
                    throws DatabaseException
Throws:
DatabaseException

restoreManyToMany

protected void restoreManyToMany(BeanType bean,
                                 int objectId)

restoreManyToOne

protected void restoreManyToOne(BeanType bean)

restoreManyToOneAssociations

protected void restoreManyToOneAssociations(BeanType bean,
                                            int objectId)

_count

protected int _count(Select count)
              throws DatabaseException
Throws:
DatabaseException

_install

protected void _install(CreateSequence createSequence,
                        CreateTable createTable)
                 throws DatabaseException
Throws:
DatabaseException

installManyToMany

protected void installManyToMany()

_remove

protected void _remove(DropSequence dropSequence,
                       DropTable dropTable)
                throws DatabaseException
Throws:
DatabaseException

removeManyToMany

protected void removeManyToMany()

addListener

public void addListener(GenericQueryManagerListener listener)
Description copied from interface: GenericQueryManager
Add the listener to the manager to get notifications when actions were successful.

Specified by:
addListener in interface GenericQueryManager<BeanType>
Parameters:
listener - the listener that has to be added

removeListeners

public void removeListeners()
Description copied from interface: GenericQueryManager
Remove all the listeners that are registered to the manager.

Specified by:
removeListeners in interface GenericQueryManager<BeanType>

createNewManager

public <OtherBeanType> GenericQueryManager<OtherBeanType> createNewManager(Class<OtherBeanType> beanClass)
Description copied from interface: GenericQueryManager
Create a new generic query manager of the same kind but for another bean class.

Specified by:
createNewManager in interface GenericQueryManager<BeanType>
Parameters:
beanClass - the class of the bean for which the new generic query manager has to be created
Returns:
a new generic query manager instance

fireInstalled

protected void fireInstalled()

fireRemoved

protected void fireRemoved()

fireInserted

protected void fireInserted(BeanType bean)

fireUpdated

protected void fireUpdated(BeanType bean)

fireRestored

protected void fireRestored(BeanType bean)

fireDeleted

protected void fireDeleted(int objectId)


Copyright © 2001-2007 Uwyn sprl/bvba. All Rights Reserved.