|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.turbine.util.db.map.TableMap
TableMap is used to model a table in a database.
Field Summary | |
static java.lang.String |
AUTOINCREMENT
Key generation through auto-increment. |
private java.util.Hashtable |
columns
The columns in the table. |
private DatabaseMap |
dbMap
The database this table belongs to. |
static java.lang.String |
IDBROKERTABLE
Key generation through the IDBroker table. |
private IdGenerator |
idGenerator
IdGenerator for this tableMap |
static java.lang.String |
NONE
Keys are given by the application. |
private java.lang.Object |
pkInfo
Object to store information that is needed if the for generating primary keys. |
private java.lang.String |
prefix
The prefix on the table name. |
private java.lang.String |
primaryKeyMethod
The primary key generation method. |
static java.lang.String |
SEQUENCE
Key generation through sequences. |
private java.lang.String |
tableName
The name of the table. |
Constructor Summary | |
TableMap(java.lang.String tableName,
DatabaseMap containingDB)
Constructor. |
|
TableMap(java.lang.String tableName,
int numberOfColumns,
DatabaseMap containingDB)
Constructor. |
|
TableMap(java.lang.String tableName,
java.lang.String prefix,
DatabaseMap containingDB)
Constructor. |
Method Summary | |
void |
addColumn(ColumnMap cmap)
Add a pre-created column to this table. |
void |
addColumn(java.lang.String columnName,
java.lang.Object type)
Add a column to this table of a certain type. |
private void |
addColumn(java.lang.String name,
java.lang.Object type,
boolean pk,
java.lang.String fkTable,
java.lang.String fkColumn,
int size)
Add a column to the table. |
void |
addColumn(java.lang.String columnName,
java.lang.Object type,
int size)
Add a column to this table of a certain type and size. |
void |
addForeignKey(java.lang.String columnName,
java.lang.Object type,
java.lang.String fkTable,
java.lang.String fkColumn)
Add a foreign key column to the table. |
void |
addForeignKey(java.lang.String columnName,
java.lang.Object type,
java.lang.String fkTable,
java.lang.String fkColumn,
int size)
Add a foreign key column to the table. |
void |
addForeignPrimaryKey(java.lang.String columnName,
java.lang.Object type,
java.lang.String fkTable,
java.lang.String fkColumn)
Add a foreign primary key column to the table. |
void |
addForeignPrimaryKey(java.lang.String columnName,
java.lang.Object type,
java.lang.String fkTable,
java.lang.String fkColumn,
int size)
Add a foreign primary key column to the table. |
void |
addPrimaryKey(java.lang.String columnName,
java.lang.Object type)
Add a primary key column to this Table. |
void |
addPrimaryKey(java.lang.String columnName,
java.lang.Object type,
int size)
Add a primary key column to this Table. |
boolean |
containsColumn(ColumnMap column)
Does this table contain the specified column? |
boolean |
containsColumn(java.lang.String name)
Does this table contain the specified column? |
boolean |
containsObjectColumn()
Returns true if this tableMap contains a column with object data. |
private java.lang.String |
firstLetterCaps(java.lang.String data)
Makes the first letter caps and the rest lowercase. |
ColumnMap |
getColumn(java.lang.String name)
Get a ColumnMap for the named table. |
ColumnMap[] |
getColumns()
Get a ColumnMap[] of the columns in this table. |
DatabaseMap |
getDatabaseMap()
Get the DatabaseMap containing this TableMap. |
IdGenerator |
getIdGenerator()
Get the value of idGenerator. |
java.lang.String |
getName()
Get the name of the Table. |
java.lang.String |
getPrefix()
Get table prefix name. |
java.lang.String |
getPrimaryKeyMethod()
Get the method used to generate primary keys for this table. |
java.lang.Object |
getPrimaryKeyMethodInfo()
Get the information used to generate a primary key |
java.lang.Object |
getSequenceInfo()
Get the information used to generate a primary key using a sequence. |
private boolean |
hasPrefix(java.lang.String data)
Tell me if i have PREFIX in my string. |
private java.lang.String |
removePrefix(java.lang.String data)
Removes the PREFIX. |
java.lang.String |
removeUnderScores(java.lang.String data)
Removes the PREFIX, removes the underscores and makes first letter caps. |
void |
setPrefix(java.lang.String prefix)
Set table prefix name. |
void |
setPrimaryKeyMethod(java.lang.String method)
Sets the method used to generate a key for this table. |
void |
setPrimaryKeyMethodInfo(java.lang.Object pkInfo)
Sets the pk information needed to generate a key |
void |
setSequenceInfo(java.lang.Object pkInfo)
Sets the sequence information needed to generate a key |
Methods inherited from class java.lang.Object |
|
Field Detail |
public static final java.lang.String AUTOINCREMENT
public static final java.lang.String SEQUENCE
public static final java.lang.String IDBROKERTABLE
public static final java.lang.String NONE
private java.util.Hashtable columns
private DatabaseMap dbMap
private java.lang.String tableName
private java.lang.String prefix
private java.lang.String primaryKeyMethod
private IdGenerator idGenerator
private java.lang.Object pkInfo
Constructor Detail |
public TableMap(java.lang.String tableName, int numberOfColumns, DatabaseMap containingDB)
tableName
- The name of the table.numberOfColumns
- The number of columns in the table.containingDB
- A DatabaseMap that this table belongs to.public TableMap(java.lang.String tableName, DatabaseMap containingDB)
tableName
- The name of the table.containingDB
- A DatabaseMap that this table belongs to.public TableMap(java.lang.String tableName, java.lang.String prefix, DatabaseMap containingDB)
tableName
- The name of the table.prefix
- The prefix for the table name (ie: SCARAB for
SCARAB_PROJECT).containingDB
- A DatabaseMap that this table belongs to.Method Detail |
public boolean containsColumn(ColumnMap column)
column
- A ColumnMap.public boolean containsColumn(java.lang.String name)
name
- A String with the name of the column.public DatabaseMap getDatabaseMap()
public boolean containsObjectColumn()
public java.lang.String getName()
public java.lang.String getPrefix()
public void setPrefix(java.lang.String prefix)
prefix
- The prefix for the table name (ie: SCARAB for
SCARAB_PROJECT).public java.lang.String getPrimaryKeyMethod()
public IdGenerator getIdGenerator()
public java.lang.Object getPrimaryKeyMethodInfo()
public java.lang.Object getSequenceInfo()
public ColumnMap[] getColumns()
public ColumnMap getColumn(java.lang.String name)
name
- A String with the name of the table.public void addColumn(ColumnMap cmap)
cmap
- A ColumnMap.public void addColumn(java.lang.String columnName, java.lang.Object type)
columnName
- A String with the column name.type
- An Object specifying the type.public void addColumn(java.lang.String columnName, java.lang.Object type, int size)
columnName
- A String with the column name.type
- An Object specifying the type.size
- An int specifying the size.public void addPrimaryKey(java.lang.String columnName, java.lang.Object type)
columnName
- A String with the column name.type
- An Object specifying the type.public void addPrimaryKey(java.lang.String columnName, java.lang.Object type, int size)
columnName
- A String with the column name.type
- An Object specifying the type.size
- An int specifying the size.public void addForeignKey(java.lang.String columnName, java.lang.Object type, java.lang.String fkTable, java.lang.String fkColumn)
columnName
- A String with the column name.type
- An Object specifying the type.fkTable
- A String with the foreign key table name.fkColumn
- A String with the foreign key column name.public void addForeignKey(java.lang.String columnName, java.lang.Object type, java.lang.String fkTable, java.lang.String fkColumn, int size)
columnName
- A String with the column name.type
- An Object specifying the type.fkTable
- A String with the foreign key table name.fkColumn
- A String with the foreign key column name.size
- An int specifying the size.public void addForeignPrimaryKey(java.lang.String columnName, java.lang.Object type, java.lang.String fkTable, java.lang.String fkColumn)
columnName
- A String with the column name.type
- An Object specifying the type.fkTable
- A String with the foreign key table name.fkColumn
- A String with the foreign key column name.public void addForeignPrimaryKey(java.lang.String columnName, java.lang.Object type, java.lang.String fkTable, java.lang.String fkColumn, int size)
columnName
- A String with the column name.type
- An Object specifying the type.fkTable
- A String with the foreign key table name.fkColumn
- A String with the foreign key column name.size
- An int specifying the size.private void addColumn(java.lang.String name, java.lang.Object type, boolean pk, java.lang.String fkTable, java.lang.String fkColumn, int size)
name
- A String with the column name.type
- An Object specifying the type.pk
- True if column is a primary key.fkTable
- A String with the foreign key table name.fkColumn
- A String with the foreign key column name.size
- An int specifying the size.public void setPrimaryKeyMethod(java.lang.String method)
method
- A String with the method name.public void setSequenceInfo(java.lang.Object pkInfo)
public void setPrimaryKeyMethodInfo(java.lang.Object pkInfo)
private final boolean hasPrefix(java.lang.String data)
data
- A String.private final java.lang.String removePrefix(java.lang.String data)
data
- A String.public final java.lang.String removeUnderScores(java.lang.String data)
data
- A String.private final java.lang.String firstLetterCaps(java.lang.String data)
data
- A String.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |