de.espirit.or.schema
Interface Entity

All Superinterfaces:
Map<String,Object>

public interface Entity
extends Map<String,Object>

Since:
4.0.17

Nested Class Summary
static class Entity.PersistentState
          Define all possible states of an entity.
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K,V>
 
Method Summary
 Entity copy()
          Copies this entity.
 void copyFrom(Entity entity)
          Copy the values of the given entity to this entity.
 Collection<String> getAttributeNames()
          Return a collection of the attributes declared for this entity.
 EntityType getEntityType()
          Return the type of this entity
 de.espirit.or.schema.Identifier getIdentifier()
          Return the identifier of this entity.
 KeyValue getKeyValue()
          Return the business key of this entity.
 List<Entity> getList(String name)
          Return the value of the attribute specified by the given name as list.
 Session getSession()
          Returns the session that owns this entity
 Entity.PersistentState getState()
          Return the state of this entity.
<T> T
getValue(Attribute<T> attribute)
          Return the value of the given attribute or null.
 Object getValue(String name)
          Return the value of the attribute specified by the given name.
 boolean isReleased()
          Return true if this entity is released else false.
 boolean isValid()
          Return true if this entity is valid else false.
 void refresh()
          Refresh the content of this entity with the one stored in the DB.
 void rollback()
          Reset all changes applied to this entity.
<T> void
setValue(Attribute<T> attribute, T value)
          Set the value of the attribute attribute to value.
<T> void
setValue(String name, T value)
          Set the value of the attribute name to value.
 
Methods inherited from interface java.util.Map
clear, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, size, values
 

Method Detail

getValue

@Nullable
Object getValue(String name)
                throws de.espirit.or.ORException
Return the value of the attribute specified by the given name. If no attribute exists with the given name then the returned 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:
de.espirit.or.ORException
Since:
4.0.17

getList

@NotNull
List<Entity> getList(String name)
                     throws de.espirit.or.ORException
Return the value of the attribute specified by the given name as list.

Parameters:
name - the name of the list attribut
Returns:
the value of the attribute specified by name as list if possible
Throws:
IllegalArgumentException - if the attribut specified by the given name is no list attribute
de.espirit.or.ORException
Since:
4.0.55

getValue

@Nullable
<T> T getValue(Attribute<T> attribute)
           throws de.espirit.or.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 (e.g. if entity is deleted)
Throws:
de.espirit.or.ORException
Since:
4.0.17

setValue

<T> void setValue(@NotNull
                  String name,
                  T value)
              throws de.espirit.or.ORException
Set the value of the attribute name to value.

Throws:
IllegalArgumentException - if name denotes not a valid attribute or value is an incorrect type for this attribute
de.espirit.or.ORException
Since:
4.0.17

setValue

<T> void setValue(@NotNull
                  Attribute<T> attribute,
                  T value)
              throws de.espirit.or.ORException
Set the value of the attribute attribute to value.

Throws:
de.espirit.or.ORException
Since:
4.0.17

getEntityType

EntityType getEntityType()
Return the type of this entity

Since:
4.0.17

getAttributeNames

Collection<String> getAttributeNames()
Return a collection of the attributes declared for this entity.

Since:
4.0.17

isValid

boolean isValid()
                throws de.espirit.or.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 in the EntityType.

Throws:
de.espirit.or.ORException
Since:
4.0.17

refresh

void refresh()
             throws de.espirit.or.ORException
Refresh the content of this entity with the one stored in the DB.

Throws:
de.espirit.or.ORException
Since:
4.0.24

getIdentifier

de.espirit.or.schema.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 following system columns: valid from, valid to, release to

Since:
4.0.17

getKeyValue

@Nullable
KeyValue getKeyValue()
Return the business key of this entity.

Since:
4.0.17

getState

Entity.PersistentState getState()
Return the state of this entity. @see PersistentState.

Since:
4.0.17

isReleased

boolean isReleased()
Return true if this entity is released else false. An entity is released if its release to value is equals Long.MAX_VALUE.

Since:
4.0.17

rollback

void rollback()
Reset all changes applied to this entity.

Since:
4.0.17

getSession

@NotNull
Session getSession()
Returns the session that owns this entity

Since:
4.0.17

copy

Entity copy()
            throws de.espirit.or.ORException
Copies this entity.

Throws:
de.espirit.or.ORException
Since:
4.0.55

copyFrom

void copyFrom(@NotNull
              Entity entity)
              throws de.espirit.or.ORException
Copy the values of the given entity to this entity. A deep copy is done if the attribute of the value is simple or it is aggregated by value else a shallow copy.

Throws:
de.espirit.or.ORException
Since:
4.0.17


Copyright © 2012 e-Spirit AG. All Rights Reserved. Build 4.2.480