public final class Grain extends NamedElement
MAX_IDENTIFIER_LENGTH| Constructor and Description |
|---|
Grain(AbstractScore score,
String name) |
| Modifier and Type | Method and Description |
|---|---|
void |
addIndex(Index index)
Adds an index.
|
void |
finalizeParsing()
Indicates that the grain parsing is completed.
|
List<NativeSqlElement> |
getAfterSqlList(DBType dbType) |
List<NativeSqlElement> |
getBeforeSqlList(DBType dbType) |
int |
getChecksum()
Returns checksum of the script file that the grain was created from.
|
int |
getDependencyOrder()
If a grain has a higher number than the other grain then it means that it can depend from the first one.
|
<T extends GrainElement> |
getElement(String name,
Class<T> classOfElement)
Returns an element by its name and class or throws an exception with the message
that element is not found.
|
<T extends GrainElement> |
getElements(Class<T> classOfElement)
Returns a set of elements of specified type defined in the grain.
|
Set<GrainPart> |
getGrainParts()
Returns grain parts that this grain consists of.
|
Map<String,Index> |
getIndices()
Returns a set of indices defined in the grain.
|
int |
getLength()
Returns length of the script file that the grain was created from.
|
MaterializedView |
getMaterializedView(String name)
Returns a materialized view by its name or an exception with a message
that the view was not found.
|
Map<String,MaterializedView> |
getMaterializedViews()
Returns a set of materialized views defined in the grain.
|
Namespace |
getNamespace()
Returns namespace of the grain.
|
ParameterizedView |
getParameterizedView(String name)
Returns a parameterized view by its name or an exception with a message
that the view was not found.
|
Map<String,ParameterizedView> |
getParameterizedViews()
Returns a set of parameterized views defined in the grain.
|
AbstractScore |
getScore()
Returns model that the grain belongs to.
|
BasicTable |
getTable(String name)
Returns a table by its name or an exception with a message that the table was not found.
|
<T extends BasicTable> |
getTable(String name,
Class<T> tableClass)
Returns a table by its name and a table class.
|
Map<String,BasicTable> |
getTables()
Returns a set of tables defined in the grain.
|
<T extends BasicTable> |
getTables(Class<T> tableClass)
Returns a set of tables defined in the grain by a table class.
|
VersionString |
getVersion()
Returns the grain version.
|
View |
getView(String name)
Returns a view by its name or an exception with a message that the view was not found.
|
Map<String,View> |
getViews()
Returns a set of views defined in the grain.
|
boolean |
isAutoupdate()
Value
false indicates that grain was created with option WITH NO AUTOUPDATE,
and won't be updated. |
boolean |
isModified()
Returns a flag of grain modification (
true if parts of grain were modified in the runtime). |
boolean |
isParsingComplete()
Indicates that the grain parsing from file is completed.
|
void |
setAutoupdate(boolean isAutoupdate)
Sets autoupdate option.
|
void |
setNamespace(Namespace namespace)
Sets namespace of the grain.
|
void |
setVersion(String version)
Sets the grain version.
|
equals, getCelestaDoc, getName, getQuotedName, getQuotedNameIfNeeded, hashCode, limitName, limitName, setCelestaDocpublic Grain(AbstractScore score, String name) throws ParseException
ParseExceptionpublic <T extends GrainElement> Map<String,T> getElements(Class<T> classOfElement)
T - class of elementclassOfElement - class of elements from the setpublic Map<String,Index> getIndices()
public Map<String,MaterializedView> getMaterializedViews()
public Map<String,ParameterizedView> getParameterizedViews()
public Map<String,BasicTable> getTables()
public <T extends BasicTable> Map<String,T> getTables(Class<T> tableClass)
tableClass - Table classpublic <T extends GrainElement> T getElement(String name, Class<T> classOfElement) throws ParseException
T - class of elementname - element nameclassOfElement - element classParseException - if element with such name and class is not found in the grainpublic void addIndex(Index index) throws ParseException
index - new index of the grain.ParseException - In case if an index with the same name already exists.public AbstractScore getScore()
public boolean isAutoupdate()
false indicates that grain was created with option WITH NO AUTOUPDATE,
and won't be updated. Default value is true.public void setAutoupdate(boolean isAutoupdate)
true.isAutoupdate - autoupdate flagpublic VersionString getVersion()
public void setVersion(String version) throws ParseException
version - Quoted-string. In course of processing single and double quotes are removed.ParseException - in case if format of quoted string is incorrect.public int getLength()
public int getChecksum()
public boolean isParsingComplete()
public int getDependencyOrder()
public void finalizeParsing()
throws ParseException
ParseException - thrown when there are tables with illegal names.public boolean isModified()
true if parts of grain were modified in the runtime).public View getView(String name) throws ParseException
name - View nameParseException - If view with that name was not found in the grain.public MaterializedView getMaterializedView(String name) throws ParseException
name - Materialized view nameParseException - If materialized view with that name was not found in the grain.public ParameterizedView getParameterizedView(String name) throws ParseException
name - Parameterized view nameParseException - If parameterized view with that name was not found in the grain.public BasicTable getTable(String name) throws ParseException
name - Table nameParseException - If table with that name was not found in the grain.public <T extends BasicTable> T getTable(String name, Class<T> tableClass) throws ParseException
name - Table nametableClass - Table classParseException - If table with that name was not found in the grain.public List<NativeSqlElement> getBeforeSqlList(DBType dbType)
public List<NativeSqlElement> getAfterSqlList(DBType dbType)
public Set<GrainPart> getGrainParts()
public Namespace getNamespace()
public void setNamespace(Namespace namespace)
namespace - Copyright © 2020 CURS. All rights reserved.