Class EntityDefinition

java.lang.Object
com.aquima.interactions.metamodel.impl.EntityDefinition
All Implemented Interfaces:
IEntityDefinition, Serializable

public class EntityDefinition extends Object implements IEntityDefinition
This class holds the static definition of an entity.
Since:
5.0
Author:
O. Kerpershoek
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    EntityDefinition(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 Type
    Method
    Description
    protected void
     
    protected void
     
    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.
    This method returns the unique identifier of the entity, consisting of the lowercased entity name.
    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
     
    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.
     
    boolean
    typeOf(String name)
    This method determines whether this instance is of the supplied type.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • EntityDefinition

      public EntityDefinition(IMetaModel metamodel, IEntityDS datasource)
      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

      protected void addSubType(IEntityDefinition entity)
    • addAttribute

      protected void addAttribute(AttributeDefinition attribute)
    • getId

      public String 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 interface IEntityDefinition
      Returns:
      the unique identifier of the entity.
    • getName

      public String getName()
      Description copied from interface: IEntityDefinition
      This method returns a unique identifier for this type of entity.
      Specified by:
      getName in interface IEntityDefinition
      Returns:
      String containing a unique identifier for this type of entity.
    • typeOf

      public boolean typeOf(String name)
      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 interface IEntityDefinition
      Parameters:
      name - String with the name of the entity type.
      Returns:
      true when this definition is of the specified type, false otherwise
    • getSuperType

      public IEntityDefinition 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 interface IEntityDefinition
      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 interface IEntityDefinition
      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 interface IEntityDefinition
      Returns:
      A boolean indicating if the entity definition is abstract.
    • getSingletonName

      public String 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 interface IEntityDefinition
      Returns:
      The name of the singleton of this entity.
    • getSubTypes

      public IEntityDefinition[] 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 interface IEntityDefinition
      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 interface IEntityDefinition
      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

      public boolean containsAttribute(String attributeName, boolean includeSuperTypes)
      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 interface IEntityDefinition
      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

      public IAttributeDefinition[] getAttributes(boolean includeSuperTypes)
      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 interface IEntityDefinition
      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

      public IAttributeDefinition getAttribute(String attributeName)
      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 interface IEntityDefinition
      Parameters:
      attributeName - The name of the attribute for which the definition should be returned.
      Returns:
      The attribute definition for supplied attribute name.
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object