org.granite.tide.cdi.lazy
Class CDIInitializer

java.lang.Object
  extended by org.granite.tide.cdi.lazy.CDIInitializer
All Implemented Interfaces:
Serializable

@ConversationScoped
public class CDIInitializer
extends Object
implements Serializable

See Also:
Serialized Form

Constructor Summary
CDIInitializer()
           
 
Method Summary
 org.granite.tide.TidePersistenceManager getPersistenceManager()
          Try to determine what type of persistence the application is using.
 Object lazyInitialize(Object entity, String[] propertyNames)
          Initiliazes the property for the passed in entity.
 void restoreLoadedEntities()
           
 void saveLoadedEntities()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CDIInitializer

public CDIInitializer()
Method Detail

lazyInitialize

public Object lazyInitialize(Object entity,
                             String[] propertyNames)
Initiliazes the property for the passed in entity. It is attached to an associated context and then the property is accessed.

Returns:
Returns result from initializing the property.

getPersistenceManager

public org.granite.tide.TidePersistenceManager getPersistenceManager()
Try to determine what type of persistence the application is using. If the EntityManager is stored under entityManager or if the Hibernate session is stored under session. Then the context will be found and used. This is only called if a ITidePersistenceManager is not found, probably because the query was not run in a conversation.

Returns:
The appropriate manager for the persistence context being used, if it can be determined otherwise a null is returned.

restoreLoadedEntities

public void restoreLoadedEntities()

saveLoadedEntities

public void saveLoadedEntities()