org.spicefactory.pimento.service.impl
Class DefaultEntityManagerProxy

java.lang.Object
  extended by org.spicefactory.pimento.service.impl.DefaultEntityManagerProxy
All Implemented Interfaces:
EntityManagerProxy

public class DefaultEntityManagerProxy
extends Object
implements EntityManagerProxy

Default EntityManagerProxy implementation.

Author:
Jens Halm

Constructor Summary
DefaultEntityManagerProxy(PimentoConfig config)
          Creates a new instance using the specified configuration.
 
Method Summary
 Object executeQuery(DefaultQuery query)
          Executes the specified query and returns the result.
 Object initialize(int metadataId, Object primaryKey)
          Loads the entity with the specified primary key and the specified metadata id.
 Object initialize(int metadataId, Object primaryKey, PropertyMetadata property)
          Loads the collection property for the entity with the specified primary key and the specified metadata id.
 Object load(int metadataId, Object primaryKey)
          Loads the entity with the specified primary key and the specified metadata id.
 Collection<EntityMetadata> loadEntityMetadata()
          Loads the metadata for all managed persistent entities.
 void merge(Object entity)
          Merges the specified entity.
 void persist(Object entity)
          Persists the specified entity.
 Object refresh(int metadataId, Object primaryKey)
          Loads the entity with the specified primary key and the specified metadata id.
 void remove(int metadataId, Object primaryKey)
          Removes the entity with the specified primary key and the specified metadata id.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultEntityManagerProxy

public DefaultEntityManagerProxy(PimentoConfig config)
Creates a new instance using the specified configuration.

Parameters:
config - the Pimento configuration
Method Detail

loadEntityMetadata

public Collection<EntityMetadata> loadEntityMetadata()
Description copied from interface: EntityManagerProxy
Loads the metadata for all managed persistent entities.

This is an internal operation not exposed to the client-side EntityManager interface. It is always executed as the initial request for any client, since the clients need access to the metadata before they are able to perform other requests.

Specified by:
loadEntityMetadata in interface EntityManagerProxy
Returns:
the metadata for all managed persistent entities

executeQuery

public Object executeQuery(DefaultQuery query)
Description copied from interface: EntityManagerProxy
Executes the specified query and returns the result.

Specified by:
executeQuery in interface EntityManagerProxy
Parameters:
query - the query to execute
Returns:
the result of the query

load

public Object load(int metadataId,
                   Object primaryKey)
Description copied from interface: EntityManagerProxy
Loads the entity with the specified primary key and the specified metadata id.

Specified by:
load in interface EntityManagerProxy
Parameters:
metadataId - the metadata id of the entity
primaryKey - the primary key of the entity
Returns:
the entity with the specified primary key and the specified metadata id

refresh

public Object refresh(int metadataId,
                      Object primaryKey)
Description copied from interface: EntityManagerProxy
Loads the entity with the specified primary key and the specified metadata id.

Specified by:
refresh in interface EntityManagerProxy
Parameters:
metadataId - the metadata id of the entity
primaryKey - the primary key of the entity
Returns:
the entity with the specified primary key and the specified metadata id

initialize

public Object initialize(int metadataId,
                         Object primaryKey)
Description copied from interface: EntityManagerProxy
Loads the entity with the specified primary key and the specified metadata id.

Specified by:
initialize in interface EntityManagerProxy
Parameters:
metadataId - the metadata id of the entity
primaryKey - the primary key of the entity
Returns:
the entity with the specified primary key and the specified metadata id

initialize

public Object initialize(int metadataId,
                         Object primaryKey,
                         PropertyMetadata property)
Description copied from interface: EntityManagerProxy
Loads the collection property for the entity with the specified primary key and the specified metadata id.

Specified by:
initialize in interface EntityManagerProxy
Parameters:
metadataId - the metadata id of the owning entity
primaryKey - the primary key of the owning entity
property - the property that holds the collection to load
Returns:
the entity with the specified primary key and the specified metadata id

persist

public void persist(Object entity)
Description copied from interface: EntityManagerProxy
Persists the specified entity.

Specified by:
persist in interface EntityManagerProxy
Parameters:
entity - the entity to persist.

merge

public void merge(Object entity)
Description copied from interface: EntityManagerProxy
Merges the specified entity.

Specified by:
merge in interface EntityManagerProxy
Parameters:
entity - the entity to merge

remove

public void remove(int metadataId,
                   Object primaryKey)
Description copied from interface: EntityManagerProxy
Removes the entity with the specified primary key and the specified metadata id.

Specified by:
remove in interface EntityManagerProxy
Parameters:
metadataId - the metadata id of the entity to remove
primaryKey - the primary key of the entity to remove