org.jasig.portal.portlet.registry
Interface IPortletEntityRegistry

All Known Implementing Classes:
PortletEntityRegistryImpl

public interface IPortletEntityRegistry

Provides methods for creating and accessing IPortletEntity and related objects.

Version:
$Revision$
Author:
Eric Dalquist

Method Summary
 IPortletEntity createPortletEntity(IPortletDefinitionId portletDefinitionId, String channelSubscribeId, int userId)
          Creates a new, persisted, portlet entity for the published and subscribed to channel.
 void deletePortletEntity(IPortletEntity portletEntity)
          Removes a portlet entity and all related data from the persistent store.
 IPortletEntity getOrCreatePortletEntity(IPortletDefinitionId portletDefinitionId, String channelSubscribeId, int userId)
          Convience for getPortletEntity(String, int) and createPortletEntity(IPortletDefinitionId, String, int).
 IPortletDefinition getParentPortletDefinition(IPortletEntityId portletEntityId)
          Gets the parent portlet definition for the entity specified by the entity id.
 Set<IPortletEntity> getPortletEntitiesForUser(int userId)
          Get all IPortletEntitys that exist for the specified user id.
 IPortletEntity getPortletEntity(IPortletEntityId portletEntityId)
          Get an existing portlet entity for the entity id.
 IPortletEntity getPortletEntity(String portletEntityIdString)
          Get an existing portlet entity for the String version of the entity id.
 IPortletEntity getPortletEntity(String channelSubscribeId, int userId)
          Get an existing portlet entity for the channel subscribe id and person.
 void storePortletEntity(IPortletEntity portletEntity)
          Stores changes made to an existing portlet entity
 

Method Detail

getPortletEntity

IPortletEntity getPortletEntity(IPortletEntityId portletEntityId)
Get an existing portlet entity for the entity id. If no entity exists for the id null will be returned.

Parameters:
portletEntityId - The id of the entity to retrieve
Returns:
The portlet entity for the id, null if no entity exists for the id.
Throws:
IllegalArgumentException - If portletEntityId is null.

getPortletEntity

IPortletEntity getPortletEntity(String portletEntityIdString)
Get an existing portlet entity for the String version of the entity id. If an exception occurs while parsing the String into an IPortletEntityId an IllegalArgumentException will be thrown. If no entity exists for the id null will be returned.

Parameters:
portletEntityIdString - The id of the entity to retrieve
Returns:
The portlet entity for the id, null if no entity exists for the id.
Throws:
IllegalArgumentException - If portletEntityIdString is null or cannot be parsed into a IPortletEntityId.

getPortletEntity

IPortletEntity getPortletEntity(String channelSubscribeId,
                                int userId)
Get an existing portlet entity for the channel subscribe id and person. If no entity exists for the parameters null will be returned.

Parameters:
channelSubscribeId - The layout subscription id for the underlying channel.
userId - The if of the person the entity is for.
Returns:
The portlet entity for the subscribe id and person, null if no entity exists for the parameters.
Throws:
IllegalArgumentException - If channelSubscribeId is null.

createPortletEntity

IPortletEntity createPortletEntity(IPortletDefinitionId portletDefinitionId,
                                   String channelSubscribeId,
                                   int userId)
Creates a new, persisted, portlet entity for the published and subscribed to channel. If an existing IPortletDefinition can't be found for the portletDefinitionId or an entity already exists for the channel subscribe id and person an exception will be thrown.

Parameters:
portletDefinitionId - The definition id of the underlying IPortletDefinition
channelSubscribeId - The layout subscription id for the underlying channel.
userId - The id of the person the entity is for.
Returns:
A new entity for the parameters
Throws:
IllegalArgumentException - If portletDefinitionId or channelSubscribeId are null
DataIntegrityViolationException - If an entity already exists for the channel subscribe id and userId pair
DataRetrievalFailureException - If no IPortletDefinition exists for the specified IPortletDefinitionId

getOrCreatePortletEntity

IPortletEntity getOrCreatePortletEntity(IPortletDefinitionId portletDefinitionId,
                                        String channelSubscribeId,
                                        int userId)
Convience for getPortletEntity(String, int) and createPortletEntity(IPortletDefinitionId, String, int). If the get returns null the entity will be created and returned.

See Also:
getPortletEntity(String, int), createPortletEntity(IPortletDefinitionId, String, int)

storePortletEntity

void storePortletEntity(IPortletEntity portletEntity)
Stores changes made to an existing portlet entity

Parameters:
portletEntity - The entity to update the persistent store for
Throws:
IllegalArgumentException - if portletEntity is null

getPortletEntitiesForUser

Set<IPortletEntity> getPortletEntitiesForUser(int userId)
Get all IPortletEntitys that exist for the specified user id. (From IPerson.getID().

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.

deletePortletEntity

void deletePortletEntity(IPortletEntity portletEntity)
Removes a portlet entity and all related data from the persistent store.

Parameters:
portletEntity - The the entity to delete.
Throws:
IllegalArgumentException - if portletEntity is null

getParentPortletDefinition

IPortletDefinition getParentPortletDefinition(IPortletEntityId portletEntityId)
Gets the parent portlet definition for the entity specified by the entity id.

Parameters:
portletEntityId - The entity ID to get the parent definition for.
Returns:
The parent portlet definition for the entity, null if no entity exists for the id.
Throws:
IllegalArgumentException - if portletEntityId is null


Copyright © 2010 Jasig. All Rights Reserved.