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
-
Constructor Summary
ConstructorDescriptionAbstractGenericQueryManager
(Datasource datasource, Class<BeanType> beanClass, String primaryKey) -
Method Summary
Modifier and TypeMethodDescriptionprotected int
protected boolean
protected boolean
protected int
_insert
(SequenceValue nextId, Insert save, BeanType bean) protected int
_insertWithoutCallbacks
(SequenceValue nextId, Insert save, BeanType bean) protected BeanType
protected 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 int
protected int
_updateWithoutCallbacks
(Update saveUpdate, BeanType bean) protected void
_validateWithoutCallbacks
(Validated validated) void
addListener
(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 void
deleteManyToMany
(int objectId) protected void
deleteManyToOne
(int objectId) protected void
fireDeleted
(int objectId) protected void
fireInserted
(BeanType bean) protected void
protected void
protected void
fireRestored
(BeanType bean) protected void
fireUpdated
(BeanType bean) Get the handled classgetCallbacks
(BeanType bean) 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
install_
(CreateSequence createSequence, CreateTable createTable) protected void
boolean
protected void
remove_
(DropSequence dropSequence, DropTable dropTable) void
Remove all the listeners that are registered to the manager.protected void
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
Validates aValidated
in 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, reserveConnection
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods 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:GenericQueryManager
Get the handled class- Specified by:
getBaseClass
in interfaceGenericQueryManager<BeanType>
- Returns:
- the handled class
-
getIdentifierName
Description copied from interface:GenericQueryManager
Get the name of the property defined as the identifier.Defaults to "id".
- Specified by:
getIdentifierName
in interfaceGenericQueryManager<BeanType>
- Returns:
- the name of the property defined as the identifier
-
getIdentifierValue
Description copied from interface:GenericQueryManager
Get the value of the property defined as the identifier.The property defaults to "id".
- Specified by:
getIdentifierValue
in 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:ValidationContext
Validates aValidated
in 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:
validate
in interfaceValidationContext
- Parameters:
validated
- theValidated
instance 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:GenericQueryManager
Add the listener to the manager to get notifications when actions were successful.- Specified by:
addListener
in interfaceGenericQueryManager<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 interfaceGenericQueryManager<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 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)
-