P - the persistence typepublic class DbObjectClassVariables<P extends AbstractDbObject<P>> extends Object
Map that can be queried by apps
by tablename.| Modifier and Type | Class and Description |
|---|---|
protected static class |
DbObjectClassVariables.ForeignReference |
| Modifier and Type | Field and Description |
|---|---|
boolean |
alwaysPrepare
true if prepared statements should always be prepared (i.e.
|
String |
classBaseName
the base-classname.
|
int |
classId
The unique class id.
|
Class<P> |
clazz
the class.
|
int |
columnCount
Number of columns in a resultset.
|
StatementId |
deleteStatementId
prepared statement ID for delete().
|
StatementId |
dummyUpdateStatementId
prepared statement ID for dummyUpdate().
|
TableSerialExpirationBacklog |
expirationBacklog
table serial expiration backlog.
|
protected Set<DbObjectClassVariables.ForeignReference> |
foreignReferences
Referencing classes and their isReferencing-methods.
|
IdSource |
idSource
the source for obtaining a new ID.
|
StatementId |
insertStatementId
prepared statement ID for insert().
|
Properties |
properties
class properties.
|
int |
remoteDelegateId
ID for the remote delegate for this class.
|
StatementId |
selectAllIdSerialStatementId
prepared statement ID for selectAllIdSerial().
|
StatementId |
selectAllObjectsStatementId
prepared statement ID for selectAll().
|
StatementId |
selectExpiredTableSerials1StatementId
prepared statement ID for selectExpiredTableSerials().
|
StatementId |
selectExpiredTableSerials2StatementId |
StatementId |
selectLockedStatementId
prepared statement ID for selectLocked().
|
StatementId |
selectMaxIdStatementId
prepared statement ID for selectMaxId().
|
StatementId |
selectMaxTableSerialStatementId
prepared statement ID for selectMaxTableSerial().
|
StatementId |
selectObjectStatementId
prepared statement ID for select().
|
StatementId |
selectSerialStatementId
prepared statement ID for selectSerial().
|
String |
tableName
database table name.
|
StatementId |
updateSerialAndTableSerialStatementId
prepared statement ID for updateSerialAndTableSerial().
|
StatementId |
updateSerialStatementId
prepared statement ID for updateSerial().
|
StatementId |
updateStatementId
prepared statement ID for update().
|
StatementId |
updateTableSerialStatementId
prepared statement ID for updateTableSerial().
|
| Constructor and Description |
|---|
DbObjectClassVariables(Class<P> clazz,
int classId,
String tableName)
constructs a classvariable.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
addReferencingClass(Class<? extends AbstractDbObject<?>> clazz,
String methodName)
Adds a PDO class that is referencing the class of this class variable holder.
|
protected TableSerialExpirationBacklog |
createBacklog()
Creates the table serial backlog.
|
protected int |
determineReferencePriority(Class<? extends AbstractDbObject<?>> clazz)
Determine the referencing priority.
|
IdSource |
getIdSource(Db db)
Get the IdSource.
If the IdSource is null, the method will look for a property file which is the classname + ".properties". |
String |
getProperty(String key)
Gets a class property.
|
org.tentackle.persist.rmi.AbstractDbObjectRemoteDelegate<P> |
getRemoteDelegate(Db db)
Gets the RemoteDelegate for the class and db.
|
int |
getRemoteDelegateId()
Gets the delegateId of the class, i.e.
|
static <P extends AbstractDbObject<P>> |
getVariables(String tableName)
Gets the classvariables for a given tablename.
|
boolean |
isReferenced(Db db,
long id)
Determines whether the class of this variable holder is referenced.
|
protected boolean |
isReferencedImpl(Db db,
long id,
Set<DbObjectClassVariables.ForeignReference> foreignReferences)
Determines whether the class of this variable holder is referenced.
|
protected void |
loadProperties()
Loads and initially processes the properties.
Invoked from constructor. |
String |
putProperty(String key,
String value)
Sets a class property.
|
static <P extends AbstractDbObject<P>> |
putVariables(DbObjectClassVariables<P> variables)
Registers a classvariables instance.
|
boolean |
removeReferencingClass(Class<? extends AbstractDbObject<?>> clazz,
String methodName)
Removes a PDO class that is referencing the class from this class variable holder.
|
String |
toString() |
protected final Set<DbObjectClassVariables.ForeignReference> foreignReferences
public final Class<P extends AbstractDbObject<P>> clazz
public final int classId
public final String classBaseName
public Properties properties
public String tableName
public int remoteDelegateId
public int columnCount
public boolean alwaysPrepare
public final StatementId selectObjectStatementId
public final StatementId selectAllObjectsStatementId
public final StatementId selectAllIdSerialStatementId
public final StatementId selectLockedStatementId
public final StatementId selectSerialStatementId
public final StatementId selectMaxIdStatementId
public final StatementId selectMaxTableSerialStatementId
public final StatementId insertStatementId
public final StatementId updateStatementId
public final StatementId deleteStatementId
public final StatementId dummyUpdateStatementId
public final StatementId updateSerialStatementId
public final StatementId updateTableSerialStatementId
public final StatementId updateSerialAndTableSerialStatementId
public final StatementId selectExpiredTableSerials1StatementId
public final StatementId selectExpiredTableSerials2StatementId
public final TableSerialExpirationBacklog expirationBacklog
public IdSource idSource
public DbObjectClassVariables(Class<P> clazz, int classId, String tableName)
clazz - is the class of the derived DbObjectclassId - the unique class id, 0 if get from @ClassId annotationtableName - is the SQL tablenamepublic static <P extends AbstractDbObject<P>> DbObjectClassVariables<P> getVariables(String tableName)
P - the persistence typetableName - is the database tablenamepublic static <P extends AbstractDbObject<P>> void putVariables(DbObjectClassVariables<P> variables)
P - the persistence typevariables - the classvariables to registerprotected TableSerialExpirationBacklog createBacklog()
protected void loadProperties()
public IdSource getIdSource(Db db)
db - the db connectionprotected int determineReferencePriority(Class<? extends AbstractDbObject<?>> clazz)
The default implementation returns 0. Provided to be overridden.
clazz - the referencing classpublic boolean addReferencingClass(Class<? extends AbstractDbObject<?>> clazz, String methodName)
The referencing class must provide a static method isReferencing<ClassBasename>,
while ClassBaseName is the classBaseName of the referenced class.
The method must provide the parameters Db and objectId as generated
by the *IsReferencing-wurblets.
clazz - the class to addmethodName - a method name, null if defaultremoveReferencingClass(java.lang.Class<? extends org.tentackle.persist.AbstractDbObject<?>>, java.lang.String)public boolean removeReferencingClass(Class<? extends AbstractDbObject<?>> clazz, String methodName)
clazz - the class to be removedmethodName - a method name, null if defaultaddReferencingClass(java.lang.Class<? extends org.tentackle.persist.AbstractDbObject<?>>, java.lang.String)public boolean isReferenced(Db db, long id)
db - the Db connectionid - the object id to test whether it is referenced by any other objectsprotected boolean isReferencedImpl(Db db, long id, Set<DbObjectClassVariables.ForeignReference> foreignReferences)
db - the Db connectionid - the object id to test whether it is referenced by any other objectsforeignReferences - the foreign rereferencespublic int getRemoteDelegateId()
public org.tentackle.persist.rmi.AbstractDbObjectRemoteDelegate<P> getRemoteDelegate(Db db)
db - the db connectionpublic String getProperty(String key)
key - the property keypublic String putProperty(String key, String value)
key - the property keyvalue - the property valueCopyright © 2016 Krake Softwaretechnik. All rights reserved.