org.qi4j.spi.entitystore
Class DefaultEntityStoreUnitOfWork

java.lang.Object
  extended by org.qi4j.spi.entitystore.DefaultEntityStoreUnitOfWork
All Implemented Interfaces:
EntityStoreUnitOfWork

public final class DefaultEntityStoreUnitOfWork
extends Object
implements EntityStoreUnitOfWork

JAVADOC


Constructor Summary
DefaultEntityStoreUnitOfWork(EntityStoreSPI entityStoreSPI, String identity, ModuleSPI module, Usecase usecase)
           
 
Method Summary
 StateCommitter applyChanges()
           
 void discard()
           
 EntityState getEntityState(EntityReference anIdentity)
          Get the EntityState for a given identity.
 String identity()
           
 ModuleSPI module()
           
 EntityState newEntityState(EntityReference anIdentity, EntityDescriptor descriptor)
          Create new EntityState for a given identity.
 void registerEntityState(EntityState state)
           
 Usecase usecase()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultEntityStoreUnitOfWork

public DefaultEntityStoreUnitOfWork(EntityStoreSPI entityStoreSPI,
                                    String identity,
                                    ModuleSPI module,
                                    Usecase usecase)
Method Detail

identity

public String identity()
Specified by:
identity in interface EntityStoreUnitOfWork

module

public ModuleSPI module()

newEntityState

public EntityState newEntityState(EntityReference anIdentity,
                                  EntityDescriptor descriptor)
                           throws EntityStoreException
Description copied from interface: EntityStoreUnitOfWork
Create new EntityState for a given identity.

This should only create the EntityState and not insert it into any database, since that should occur during the EntityStoreUnitOfWork.applyChanges() call.

Specified by:
newEntityState in interface EntityStoreUnitOfWork
Parameters:
anIdentity - the identity of the entity
descriptor - entity descriptor
Returns:
The new entity state.
Throws:
EntityStoreException - Thrown if creational fails.

getEntityState

public EntityState getEntityState(EntityReference anIdentity)
                           throws EntityStoreException,
                                  EntityNotFoundException
Description copied from interface: EntityStoreUnitOfWork
Get the EntityState for a given identity. Throws EntityNotFoundException if the entity with given anIdentity is not found.

Specified by:
getEntityState in interface EntityStoreUnitOfWork
Parameters:
anIdentity - The entity identity. This argument must not be null.
Returns:
Entity state given the composite descriptor and identity.
Throws:
EntityStoreException - thrown if retrieval failed.
EntityNotFoundException - if requested entity does not exist

applyChanges

public StateCommitter applyChanges()
                            throws EntityStoreException
Specified by:
applyChanges in interface EntityStoreUnitOfWork
Throws:
EntityStoreException

discard

public void discard()
Specified by:
discard in interface EntityStoreUnitOfWork

registerEntityState

public void registerEntityState(EntityState state)

usecase

public Usecase usecase()