Nuxeo ECM Projects 5.4.3-SNAPSHOT

org.nuxeo.ecm.core.storage.sql.jdbc.db
Class TableAlias

java.lang.Object
  extended by org.nuxeo.ecm.core.storage.sql.jdbc.db.TableAlias
All Implemented Interfaces:
Serializable, Table

public class TableAlias
extends Object
implements Table

An alias for an existing table. The returned columns are wrapped.

See Also:
Serialized Form

Constructor Summary
TableAlias(Table table, String alias)
          Creates a table as an alias for another one.
 
Method Summary
 Column addColumn(String name, ColumnType type, String key, Model model)
          Adds a Column to the table.
 void addFulltextIndex(String indexName, String... columnNames)
          Adds a named fulltext index on one or several columns.
 void addIndex(String... columnNames)
          Adds an index on one or several columns.
 String getAddColumnSql(Column column)
          Computes the SQL statement to alter a table and add a column to it.
 Column getColumn(String name)
           
 Collection<Column> getColumns()
           
 String getCreateSql()
          Computes the SQL statement to create the table.
 Dialect getDialect()
           
 String getDropSql()
          Computes the SQL statement to drop the table.
 String getKey()
           
 String getPhysicalName()
           
 List<String> getPostAddSqls(Column column, Model model)
          Computes the SQL statements to finish adding a column, usually some ALTER TABLE statements to add constraints or indexes.
 List<String> getPostCreateSqls(Model model)
          Computes the SQL statements to finish creating the table, usually some ALTER TABLE statements to add constraints or indexes.
 Column getPrimaryColumn()
           
 String getQuotedName()
           
 String getQuotedSuffixedName(String suffix)
           
 Table getRealTable()
           
 boolean hasFulltextIndex()
          Checks if the table has some fulltext indexes.
 boolean isAlias()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TableAlias

public TableAlias(Table table,
                  String alias)
Creates a table as an alias for another one.

Method Detail

isAlias

public boolean isAlias()
Specified by:
isAlias in interface Table

getRealTable

public Table getRealTable()
Specified by:
getRealTable in interface Table

getDialect

public Dialect getDialect()
Specified by:
getDialect in interface Table

getKey

public String getKey()
Specified by:
getKey in interface Table

getPhysicalName

public String getPhysicalName()
Specified by:
getPhysicalName in interface Table

getQuotedName

public String getQuotedName()
Specified by:
getQuotedName in interface Table

getQuotedSuffixedName

public String getQuotedSuffixedName(String suffix)
Specified by:
getQuotedSuffixedName in interface Table

toString

public String toString()
Overrides:
toString in class Object

getColumn

public Column getColumn(String name)
Specified by:
getColumn in interface Table

getPrimaryColumn

public Column getPrimaryColumn()
Specified by:
getPrimaryColumn in interface Table

getColumns

public Collection<Column> getColumns()
Specified by:
getColumns in interface Table

addColumn

public Column addColumn(String name,
                        ColumnType type,
                        String key,
                        Model model)
Description copied from interface: Table
Adds a Column to the table.

Specified by:
addColumn in interface Table

addIndex

public void addIndex(String... columnNames)
Description copied from interface: Table
Adds an index on one or several columns.

Specified by:
addIndex in interface Table
Parameters:
columnNames - the column names

addFulltextIndex

public void addFulltextIndex(String indexName,
                             String... columnNames)
Description copied from interface: Table
Adds a named fulltext index on one or several columns.

Specified by:
addFulltextIndex in interface Table
Parameters:
indexName - the index name
columnNames - the column names

hasFulltextIndex

public boolean hasFulltextIndex()
Description copied from interface: Table
Checks if the table has some fulltext indexes.

Specified by:
hasFulltextIndex in interface Table
Returns:
true if the table has some fulltext indexes

getCreateSql

public String getCreateSql()
Description copied from interface: Table
Computes the SQL statement to create the table.

Specified by:
getCreateSql in interface Table
Returns:
the SQL create string.

getAddColumnSql

public String getAddColumnSql(Column column)
Description copied from interface: Table
Computes the SQL statement to alter a table and add a column to it.

Specified by:
getAddColumnSql in interface Table
Parameters:
column - the column to add
Returns:
the SQL alter table string

getPostCreateSqls

public List<String> getPostCreateSqls(Model model)
Description copied from interface: Table
Computes the SQL statements to finish creating the table, usually some ALTER TABLE statements to add constraints or indexes.

Specified by:
getPostCreateSqls in interface Table
Returns:
the SQL strings

getPostAddSqls

public List<String> getPostAddSqls(Column column,
                                   Model model)
Description copied from interface: Table
Computes the SQL statements to finish adding a column, usually some ALTER TABLE statements to add constraints or indexes.

Specified by:
getPostAddSqls in interface Table
Returns:
the SQL strings

getDropSql

public String getDropSql()
Description copied from interface: Table
Computes the SQL statement to drop the table.

TODO drop constraints and indexes

Specified by:
getDropSql in interface Table
Returns:
the SQL drop string.

Nuxeo ECM Projects 5.4.3-SNAPSHOT

Copyright © 2011 Nuxeo SAS. All Rights Reserved.