org.qi4j.spi.entity
Interface EntityState

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

public interface EntityState

State holder for Entities.


Method Summary
 EntityReference associationValueOf(QualifiedName stateName)
           
 EntityDescriptor entityDescriptor()
           
 EntityReference identity()
          Returns the identity of the entity that this EntityState represents.
 boolean isAssignableTo(java.lang.Class<?> type)
           
 long lastModified()
          Last modified timestamp of the entity.
 ManyAssociationState manyAssociationValueOf(QualifiedName stateName)
           
 java.lang.Object propertyValueOf(QualifiedName stateName)
           
 void remove()
          Remove the entity represented by this EntityState when the unit of work is completed.
 void setAssociationValue(QualifiedName stateName, EntityReference newEntity)
           
 void setPropertyValue(QualifiedName stateName, java.lang.Object json)
           
 EntityStatus status()
          The status of this EntityState
 java.lang.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

java.lang.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

isAssignableTo

boolean isAssignableTo(java.lang.Class<?> type)

entityDescriptor

EntityDescriptor entityDescriptor()

propertyValueOf

java.lang.Object propertyValueOf(QualifiedName stateName)

setPropertyValue

void setPropertyValue(QualifiedName stateName,
                      java.lang.Object json)

associationValueOf

EntityReference associationValueOf(QualifiedName stateName)

setAssociationValue

void setAssociationValue(QualifiedName stateName,
                         EntityReference newEntity)

manyAssociationValueOf

ManyAssociationState manyAssociationValueOf(QualifiedName stateName)