Class EntityDefinition
java.lang.Object
com.aquima.interactions.metamodel.impl.EntityDefinition
- All Implemented Interfaces:
IEntityDefinition
,Serializable
This class holds the static definition of an entity.
- Since:
- 5.0
- Author:
- O. Kerpershoek
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionEntityDefinition
(IMetaModel metamodel, IEntityDS datasource) Constructs an entity definition using the (partially) initialized meta model and a data source providing the entity information. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addAttribute
(AttributeDefinition attribute) protected void
addSubType
(IEntityDefinition entity) boolean
containsAttribute
(String attributeName, boolean includeSuperTypes) This method checks if the entity definition contains an attribute with the specified name.boolean
getAttribute
(String attributeName) This method returns the attribute definition for the given attribute name.int
getAttributeCount
(boolean includeSuperTypes) This method returns the number of attributes that are defined in this entity.getAttributes
(boolean includeSuperTypes) This method returns an array containing the attribute definitions belonging to this entity definition.getId()
This method returns the unique identifier of the entity, consisting of the lowercased entity name.getName()
This method returns a unique identifier for this type of entity.This method return the default name of the singleton instance.This method will return an array of entity definitions of those entity types that are a direct descendant from this type.This method return the definition of the direct super type of this definition.int
hashCode()
boolean
This method returns a boolean indicating if the entity definition is abstract, and may only used as super type of other entity definitions.boolean
This method returns whether this type of entity may only exists once at runtime.toString()
boolean
This method determines whether this instance is of the supplied type.
-
Constructor Details
-
EntityDefinition
Constructs an entity definition using the (partially) initialized meta model and a data source providing the entity information. The meta model is used to lookup definition of other entities and attributes that are used by this entity. For example when this entity extends another entity, the base definition will be requested from the meta model.- Parameters:
metamodel
- The meta model definition the entity will be part of.datasource
- The data source providing the entity information.- Throws:
InitializationException
- This error is thrown when structural errors are encountered during initialization.
-
-
Method Details
-
addSubType
-
addAttribute
- Throws:
InitializationException
-
getId
Description copied from interface:IEntityDefinition
This method returns the unique identifier of the entity, consisting of the lowercased entity name.- Specified by:
getId
in interfaceIEntityDefinition
- Returns:
- the unique identifier of the entity.
-
getName
Description copied from interface:IEntityDefinition
This method returns a unique identifier for this type of entity.- Specified by:
getName
in interfaceIEntityDefinition
- Returns:
- String containing a unique identifier for this type of entity.
-
typeOf
Description copied from interface:IEntityDefinition
This method determines whether this instance is of the supplied type. The definition is considered of the same type when either the supplied type is exactly the same as the type of this definition, or when the supplied type matches the type of a parent definition.- Specified by:
typeOf
in interfaceIEntityDefinition
- Parameters:
name
- String with the name of the entity type.- Returns:
- true when this definition is of the specified type, false otherwise
-
getSuperType
Description copied from interface:IEntityDefinition
This method return the definition of the direct super type of this definition. When this definition is a top level entity which is not derived from a base type, this method will return a null value.- Specified by:
getSuperType
in interfaceIEntityDefinition
- Returns:
- Entity definition of the direct super type, or null when this is a top level entity.
-
isSingleton
public boolean isSingleton()Description copied from interface:IEntityDefinition
This method returns whether this type of entity may only exists once at runtime. A singleton instance will always get an id with value 0 (zero) and can be requested by using the getSingletonInstance method from the profile.- Specified by:
isSingleton
in interfaceIEntityDefinition
- Returns:
- boolean indicating if the entity type is defined as singleton.
-
isAbstract
public boolean isAbstract()Description copied from interface:IEntityDefinition
This method returns a boolean indicating if the entity definition is abstract, and may only used as super type of other entity definitions. Abstract entities can never be instantiated in the profile. If an entity is defined both abstract and singleton, the profile may hold multiple instances of this type, but each instance of an entity extending this abstract type must be a singleton.- Specified by:
isAbstract
in interfaceIEntityDefinition
- Returns:
- A boolean indicating if the entity definition is abstract.
-
getSingletonName
Description copied from interface:IEntityDefinition
This method return the default name of the singleton instance. The singleton name is only applicable when the entity is defined as singleton.- Specified by:
getSingletonName
in interfaceIEntityDefinition
- Returns:
- The name of the singleton of this entity.
-
getSubTypes
Description copied from interface:IEntityDefinition
This method will return an array of entity definitions of those entity types that are a direct descendant from this type. When there are no entity sub-types derived from this type, an empty array will be returned.- Specified by:
getSubTypes
in interfaceIEntityDefinition
- Returns:
- Array containing the definition of the direct descendants of this entity type.
-
getAttributeCount
public int getAttributeCount(boolean includeSuperTypes) Description copied from interface:IEntityDefinition
This method returns the number of attributes that are defined in this entity. Depending on the value of the includeSuperTypes parameter, this method will also count the number of attributes that are defined in the super types of this definition. When the includeSuperTypes has a value false this method will only return the number of attributes that are directly defined in this entity definition.- Specified by:
getAttributeCount
in interfaceIEntityDefinition
- Parameters:
includeSuperTypes
- Boolean indicating whether the super type(s) of this definition should also be counted.- Returns:
- The number of attributes that are present in the definition.
-
containsAttribute
Description copied from interface:IEntityDefinition
This method checks if the entity definition contains an attribute with the specified name. The attribute name is not case sensitive, and should not contain the entity name (no dotted notation allowed here). Depending on the value of includeSuperTypes this method will also check if the attribute is defined in a super type of this definition.- Specified by:
containsAttribute
in interfaceIEntityDefinition
- Parameters:
attributeName
- The name of the attribute.includeSuperTypes
- Boolean indicating whether the super type(s) of this definition should also be checked.- Returns:
- true if the entity definition contains the attribute, false otherwise.
-
getAttributes
Description copied from interface:IEntityDefinition
This method returns an array containing the attribute definitions belonging to this entity definition. If the entity definition does not contain any attributes, an empty array will be returned. Depending on the value of the includeSuperTypes parameter, also the attribute definitions of the super types will be returned.- Specified by:
getAttributes
in interfaceIEntityDefinition
- Parameters:
includeSuperTypes
- Boolean indicating whether the super type(s) of this definition should also be processed.- Returns:
- Array containing the attribute definition of this entity.
-
getAttribute
Description copied from interface:IEntityDefinition
This method returns the attribute definition for the given attribute name. The attribute name is not case sensitive, and should not contain the entity name (no dotted notation allowed here).- Specified by:
getAttribute
in interfaceIEntityDefinition
- Parameters:
attributeName
- The name of the attribute for which the definition should be returned.- Returns:
- The attribute definition for supplied attribute name.
- Throws:
UnknownAttributeException
- An unknown attribute exception is raised when the supplied name does not belong to an attribute of this entity definition.
-
equals
-
hashCode
public int hashCode() -
toString
-