org.qi4j.spi.entity
Interface EntityState

All Known Subinterfaces:
SQLEntityState
All Known Implementing Classes:
DefaultEntityState, GaeEntityState, JSONEntityState, NeoEntityState, SQLEntityState.DefaultSQLEntityState

public interface EntityState


Method Summary
 EntityDescriptor entityDescriptor()
           
 EntityReference getAssociation(QualifiedName stateName)
           
 ManyAssociationState getManyAssociation(QualifiedName stateName)
           
 Object getProperty(QualifiedName stateName)
           
 EntityReference identity()
          Returns the identity of the entity that this EntityState represents.
 boolean isOfType(TypeName type)
           
 long lastModified()
          Last modified timestamp of the entity.
 void remove()
          Remove the entity represented by this EntityState when the unit of work is completed.
 void setAssociation(QualifiedName stateName, EntityReference newEntity)
           
 void setProperty(QualifiedName stateName, Object json)
           
 EntityStatus status()
          The status of this EntityState
 String version()
          Version of the entity.
 

Method Detail

identity

EntityReference identity()
Returns the identity of the entity that this EntityState represents.

Returns:
the identity of the entity that this EntityState represents.

version

String version()
Version of the entity. This is managed by the EntityStore.

If the underlying EntityStore does not support versioning, then version must always be set to 0.

Returns:
version of the entity

lastModified

long lastModified()
Last modified timestamp of the entity. This is managed by the EntityStore.

If the underlying EntityStore does not support timestamping, then last modified must always be set to the current time.

Returns:
last modified timestamp of the entity, as defined by System.currentTimeMillis()

remove

void remove()
Remove the entity represented by this EntityState when the unit of work is completed.


status

EntityStatus status()
The status of this EntityState

Returns:
the status

isOfType

boolean isOfType(TypeName type)

entityDescriptor

EntityDescriptor entityDescriptor()

getProperty

Object getProperty(QualifiedName stateName)

setProperty

void setProperty(QualifiedName stateName,
                 Object json)

getAssociation

EntityReference getAssociation(QualifiedName stateName)

setAssociation

void setAssociation(QualifiedName stateName,
                    EntityReference newEntity)

getManyAssociation

ManyAssociationState getManyAssociation(QualifiedName stateName)