Package ru.curs.celesta.score
Class Grain
java.lang.Object
ru.curs.celesta.score.NamedElement
ru.curs.celesta.score.Grain
Grain.
-
Field Summary
Fields inherited from class ru.curs.celesta.score.NamedElement
MAX_IDENTIFIER_LENGTH -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds an index.voidIndicates that the grain parsing is completed.getAfterSqlList(DBType dbType) getBeforeSqlList(DBType dbType) intReturns checksum of the script file that the grain was created from.intIf a grain has a higher number than the other grain then it means that it can depend from the first one.<T extends GrainElement>
TgetElement(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>
Map<String, T> getElements(Class<T> classOfElement) Returns a set of elements of specified type defined in the grain.Returns grain parts that this grain consists of.Returns a set of indices defined in the grain.intReturns length of the script file that the grain was created from.getMaterializedView(String name) Returns a materialized view by its name or an exception with a message that the view was not found.Returns a set of materialized views defined in the grain.Returns namespace of the grain.getParameterizedView(String name) Returns a parameterized view by its name or an exception with a message that the view was not found.Returns a set of parameterized views defined in the grain.getScore()Returns model that the grain belongs to.Returns a table by its name or an exception with a message that the table was not found.<T extends BasicTable>
TReturns a table by its name and a table class.Returns a set of tables defined in the grain.<T extends BasicTable>
Map<String, T> Returns a set of tables defined in the grain by a table class.Returns the grain version.Returns a view by its name or an exception with a message that the view was not found.getViews()Returns a set of views defined in the grain.booleanValuefalseindicates that grain was created with option WITH NO AUTOUPDATE, and won't be updated.booleanReturns a flag of grain modification (trueif parts of grain were modified in the runtime).booleanIndicates that the grain parsing from file is completed.voidsetAutoupdate(boolean autoupdate) Sets autoupdate option.voidsetNamespace(Namespace namespace) Sets namespace of the grain.voidsetVersion(String version) Sets the grain version.Methods inherited from class ru.curs.celesta.score.NamedElement
equals, getCelestaDoc, getName, getQuotedName, getQuotedNameIfNeeded, hashCode, limitName, limitName, setCelestaDoc
-
Constructor Details
-
Grain
- Throws:
ParseException
-
-
Method Details
-
getElements
Returns a set of elements of specified type defined in the grain.- Type Parameters:
T- class of element- Parameters:
classOfElement- class of elements from the set
-
getIndices
Returns a set of indices defined in the grain. -
getMaterializedViews
Returns a set of materialized views defined in the grain. -
getParameterizedViews
Returns a set of parameterized views defined in the grain. -
getTables
Returns a set of tables defined in the grain. -
getTables
Returns a set of tables defined in the grain by a table class.- Type Parameters:
T- table type (e.g. Table or ReadOnlyTable)- Parameters:
tableClass- Table class
-
getViews
Returns a set of views defined in the grain. -
getElement
public <T extends GrainElement> T getElement(String name, Class<T> classOfElement) throws ParseException Returns an element by its name and class or throws an exception with the message that element is not found.- Type Parameters:
T- class of element- Parameters:
name- element nameclassOfElement- element class- Throws:
ParseException- if element with such name and class is not found in the grain
-
addIndex
Adds an index.- Parameters:
index- new index of the grain.- Throws:
ParseException- In case if an index with the same name already exists.
-
getScore
Returns model that the grain belongs to. -
isAutoupdate
public boolean isAutoupdate()Valuefalseindicates that grain was created with option WITH NO AUTOUPDATE, and won't be updated. Default value istrue. -
setAutoupdate
public void setAutoupdate(boolean autoupdate) Sets autoupdate option. Default value istrue.- Parameters:
autoupdate- autoupdate flag
-
getVersion
Returns the grain version. -
setVersion
Sets the grain version.- Parameters:
version- Quoted-string. In course of processing single and double quotes are removed.- Throws:
ParseException- in case if format of quoted string is incorrect.
-
getLength
public int getLength()Returns length of the script file that the grain was created from. -
getChecksum
public int getChecksum()Returns checksum of the script file that the grain was created from. Coincidence of version, length and checksum is considered to be a sufficient solution for skipping the reading and update of the database structure. -
isParsingComplete
public boolean isParsingComplete()Indicates that the grain parsing from file is completed. -
getDependencyOrder
public int getDependencyOrder()If a grain has a higher number than the other grain then it means that it can depend from the first one. -
finalizeParsing
Indicates that the grain parsing is completed. A system method.- Throws:
ParseException- thrown when there are tables with illegal names.
-
isModified
public boolean isModified()Returns a flag of grain modification (trueif parts of grain were modified in the runtime). -
getView
Returns a view by its name or an exception with a message that the view was not found.- Parameters:
name- View name- Throws:
ParseException- If view with that name was not found in the grain.
-
getMaterializedView
Returns a materialized view by its name or an exception with a message that the view was not found.- Parameters:
name- Materialized view name- Throws:
ParseException- If materialized view with that name was not found in the grain.
-
getParameterizedView
Returns a parameterized view by its name or an exception with a message that the view was not found.- Parameters:
name- Parameterized view name- Throws:
ParseException- If parameterized view with that name was not found in the grain.
-
getTable
Returns a table by its name or an exception with a message that the table was not found.- Parameters:
name- Table name- Throws:
ParseException- If table with that name was not found in the grain.
-
getTable
Returns a table by its name and a table class.- Type Parameters:
T- table type (e.g. Table or ReadOnlyTable)- Parameters:
name- Table nametableClass- Table class- Throws:
ParseException- If table with that name was not found in the grain.
-
getBeforeSqlList
-
getAfterSqlList
-
getGrainParts
Returns grain parts that this grain consists of. -
getNamespace
Returns namespace of the grain. -
setNamespace
Sets namespace of the grain.- Parameters:
namespace- namespace
-