Class AbstractGenericQueryManager<BeanType>
java.lang.Object
rife.database.DbQueryManager
rife.database.querymanagers.generic.AbstractGenericQueryManager<BeanType>
- All Implemented Interfaces:
Cloneable,GenericQueryManager<BeanType>,ValidationContext
public abstract class AbstractGenericQueryManager<BeanType>
extends DbQueryManager
implements GenericQueryManager<BeanType>
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionAbstractGenericQueryManager(Datasource datasource, Class<BeanType> beanClass, String primaryKey) -
Method Summary
Modifier and TypeMethodDescriptionprotected intprotected booleanprotected booleanprotected int_insert(SequenceValue nextId, Insert save, BeanType bean) protected int_insertWithoutCallbacks(SequenceValue nextId, Insert save, BeanType bean) protected BeanTypeprotected boolean_restore(Select restore, DbRowProcessor rowProcessor) protected boolean_restore(Select restore, BeanFetcher<BeanType> beanFetcher) protected BeanType_restoreFirst(Select restore) protected int_save(SequenceValue nextId, Insert save, Update saveUpdate, BeanType bean) protected intprotected int_updateWithoutCallbacks(Update saveUpdate, BeanType bean) protected void_validateWithoutCallbacks(Validated validated) voidaddListener(GenericQueryManagerListener<BeanType> 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 voiddeleteManyToMany(int objectId) protected voiddeleteManyToOne(int objectId) protected voidfireDeleted(int objectId) protected voidfireInserted(BeanType bean) protected voidprotected voidprotected voidfireRestored(BeanType bean) protected voidfireUpdated(BeanType bean) Get the handled classgetCallbacks(BeanType bean) Get the name of the property defined as the identifier.intgetIdentifierValue(BeanType bean) Get the value of the property defined as the identifier.protected voidinstall_(CreateSequence createSequence, CreateTable createTable) protected voidbooleanprotected voidremove_(DropSequence dropSequence, DropTable dropTable) voidRemove all the listeners that are registered to the manager.protected voidprotected voidrestoreManyToMany(BeanType bean, int objectId) protected voidrestoreManyToOne(BeanType bean) protected voidrestoreManyToOneAssociations(BeanType bean, int objectId) protected voidsetManyToOneJoinParameters(DbPreparedStatement statement, BeanType bean) protected voidstoreManyToMany(BeanType bean, int objectId) protected voidstoreManyToOne(BeanType bean) protected voidstoreManyToOneAssociations(BeanType bean, int objectId) voidValidates aValidatedin this context.Methods inherited from class rife.database.DbQueryManager
clone, executeFetchAll, executeFetchAll, executeFetchAll, executeFetchAll, executeFetchAllBeans, executeFetchAllBeans, executeFetchFirst, executeFetchFirst, 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, executeResultQuery, executeUpdate, executeUpdate, executeUpdate, executeUseFirstAsciiStream, executeUseFirstAsciiStream, executeUseFirstBinaryStream, executeUseFirstBinaryStream, executeUseFirstCharacterStream, executeUseFirstCharacterStream, fetch, fetch, fetch, fetchAll, fetchAll, getConnection, getDatasource, inTransaction, inTransaction, reserveConnectionMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface 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, restore, restore, restoreFirst, save, update
-
Field Details
-
baseClass_
-
-
getPrimaryKeyMethod_
-
setPrimaryKeyMethod_
-
sparseIdentifier_
protected boolean sparseIdentifier_ -
listeners_
-
-
Constructor Details
-
AbstractGenericQueryManager
public AbstractGenericQueryManager(Datasource datasource, Class<BeanType> beanClass, String primaryKey) throws DatabaseException - Throws:
DatabaseException
-
-
Method Details
-
getBaseClass
Description copied from interface:GenericQueryManagerGet the handled class- Specified by:
getBaseClassin interfaceGenericQueryManager<BeanType>- Returns:
- the handled class
-
getIdentifierName
Description copied from interface:GenericQueryManagerGet the name of the property defined as the identifier.Defaults to "id".
- Specified by:
getIdentifierNamein interfaceGenericQueryManager<BeanType>- Returns:
- the name of the property defined as the identifier
-
getIdentifierValue
Description copied from interface:GenericQueryManagerGet the value of the property defined as the identifier.The property defaults to "id".
- Specified by:
getIdentifierValuein interfaceGenericQueryManager<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
Description copied from interface:ValidationContextValidates aValidatedin this context.This method is not supposed 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:
validatein interfaceValidationContext- Parameters:
validated- theValidatedinstance that will be validated
-
_validateWithoutCallbacks
-
getCallbacks
-
_update
-
_updateWithoutCallbacks
-
_insert
-
_insertWithoutCallbacks
-
setManyToOneJoinParameters
-
storeManyToOne
-
storeManyToOneAssociations
-
storeManyToMany
-
_save
protected int _save(SequenceValue nextId, Insert save, Update saveUpdate, BeanType bean) throws DatabaseException - Throws:
DatabaseException
-
_delete
- Throws:
DatabaseException
-
_delete
- Throws:
DatabaseException
-
deleteManyToOne
protected void deleteManyToOne(int objectId) -
deleteManyToMany
protected void deleteManyToMany(int objectId) -
_restore
- Throws:
DatabaseException
-
_restoreFirst
- Throws:
DatabaseException
-
_restore
- Throws:
DatabaseException
-
_restore
- Throws:
DatabaseException
-
_restore
protected boolean _restore(Select restore, BeanFetcher<BeanType> beanFetcher) throws DatabaseException - Throws:
DatabaseException
-
restoreManyToMany
-
restoreManyToOne
-
restoreManyToOneAssociations
-
_count
- Throws:
DatabaseException
-
install_
protected void install_(CreateSequence createSequence, CreateTable createTable) throws DatabaseException - Throws:
DatabaseException
-
installManyToMany
protected void installManyToMany() -
remove_
- Throws:
DatabaseException
-
removeManyToMany
protected void removeManyToMany() -
addListener
Description copied from interface:GenericQueryManagerAdd the listener to the manager to get notifications when actions were successful.- Specified by:
addListenerin interfaceGenericQueryManager<BeanType>- Parameters:
listener- the listener that has to be added
-
removeListeners
public void removeListeners()Description copied from interface:GenericQueryManagerRemove all the listeners that are registered to the manager.- Specified by:
removeListenersin interfaceGenericQueryManager<BeanType>
-
createNewManager
public <OtherBeanType> GenericQueryManager<OtherBeanType> createNewManager(Class<OtherBeanType> beanClass) Description copied from interface:GenericQueryManagerCreate a new generic query manager of the same kind but for another bean class.- Specified by:
createNewManagerin interfaceGenericQueryManager<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
-
fireUpdated
-
fireRestored
-
fireDeleted
protected void fireDeleted(int objectId)
-