public class IndexImpl extends Object implements Index
| Constructor and Description |
|---|
IndexImpl(EntityFactoryImpl factory,
Entity entity,
SourceInfo sourceInfo)
Creates an index.
|
| Modifier and Type | Method and Description |
|---|---|
String |
createDatabaseIndexName(Entity entity)
Creates the database index name for given entity.
|
ModelException |
createModelException(String message)
Creates a model exception.
|
List<IndexAttribute> |
getAttributes()
Gets the index attributes.
|
String |
getComment()
Gets the comment.
|
Entity |
getEntity()
Gets the entity this index belongs to.
|
String |
getFilterCondition()
Gets the optional filter condition.
|
String |
getName()
Gets the name of the element.
|
ModelElement |
getParent()
Gets the parent element.
|
SourceInfo |
getSourceInfo()
Gets the information about the source where this element is defined.
|
ConfigurationLine |
getSourceLine()
Gets the source line.
|
boolean |
isParsed()
Returns whether index is already parsed.
Indexes are parsed delayed because some attributes may be added later when the whole model is known. |
boolean |
isUnique()
Returns whether the index is unique.
|
void |
parse(Entity entity)
Parses a configuration line.
|
void |
setComment(String comment) |
void |
setFilterCondition(String filterCondition) |
void |
setName(String name) |
void |
setSourceLine(ConfigurationLine sourceLine)
Sets the source line.
|
void |
setUnique(boolean unique) |
String |
sqlCreateIndex(Backend backend,
Entity entity)
Creates the index creation sql code.
|
String |
toString() |
void |
validate()
Validates the index.
|
public IndexImpl(EntityFactoryImpl factory, Entity entity, SourceInfo sourceInfo)
factory - the factory to create indexesentity - the entity this index belongs tosourceInfo - the source infopublic Entity getEntity()
Indexpublic SourceInfo getSourceInfo()
ModelElementgetSourceInfo in interface ModelElementpublic ModelElement getParent()
ModelElementgetParent in interface ModelElementpublic void parse(Entity entity) throws ModelException
entity - the entityModelException - if parsing the model failedpublic String getName()
ModelElementgetName in interface ModelElementpublic String createDatabaseIndexName(Entity entity)
IndexcreateDatabaseIndexName in interface Indexentity - the entitypublic String getComment()
IndexgetComment in interface Indexpublic boolean isUnique()
Indexpublic String getFilterCondition()
IndexgetFilterCondition in interface Indexpublic List<IndexAttribute> getAttributes()
IndexgetAttributes in interface Indexpublic void setName(String name)
public void setComment(String comment)
public void setUnique(boolean unique)
public void setFilterCondition(String filterCondition)
public boolean isParsed()
public void validate()
throws ModelException
Indexvalidate in interface IndexModelException - if validation failedpublic ConfigurationLine getSourceLine()
public void setSourceLine(ConfigurationLine sourceLine)
sourceLine - the linepublic ModelException createModelException(String message)
Refers to the source line if set, otherwise just the message.
message - the messagepublic String sqlCreateIndex(Backend backend, Entity entity)
IndexsqlCreateIndex in interface Indexbackend - the backend to create sql code forentity - the entity to create the index forTentackle - a domain driven enterprise framework