Package ru.curs.celesta.score
Class MaterializedView
- java.lang.Object
-
- ru.curs.celesta.score.NamedElement
-
- ru.curs.celesta.score.GrainElement
-
- ru.curs.celesta.score.DataGrainElement
-
- ru.curs.celesta.score.AbstractView
-
- ru.curs.celesta.score.MaterializedView
-
- All Implemented Interfaces:
HasColumns
,TableElement
public final class MaterializedView extends AbstractView implements TableElement
Materialized view data element.- Since:
- 2017-06-08
- Author:
- ioann
-
-
Field Summary
Fields Modifier and Type Field Description static String
CHECKSUM_COMMENT_TEMPLATE
Checksum comment template.static String
SURROGATE_COUNT
System field name that contains result of COUNT().-
Fields inherited from class ru.curs.celesta.score.NamedElement
MAX_IDENTIFIER_LENGTH
-
Fields inherited from interface ru.curs.celesta.score.TableElement
YOU_CANNOT_DROP_A_COLUMN_THAT_BELONGS_TO
-
-
Constructor Summary
Constructors Constructor Description MaterializedView(GrainPart grainPart, String name)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addColumn(Column<?> column)
Adds a column to the table.String
getChecksum()
Column<?>
getColumn(String colName)
Returns a column by its name or throws an exception with a message that the column is not found.List<String>
getColumnRefNames()
Map<String,Column<?>>
getColumns()
Returns a map of columns of the view.String
getGroupByPartOfScript()
String
getPkConstraintName()
Returns PK constraint name.Map<String,Column<?>>
getPrimaryKey()
Returns unmodified map of primary key columns.TableRef
getRefTable()
String
getSelectPartOfScript()
IntegerColumn
getSurrogateCount()
String
getTriggerName(TriggerType type)
boolean
hasPrimeKey()
Whether the table has primary key.boolean
isGroupByColumn(String alias)
void
removeColumn(Column<?> column)
Removes a column from the table.-
Methods inherited from class ru.curs.celesta.score.AbstractView
getAggregateColumns, getColumnIndex, getColumnRef, getSegments, selectScript
-
Methods inherited from class ru.curs.celesta.score.DataGrainElement
delete
-
Methods inherited from class ru.curs.celesta.score.GrainElement
getGrain, getGrainPart
-
Methods inherited from class ru.curs.celesta.score.NamedElement
equals, getCelestaDoc, getName, getQuotedName, getQuotedNameIfNeeded, hashCode, limitName, limitName, setCelestaDoc
-
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface ru.curs.celesta.score.TableElement
getGrain, getName, getQuotedName, getQuotedNameIfNeeded
-
-
-
-
Field Detail
-
SURROGATE_COUNT
public static final String SURROGATE_COUNT
System field name that contains result of COUNT().- See Also:
- Constant Field Values
-
CHECKSUM_COMMENT_TEMPLATE
public static final String CHECKSUM_COMMENT_TEMPLATE
Checksum comment template.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
MaterializedView
public MaterializedView(GrainPart grainPart, String name) throws ParseException
- Throws:
ParseException
-
-
Method Detail
-
getSurrogateCount
public IntegerColumn getSurrogateCount()
-
getColumns
public Map<String,Column<?>> getColumns()
Description copied from class:AbstractView
Returns a map of columns of the view.- Specified by:
getColumns
in interfaceHasColumns
- Specified by:
getColumns
in interfaceTableElement
- Specified by:
getColumns
in classAbstractView
-
getColumn
public Column<?> getColumn(String colName) throws ParseException
Description copied from interface:TableElement
Returns a column by its name or throws an exception with a message that the column is not found.- Specified by:
getColumn
in interfaceTableElement
- Parameters:
colName
- column name- Returns:
- Throws:
ParseException
- if a column with the specified name is not found in the table
-
addColumn
public void addColumn(Column<?> column) throws ParseException
Description copied from interface:TableElement
Adds a column to the table.- Specified by:
addColumn
in interfaceTableElement
- Parameters:
column
- new column- Throws:
ParseException
- if the column couldn't be added
-
removeColumn
public void removeColumn(Column<?> column) throws ParseException
Description copied from interface:TableElement
Removes a column from the table.- Specified by:
removeColumn
in interfaceTableElement
- Parameters:
column
- existing column- Throws:
ParseException
- if the column couldn't be removed
-
hasPrimeKey
public boolean hasPrimeKey()
Description copied from interface:TableElement
Whether the table has primary key.- Specified by:
hasPrimeKey
in interfaceTableElement
- Returns:
-
getPkConstraintName
public String getPkConstraintName()
Description copied from interface:TableElement
Returns PK constraint name.- Specified by:
getPkConstraintName
in interfaceTableElement
- Returns:
-
getPrimaryKey
public Map<String,Column<?>> getPrimaryKey()
Description copied from interface:TableElement
Returns unmodified map of primary key columns.- Specified by:
getPrimaryKey
in interfaceTableElement
- Returns:
- map of column name -> column
-
getRefTable
public TableRef getRefTable()
-
isGroupByColumn
public boolean isGroupByColumn(String alias)
-
getSelectPartOfScript
public String getSelectPartOfScript()
-
getGroupByPartOfScript
public String getGroupByPartOfScript()
-
getChecksum
public String getChecksum()
-
getTriggerName
public String getTriggerName(TriggerType type)
-
-