- All Superinterfaces:
ModelElement
- All Known Implementing Classes:
EntityImpl
The entity.
This is the top-level model element.
- Author:
- harald
-
Method Summary
Modifier and TypeMethodDescriptionGets all attributes including inherited and from sub entities.Gets all direct and indirect components of this entity.Gets the paths of composite relations to this entity.
Notice that this inludes paths to sub-entities and super-entities as well.Gets all including inherited and indexes from sub entities.Gets the relations from other entities referencing this entity or any sub-entity or super entity.Gets all relations including the inherited and the ones from the sub entities.Gets all sub entities.Gets a set of all entities that are associated to this entity.
The kind of association can be a relation, a foreign relation or some hierarchy dependency or a combination of.getAttributeByColumnName(String columnName, boolean all) Gets an attribute by its database column name.getAttributeByJavaName(String javaName, boolean all) Gets an attribute by its java name.Gets the attributes.Gets the attributes including the inherited ones.Gets the attributes including the ones from the sub entities.intGets the unique id of this entity.
A sort of class-ID that is used to map from a small number to a class or classname.Gets the direct components of this entity.Gets the direct and inherited components of this entity.Gets the paths of composite relations to this entity.
Notice that this inludes paths to sub-entities as well.Gets the attribute that holds the context id.Gets the deeply referenced components.
Will contain the relations to components whereisDeeplyReferenced()is true.Gets the deep references to this entity.Gets the deep references to components of this root entity.
Will contain all deep references to all components, not only the direct childs.Gets the table alias originally configured in the model.Gets the inheritance type of the hierarchy.
For leafs, which haveInheritanceType.NONE, the type of the super entity is returned.Gets an index by its name.Gets the indexes.Gets all including inherited indexes.Gets all including indexes from sub entities.getInheritanceChain(Entity subEntity) Gets the inheritance chain from this entity down to given sub entity.Gets the inheritance type.Gets the inherited attributes.Gets inherited indexes.Gets the relations from other entities referencing any super-entity.Gets the inherited relations.Gets the referential integrity mode.Gets the list of non-abstract leaf sub entities.
If this entity is already non-abstract the list consists of this entity.Gets the attributes mapped by the persistence layer for this entity.Gets the options.Gets the relations from other entities directly referencing this entity.Gets the relations from other entities referencing this entity or any super-entity.Gets the relations from other entities referencing this entity or any sub-entity.getRelation(String name, boolean all) Gets a relation by its name.Gets the relations.getRelations(Entity entity, boolean all) Gets all relations for a given entity type.Gets all including inherited relations.Gets all relations including the ones from the sub entities.Returns the single root attribute if there is exactly one.Returns the attributes that corresponds to the root id.Returns the root entities.
Returns all roots, even abstract ones.Returns the single root entity if there is exactly one and it is not abstract.Gets the schema name.Gets the default sorting for this entity.Gets the direct sub entities.Gets the attributes from the sub entities.Gets indexes from sub entities.Gets the relations from other entities referencing any sub-entity.Gets the relations from the sub entities.Gets all super entities.Gets the super class entity if inherited.Gets the name of the super class entity.Gets the table alias for joined selects.
The alias is unique among all tables.Gets the attributes of the table mapped by this entity.Gets the indexes of the table mapped by this entity.Gets the database table name.
An optional schema may be prepended separated by a dot.Gets the tablename without the leading schema.Gets the entity that provides the database table.Gets the relations of the table mapped by this entity.Gets the top most entity of the inheritance tree.
Returns this entity if there is no inheritance.Gets the attributes describing the unique domain key.booleanReturns whether class may be instantiated.booleanReturns whether entity has composite relations.booleanReturns whether this entity or one of its components is deeply referenced.Returns the cascade-flag if it is the same for all composite relations.
If there are no composite relations at all, false is returned.booleanReturns whether this entity should provide a root class id according to model.booleanReturns whether this entity should provide a root id according to model.booleanReturns whether this is a root entity.
Inspects the super entities as well.booleanReturns whether this entity is a root-entity according to model.booleanReturns whether entity is the root of an inheritance hierarchy.booleanReturns whether entity is tracked.sqlCreateTable(Backend backend) Creates the table creation sql code.Methods inherited from interface org.tentackle.model.ModelElement
getName, getOrdinal, getParent, getSourceInfo
-
Method Details
-
getClassId
int getClassId()Gets the unique id of this entity.
A sort of class-ID that is used to map from a small number to a class or classname.- Returns:
- the entity class id
-
getTableName
String getTableName()Gets the database table name.
An optional schema may be prepended separated by a dot.Important: similar to the entity name, the table name must be unique among the whole model and all schemas. This restriction avoids unnecessary confusion and reduces the potential for errors in SQL statements.
- Returns:
- the tablename (always in lowercase), null if entity doesn't map to its own table
-
getSchemaName
String getSchemaName()Gets the schema name.- Returns:
- the schema (always in lowercase), null if default
-
getTableNameWithoutSchema
String getTableNameWithoutSchema()Gets the tablename without the leading schema.Important: similar to the entity name, the table name must be unique among the whole model and all schemas. This restriction avoids unnecessary confusion and reduces the potential for errors in SQL statements.
- Returns:
- the tablename relative to its schema (always in lowercase), null if entity doesn't map to its own table
-
getTableAlias
String getTableAlias()Gets the table alias for joined selects.
The alias is unique among all tables. If the model does not provide an alias, a unique alias will be generated.- Returns:
- the table alias
-
getDefinedTableAlias
String getDefinedTableAlias()Gets the table alias originally configured in the model.- Returns:
- the fixed alias, null if automatic
-
getIntegrity
Integrity getIntegrity()Gets the referential integrity mode.- Returns:
- the integrity mode
-
getOptions
EntityOptions getOptions()Gets the options.- Returns:
- the options
-
getAttributes
Gets the attributes.- Returns:
- the attributes
-
getInheritedAttributes
Gets the inherited attributes.- Returns:
- the attributes
-
getSubEntityAttributes
Gets the attributes from the sub entities.- Returns:
- the attributes
-
getAttributesIncludingInherited
Gets the attributes including the inherited ones.- Returns:
- the attributes
-
getAttributesIncludingSubEntities
Gets the attributes including the ones from the sub entities.- Returns:
- the attributes
-
getAllAttributes
Gets all attributes including inherited and from sub entities.- Returns:
- the attributes
-
getTableAttributes
Gets the attributes of the table mapped by this entity.- Returns:
- the attributes, empty if entity does not map to a table or does not provide attributes
-
getMappedAttributes
Gets the attributes mapped by the persistence layer for this entity.- Returns:
- the attributes
-
getAttributeByJavaName
Gets an attribute by its java name.- Parameters:
javaName- the java nameall- true if include inherited attributes- Returns:
- the attribute, null if no such attribute
-
getAttributeByColumnName
Gets an attribute by its database column name.Notice that upper/lowercase doesnt matter.
- Parameters:
columnName- the database column nameall- true if include inherited attributes- Returns:
- the attribute, null if no such attribute
-
getContextIdAttribute
Attribute getContextIdAttribute()Gets the attribute that holds the context id.- Returns:
- the context attribute, null if none
-
getUniqueDomainKey
Gets the attributes describing the unique domain key.- Returns:
- the udk attributes, empty if no udk
-
getSorting
List<AttributeSorting> getSorting()Gets the default sorting for this entity.- Returns:
- the sorting, null if unsorted by default
-
getRelations
Gets the relations.- Returns:
- the relations
-
getInheritedRelations
Gets the inherited relations.- Returns:
- the relations
-
getSubEntityRelations
Gets the relations from the sub entities.- Returns:
- the relations
-
getRelationsIncludingInherited
Gets all including inherited relations.- Returns:
- the relations
-
getRelationsIncludingSubEntities
Gets all relations including the ones from the sub entities.- Returns:
- the relations
-
getAllRelations
Gets all relations including the inherited and the ones from the sub entities.- Returns:
- the relations
-
getTableRelations
Gets the relations of the table mapped by this entity.- Returns:
- the relations, empty if entity does not map to a table or provides no relations
-
getRelation
Gets a relation by its name.- Parameters:
name- the relation's nameall- true if include inherited relations- Returns:
- the relation, null if no such relation
-
getRelations
Gets all relations for a given entity type.- Parameters:
entity- the entityall- true if include inherited relations- Returns:
- the relations, empty if no such relation
-
getReferencingRelations
Gets the relations from other entities directly referencing this entity.- Returns:
- the relations
-
getInheritedReferencingRelations
Gets the relations from other entities referencing any super-entity.- Returns:
- the relations
-
getSubEntityReferencingRelations
Gets the relations from other entities referencing any sub-entity.- Returns:
- the relations
-
getReferencingRelationsIncludingInherited
Gets the relations from other entities referencing this entity or any super-entity.- Returns:
- the relations
-
getReferencingRelationsIncludingSubEntities
Gets the relations from other entities referencing this entity or any sub-entity.- Returns:
- the relations
-
getAllReferencingRelations
Gets the relations from other entities referencing this entity or any sub-entity or super entity.- Returns:
- the relations
-
getIndexes
Gets the indexes.- Returns:
- the indexes
-
getInheritedIndexes
Gets inherited indexes.- Returns:
- the indexes
-
getSubEntityIndexes
Gets indexes from sub entities.- Returns:
- the indexes
-
getIndexesIncludingInherited
Gets all including inherited indexes.- Returns:
- the indexes
-
getIndexesIncludingSubEntities
Gets all including indexes from sub entities.- Returns:
- the indexes
-
getAllIndexes
Gets all including inherited and indexes from sub entities.- Returns:
- the indexes
-
getTableIndexes
Gets the indexes of the table mapped by this entity.- Returns:
- the indexes, empty if entity does not map to a table or provides no indexes
-
getIndex
Gets an index by its name.- Parameters:
name- the index nameall- true if include inherited indexes- Returns:
- the index, null if no such index
-
sqlCreateTable
Creates the table creation sql code.- Parameters:
backend- the backend to create sql code for- Returns:
- the SQL code
- Throws:
ModelException- if model inconsistent
-
isComposite
boolean isComposite()Returns whether entity has composite relations.- Returns:
- true if composite entity
-
isAbstract
boolean isAbstract()Returns whether class may be instantiated.- Returns:
- true if class is abstract
-
isTracked
boolean isTracked()Returns whether entity is tracked.- Returns:
- true if tracked
-
isDeletionCascaded
Boolean isDeletionCascaded()Returns the cascade-flag if it is the same for all composite relations.
If there are no composite relations at all, false is returned.- Returns:
- the cascade flag, null if mixed composite relations
-
getRootAttributes
Returns the attributes that corresponds to the root id.- Returns:
- the attributes, empty list if root id is provided separately or no root id at all
-
getRootAttribute
Attribute getRootAttribute()Returns the single root attribute if there is exactly one.- Returns:
- the attribute, null if none or more than one
-
getRootEntities
Returns the root entities.
Returns all roots, even abstract ones.- Returns:
- the root entities, empty list if rootclassid is provided separately or no rootclassid at all
-
getRootEntity
Entity getRootEntity()Returns the single root entity if there is exactly one and it is not abstract.- Returns:
- the root entity, null if none or abstract or more than one
-
isRootEntity
boolean isRootEntity()Returns whether this is a root entity.
Inspects the super entities as well.- Returns:
- true if root entity
-
isRootOfInheritanceHierarchy
boolean isRootOfInheritanceHierarchy()Returns whether entity is the root of an inheritance hierarchy.- Returns:
- true if root
-
getTableProvidingEntity
Entity getTableProvidingEntity()Gets the entity that provides the database table.- Returns:
- the table providing entity, null if entity is abstract and does not correspond to a single table
-
getInheritanceType
InheritanceType getInheritanceType()Gets the inheritance type.- Returns:
- the inheritance type
-
getHierarchyInheritanceType
InheritanceType getHierarchyInheritanceType()Gets the inheritance type of the hierarchy.
For leafs, which haveInheritanceType.NONE, the type of the super entity is returned.- Returns:
- the effective inheritance type
-
getSuperEntityName
String getSuperEntityName()Gets the name of the super class entity.- Returns:
- the super class name, null if not inherited
-
getSuperEntity
Entity getSuperEntity()Gets the super class entity if inherited.- Returns:
- the super entity, null if not inherited
-
getSuperEntities
Gets all super entities.- Returns:
- the path along up to the top super entity.
-
getTopSuperEntity
Entity getTopSuperEntity()Gets the top most entity of the inheritance tree.
Returns this entity if there is no inheritance.- Returns:
- the root of the inheritance hierarchy
-
getInheritanceChain
Gets the inheritance chain from this entity down to given sub entity.- Parameters:
subEntity- the sub entity- Returns:
- the chain starting with this entity end ending with the sub entity
- Throws:
ModelException- if subEntity does not inherit this entity
-
getSubEntities
Gets the direct sub entities.- Returns:
- the sub entities, empty list if no sub entities
-
getAllSubEntities
Gets all sub entities.- Returns:
- the sub entities, empty list if no sub entities
-
getLeafEntities
Gets the list of non-abstract leaf sub entities.
If this entity is already non-abstract the list consists of this entity.- Returns:
- the leafs
-
getAssociatedEntities
Gets a set of all entities that are associated to this entity.
The kind of association can be a relation, a foreign relation or some hierarchy dependency or a combination of.- Returns:
- the set of entities including me
-
getCompositePaths
Gets the paths of composite relations to this entity.
Notice that this inludes paths to sub-entities as well.- Returns:
- the paths, empty list if this is not a component of any other entity
-
getAllCompositePaths
Gets the paths of composite relations to this entity.
Notice that this inludes paths to sub-entities and super-entities as well.- Returns:
- the paths, empty list if this is not a component of any other entity
-
getComponents
Gets the direct components of this entity.- Returns:
- the components
-
getComponentsIncludingInherited
Gets the direct and inherited components of this entity.- Returns:
- the components
-
getAllComponents
Gets all direct and indirect components of this entity.- Returns:
- the components
-
isProvidingRootClassIdAccordingToModel
boolean isProvidingRootClassIdAccordingToModel()Returns whether this entity should provide a root class id according to model.- Returns:
- true if should provide a root class id
-
isProvidingRootIdAccordingToModel
boolean isProvidingRootIdAccordingToModel()Returns whether this entity should provide a root id according to model.- Returns:
- true if should provide a root id
-
isRootEntityAccordingToModel
boolean isRootEntityAccordingToModel()Returns whether this entity is a root-entity according to model.- Returns:
- true if root entity
-
getDeepReferences
Gets the deep references to this entity.- Returns:
- the deep references, empty if no deep references
-
isDeeplyReferenced
boolean isDeeplyReferenced()Returns whether this entity or one of its components is deeply referenced.- Returns:
- true if deeply referenced, false if not
-
getDeepReferencesToComponents
Gets the deep references to components of this root entity.
Will contain all deep references to all components, not only the direct childs.- Returns:
- the deep references, empty if this is not a root entity or there are no deep references
-
getDeeplyReferencedComponents
Gets the deeply referenced components.
Will contain the relations to components whereisDeeplyReferenced()is true.- Returns:
- the composite relations deeply referenced
-