- java.lang.Object
-
- org.tentackle.model.impl.EntityImpl
-
- All Implemented Interfaces:
java.lang.Comparable<EntityImpl>,Entity,ModelElement
public class EntityImpl extends java.lang.Object implements Entity, java.lang.Comparable<EntityImpl>
The entity model implementation.- Author:
- harald
-
-
Constructor Summary
Constructors Constructor Description EntityImpl(EntityFactoryImpl factory, SourceInfo sourceInfo)Creates an entity.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.util.List<Attribute>appendIdSerial(Entity entity, java.util.List<Attribute> attributes)Appends id and serial from another entity.protected voidcollectAssociatedEntities(java.util.Set<Entity> associates, Entity entity, java.util.Set<Entity> processedEntities)Recursively collects the associated entities for a given entity.protected voidcollectLeafEntities(java.util.List<Entity> leafs, Entity entity)Recursivly collects the leaf childs.protected voidcollectSubEntities(java.util.List<Entity> subEntities, Entity entity)Recursivly collects all sub entities.intcompareTo(EntityImpl o)booleanequals(java.lang.Object obj)java.util.List<Attribute>getAllAttributes()Gets all attributes including inherited and from sub entities.java.util.Set<Entity>getAllComponents()Gets all direct and indirect components of this entity.java.util.Set<java.util.List<Relation>>getAllCompositePaths()Gets the paths of composite relations to this entity.
Notice that this inludes paths to sub-entities and super-entities as well.java.util.List<Index>getAllIndexes()Gets all including inherited and indexes from sub entities.java.util.List<Relation>getAllReferencingRelations()Gets the relations from other entities referencing this entity or any sub-entity or super entity.java.util.List<Relation>getAllRelations()Gets all relations including the inherited and the ones from the sub entities.java.util.List<Entity>getAllSubEntities()Gets all sub entities.java.util.Set<Entity>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.AttributegetAttributeByColumnName(java.lang.String columnName, boolean all)Gets an attribute by its database column name.AttributegetAttributeByJavaName(java.lang.String javaName, boolean all)Gets an attribute by its java name.java.util.List<Attribute>getAttributes()Gets the attributes.java.util.List<Attribute>getAttributesIncludingInherited()Gets the attributes including the inherited ones.java.util.List<Attribute>getAttributesIncludingSubEntities()Gets the attributes including the ones from the sub entities.intgetClassId()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.java.util.Set<Entity>getComponents()Gets the direct components of this entity.java.util.Set<Entity>getComponentsIncludingInherited()Gets the direct and inherited components of this entity.java.util.Set<java.util.List<Relation>>getCompositePaths()Gets the paths of composite relations to this entity.
Notice that this inludes paths to sub-entities as well.AttributegetContextIdAttribute()Gets the attribute that holds the context id.java.util.List<Relation>getDeeplyReferencedComponents()Gets the deeply referenced components.
Will contain the relations to components whereEntity.isDeeplyReferenced()is true.java.util.List<Relation>getDeepReferences()Gets the deep references to this entity.java.util.List<Relation>getDeepReferencesToComponents()Gets the deep references to components of this root entity.
Will contain all deep references to all components, not only the direct childs.java.lang.StringgetDefinedTableAlias()Gets the table alias originally configured in the model.InheritanceTypegetHierarchyInheritanceType()Gets the inheritance type of the hierarchy.
For leafs, which haveInheritanceType.NONE, the type of the super entity is returned.IndexgetIndex(java.lang.String name, boolean all)Gets an index by its name.java.util.List<Index>getIndexes()Gets the indexes.java.util.List<Index>getIndexesIncludingInherited()Gets all including inherited indexes.java.util.List<Index>getIndexesIncludingSubEntities()Gets all including indexes from sub entities.java.util.List<Entity>getInheritanceChain(Entity childEntity)Gets the inheritance chain from this entity down to given sub entity.InheritanceTypegetInheritanceType()Gets the inheritance type.java.util.List<Attribute>getInheritedAttributes()Gets the inherited attributes.java.util.List<Index>getInheritedIndexes()Gets inherited indexes.java.util.List<Relation>getInheritedReferencingRelations()Gets the relations from other entities referencing any super-entity.java.util.List<Relation>getInheritedRelations()Gets the inherited relations.IntegritygetIntegrity()Gets the referential integrity mode.java.util.List<Entity>getLeafEntities()Gets the list of non-abstract leaf sub entities.
If this entity is already non-abstract the list consists of this entity.java.util.List<Attribute>getMappedAttributes()Gets the attributes mapped by the persistence layer for this entity.java.lang.StringgetName()Gets the name of the element.EntityOptionsImplgetOptions()Gets the options.intgetOrdinal()Gets the ordinal along the inheritance path.ModelElementgetParent()Gets the parent element.java.util.List<Relation>getReferencingRelations()Gets the relations from other entities directly referencing this entity.java.util.List<Relation>getReferencingRelationsIncludingInherited()Gets the relations from other entities referencing this entity or any super-entity.java.util.List<Relation>getReferencingRelationsIncludingSubEntities()Gets the relations from other entities referencing this entity or any sub-entity.RelationgetRelation(java.lang.String name, boolean all)Gets a relation by its name.java.util.List<Relation>getRelations()Gets the relations.java.util.List<Relation>getRelations(Entity entity, boolean all)Gets all relations for a given entity type.java.util.List<Relation>getRelationsIncludingInherited()Gets all including inherited relations.java.util.List<Relation>getRelationsIncludingSubEntities()Gets all relations including the ones from the sub entities.AttributegetRootAttribute()Returns the single root attribute if there is exactly one.java.util.Set<Attribute>getRootAttributes()Returns the attributes that corresponds to the root id.java.util.Set<Entity>getRootEntities()Returns the root entities.
Returns all roots, even abstract ones.EntitygetRootEntity()Returns the single root entity if there is exactly one and it is not abstract.java.lang.StringgetSchemaName()Gets the schema name.java.util.List<AttributeSorting>getSorting()Gets the default sorting for this entity.SourceInfogetSourceInfo()Gets the information about the source where this element is defined.java.util.List<Entity>getSubEntities()Gets the direct sub entities.java.util.List<Attribute>getSubEntityAttributes()Gets the attributes from the sub entities.java.util.List<Index>getSubEntityIndexes()Gets indexes from sub entities.java.util.List<Relation>getSubEntityReferencingRelations()Gets the relations from other entities referencing any sub-entity.java.util.List<Relation>getSubEntityRelations()Gets the relations from the sub entities.java.util.List<Entity>getSuperEntities()Gets all super entities.EntitygetSuperEntity()Gets the super class entity if inherited.java.lang.StringgetSuperEntityName()Gets the name of the super class entity.java.lang.StringgetTableAlias()Gets the table alias for joined selects.
The alias is unique among all tables.java.util.List<Attribute>getTableAttributes()Gets the attributes of the table mapped by this entity.java.util.List<Index>getTableIndexes()Gets the indexes of the table mapped by this entity.java.lang.StringgetTableName()Gets the database table name.
An optional schema may be prepended separated by a dot.java.lang.StringgetTableNameWithoutSchema()Gets the tablename without the leading schema.EntitygetTableProvidingEntity()Gets the entity that provides the database table.java.util.List<Relation>getTableRelations()Gets the relations of the table mapped by this entity.EntitygetTopSuperEntity()Gets the top most entity of the inheritance tree.
Returns this entity if there is no inheritance.java.util.List<Attribute>getUniqueDomainKey()Gets the attributes describing the unique domain key.protected voidgetUniqueDomainKeyImpl(java.util.List<Attribute> uniqueDomainKeys, Entity entity)Adds the unique domain keys recursively for given entity to the list.inthashCode()booleanisAbstract()Returns whether class may be instantiated.booleanisComposite()Returns whether entity has composite relations.booleanisDeeplyReferenced()Returns whether this entity or one of its components is deeply referenced.java.lang.BooleanisDeletionCascaded()Returns the cascade-flag if it is the same for all composite relations.
If there are no composite relations at all, false is returned.booleanisProvidingRootClassIdAccordingToModel()Returns whether this entity should provide a root class id according to model.booleanisProvidingRootIdAccordingToModel()Returns whether this entity should provide a root id according to model.booleanisRootEntity()Returns whether this is a root entity.
Inspects the super entities as well.booleanisRootEntityAccordingToModel()Returns whether this entity is a root-entity according to model.booleanisRootOfInheritanceHierarchy()Returns whether entity is the root of an inheritance hierarchy.booleanisTracked()Returns whether entity is tracked.protected java.util.List<Attribute>moveIdSerialToEnd(java.util.List<Attribute> attributes)Moved id and serial to the end of a new created attribute list.booleanparseConfiguration(ConfigurationLine line)Parses a configuration line.protected java.util.List<Attribute>removeIdSerial(java.util.List<Attribute> attributes)Removes id and serial from the list of attributes.voidsetClassId(int classId)Sets the entity id.voidsetContextIdAttribute(Attribute contextIdAttribute)Sets the context id attribute.voidsetDeeplyReferenced(boolean deeplyReferenced)voidsetDefinedTableAlias(java.lang.String definedTableAlias)Sets the table alias defined by the model specification.voidsetInheritanceType(InheritanceType inheritanceType)Sets the inheritance type.voidsetIntegrity(Integrity integrity)Sets the integrity.voidsetName(java.lang.String name)Sets the entity's name.voidsetOrdinal(int ordinal)voidsetProvidingRootClassIdAccordingToModel(boolean modelRootClassId)Sets whether this entity should provide a root class id according to model.voidsetProvidingRootIdAccordingToModel(boolean modelRootId)Sets whether this entity should provide a root id according to model.voidsetRootEntityAccordingToModel(boolean modelRoot)Sets whether this entity is a root-entity according to model.voidsetSorting(java.util.List<AttributeSorting> sorting)Sets the default sorting.voidsetSuperEntity(Entity superEntity)Sets the super entity.voidsetSuperEntityName(java.lang.String superEntityName)Sets the name of the super entity.voidsetTableAlias(java.lang.String tableAlias)Sets the table alias.voidsetTableName(java.lang.String tableName)Sets the tablename.java.lang.StringsqlCreateTable(org.tentackle.sql.Backend backend)Creates the table creation sql code.java.lang.StringtoString()voidvalidate()Validates the entity without relation dependent settings.voidvalidateRelated()Validates the relation dependent settings.
AssumesModelImpl.updateRelations(org.tentackle.model.ModelDefaults, org.tentackle.model.EntityAliases)applied successfully.
-
-
-
Constructor Detail
-
EntityImpl
public EntityImpl(EntityFactoryImpl factory, SourceInfo sourceInfo)
Creates an entity.- Parameters:
factory- the factory to create entity optionssourceInfo- the source information
-
-
Method Detail
-
getSourceInfo
public SourceInfo getSourceInfo()
Description copied from interface:ModelElementGets the information about the source where this element is defined.- Specified by:
getSourceInfoin interfaceModelElement- Returns:
- the source info
-
getParent
public ModelElement getParent()
Description copied from interface:ModelElementGets the parent element.- Specified by:
getParentin interfaceModelElement- Returns:
- the parent, null if none
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
compareTo
public int compareTo(EntityImpl o)
- Specified by:
compareToin interfacejava.lang.Comparable<EntityImpl>
-
parseConfiguration
public boolean parseConfiguration(ConfigurationLine line) throws ModelException
Parses a configuration line.- Parameters:
line- the configuation line- Returns:
- true if known configuration processed
- Throws:
ModelException- if parsing failed
-
getName
public java.lang.String getName()
Description copied from interface:ModelElementGets the name of the element.- Specified by:
getNamein interfaceModelElement- Returns:
- the name
-
setName
public void setName(java.lang.String name)
Sets the entity's name.- Parameters:
name- the name
-
getOrdinal
public int getOrdinal()
Description copied from interface:ModelElementGets the ordinal along the inheritance path.- Specified by:
getOrdinalin interfaceModelElement- Returns:
- the ordinal, starting at 0
-
setOrdinal
public void setOrdinal(int ordinal)
-
getClassId
public int getClassId()
Description copied from interface:EntityGets 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.- Specified by:
getClassIdin interfaceEntity- Returns:
- the entity class id
-
setClassId
public void setClassId(int classId)
Sets the entity id.- Parameters:
classId- the id
-
getTableName
public java.lang.String getTableName()
Description copied from interface:EntityGets the database table name.
An optional schema may be prepended separated by a dot.- Specified by:
getTableNamein interfaceEntity- Returns:
- the tablename (always in lowercase)
-
getSchemaName
public java.lang.String getSchemaName()
Description copied from interface:EntityGets the schema name.- Specified by:
getSchemaNamein interfaceEntity- Returns:
- the schema (always in lowercase), null if default
-
getTableNameWithoutSchema
public java.lang.String getTableNameWithoutSchema()
Description copied from interface:EntityGets the tablename without the leading schema.- Specified by:
getTableNameWithoutSchemain interfaceEntity- Returns:
- the tablename relative to its schema (always in lowercase)
-
getTableAlias
public java.lang.String getTableAlias()
Description copied from interface:EntityGets 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.- Specified by:
getTableAliasin interfaceEntity- Returns:
- the table alias
-
getDefinedTableAlias
public java.lang.String getDefinedTableAlias()
Description copied from interface:EntityGets the table alias originally configured in the model.- Specified by:
getDefinedTableAliasin interfaceEntity- Returns:
- the fixed alias, null if automatic
-
setTableName
public void setTableName(java.lang.String tableName)
Sets the tablename.- Parameters:
tableName- the tablename
-
setTableAlias
public void setTableAlias(java.lang.String tableAlias)
Sets the table alias.- Parameters:
tableAlias- the alias
-
setDefinedTableAlias
public void setDefinedTableAlias(java.lang.String definedTableAlias)
Sets the table alias defined by the model specification.- Parameters:
definedTableAlias- the original alias, null if automatic
-
getIntegrity
public Integrity getIntegrity()
Description copied from interface:EntityGets the referential integrity mode.- Specified by:
getIntegrityin interfaceEntity- Returns:
- the integrity mode
-
getInheritanceType
public InheritanceType getInheritanceType()
Description copied from interface:EntityGets the inheritance type.- Specified by:
getInheritanceTypein interfaceEntity- Returns:
- the inheritance type
-
getHierarchyInheritanceType
public InheritanceType getHierarchyInheritanceType()
Description copied from interface:EntityGets the inheritance type of the hierarchy.
For leafs, which haveInheritanceType.NONE, the type of the super entity is returned.- Specified by:
getHierarchyInheritanceTypein interfaceEntity- Returns:
- the effective inheritance type
-
getSuperEntityName
public java.lang.String getSuperEntityName()
Description copied from interface:EntityGets the name of the super class entity.- Specified by:
getSuperEntityNamein interfaceEntity- Returns:
- the super class name, null if not inherited
-
getSuperEntity
public Entity getSuperEntity()
Description copied from interface:EntityGets the super class entity if inherited.- Specified by:
getSuperEntityin interfaceEntity- Returns:
- the super entity, null if not inherited
-
getSuperEntities
public java.util.List<Entity> getSuperEntities()
Description copied from interface:EntityGets all super entities.- Specified by:
getSuperEntitiesin interfaceEntity- Returns:
- the path along up to the top super entity.
-
getTopSuperEntity
public Entity getTopSuperEntity()
Description copied from interface:EntityGets the top most entity of the inheritance tree.
Returns this entity if there is no inheritance.- Specified by:
getTopSuperEntityin interfaceEntity- Returns:
- the root of the inheritance hierarchy
-
getInheritanceChain
public java.util.List<Entity> getInheritanceChain(Entity childEntity) throws ModelException
Description copied from interface:EntityGets the inheritance chain from this entity down to given sub entity.- Specified by:
getInheritanceChainin interfaceEntity- Parameters:
childEntity- 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
public java.util.List<Entity> getSubEntities()
Description copied from interface:EntityGets the direct sub entities.- Specified by:
getSubEntitiesin interfaceEntity- Returns:
- the sub entities, empty list if no sub entities
-
getAllSubEntities
public java.util.List<Entity> getAllSubEntities()
Description copied from interface:EntityGets all sub entities.- Specified by:
getAllSubEntitiesin interfaceEntity- Returns:
- the sub entities, empty list if no sub entities
-
getLeafEntities
public java.util.List<Entity> getLeafEntities()
Description copied from interface:EntityGets the list of non-abstract leaf sub entities.
If this entity is already non-abstract the list consists of this entity.- Specified by:
getLeafEntitiesin interfaceEntity- Returns:
- the leafs
-
collectLeafEntities
protected void collectLeafEntities(java.util.List<Entity> leafs, Entity entity)
Recursivly collects the leaf childs.- Parameters:
leafs- the list if leafsentity- the current entity to analyze
-
collectSubEntities
protected void collectSubEntities(java.util.List<Entity> subEntities, Entity entity)
Recursivly collects all sub entities.- Parameters:
subEntities- the list of collected sub entitiesentity- the current entity to analyze
-
getAssociatedEntities
public java.util.Set<Entity> getAssociatedEntities()
Description copied from interface:EntityGets 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.- Specified by:
getAssociatedEntitiesin interfaceEntity- Returns:
- the set of entities including me
-
collectAssociatedEntities
protected void collectAssociatedEntities(java.util.Set<Entity> associates, Entity entity, java.util.Set<Entity> processedEntities)
Recursively collects the associated entities for a given entity.- Parameters:
associates- the set of associated entities so farentity- the current entity to analyzeprocessedEntities- the already processed entities (to avoid loops)
-
setIntegrity
public void setIntegrity(Integrity integrity)
Sets the integrity.- Parameters:
integrity- the integrity
-
setInheritanceType
public void setInheritanceType(InheritanceType inheritanceType)
Sets the inheritance type.- Parameters:
inheritanceType- the inheritance type
-
setSuperEntityName
public void setSuperEntityName(java.lang.String superEntityName)
Sets the name of the super entity.- Parameters:
superEntityName- the super entity
-
setSuperEntity
public void setSuperEntity(Entity superEntity)
Sets the super entity.- Parameters:
superEntity- the super entity
-
setContextIdAttribute
public void setContextIdAttribute(Attribute contextIdAttribute)
Sets the context id attribute.- Parameters:
contextIdAttribute- the attribute providing the context ID
-
setSorting
public void setSorting(java.util.List<AttributeSorting> sorting)
Sets the default sorting.- Parameters:
sorting- the sorting, null if none
-
getOptions
public EntityOptionsImpl getOptions()
Description copied from interface:EntityGets the options.- Specified by:
getOptionsin interfaceEntity- Returns:
- the options
-
getAttributes
public java.util.List<Attribute> getAttributes()
Description copied from interface:EntityGets the attributes.- Specified by:
getAttributesin interfaceEntity- Returns:
- the attributes
-
isRootEntityAccordingToModel
public boolean isRootEntityAccordingToModel()
Returns whether this entity is a root-entity according to model.- Specified by:
isRootEntityAccordingToModelin interfaceEntity- Returns:
- true if root entity
-
setRootEntityAccordingToModel
public void setRootEntityAccordingToModel(boolean modelRoot)
Sets whether this entity is a root-entity according to model.- Parameters:
modelRoot- true if root entity
-
isProvidingRootClassIdAccordingToModel
public boolean isProvidingRootClassIdAccordingToModel()
Returns whether this entity should provide a root class id according to model.- Specified by:
isProvidingRootClassIdAccordingToModelin interfaceEntity- Returns:
- true if should provide a root class id
-
setProvidingRootClassIdAccordingToModel
public void setProvidingRootClassIdAccordingToModel(boolean modelRootClassId)
Sets whether this entity should provide a root class id according to model.- Parameters:
modelRootClassId- true if should provide a root class id
-
isProvidingRootIdAccordingToModel
public boolean isProvidingRootIdAccordingToModel()
Returns whether this entity should provide a root id according to model.- Specified by:
isProvidingRootIdAccordingToModelin interfaceEntity- Returns:
- true if should provide a root id
-
setProvidingRootIdAccordingToModel
public void setProvidingRootIdAccordingToModel(boolean modelRootId)
Sets whether this entity should provide a root id according to model.- Parameters:
modelRootId- true if should provide a root id
-
getInheritedAttributes
public java.util.List<Attribute> getInheritedAttributes()
Description copied from interface:EntityGets the inherited attributes.- Specified by:
getInheritedAttributesin interfaceEntity- Returns:
- the attributes
-
getSubEntityAttributes
public java.util.List<Attribute> getSubEntityAttributes()
Description copied from interface:EntityGets the attributes from the sub entities.- Specified by:
getSubEntityAttributesin interfaceEntity- Returns:
- the attributes
-
getAttributesIncludingInherited
public java.util.List<Attribute> getAttributesIncludingInherited()
Description copied from interface:EntityGets the attributes including the inherited ones.- Specified by:
getAttributesIncludingInheritedin interfaceEntity- Returns:
- the attributes
-
getAttributesIncludingSubEntities
public java.util.List<Attribute> getAttributesIncludingSubEntities()
Description copied from interface:EntityGets the attributes including the ones from the sub entities.- Specified by:
getAttributesIncludingSubEntitiesin interfaceEntity- Returns:
- the attributes
-
getAllAttributes
public java.util.List<Attribute> getAllAttributes()
Description copied from interface:EntityGets all attributes including inherited and from sub entities.- Specified by:
getAllAttributesin interfaceEntity- Returns:
- the attributes
-
getTableAttributes
public java.util.List<Attribute> getTableAttributes()
Description copied from interface:EntityGets the attributes of the table mapped by this entity.- Specified by:
getTableAttributesin interfaceEntity- Returns:
- the attributes, empty if entity does not map to a table or does not provide attributes
-
getMappedAttributes
public java.util.List<Attribute> getMappedAttributes()
Description copied from interface:EntityGets the attributes mapped by the persistence layer for this entity.- Specified by:
getMappedAttributesin interfaceEntity- Returns:
- the attributes
-
moveIdSerialToEnd
protected java.util.List<Attribute> moveIdSerialToEnd(java.util.List<Attribute> attributes)
Moved id and serial to the end of a new created attribute list.- Parameters:
attributes- the attribute list- Returns:
- the new filtered attribute list
-
removeIdSerial
protected java.util.List<Attribute> removeIdSerial(java.util.List<Attribute> attributes)
Removes id and serial from the list of attributes.- Parameters:
attributes- the attribute list- Returns:
- the new filtered attribute list
-
appendIdSerial
protected java.util.List<Attribute> appendIdSerial(Entity entity, java.util.List<Attribute> attributes)
Appends id and serial from another entity.- Parameters:
entity- the entity defining id and serialattributes- the attribute list- Returns:
- the new filtered attribute list
-
getInheritedIndexes
public java.util.List<Index> getInheritedIndexes()
Description copied from interface:EntityGets inherited indexes.- Specified by:
getInheritedIndexesin interfaceEntity- Returns:
- the indexes
-
getIndexesIncludingInherited
public java.util.List<Index> getIndexesIncludingInherited()
Description copied from interface:EntityGets all including inherited indexes.- Specified by:
getIndexesIncludingInheritedin interfaceEntity- Returns:
- the indexes
-
getSubEntityIndexes
public java.util.List<Index> getSubEntityIndexes()
Description copied from interface:EntityGets indexes from sub entities.- Specified by:
getSubEntityIndexesin interfaceEntity- Returns:
- the indexes
-
getIndexesIncludingSubEntities
public java.util.List<Index> getIndexesIncludingSubEntities()
Description copied from interface:EntityGets all including indexes from sub entities.- Specified by:
getIndexesIncludingSubEntitiesin interfaceEntity- Returns:
- the indexes
-
getAllIndexes
public java.util.List<Index> getAllIndexes()
Description copied from interface:EntityGets all including inherited and indexes from sub entities.- Specified by:
getAllIndexesin interfaceEntity- Returns:
- the indexes
-
getTableIndexes
public java.util.List<Index> getTableIndexes()
Description copied from interface:EntityGets the indexes of the table mapped by this entity.- Specified by:
getTableIndexesin interfaceEntity- Returns:
- the indexes, empty if entity does not map to a table or provides no indexes
-
getInheritedRelations
public java.util.List<Relation> getInheritedRelations()
Description copied from interface:EntityGets the inherited relations.- Specified by:
getInheritedRelationsin interfaceEntity- Returns:
- the relations
-
getSubEntityRelations
public java.util.List<Relation> getSubEntityRelations()
Description copied from interface:EntityGets the relations from the sub entities.- Specified by:
getSubEntityRelationsin interfaceEntity- Returns:
- the relations
-
getRelationsIncludingInherited
public java.util.List<Relation> getRelationsIncludingInherited()
Description copied from interface:EntityGets all including inherited relations.- Specified by:
getRelationsIncludingInheritedin interfaceEntity- Returns:
- the relations
-
getRelationsIncludingSubEntities
public java.util.List<Relation> getRelationsIncludingSubEntities()
Description copied from interface:EntityGets all relations including the ones from the sub entities.- Specified by:
getRelationsIncludingSubEntitiesin interfaceEntity- Returns:
- the relations
-
getAllRelations
public java.util.List<Relation> getAllRelations()
Description copied from interface:EntityGets all relations including the inherited and the ones from the sub entities.- Specified by:
getAllRelationsin interfaceEntity- Returns:
- the relations
-
getTableRelations
public java.util.List<Relation> getTableRelations()
Description copied from interface:EntityGets the relations of the table mapped by this entity.- Specified by:
getTableRelationsin interfaceEntity- Returns:
- the relations, empty if entity does not map to a table or provides no relations
-
getCompositePaths
public java.util.Set<java.util.List<Relation>> getCompositePaths()
Description copied from interface:EntityGets the paths of composite relations to this entity.
Notice that this inludes paths to sub-entities as well.- Specified by:
getCompositePathsin interfaceEntity- Returns:
- the paths, empty list if this is not a component of any other entity
-
getAllCompositePaths
public java.util.Set<java.util.List<Relation>> getAllCompositePaths()
Description copied from interface:EntityGets the paths of composite relations to this entity.
Notice that this inludes paths to sub-entities and super-entities as well.- Specified by:
getAllCompositePathsin interfaceEntity- Returns:
- the paths, empty list if this is not a component of any other entity
-
getComponents
public java.util.Set<Entity> getComponents()
Description copied from interface:EntityGets the direct components of this entity.- Specified by:
getComponentsin interfaceEntity- Returns:
- the components
-
getComponentsIncludingInherited
public java.util.Set<Entity> getComponentsIncludingInherited()
Description copied from interface:EntityGets the direct and inherited components of this entity.- Specified by:
getComponentsIncludingInheritedin interfaceEntity- Returns:
- the components
-
getAllComponents
public java.util.Set<Entity> getAllComponents()
Description copied from interface:EntityGets all direct and indirect components of this entity.- Specified by:
getAllComponentsin interfaceEntity- Returns:
- the components
-
isDeeplyReferenced
public boolean isDeeplyReferenced()
Description copied from interface:EntityReturns whether this entity or one of its components is deeply referenced.- Specified by:
isDeeplyReferencedin interfaceEntity- Returns:
- true if deeply referenced, false if not
-
setDeeplyReferenced
public void setDeeplyReferenced(boolean deeplyReferenced)
-
getDeepReferences
public java.util.List<Relation> getDeepReferences()
Description copied from interface:EntityGets the deep references to this entity.- Specified by:
getDeepReferencesin interfaceEntity- Returns:
- the deep references, empty if no deep references
-
getDeepReferencesToComponents
public java.util.List<Relation> getDeepReferencesToComponents()
Description copied from interface:EntityGets the deep references to components of this root entity.
Will contain all deep references to all components, not only the direct childs.- Specified by:
getDeepReferencesToComponentsin interfaceEntity- Returns:
- the deep references, empty if this is not a root entity or there are no deep references
-
getDeeplyReferencedComponents
public java.util.List<Relation> getDeeplyReferencedComponents()
Description copied from interface:EntityGets the deeply referenced components.
Will contain the relations to components whereEntity.isDeeplyReferenced()is true.- Specified by:
getDeeplyReferencedComponentsin interfaceEntity- Returns:
- the composite relations deeply referenced
-
getAttributeByJavaName
public Attribute getAttributeByJavaName(java.lang.String javaName, boolean all)
Description copied from interface:EntityGets an attribute by its java name.- Specified by:
getAttributeByJavaNamein interfaceEntity- Parameters:
javaName- the java nameall- true if include inherited attributes- Returns:
- the attribute, null if no such attribute
-
getAttributeByColumnName
public Attribute getAttributeByColumnName(java.lang.String columnName, boolean all)
Description copied from interface:EntityGets an attribute by its database column name.Notice that upper/lowercase doesnt matter.
- Specified by:
getAttributeByColumnNamein interfaceEntity- Parameters:
columnName- the database column nameall- true if include inherited attributes- Returns:
- the attribute, null if no such attribute
-
getContextIdAttribute
public Attribute getContextIdAttribute()
Description copied from interface:EntityGets the attribute that holds the context id.- Specified by:
getContextIdAttributein interfaceEntity- Returns:
- the context attribute, null if none
-
getUniqueDomainKey
public java.util.List<Attribute> getUniqueDomainKey()
Description copied from interface:EntityGets the attributes describing the unique domain key.- Specified by:
getUniqueDomainKeyin interfaceEntity- Returns:
- the udk attributes, empty if no udk
-
getUniqueDomainKeyImpl
protected void getUniqueDomainKeyImpl(java.util.List<Attribute> uniqueDomainKeys, Entity entity)
Adds the unique domain keys recursively for given entity to the list.- Parameters:
uniqueDomainKeys- the unique domain key attributesentity- the entity to inspect
-
getSorting
public java.util.List<AttributeSorting> getSorting()
Description copied from interface:EntityGets the default sorting for this entity.- Specified by:
getSortingin interfaceEntity- Returns:
- the sorting, null if unsorted by default
-
getIndexes
public java.util.List<Index> getIndexes()
Description copied from interface:EntityGets the indexes.- Specified by:
getIndexesin interfaceEntity- Returns:
- the indexes
-
getIndex
public Index getIndex(java.lang.String name, boolean all)
Description copied from interface:EntityGets an index by its name.
-
getRelations
public java.util.List<Relation> getRelations()
Description copied from interface:EntityGets the relations.- Specified by:
getRelationsin interfaceEntity- Returns:
- the relations
-
getReferencingRelations
public java.util.List<Relation> getReferencingRelations()
Description copied from interface:EntityGets the relations from other entities directly referencing this entity.- Specified by:
getReferencingRelationsin interfaceEntity- Returns:
- the relations
-
getInheritedReferencingRelations
public java.util.List<Relation> getInheritedReferencingRelations()
Description copied from interface:EntityGets the relations from other entities referencing any super-entity.- Specified by:
getInheritedReferencingRelationsin interfaceEntity- Returns:
- the relations
-
getReferencingRelationsIncludingInherited
public java.util.List<Relation> getReferencingRelationsIncludingInherited()
Description copied from interface:EntityGets the relations from other entities referencing this entity or any super-entity.- Specified by:
getReferencingRelationsIncludingInheritedin interfaceEntity- Returns:
- the relations
-
getSubEntityReferencingRelations
public java.util.List<Relation> getSubEntityReferencingRelations()
Description copied from interface:EntityGets the relations from other entities referencing any sub-entity.- Specified by:
getSubEntityReferencingRelationsin interfaceEntity- Returns:
- the relations
-
getReferencingRelationsIncludingSubEntities
public java.util.List<Relation> getReferencingRelationsIncludingSubEntities()
Description copied from interface:EntityGets the relations from other entities referencing this entity or any sub-entity.- Specified by:
getReferencingRelationsIncludingSubEntitiesin interfaceEntity- Returns:
- the relations
-
getAllReferencingRelations
public java.util.List<Relation> getAllReferencingRelations()
Description copied from interface:EntityGets the relations from other entities referencing this entity or any sub-entity or super entity.- Specified by:
getAllReferencingRelationsin interfaceEntity- Returns:
- the relations
-
getRelation
public Relation getRelation(java.lang.String name, boolean all)
Description copied from interface:EntityGets a relation by its name.- Specified by:
getRelationin interfaceEntity- Parameters:
name- the relation's nameall- true if include inherited relations- Returns:
- the relation, null if no such relation
-
getRelations
public java.util.List<Relation> getRelations(Entity entity, boolean all)
Description copied from interface:EntityGets all relations for a given entity type.- Specified by:
getRelationsin interfaceEntity- Parameters:
entity- the entityall- true if include inherited relations- Returns:
- the relations, empty if no such relation
-
validate
public void validate() throws ModelExceptionValidates the entity without relation dependent settings.- Throws:
ModelException- if validation failed
-
validateRelated
public void validateRelated() throws ModelExceptionValidates the relation dependent settings.
AssumesModelImpl.updateRelations(org.tentackle.model.ModelDefaults, org.tentackle.model.EntityAliases)applied successfully.- Throws:
ModelException- if validation failed
-
sqlCreateTable
public java.lang.String sqlCreateTable(org.tentackle.sql.Backend backend) throws ModelExceptionDescription copied from interface:EntityCreates the table creation sql code.- Specified by:
sqlCreateTablein interfaceEntity- Parameters:
backend- the backend to create sql code for- Returns:
- the SQL code
- Throws:
ModelException- if model inconsistent
-
isComposite
public boolean isComposite()
Description copied from interface:EntityReturns whether entity has composite relations.- Specified by:
isCompositein interfaceEntity- Returns:
- true if composite entity
-
isAbstract
public boolean isAbstract()
Description copied from interface:EntityReturns whether class may be instantiated.- Specified by:
isAbstractin interfaceEntity- Returns:
- true if class is abstract
-
isTracked
public boolean isTracked()
Description copied from interface:EntityReturns whether entity is tracked.
-
isDeletionCascaded
public java.lang.Boolean isDeletionCascaded()
Description copied from interface:EntityReturns the cascade-flag if it is the same for all composite relations.
If there are no composite relations at all, false is returned.- Specified by:
isDeletionCascadedin interfaceEntity- Returns:
- the cascade flag, null if mixed composite relations
-
isRootOfInheritanceHierarchy
public boolean isRootOfInheritanceHierarchy()
Description copied from interface:EntityReturns whether entity is the root of an inheritance hierarchy.- Specified by:
isRootOfInheritanceHierarchyin interfaceEntity- Returns:
- true if root
-
getRootAttributes
public java.util.Set<Attribute> getRootAttributes()
Description copied from interface:EntityReturns the attributes that corresponds to the root id.- Specified by:
getRootAttributesin interfaceEntity- Returns:
- the attributes, empty list if root id is provided separately or no root id at all
-
getRootAttribute
public Attribute getRootAttribute()
Description copied from interface:EntityReturns the single root attribute if there is exactly one.- Specified by:
getRootAttributein interfaceEntity- Returns:
- the attribute, null if none or more than one
-
getRootEntities
public java.util.Set<Entity> getRootEntities()
Description copied from interface:EntityReturns the root entities.
Returns all roots, even abstract ones.- Specified by:
getRootEntitiesin interfaceEntity- Returns:
- the root entities, empty list if rootclassid is provided separately or no rootclassid at all
-
getRootEntity
public Entity getRootEntity()
Description copied from interface:EntityReturns the single root entity if there is exactly one and it is not abstract.- Specified by:
getRootEntityin interfaceEntity- Returns:
- the root entity, null if none or abstract or more than one
-
isRootEntity
public boolean isRootEntity()
Description copied from interface:EntityReturns whether this is a root entity.
Inspects the super entities as well.- Specified by:
isRootEntityin interfaceEntity- Returns:
- true if root entity
-
getTableProvidingEntity
public Entity getTableProvidingEntity()
Description copied from interface:EntityGets the entity that provides the database table.- Specified by:
getTableProvidingEntityin interfaceEntity- Returns:
- the table providing entity, null if entity is abstract and does not correspond to a single table
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-