public class TableDescriptor
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
FOREIGNKEY_SUFFIX |
static java.lang.String |
INDEX_SUFFIX |
static java.lang.String |
PRIMARYKEY_SUFFIX |
static java.lang.String |
RELATION_SUFFIX |
static java.lang.String |
TYPECOLUMN |
Constructor and Description |
---|
TableDescriptor(DatabaseDescriptor dbd,
PersistentType<?> persistentType)
Constructor
|
TableDescriptor(DatabaseDescriptor dbd,
java.lang.String tableName)
Constructor by name
|
Modifier and Type | Method and Description |
---|---|
ColumnDescriptor |
addClassReferenceColumn(java.lang.String columnName,
ColumnConstraintType constraintType,
SQLType sqlType,
java.lang.String javaPropertyName,
org.resoa.json.stream.Serializer serializer,
TableDescriptor refTo,
Relation relationInfo)
Add a foreignKey column
|
void |
addColumn(java.lang.Class<?> type,
java.lang.String propertyName,
org.resoa.codegen.PropertyHandler javaProperty,
org.resoa.json.stream.Serializer serializer,
ColumnConstraintType columnConstraint,
TableRelation relation)
Add an object field as column.
|
void |
addJavaTypeColumn()
Add a name for stored type (used in case of inheritance)
|
void |
addTableRelation(TableRelation newRelation)
Add a new relation to another table
|
void |
checkPrimaryKeyColumn()
Generate primary keyColumn if not yet exists
|
void |
finalizeRelations()
Finalize Table References
|
void |
generateNMRelationColumns(TableRelation tableRelation) |
java.util.List<TableRelation> |
generateReferenceColumns(java.util.Map<java.lang.String,TableDescriptor> tables)
Generate Reference Columns
|
ColumnDescriptor |
getColumn(java.lang.String columnName) |
java.util.Collection<ColumnDescriptor> |
getColumns()
The collection of table columns
|
org.skife.jdbi.v2.DBI |
getDatabase() |
DatabaseDescriptor |
getDatabaseDescriptor() |
java.util.List<Relation> |
getDeclaredRelations() |
ForeignKeyColumnDescriptor |
getForeignKeyColumn(TableDescriptor table,
java.lang.String javaPropertyName)
Get a ForeignKey Columns
|
java.util.Collection<ForeignKeyColumnDescriptor> |
getForeignKeyColumns()
Get all declared ForeignKey Columns
|
java.util.Collection<java.lang.String> |
getIndices() |
java.util.List<ColumnDescriptor> |
getNMRelationColumns() |
java.lang.Object[] |
getObjectArrayFromJSON(org.resoa.json.JSONObject json)
Create an object out of JSON for SQL transactions
|
PersistentType<?> |
getPersistentType() |
java.lang.reflect.Field |
getPrimaryJavaKeyField() |
ColumnDescriptor |
getPrimaryKeyColumn() |
java.lang.Object |
getPrimaryKeyFromJSON(org.resoa.json.JSONObject json,
java.lang.String referenceColumn,
boolean generateNew) |
java.lang.String |
getTableName() |
java.util.Collection<TableRelation> |
getTableRelations()
Get all relations to other tables
|
boolean |
hasFKReferenceColumns() |
boolean |
isInheritanceEnabled() |
void |
printColumns()
Dump columns
|
void |
setDatabase(org.skife.jdbi.v2.DBI database)
Set the DBI handle for database processing
|
java.lang.String |
SQL_getDELETE()
Get a JDBI compatible SQL DELETE statement
|
java.lang.String |
SQL_getINSERT()
Get a JDBI compatible SQL INSERT statement
|
java.lang.String |
SQL_getSELECT_FOREIGNKEY(java.lang.String keyColumnName,
boolean keysOnly) |
java.lang.String |
SQL_getSELECT_GENERIC(java.lang.String whereStatement,
boolean keyOnly) |
java.lang.String |
SQL_getSELECT_PRIMARYKEY(boolean keyOnly) |
java.lang.String |
SQL_getUPDATE()
Get a JDBI compatible SQL UPDATE statement
|
public static java.lang.String TYPECOLUMN
public static java.lang.String RELATION_SUFFIX
public static java.lang.String INDEX_SUFFIX
public static java.lang.String FOREIGNKEY_SUFFIX
public static java.lang.String PRIMARYKEY_SUFFIX
public TableDescriptor(DatabaseDescriptor dbd, PersistentType<?> persistentType)
persistentType
- dbd
- public TableDescriptor(DatabaseDescriptor dbd, java.lang.String tableName)
tableName
- dbd
- public java.util.Collection<ColumnDescriptor> getColumns()
public ColumnDescriptor getColumn(java.lang.String columnName)
columnName
- public java.util.Collection<TableRelation> getTableRelations()
public java.util.Collection<ForeignKeyColumnDescriptor> getForeignKeyColumns()
public ForeignKeyColumnDescriptor getForeignKeyColumn(TableDescriptor table, java.lang.String javaPropertyName)
table
- javaPropertyName
- public void addTableRelation(TableRelation newRelation)
newRelation
- public java.util.Collection<java.lang.String> getIndices()
public boolean isInheritanceEnabled()
public boolean hasFKReferenceColumns()
public java.lang.String getTableName()
public org.skife.jdbi.v2.DBI getDatabase()
public void setDatabase(org.skife.jdbi.v2.DBI database)
database
- public PersistentType<?> getPersistentType()
public java.lang.reflect.Field getPrimaryJavaKeyField()
public ColumnDescriptor getPrimaryKeyColumn()
public java.lang.Object getPrimaryKeyFromJSON(org.resoa.json.JSONObject json, java.lang.String referenceColumn, boolean generateNew)
public void checkPrimaryKeyColumn()
public java.util.List<ColumnDescriptor> getNMRelationColumns()
public java.util.List<Relation> getDeclaredRelations()
public DatabaseDescriptor getDatabaseDescriptor()
public void addColumn(java.lang.Class<?> type, java.lang.String propertyName, org.resoa.codegen.PropertyHandler javaProperty, org.resoa.json.stream.Serializer serializer, ColumnConstraintType columnConstraint, TableRelation relation)
type
- propertyName
- columnConstraint
- relation
- javaProperty
- serializer
- public void addJavaTypeColumn()
public ColumnDescriptor addClassReferenceColumn(java.lang.String columnName, ColumnConstraintType constraintType, SQLType sqlType, java.lang.String javaPropertyName, org.resoa.json.stream.Serializer serializer, TableDescriptor refTo, Relation relationInfo)
columnName
- constraintType
- sqlType
- refTo
- relationInfo
- public void generateNMRelationColumns(TableRelation tableRelation)
public java.util.List<TableRelation> generateReferenceColumns(java.util.Map<java.lang.String,TableDescriptor> tables)
tables
- public void finalizeRelations()
public java.lang.String SQL_getSELECT_PRIMARYKEY(boolean keyOnly)
public java.lang.String SQL_getSELECT_GENERIC(java.lang.String whereStatement, boolean keyOnly)
public java.lang.String SQL_getSELECT_FOREIGNKEY(java.lang.String keyColumnName, boolean keysOnly)
public java.lang.String SQL_getUPDATE()
public java.lang.String SQL_getINSERT()
public java.lang.String SQL_getDELETE()
public java.lang.Object[] getObjectArrayFromJSON(org.resoa.json.JSONObject json) throws org.resoa.exception.JSONException
json
- org.resoa.exception.JSONException
public void printColumns()
Copyright © 2005-2014 The Resoa Project, resoa.org.