Package lu.kbra.pclib.db.table
Class DatabaseTable<T extends DatabaseEntry>
java.lang.Object
lu.kbra.pclib.db.table.DatabaseTable<T>
- All Implemented Interfaces:
SQLQueryable<T>,AbstractDBTable<T>
- Direct Known Subclasses:
DBTableProxy,DeferredDatabaseTable
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Databaseprotected DatabaseEntryUtilsprotected SQLQueryableHookManagerprotected TableStructure -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedDatabaseTable(Database database) DatabaseTable(Database database, String name) protectedDatabaseTable(Database database, DatabaseEntryUtils databaseEntryUtils) protectedDatabaseTable(Database database, DatabaseEntryUtils databaseEntryUtils, Class<? extends AbstractDBTable<T>> tableClass, Map<String, Object> customHints) -
Method Summary
Modifier and TypeMethodDescriptionintclear()protected intintcount()protected intprotected intcountNotNull(AbstractConnection c, T data) intcountNotNull(T data) protected intcountUniques(AbstractConnection c, T data) intcountUniques(T data) create()protected DatabaseTableStatuscreateProxy(Supplier<AbstractConnection> connection) protected Tdelete(AbstractConnection c, T data) <C extends Collection<T>>
CdeleteAll(C datas) protected <C extends Collection<T>>
CdeleteAll(AbstractConnection c, C datas) <C extends Collection<T>,D extends Collection<T>>
DdeleteAllIfExists(C datas, Supplier<D> supplier) protected <D extends Collection<T>,C extends Collection<T>>
DdeleteIfExists(AbstractConnection c, C datas, Supplier<D> supplier) deleteIfExists(AbstractConnection c, T data) deleteIfExists(T data) deleteUnique(AbstractConnection c, T data) deleteUnique(T data) deleteUniques(AbstractConnection c, T data) deleteUniques(T data) protected StringdoubleQuoteEscapeIdentifier(String identifier) drop()protected AbstractDBTable<T> booleanexists()protected booleanprotected booleanexists(AbstractConnection c, T data) booleanprotected booleanexistsUnique(AbstractConnection c, T data) booleanexistsUnique(T data) protected booleanexistsUniques(AbstractConnection c, T data) booleanexistsUniques(T data) <C extends Collection<T>,D extends Collection<T>>
DfilterExists(C datas, Supplier<D> supplier) protected <C extends Collection<T>,D extends Collection<T>>
DfilterExists(AbstractConnection c, C datas, Supplier<D> supplier) <C extends Collection<T>,D extends Collection<T>>
DfilterExistsByUnique(C datas, Supplier<D> supplier) protected <D extends Collection<T>,C extends Collection<T>>
DfilterExistsByUnique(AbstractConnection c, C datas, Supplier<D> supplier) <C extends Collection<T>,D extends Collection<T>>
DfilterExistsUnique(C datas, Supplier<D> supplier) protected <D extends Collection<T>,C extends Collection<T>>
DfilterExistsUnique(AbstractConnection c, C datas, Supplier<D> supplier) String[]final StringgetName()final Stringprotected AbstractDBTable<T> final Class<? extends SQLQueryable<T>> protected Tinsert(AbstractConnection c, T data) <C extends Collection<T>>
CinsertAll(C data) protected <C extends Collection<T>>
CinsertAll(AbstractConnection c, C datas) protected TinsertAndReload(AbstractConnection c, T data) insertAndReload(T data) <C extends Collection<T>>
CinsertAndReloadAll(C datas) protected <C extends Collection<T>>
CinsertAndReloadAll(AbstractConnection c, C datas) protected Tload(AbstractConnection c, T data) <C extends Collection<T>>
CloadAll(C datas) protected <C extends Collection<T>>
CloadAll(AbstractConnection c, C datas) <C extends Collection<T>,D extends Collection<T>>
DloadAllByUnique(C datas, Supplier<D> supplier) protected <C extends Collection<T>,D extends Collection<T>>
DloadAllByUnique(AbstractConnection c, C datas, Supplier<D> supplier) <C extends Collection<T>,D extends Collection<T>>
DloadAllIfExists(C datas, Supplier<D> supplier) <C extends Collection<T>>
CloadAllUnique(C datas) protected <C extends Collection<T>>
CloadAllUnique(AbstractConnection c, C datas) loadByUnique(AbstractConnection c, T data) loadByUnique(T data) Returns a list of all the possible entries matching with the unique values of the input.protected <C extends Collection<T>,D extends Collection<T>>
DloadIfExists(AbstractConnection c, C datas, Supplier<D> supplier) loadIfExists(AbstractConnection c, T data) loadIfExists(T data) protected TloadIfExistsElseInsert(AbstractConnection c, T data) loadIfExistsElseInsert(T data) Loads the first pk result, returns a the newly inserted instance if none is foundprotected TloadUnique(AbstractConnection c, T data) loadUnique(T data) Loads the first unique result, or throws an exception if none is found.loadUniqueIfExists(AbstractConnection c, T data) loadUniqueIfExists(T data) Loads the first unique result, returns null if none is found and throws an exception if too many are available.protected TLoads the first unique result, returns a the newly inserted instance if none is found and throws an exception if too many are available.protected TLoads the first unique result, returns null if none is found and throws an exception if too many are available.protected TloadUniqueInternal(AbstractConnection c, T data) protected <B> Bquery(AbstractConnection c, SQLQuery<T, B> query) <B> BvoidsetDbEntryUtils(DatabaseEntryUtils dbEntryUtils) voidsetTableStructure(TableStructure tableStructure) toString()inttruncate()protected intprotected Tupdate(AbstractConnection c, T data) <C extends Collection<T>>
CupdateAll(C datas) protected <C extends Collection<T>>
CupdateAll(AbstractConnection c, C datas) protected TupdateAndReload(AbstractConnection c, T data) updateAndReload(T data) <C extends Collection<T>>
CupdateAndReloadAll(C datas) protected <C extends Collection<T>>
CupdateAndReloadAll(AbstractConnection c, C datas) updateAndReloadIfExists(AbstractConnection c, T data) updateAndReloadIfExists(T data) protected Tprotected TupdateIfExists(AbstractConnection c, T data) updateIfExists(T data) protected TupdateIfExistsElseInsert(AbstractConnection c, T data) updateIfExistsElseInsert(T data) protected Tprotected AbstractConnectionuse()protected voidprotected voidMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface lu.kbra.pclib.db.table.AbstractDBTable
getCustomHints, getDatabase, getQueryableHookManager, getStructure, setQueryableHookManagerMethods inherited from interface lu.kbra.pclib.db.impl.SQLQueryable
getDatabaseEntryUtils, getStatementAsSQL
-
Field Details
-
database
-
databaseEntryUtils
-
structure
-
customHints
-
queryableHookManager
-
-
Constructor Details
-
DatabaseTable
protected DatabaseTable() -
DatabaseTable
-
DatabaseTable
-
DatabaseTable
protected DatabaseTable(Database database, DatabaseEntryUtils databaseEntryUtils, Class<? extends AbstractDBTable<T>> tableClass, Map<String, Object> customHints) -
DatabaseTable
-
-
Method Details
-
clear
- Specified by:
clearin interfaceAbstractDBTable<T extends DatabaseEntry>- Throws:
DBException
-
clear
- Throws:
DBException
-
count
- Specified by:
countin interfaceSQLQueryable<T extends DatabaseEntry>- Throws:
DBException
-
count
- Throws:
DBException
-
countNotNull
- Throws:
DBException
-
countNotNull
- Specified by:
countNotNullin interfaceAbstractDBTable<T extends DatabaseEntry>- Throws:
DBException
-
countUniques
- Throws:
DBException
-
countUniques
- Specified by:
countUniquesin interfaceAbstractDBTable<T extends DatabaseEntry>- Throws:
DBException
-
create
- Specified by:
createin interfaceAbstractDBTable<T extends DatabaseEntry>- Throws:
DBException
-
create
- Throws:
DBException
-
createProxy
-
delete
- Throws:
DBException
-
delete
- Specified by:
deletein interfaceAbstractDBTable<T extends DatabaseEntry>- Throws:
DBException
-
deleteAll
- Specified by:
deleteAllin interfaceAbstractDBTable<T extends DatabaseEntry>- Throws:
DBException
-
deleteAll
-
deleteIfExists
protected <D extends Collection<T>,C extends Collection<T>> D deleteIfExists(AbstractConnection c, C datas, Supplier<D> supplier) -
deleteAllIfExists
public <C extends Collection<T>,D extends Collection<T>> D deleteAllIfExists(C datas, Supplier<D> supplier) throws DBException - Specified by:
deleteAllIfExistsin interfaceAbstractDBTable<T extends DatabaseEntry>- Throws:
DBException
-
deleteIfExists
- Throws:
DBException
-
deleteIfExists
- Specified by:
deleteIfExistsin interfaceAbstractDBTable<T extends DatabaseEntry>- Throws:
DBException
-
deleteUnique
- Throws:
DBException
-
deleteUnique
- Specified by:
deleteUniquein interfaceAbstractDBTable<T extends DatabaseEntry>- Throws:
DBException
-
deleteUniques
- Throws:
DBException
-
deleteUniques
- Specified by:
deleteUniquesin interfaceAbstractDBTable<T extends DatabaseEntry>- Throws:
DBException
-
doubleQuoteEscapeIdentifier
-
drop
- Specified by:
dropin interfaceAbstractDBTable<T extends DatabaseEntry>- Throws:
DBException
-
drop
- Throws:
DBException
-
exists
- Specified by:
existsin interfaceAbstractDBTable<T extends DatabaseEntry>- Throws:
DBException
-
exists
- Throws:
DBException
-
exists
- Throws:
DBException
-
exists
- Specified by:
existsin interfaceAbstractDBTable<T extends DatabaseEntry>- Throws:
DBException
-
existsUnique
- Throws:
DBException
-
existsUnique
- Specified by:
existsUniquein interfaceAbstractDBTable<T extends DatabaseEntry>- Throws:
DBException
-
existsUniques
- Throws:
DBException
-
existsUniques
- Specified by:
existsUniquesin interfaceAbstractDBTable<T extends DatabaseEntry>- Throws:
DBException
-
filterExists
public <C extends Collection<T>,D extends Collection<T>> D filterExists(C datas, Supplier<D> supplier) throws DBException - Specified by:
filterExistsin interfaceAbstractDBTable<T extends DatabaseEntry>- Throws:
DBException
-
filterExists
protected <C extends Collection<T>,D extends Collection<T>> D filterExists(AbstractConnection c, C datas, Supplier<D> supplier) -
filterExistsUnique
protected <D extends Collection<T>,C extends Collection<T>> D filterExistsUnique(AbstractConnection c, C datas, Supplier<D> supplier) -
filterExistsUnique
public <C extends Collection<T>,D extends Collection<T>> D filterExistsUnique(C datas, Supplier<D> supplier) throws DBException - Specified by:
filterExistsUniquein interfaceAbstractDBTable<T extends DatabaseEntry>- Throws:
DBException
-
getConnector
- Specified by:
getConnectorin interfaceSQLQueryable<T extends DatabaseEntry>
-
getCreateSQL
- Specified by:
getCreateSQLin interfaceAbstractDBTable<T extends DatabaseEntry>
-
getEntryClass
- Specified by:
getEntryClassin interfaceSQLQueryable<T extends DatabaseEntry>
-
getName
- Specified by:
getNamein interfaceSQLQueryable<T extends DatabaseEntry>
-
getQualifiedName
- Specified by:
getQualifiedNamein interfaceSQLQueryable<T extends DatabaseEntry>
-
getQueryable
-
getTargetClass
- Specified by:
getTargetClassin interfaceSQLQueryable<T extends DatabaseEntry>
-
insert
- Throws:
DBException
-
insert
- Specified by:
insertin interfaceAbstractDBTable<T extends DatabaseEntry>- Throws:
DBException
-
insertAll
- Specified by:
insertAllin interfaceAbstractDBTable<T extends DatabaseEntry>- Throws:
DBException
-
insertAll
-
insertAndReload
- Throws:
DBException
-
insertAndReload
- Specified by:
insertAndReloadin interfaceAbstractDBTable<T extends DatabaseEntry>- Throws:
DBException
-
insertAndReloadAll
- Specified by:
insertAndReloadAllin interfaceAbstractDBTable<T extends DatabaseEntry>- Throws:
DBException
-
insertAndReloadAll
-
load
- Throws:
DBException
-
load
- Specified by:
loadin interfaceAbstractDBTable<T extends DatabaseEntry>- Throws:
DBException
-
loadAll
- Specified by:
loadAllin interfaceAbstractDBTable<T extends DatabaseEntry>- Throws:
DBException
-
loadAll
-
loadByUnique
- Throws:
DBException
-
loadByUnique
Returns a list of all the possible entries matching with the unique values of the input.- Specified by:
loadByUniquein interfaceAbstractDBTable<T extends DatabaseEntry>- Throws:
DBException
-
loadIfExists
protected <C extends Collection<T>,D extends Collection<T>> D loadIfExists(AbstractConnection c, C datas, Supplier<D> supplier) -
loadAllIfExists
public <C extends Collection<T>,D extends Collection<T>> D loadAllIfExists(C datas, Supplier<D> supplier) throws DBException - Specified by:
loadAllIfExistsin interfaceAbstractDBTable<T extends DatabaseEntry>- Throws:
DBException
-
loadIfExists
- Throws:
DBException
-
updateIfExistsElseInsertAndReload
- Specified by:
updateIfExistsElseInsertAndReloadin interfaceAbstractDBTable<T extends DatabaseEntry>
-
updateIfExistsElseInsertAndReload
-
updateIfExistsElseInsert
- Specified by:
updateIfExistsElseInsertin interfaceAbstractDBTable<T extends DatabaseEntry>
-
updateIfExistsElseInsert
-
updateIfExists
- Specified by:
updateIfExistsin interfaceAbstractDBTable<T extends DatabaseEntry>
-
updateIfExists
-
updateAndReloadIfExistsElseInsertAndReload
- Specified by:
updateAndReloadIfExistsElseInsertAndReloadin interfaceAbstractDBTable<T extends DatabaseEntry>
-
updateAndReloadIfExistsElseInsertAndReload
-
updateAndReloadIfExistsElseInsert
- Specified by:
updateAndReloadIfExistsElseInsertin interfaceAbstractDBTable<T extends DatabaseEntry>
-
updateAndReloadIfExistsElseInsert
-
updateAndReloadIfExists
- Specified by:
updateAndReloadIfExistsin interfaceAbstractDBTable<T extends DatabaseEntry>
-
updateAndReloadIfExists
-
loadIfExists
- Specified by:
loadIfExistsin interfaceAbstractDBTable<T extends DatabaseEntry>- Throws:
DBException
-
loadIfExistsElseInsert
- Throws:
DBException
-
loadIfExistsElseInsert
Loads the first pk result, returns a the newly inserted instance if none is found- Throws:
DBException
-
loadUnique
- Throws:
DBException
-
loadUnique
Loads the first unique result, or throws an exception if none is found.- Specified by:
loadUniquein interfaceAbstractDBTable<T extends DatabaseEntry>- Throws:
DBException
-
loadUniqueIfExists
- Throws:
DBException
-
loadUniqueIfExists
Loads the first unique result, returns null if none is found and throws an exception if too many are available.- Specified by:
loadUniqueIfExistsin interfaceAbstractDBTable<T extends DatabaseEntry>- Throws:
DBException
-
loadUniqueIfExistsElseInsert
- Throws:
DBException
-
loadUniqueIfExistsElseInsertAndReload
Loads the first unique result, returns null if none is found and throws an exception if too many are available.- Specified by:
loadUniqueIfExistsElseInsertAndReloadin interfaceAbstractDBTable<T extends DatabaseEntry>- Throws:
DBException
-
loadUniqueIfExistsElseInsertAndReload
- Throws:
DBException
-
loadUniqueIfExistsElseInsert
Loads the first unique result, returns a the newly inserted instance if none is found and throws an exception if too many are available.- Specified by:
loadUniqueIfExistsElseInsertin interfaceAbstractDBTable<T extends DatabaseEntry>- Throws:
DBException
-
loadUniqueInternal
-
query
- Throws:
DBException
-
query
- Specified by:
queryin interfaceSQLQueryable<T extends DatabaseEntry>- Throws:
DBException
-
setDbEntryUtils
-
setTableStructure
- Specified by:
setTableStructurein interfaceAbstractDBTable<T extends DatabaseEntry>
-
truncate
- Specified by:
truncatein interfaceAbstractDBTable<T extends DatabaseEntry>- Throws:
DBException
-
truncate
- Throws:
DBException
-
update
- Throws:
DBException
-
update
- Specified by:
updatein interfaceAbstractDBTable<T extends DatabaseEntry>- Throws:
DBException
-
updateAll
- Specified by:
updateAllin interfaceAbstractDBTable<T extends DatabaseEntry>- Throws:
DBException
-
updateAll
-
updateAndReload
- Throws:
DBException
-
updateAndReload
- Specified by:
updateAndReloadin interfaceAbstractDBTable<T extends DatabaseEntry>- Throws:
DBException
-
updateAndReloadAll
- Specified by:
updateAndReloadAllin interfaceAbstractDBTable<T extends DatabaseEntry>- Throws:
DBException
-
updateAndReloadAll
-
loadAllUnique
- Specified by:
loadAllUniquein interfaceAbstractDBTable<T extends DatabaseEntry>- Throws:
DBException
-
loadAllUnique
-
loadAllByUnique
public <C extends Collection<T>,D extends Collection<T>> D loadAllByUnique(C datas, Supplier<D> supplier) throws DBException - Specified by:
loadAllByUniquein interfaceAbstractDBTable<T extends DatabaseEntry>- Throws:
DBException
-
loadAllByUnique
protected <C extends Collection<T>,D extends Collection<T>> D loadAllByUnique(AbstractConnection c, C datas, Supplier<D> supplier) -
filterExistsByUnique
public <C extends Collection<T>,D extends Collection<T>> D filterExistsByUnique(C datas, Supplier<D> supplier) throws DBException - Specified by:
filterExistsByUniquein interfaceAbstractDBTable<T extends DatabaseEntry>- Throws:
DBException
-
filterExistsByUnique
protected <D extends Collection<T>,C extends Collection<T>> D filterExistsByUnique(AbstractConnection c, C datas, Supplier<D> supplier) -
use
- Throws:
DBException
-
validateStructure
protected void validateStructure() -
validateWrite
protected void validateWrite() -
toString
-