Interface Entity

All Superinterfaces:
Map<String,Object>

public interface Entity extends Map<String,Object>
An entity of a specific entity type as retrieved from a session. The current state of the entity is available by calling getState(). Attribute values can be requested by:
Since:
4.0.17
  • Method Details

    • getValue

      @ApiDoc(comment="Return the value of the attribute specified by the given name.", since="4.0.17") @Nullable @Nullable Object getValue(@NotNull @NotNull String name) throws ORException
      Return the value of the attribute specified by the given name. If no attribute exists with the given name then the returned value is null.
      Parameters:
      name - specifying the attribute to get the value for
      Returns:
      the value of the the attribute specified by the given name or null.
      Throws:
      ORException
      Since:
      4.0.17
    • getList

      @ApiDoc(comment=" Return the value of the specified list attribute (\"to N relation\").", since="4.0.55") @NotNull @NotNull List<Entity> getList(String name) throws ORException
      Return the value of the specified list attribute ("to N relation").
      Parameters:
      name - The name of the list attribute.
      Returns:
      The value of the attribute specified by name.
      Throws:
      IllegalArgumentException - if the attribut is no list attribute.
      ORException
      Since:
      4.0.55
    • getValue

      @ApiDoc(comment="Return the value of the given attribute or null.", since="4.0.17") @Nullable <T> T getValue(Attribute<T> attribute) throws ORException
      Return the value of the given attribute or null.
      Parameters:
      attribute - The attribute to get the value for.
      Returns:
      the value of the given attribute or null.
      Throws:
      ORException
      Since:
      4.0.17
    • setValue

      @ApiDoc(comment="Set the value of the attribute with name to the given value.", since="4.0.17") <T> void setValue(@NotNull @NotNull String name, @Nullable T value) throws ORException
      Set the value of the attribute with name to the given value.
      Parameters:
      name - The attribute name.
      value - The new value.
      Throws:
      IllegalArgumentException - Ifname denotes not a valid attribute or value is an incorrect type for this attribute
      ORException
      Since:
      4.0.17
    • setValue

      @ApiDoc(comment="Set the value of the attribute attribute to value.", since="4.0.17") <T> void setValue(@NotNull @NotNull Attribute<T> attribute, @Nullable T value) throws ORException
      Set the value of the attribute attribute to value.
      Throws:
      ORException
      Since:
      4.0.17
    • getEntityType

      @ApiDoc(comment="Return the type of this entity.", since="4.0.17") EntityType getEntityType()
      Return the type of this entity.
      Returns:
      The entity type of this entity.
      Since:
      4.0.17
    • getAttributeNames

      @ApiDoc(comment="Return a collection of the attributes declared for this entity.", since="4.0.17") Collection<String> getAttributeNames()
      Return a collection of the attributes declared for this entity. Shortcut for getEntityType().EntityType.getAttributeNames().
      Returns:
      List of valid attribute names.
      Since:
      4.0.17
    • isValid

      @ApiDoc(comment="Return true if this entity is valid else false.", since="4.0.17") boolean isValid() throws ORException
      Return true if this entity is valid else false. An entity is valid if and only if all values of its attributes are valid and itself is valid according to the assigned validator of its entity type.
      Returns:
      true if the entity is valid.
      Throws:
      ORException
      Since:
      4.0.17
    • refresh

      @ApiDoc(comment="Refresh the content of this entity with the one stored in the database.", since="4.0.24") void refresh() throws ORException
      Refresh the content of this entity with the one stored in the database.
      Throws:
      ORException
      Since:
      4.0.24
    • getIdentifier

      @ApiDoc(comment="Return the identifier of this entity.", since="4.0.17") Identifier getIdentifier()
      Return the identifier of this entity. In a temporal context an entity can have more than one version. All of the versions have the same KeyValue but each version must have an unique identifier which is used to retrieve the version from the database. In the temporal context the identifier is a composed primary key, it contains the key value of the entity and the system columns valid from, valid to, release to
      Returns:
      The identifier of this entity.
      Since:
      4.0.17
    • getGid

      @ApiDoc(comment="Returns the gid of this entity, if the session supports gids and the gid is already created, else null.", since="5.0.100") @Nullable @Nullable UUID getGid()
      Returns the gid of this entity, if the session supports gids and the gid is already created, else null.
      Attention: For newly created or modified legacy entities the gid first becomes available after calling Session.commit()
      Returns:
      The gid of this entity or null if not created yet or the session supports no gids.
      Since:
      5.0.100
    • getKeyValue

      @ApiDoc(comment="Return the business key of this entity or null if this entity is in state NEW.", since="4.0.17") @Nullable @Nullable KeyValue getKeyValue()
      Return the business key of this entity or null if this entity is in state NEW.
      Returns:
      The business key or null if the entity is new.
      Since:
      4.0.17
    • getState

      @ApiDoc(comment="Return the state of this entity.", since="4.0.17") @NotNull @NotNull Entity.PersistentState getState()
      Return the state of this entity.
      Returns:
      The state of this entity.
      Since:
      4.0.17
      See Also:
    • isReleased

      @ApiDoc(comment="Return true if this entity is released else false.", since="4.0.17") boolean isReleased()
      Return true if this entity is released else false. An entity is released if its release to value is equals to Long.MAX_VALUE. For non temporal data storage the returned value is always false.
      Returns:
      true if the the entity is released.
      Since:
      4.0.17
    • rollback

      @ApiDoc(comment="Revert all attribute changes.", since="4.0.17") void rollback()
      Revert all attribute changes.
      Since:
      4.0.17
      See Also:
    • rollbackWithRelations

      @ApiDoc(comment="Reset all changes, including relations (i.e. this may rollback delete operations of entities which has been set in relation to this entity).", since="4.0.416") void rollbackWithRelations()
      Reset all changes, including relations (i.e. this may rollback delete operations of entities which has been set in relation to this entity).
      Since:
      4.0.416
      See Also:
    • getSession

      @ApiDoc(comment="Returns the session which was used to create or retrieve this entity.", since="4.0.17") @NotNull @NotNull Session getSession()
      Returns the session which was used to create or retrieve this entity.
      Returns:
      The session instance used to create or retrieve this entity.
      Since:
      4.0.17
    • copy

      @ApiDoc(comment="Copies this entity.", since="4.0.55") Entity copy() throws ORException
      Copies this entity. This will create a shallow copy for related entities and a deep copy for aggregated entities. The returned entity will have the state Entity.PersistentState.NEW.
      Returns:
      A copy of this entity.
      Throws:
      ORException
      Since:
      4.0.55
    • copyFrom

      @ApiDoc(comment="Copy the values of the given entity to this entity.", since="4.0.17") void copyFrom(@NotNull @NotNull Entity entity) throws ORException
      Copy the values of the given entity to this entity. This will perform a shallow copy for related entities and a deep copy for aggregated entities.
      Parameters:
      entity - Entity to copy values from
      Throws:
      ORException
      Since:
      4.0.17