|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object butler.util.BaseGroovyObjectSupport butler.sql.metadata.Table
public class Table
Represents a table in the database. This class should not be serialized.
Field Summary | |
---|---|
protected java.util.Map |
_fks
|
java.lang.String |
_name
|
static java.lang.String |
DUMMY
|
Constructor Summary | |
---|---|
Table(java.lang.String name)
|
|
Table(java.lang.String name,
Schema schema)
|
|
Table(java.lang.String name,
Schema schema,
boolean lazy)
|
|
Table(java.lang.String name,
Schema schema,
java.lang.String caption)
|
|
Table(java.lang.String name,
Schema schema,
java.lang.String caption,
boolean lazy)
|
Method Summary | |
---|---|
void |
addForeignKey(ForeignKey fk)
|
void |
addIndex(Index index)
Adds an index to this table. |
Record |
addRecord()
Creates a new empty record with the state NEW. |
void |
addRecordListener(RecordListener listener)
|
void |
addRelation(ManyToManyRelation relation)
|
Table |
copy()
Makes a deep copy of this table |
void |
create()
Creates the table in the database. |
Column |
createColumn(java.lang.String name,
Datatype datatype,
boolean primaryKey,
boolean nullable)
|
Column |
createColumn(java.lang.String name,
int type,
int size,
int decimals,
boolean primaryKey,
boolean nullable)
Creates a column to this table with the given name. |
Column |
createColumn(java.lang.String name,
int type,
int size,
int decimals,
boolean primaryKey,
boolean nullable,
Datatype datatype)
Creates a column to this table with the given name. |
Column |
createColumn(java.lang.String name,
java.lang.String datatype,
boolean primaryKey,
boolean nullable)
|
Column |
createColumn(java.lang.String name,
java.lang.String caption,
int type,
int size,
int decimals,
boolean primaryKey,
boolean nullable)
Creates a column to this table with the given name. |
Column |
createColumn(java.lang.String name,
java.lang.String caption,
int type,
int size,
int decimals,
boolean primaryKey,
boolean nullable,
Datatype datatype)
Creates a column to this table with the given name. |
DeleteQuery |
createDeleteQuery()
Creates a delete query with this table as the main table. |
Query |
createQuery()
Creates a query with this table as the main table. |
Record |
createRecord()
Creates a new empty record with the state NEW, and firing init event. |
void |
drop()
Drops the table in the database. |
boolean |
equals(java.lang.Object other)
|
boolean |
equals(Table other)
|
boolean |
exists()
|
RecordList |
findAll()
Returns all records in this table. |
Record |
findByPK(java.lang.Object value)
Returns the record with the given (single-column) primary key. |
Record |
findByPK(butler.util.Tuple pk)
Returns the record with the given (multi-column) primary key. |
Record |
findByPK0(butler.util.Tuple pk)
|
Record |
findByPKIfExists(java.lang.Object key)
Returns the record with the given primary key. |
Record |
findByPKIfExists(butler.util.Tuple key)
Returns the record with the given primary key. |
Authorizator |
getAuthorizator()
|
java.lang.String |
getCaption()
Returns the table caption, the name if no caption is given. |
Column |
getColumn(java.lang.String columnname)
Returns the column with the given name. |
java.util.List |
getColumns()
Returns all columns. |
Database |
getDatabase()
|
java.util.List |
getDataColumns()
Returns physical columns that are not in the primary key. |
java.util.List |
getExportedForeignKeys()
|
ForeignKey |
getForeignKey(java.lang.String name)
Returns the foreign key with the given name. |
ForeignKey |
getForeignKey(Table table)
Returns the foreign key that connects this table and the given table. |
java.util.Iterator |
getForeignKeyNames()
Deprecated. Use getForeignKeys() |
java.util.List |
getForeignKeys()
Returns the foreign keys for this table. |
java.util.List |
getImportedForeignKeys()
|
Index |
getIndex(java.lang.String name)
Returns the index with the given name. |
java.util.List |
getIndexes()
Returns all indexes for this table. |
butler.util.LocalizedText |
getLocalizedCaption()
|
java.util.List |
getLogicalColumns()
Returns logical columns. |
java.lang.String |
getName()
Returns the table name. |
java.lang.String |
getPath()
|
java.util.List |
getPhysicalColumns()
|
java.lang.String |
getPhysicalName()
|
java.util.List |
getPrimaryKeyColumns()
Returns the primary key columns. |
java.lang.Object |
getProperty(java.lang.String property)
|
java.lang.String |
getQualifiedName(java.sql.DatabaseMetaData metaData)
|
Query |
getQuery(java.lang.String name)
|
java.util.Comparator |
getRecordComparator()
|
java.util.Set |
getRecordListeners()
|
ManyToManyRelation |
getRelation(java.lang.String name)
|
Schema |
getSchema()
Returns the schema to which the table belongs. |
static Table |
getTable(org.dom4j.Element element)
|
static Table |
getTable(java.util.Map tableDictonary,
org.dom4j.Element element)
|
RecordValidator |
getValidator()
|
int |
hashCode()
|
java.lang.Object |
invokeMethod(java.lang.String name,
java.lang.Object args)
|
boolean |
isDummy()
|
protected void |
load()
|
protected void |
loadAll()
|
protected void |
loadFKs()
|
Record |
newRecord()
Creates a new empty record. |
void |
registerColumn(Column column)
|
void |
registerQuery(Query q)
|
void |
setAuthorizator(Authorizator auth)
|
void |
setRecordComparator(java.util.Comparator comp)
|
void |
setSchema(Schema schema)
Sets the schema to which to table belongs. |
void |
setValidator(RecordValidator validator)
|
void |
toXML(org.xml.sax.ContentHandler handler)
|
void |
unload(java.io.PrintStream stream)
|
void |
upgrade()
Creates the table, adds column, foreign keys and indexes if necessary. |
Methods inherited from class butler.util.BaseGroovyObjectSupport |
---|
getMetaClass, setMetaClass, setProperty |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String DUMMY
public java.lang.String _name
protected java.util.Map _fks
Constructor Detail |
---|
public Table(java.lang.String name)
public Table(java.lang.String name, Schema schema)
public Table(java.lang.String name, Schema schema, java.lang.String caption)
public Table(java.lang.String name, Schema schema, boolean lazy)
public Table(java.lang.String name, Schema schema, java.lang.String caption, boolean lazy)
Method Detail |
---|
public java.lang.String getName()
public java.lang.String getCaption() throws java.lang.Exception
java.lang.Exception
public butler.util.LocalizedText getLocalizedCaption() throws java.lang.Exception
java.lang.Exception
public Schema getSchema() throws java.lang.Exception
java.lang.Exception
public Database getDatabase() throws java.lang.Exception
java.lang.Exception
public void setSchema(Schema schema)
public ForeignKey getForeignKey(java.lang.String name) throws java.lang.Exception
java.lang.Exception
public void addForeignKey(ForeignKey fk) throws java.lang.Exception
java.lang.Exception
public void addRelation(ManyToManyRelation relation) throws java.lang.Exception
java.lang.Exception
public ManyToManyRelation getRelation(java.lang.String name)
public void setValidator(RecordValidator validator)
public RecordValidator getValidator()
public void setAuthorizator(Authorizator auth)
public Authorizator getAuthorizator()
public java.util.Iterator getForeignKeyNames() throws java.lang.Exception
java.lang.Exception
public java.util.List getForeignKeys() throws java.lang.Exception
java.lang.Exception
public java.util.List getImportedForeignKeys() throws java.lang.Exception
java.lang.Exception
public java.util.List getExportedForeignKeys() throws java.lang.Exception
java.lang.Exception
public Column getColumn(java.lang.String columnname) throws java.lang.Exception
java.lang.Exception
public java.util.List getColumns() throws java.lang.Exception
java.lang.Exception
public java.util.List getPhysicalColumns() throws java.lang.Exception
java.lang.Exception
public Column createColumn(java.lang.String name, int type, int size, int decimals, boolean primaryKey, boolean nullable) throws java.lang.Exception
java.lang.Exception
public Column createColumn(java.lang.String name, java.lang.String caption, int type, int size, int decimals, boolean primaryKey, boolean nullable) throws java.lang.Exception
java.lang.Exception
public Column createColumn(java.lang.String name, int type, int size, int decimals, boolean primaryKey, boolean nullable, Datatype datatype) throws java.lang.Exception
java.lang.Exception
public Column createColumn(java.lang.String name, java.lang.String caption, int type, int size, int decimals, boolean primaryKey, boolean nullable, Datatype datatype) throws java.lang.Exception
java.lang.Exception
public Column createColumn(java.lang.String name, Datatype datatype, boolean primaryKey, boolean nullable) throws java.lang.Exception
java.lang.Exception
public Column createColumn(java.lang.String name, java.lang.String datatype, boolean primaryKey, boolean nullable) throws java.lang.Exception
java.lang.Exception
public void registerColumn(Column column) throws java.lang.Exception
java.lang.Exception
public java.util.List getPrimaryKeyColumns() throws java.lang.Exception
java.lang.Exception
public java.util.List getDataColumns() throws java.lang.Exception
java.lang.Exception
public java.util.List getLogicalColumns() throws java.lang.Exception
java.lang.Exception
public java.util.List getIndexes() throws java.lang.Exception
java.lang.Exception
public Index getIndex(java.lang.String name) throws java.lang.Exception
java.lang.Exception
public void addIndex(Index index)
public Record findByPK(java.lang.Object value) throws java.lang.Exception
RecordNotFoundException
java.lang.Exception
public Record findByPK(butler.util.Tuple pk) throws java.lang.Exception
RecordNotFoundException
java.lang.Exception
public Record findByPKIfExists(butler.util.Tuple key) throws java.lang.Exception
java.lang.Exception
public Record findByPKIfExists(java.lang.Object key) throws java.lang.Exception
java.lang.Exception
public Record findByPK0(butler.util.Tuple pk) throws java.lang.Exception
java.lang.Exception
public RecordList findAll() throws java.lang.Exception
java.lang.Exception
public Query createQuery() throws java.lang.Exception
java.lang.Exception
public DeleteQuery createDeleteQuery() throws java.lang.Exception
java.lang.Exception
public void create() throws java.lang.Exception
java.lang.Exception
public void upgrade() throws java.lang.Exception
java.lang.Exception
public void drop() throws java.lang.Exception
java.lang.Exception
public Record addRecord() throws java.lang.Exception
java.lang.Exception
public Record createRecord() throws java.lang.Exception
java.lang.Exception
public Record newRecord() throws java.lang.Exception
java.lang.Exception
public void toXML(org.xml.sax.ContentHandler handler) throws java.lang.Exception
java.lang.Exception
protected void loadAll() throws java.lang.Exception
java.lang.Exception
protected void load() throws java.lang.Exception
java.lang.Exception
protected void loadFKs() throws java.lang.Exception
java.lang.Exception
public java.lang.String getQualifiedName(java.sql.DatabaseMetaData metaData) throws java.lang.Exception
java.lang.Exception
public boolean equals(Table other)
public boolean equals(java.lang.Object other)
equals
in class java.lang.Object
public void unload(java.io.PrintStream stream) throws java.lang.Exception
java.lang.Exception
public int hashCode()
hashCode
in class java.lang.Object
public ForeignKey getForeignKey(Table table) throws java.lang.Exception
java.lang.IllegalArgumentException
- Thrown if no or multiple foreign keys was found.
java.lang.Exception
public void addRecordListener(RecordListener listener)
public java.util.Set getRecordListeners()
public static Table getTable(org.dom4j.Element element) throws java.lang.Exception
java.lang.Exception
public boolean exists() throws java.lang.Exception
java.lang.Exception
public Table copy() throws java.lang.Exception
java.lang.Exception
public java.util.Comparator getRecordComparator()
public void setRecordComparator(java.util.Comparator comp)
public java.lang.String getPath()
public static Table getTable(java.util.Map tableDictonary, org.dom4j.Element element) throws java.lang.Exception
java.lang.Exception
public void registerQuery(Query q)
public Query getQuery(java.lang.String name)
public java.lang.Object getProperty(java.lang.String property)
getProperty
in interface groovy.lang.GroovyObject
getProperty
in class butler.util.BaseGroovyObjectSupport
public java.lang.Object invokeMethod(java.lang.String name, java.lang.Object args)
invokeMethod
in interface groovy.lang.GroovyObject
invokeMethod
in class butler.util.BaseGroovyObjectSupport
public java.lang.String getPhysicalName()
public boolean isDummy()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |