org.jasig.portal.portlet.dao.trans
Class TransientPortletEntityDao

java.lang.Object
  extended by org.jasig.portal.portlet.dao.trans.TransientPortletEntityDao
All Implemented Interfaces:
IPortletEntityDao

public class TransientPortletEntityDao
extends Object
implements IPortletEntityDao

Handles entity management for transient portlets, portlets that aren't permanant parts of the user's layout. Portlet preferences are still persisted but are associated with a transient rendering of the portlet. Transient portlets are detected by checking the channel subscribe ID against the TransientUserLayoutManagerWrapper.SUBSCRIBE_PREFIX prefix.

Version:
$Revision: 19776 $
Author:
Eric Dalquist

Field Summary
protected  org.apache.commons.logging.Log logger
           
 
Constructor Summary
TransientPortletEntityDao()
           
 
Method Summary
 IPortletEntity createPortletEntity(IPortletDefinitionId portletDefinitionId, String channelSubscribeId, int userId)
          Creates, initializes and persists a new IPortletEntity based on the specified IPortletDefinitionId, channel subscribe id and user id.
 void deletePortletEntity(IPortletEntity portletEntity)
          Removes the specified IPortletEntity from the persistent store.
protected  String determineDatabaseChannelSubscribeId(String channelSubscribeId)
           
protected  String getDatabaseChannelSubscribeId(IPortletDefinitionId portletDefinitionId)
           
 IPortletEntityDao getDelegatePortletEntityDao()
           
 IPortalRequestUtils getPortalRequestUtils()
           
 IPortletDefinitionRegistry getPortletDefinitionRegistry()
           
 Set<IPortletEntity> getPortletEntities(IPortletDefinitionId portletDefinitionId)
          Get all IPortletEntitys based on the specified IPortletDefinitionId.
 Set<IPortletEntity> getPortletEntitiesForUser(int userId)
          Get all IPortletEntitys that exist for the specified user id.
 IPortletEntity getPortletEntity(IPortletEntityId portletEntityId)
          Get a IPortletEntity for the specified IPortletEntityId.
 IPortletEntity getPortletEntity(String channelSubscribeId, int userId)
          Get a IPortletEntity for the specified channel subscribe id and user id.
 IUserInstanceManager getUserInstanceManager()
           
protected  IUserLayoutManager getUserLayoutManager()
           
 void setDelegatePortletEntityDao(IPortletEntityDao delegatePortletEntityDao)
          The IPortletEntityDao to delegate calls to for actualy persistence
 void setPortalRequestUtils(IPortalRequestUtils portalRequestUtils)
          Used to get access to the current portal request
 void setPortletDefinitionRegistry(IPortletDefinitionRegistry portletDefinitionRegistry)
          Registry for looking up data related to portlet definitions
 void setUserInstanceManager(IUserInstanceManager userInstanceManager)
          Used to get access to the user's layout manager
protected  IPortletEntity unwrapEntity(IPortletEntity portletEntity)
          Returns the unwrapped entity if it is an instance of TransientPortletEntity.
 void updatePortletEntity(IPortletEntity portletEntity)
          Persists changes to a IPortletEntity.
protected  Set<IPortletEntity> wrapEntities(Set<IPortletEntity> portletEntities)
          Calles wrapEntity(IPortletEntity) on each entry in the Set, wrap calls that return null result in the entitiy being dropped from the returned Set
protected  IPortletEntity wrapEntity(IPortletEntity portletEntity)
          Adds a TransientPortletEntity wrapper to the portletEntity if it is needed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected final org.apache.commons.logging.Log logger
Constructor Detail

TransientPortletEntityDao

public TransientPortletEntityDao()
Method Detail

getDelegatePortletEntityDao

public IPortletEntityDao getDelegatePortletEntityDao()

setDelegatePortletEntityDao

public void setDelegatePortletEntityDao(IPortletEntityDao delegatePortletEntityDao)
The IPortletEntityDao to delegate calls to for actualy persistence


getPortletDefinitionRegistry

public IPortletDefinitionRegistry getPortletDefinitionRegistry()

setPortletDefinitionRegistry

public void setPortletDefinitionRegistry(IPortletDefinitionRegistry portletDefinitionRegistry)
Registry for looking up data related to portlet definitions


getUserInstanceManager

public IUserInstanceManager getUserInstanceManager()

setUserInstanceManager

public void setUserInstanceManager(IUserInstanceManager userInstanceManager)
Used to get access to the user's layout manager


getPortalRequestUtils

public IPortalRequestUtils getPortalRequestUtils()

setPortalRequestUtils

public void setPortalRequestUtils(IPortalRequestUtils portalRequestUtils)
Used to get access to the current portal request


createPortletEntity

public IPortletEntity createPortletEntity(IPortletDefinitionId portletDefinitionId,
                                          String channelSubscribeId,
                                          int userId)
Description copied from interface: IPortletEntityDao
Creates, initializes and persists a new IPortletEntity based on the specified IPortletDefinitionId, channel subscribe id and user id.

Specified by:
createPortletEntity in interface IPortletEntityDao
Parameters:
portletDefinitionId - The id of the IPortletDefinition that is the parent of the new entity
channelSubscribeId - The subscription id for the channel the entity is based on in the user's layout.
userId - The id of the user the entity is for.
Returns:
A newly created, initialized and persisted entity.

deletePortletEntity

public void deletePortletEntity(IPortletEntity portletEntity)
Description copied from interface: IPortletEntityDao
Removes the specified IPortletEntity from the persistent store.

Specified by:
deletePortletEntity in interface IPortletEntityDao
Parameters:
portletEntity - The entity to remove.

getPortletEntities

public Set<IPortletEntity> getPortletEntities(IPortletDefinitionId portletDefinitionId)
Description copied from interface: IPortletEntityDao
Get all IPortletEntitys based on the specified IPortletDefinitionId.

Specified by:
getPortletEntities in interface IPortletEntityDao
Parameters:
portletDefinitionId - The ID of the parent portlet definition
Returns:
A set of all entities based on the specified portlet definition id, will be empty if no entities exist for the id, will never be null.

getPortletEntitiesForUser

public Set<IPortletEntity> getPortletEntitiesForUser(int userId)
Description copied from interface: IPortletEntityDao
Get all IPortletEntitys that exist for the specified user id. (From IPerson.getID().

Specified by:
getPortletEntitiesForUser in interface IPortletEntityDao
Parameters:
userId - The id of the user to get the entities for.
Returns:
A set of all entities base on the specified user id, will be empty if no entities exist for the id, will never be null.

getPortletEntity

public IPortletEntity getPortletEntity(IPortletEntityId portletEntityId)
Description copied from interface: IPortletEntityDao
Get a IPortletEntity for the specified IPortletEntityId.

Specified by:
getPortletEntity in interface IPortletEntityDao
Parameters:
portletEntityId - The id to get the entity for.
Returns:
The portlet entity for the id, null if no entity exists for the id.

getPortletEntity

public IPortletEntity getPortletEntity(String channelSubscribeId,
                                       int userId)
Description copied from interface: IPortletEntityDao
Get a IPortletEntity for the specified channel subscribe id and user id.

Specified by:
getPortletEntity in interface IPortletEntityDao
Parameters:
channelSubscribeId - The channel subscription id from the user's layout to get the entity for
userId - The user id to get the entity for
Returns:
The portlet entity for the id, null if no entity exists for the ids.

updatePortletEntity

public void updatePortletEntity(IPortletEntity portletEntity)
Description copied from interface: IPortletEntityDao
Persists changes to a IPortletEntity.

Specified by:
updatePortletEntity in interface IPortletEntityDao
Parameters:
portletEntity - The portlet entity to store the changes for

unwrapEntity

protected IPortletEntity unwrapEntity(IPortletEntity portletEntity)
Returns the unwrapped entity if it is an instance of TransientPortletEntity. If not the original entity is returned.


wrapEntity

protected IPortletEntity wrapEntity(IPortletEntity portletEntity)
Adds a TransientPortletEntity wrapper to the portletEntity if it is needed. If the specified entity is transient but no transient subscribe id has been registered for it yet in the transientIdMap null is returned. If no wrapping is needed the original entity is returned.


wrapEntities

protected Set<IPortletEntity> wrapEntities(Set<IPortletEntity> portletEntities)
Calles wrapEntity(IPortletEntity) on each entry in the Set, wrap calls that return null result in the entitiy being dropped from the returned Set


determineDatabaseChannelSubscribeId

protected String determineDatabaseChannelSubscribeId(String channelSubscribeId)

getDatabaseChannelSubscribeId

protected String getDatabaseChannelSubscribeId(IPortletDefinitionId portletDefinitionId)

getUserLayoutManager

protected IUserLayoutManager getUserLayoutManager()


Copyright © 2010 Jasig. All Rights Reserved.