org.jasig.portal
Class RDBMChannelRegistryStore

java.lang.Object
  extended by org.jasig.portal.RDBMChannelRegistryStore
All Implemented Interfaces:
IChannelRegistryStore

public class RDBMChannelRegistryStore
extends java.lang.Object
implements IChannelRegistryStore

Reference implementation of IChannelRegistryStore.

Version:
$Revision: 1.87.2.1 $
Author:
Ken Weiner, kweiner@unicon.net

Field Summary
protected static boolean localeAware
           
private static org.apache.commons.logging.Log log
           
 
Constructor Summary
RDBMChannelRegistryStore()
           
 
Method Summary
 void addCategoryToCategory(ChannelCategory child, ChannelCategory parent)
          Makes one category a child of another.
 void addChannelToCategory(ChannelDefinition channelDef, ChannelCategory category)
          Associates a channel definition with a category.
 void approveChannelDefinition(ChannelDefinition channelDef, IPerson approver, java.util.Date approveDate)
          Sets a channel definition as "approved".
 void deleteChannelCategory(ChannelCategory category)
          Deletes a channel category.
 void deleteChannelDefinition(ChannelDefinition channelDef)
          Permanently deletes a channel definition from the store.
 void deleteChannelType(ChannelType chanType)
          Deletes a channel type.
 void disapproveChannelDefinition(ChannelDefinition channelDef)
          Removes a channel from the channel registry by changing its status from "approved" to "unapproved".
 ChannelCategory getChannelCategory(java.lang.String channelCategoryId)
          Gets an existing channel category.
 ChannelDefinition getChannelDefinition(int channelPublishId)
          Get a channel definition.
 ChannelDefinition getChannelDefinition(java.lang.String channelFunctionalName)
          Get a channel definition.
 ChannelDefinition[] getChannelDefinitions()
          Get all channel definitions including ones that haven't been approved.
protected static java.sql.PreparedStatement getChannelMdataPstmt(java.sql.Connection con)
           
protected static java.sql.PreparedStatement getChannelParamPstmt(java.sql.Connection con)
           
protected static java.sql.PreparedStatement getChannelPstmt(java.sql.Connection con)
           
 ChannelType getChannelType(int channelTypeId)
          Get the channel type associated with a particular identifier.
 ChannelType[] getChannelTypes()
          Get channel types.
 ChannelCategory[] getChildCategories(ChannelCategory parent)
          Gets all child channel categories for a parent category.
 ChannelDefinition[] getChildChannels(ChannelCategory parent)
          Gets all child channel definitions for a parent category.
 ChannelCategory[] getParentCategories(ChannelCategory child)
          Gets the immediate parent categories of this category.
 ChannelCategory[] getParentCategories(ChannelDefinition child)
          Gets the immediate parent categories of this channel definition.
 ChannelCategory getTopLevelChannelCategory()
          Gets top level channel category
 ChannelCategory newChannelCategory()
          Creates a new channel category.
 ChannelCategory newChannelCategory(java.lang.String name, java.lang.String description, java.lang.String creatorId)
          Creates a new channel category with the specified values.
 ChannelDefinition newChannelDefinition()
          Create a new ChannelDefinition object.
 ChannelType newChannelType()
          Create a new ChannelType object.
 void removeCategoryFromCategory(ChannelCategory child, ChannelCategory parent)
          Makes one category a child of another.
 void removeChannelFromCategory(ChannelDefinition channelDef, ChannelCategory category)
          Disassociates a channel definition from a category.
 void saveChannelCategory(ChannelCategory category)
          Persists a channel category.
 void saveChannelDefinition(ChannelDefinition channelDef)
          Persists a channel definition.
 void saveChannelType(ChannelType chanType)
          Persists a channel type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static final org.apache.commons.logging.Log log

localeAware

protected static final boolean localeAware
Constructor Detail

RDBMChannelRegistryStore

public RDBMChannelRegistryStore()
Method Detail

newChannelType

public ChannelType newChannelType()
                           throws java.lang.Exception
Create a new ChannelType object.

Specified by:
newChannelType in interface IChannelRegistryStore
Returns:
channelType, the new channel type
Throws:
java.lang.Exception

getChannelType

public ChannelType getChannelType(int channelTypeId)
                           throws java.sql.SQLException
Get the channel type associated with a particular identifier.

Specified by:
getChannelType in interface IChannelRegistryStore
Parameters:
channelTypeId - the channel type identifier
Returns:
channelType the channel type
Throws:
java.sql.SQLException

getChannelTypes

public ChannelType[] getChannelTypes()
                              throws java.sql.SQLException
Get channel types.

Specified by:
getChannelTypes in interface IChannelRegistryStore
Returns:
types, the channel types
Throws:
java.sql.SQLException

saveChannelType

public void saveChannelType(ChannelType chanType)
                     throws java.sql.SQLException
Persists a channel type.

Specified by:
saveChannelType in interface IChannelRegistryStore
Parameters:
chanType - a channel type
Throws:
java.sql.SQLException

deleteChannelType

public void deleteChannelType(ChannelType chanType)
                       throws java.sql.SQLException
Deletes a channel type. The deletion will only succeed if no existing channels reference the channel type.

Specified by:
deleteChannelType in interface IChannelRegistryStore
Parameters:
chanType - a channel type
Throws:
java.sql.SQLException

newChannelDefinition

public ChannelDefinition newChannelDefinition()
                                       throws java.lang.Exception
Create a new ChannelDefinition object.

Specified by:
newChannelDefinition in interface IChannelRegistryStore
Returns:
channelDefinition, the new channel definition
Throws:
java.lang.Exception

getChannelDefinition

public ChannelDefinition getChannelDefinition(int channelPublishId)
                                       throws java.sql.SQLException
Get a channel definition.

Specified by:
getChannelDefinition in interface IChannelRegistryStore
Parameters:
channelPublishId - a channel publish ID
Returns:
channelDefinition, a definition of the channel or null if no matching channel definition can be found
Throws:
java.sql.SQLException

getChannelDefinition

public ChannelDefinition getChannelDefinition(java.lang.String channelFunctionalName)
                                       throws java.sql.SQLException
Get a channel definition. If there is more than one channel definition with the given functional name, then the one with the most recent approval date will be returned.

Specified by:
getChannelDefinition in interface IChannelRegistryStore
Parameters:
channelFunctionalName - a channel functional name
Returns:
channelDefinition, a definition of the channel or null if no matching channel definition can be found
Throws:
java.sql.SQLException

getChannelDefinitions

public ChannelDefinition[] getChannelDefinitions()
                                          throws java.sql.SQLException
Get all channel definitions including ones that haven't been approved.

Specified by:
getChannelDefinitions in interface IChannelRegistryStore
Returns:
channelDefs, the channel definitions
Throws:
java.sql.SQLException

saveChannelDefinition

public void saveChannelDefinition(ChannelDefinition channelDef)
                           throws java.lang.Exception
Persists a channel definition.

Specified by:
saveChannelDefinition in interface IChannelRegistryStore
Parameters:
channelDef - the channel definition
Throws:
java.sql.SQLException
java.lang.Exception

deleteChannelDefinition

public void deleteChannelDefinition(ChannelDefinition channelDef)
                             throws java.sql.SQLException,
                                    GroupsException
Permanently deletes a channel definition from the store. All references to this channel definition are also deleted.

Specified by:
deleteChannelDefinition in interface IChannelRegistryStore
Parameters:
channelDef - the channel definition
Throws:
java.sql.SQLException
GroupsException

approveChannelDefinition

public void approveChannelDefinition(ChannelDefinition channelDef,
                                     IPerson approver,
                                     java.util.Date approveDate)
                              throws java.lang.Exception
Sets a channel definition as "approved". This effectively makes a channel definition available in the channel registry, making the channel available for subscription to those authorized to subscribe to it. This method is a convenience method. As an alternative to calling this method, one could simply set the approver ID and approval date and then call saveChannelDefinition(ChannelDefinition chanDef).

Specified by:
approveChannelDefinition in interface IChannelRegistryStore
Parameters:
channelDef - the channel definition to approve
approver - the user that approves this channel definition
approveDate - the date when the channel definition should be approved (can be future dated)
Throws:
java.lang.Exception

disapproveChannelDefinition

public void disapproveChannelDefinition(ChannelDefinition channelDef)
                                 throws java.lang.Exception
Removes a channel from the channel registry by changing its status from "approved" to "unapproved". Afterwards, no one will be able to subscribe to or render the channel. This method is a convenience method. As an alternative to calling this method, one could simply set the approver ID and approval date to NULL and then call saveChannelDefinition(ChannelDefinition chanDef).

Specified by:
disapproveChannelDefinition in interface IChannelRegistryStore
Parameters:
channelDef - the channel definition to disapprove
Throws:
java.lang.Exception

newChannelCategory

public ChannelCategory newChannelCategory()
                                   throws GroupsException
Creates a new channel category.

Specified by:
newChannelCategory in interface IChannelRegistryStore
Returns:
channelCategory the new channel category
Throws:
GroupsException

newChannelCategory

public ChannelCategory newChannelCategory(java.lang.String name,
                                          java.lang.String description,
                                          java.lang.String creatorId)
                                   throws GroupsException
Creates a new channel category with the specified values.

Specified by:
newChannelCategory in interface IChannelRegistryStore
Parameters:
name - the name of the category
description - the name of the description
creatorId - the id of the creator or system
Returns:
channelCategory the new channel category
Throws:
GroupsException

getChannelCategory

public ChannelCategory getChannelCategory(java.lang.String channelCategoryId)
                                   throws GroupsException
Gets an existing channel category.

Specified by:
getChannelCategory in interface IChannelRegistryStore
Parameters:
channelCategoryId - the id of the category to get
Returns:
channelCategory the channel category
Throws:
GroupsException

getTopLevelChannelCategory

public ChannelCategory getTopLevelChannelCategory()
                                           throws GroupsException
Gets top level channel category

Specified by:
getTopLevelChannelCategory in interface IChannelRegistryStore
Returns:
channelCategories the new channel category
Throws:
GroupsException

getChildCategories

public ChannelCategory[] getChildCategories(ChannelCategory parent)
                                     throws GroupsException
Gets all child channel categories for a parent category.

Specified by:
getChildCategories in interface IChannelRegistryStore
Returns:
channelCategories the children categories
Throws:
GroupsException

getChildChannels

public ChannelDefinition[] getChildChannels(ChannelCategory parent)
                                     throws java.sql.SQLException,
                                            GroupsException
Gets all child channel definitions for a parent category.

Specified by:
getChildChannels in interface IChannelRegistryStore
Returns:
channelDefinitions the children channel definitions
Throws:
java.sql.SQLException
GroupsException

getParentCategories

public ChannelCategory[] getParentCategories(ChannelCategory child)
                                      throws GroupsException
Gets the immediate parent categories of this category.

Specified by:
getParentCategories in interface IChannelRegistryStore
Returns:
parents, the parent categories.
Throws:
GroupsException

getParentCategories

public ChannelCategory[] getParentCategories(ChannelDefinition child)
                                      throws GroupsException
Gets the immediate parent categories of this channel definition.

Specified by:
getParentCategories in interface IChannelRegistryStore
Returns:
parents, the parent categories.
Throws:
GroupsException

saveChannelCategory

public void saveChannelCategory(ChannelCategory category)
                         throws GroupsException
Persists a channel category.

Specified by:
saveChannelCategory in interface IChannelRegistryStore
Parameters:
category - the channel category to persist
Throws:
GroupsException

deleteChannelCategory

public void deleteChannelCategory(ChannelCategory category)
                           throws GroupsException
Deletes a channel category.

Specified by:
deleteChannelCategory in interface IChannelRegistryStore
Parameters:
category - the channel category to delete
Throws:
GroupsException

addCategoryToCategory

public void addCategoryToCategory(ChannelCategory child,
                                  ChannelCategory parent)
                           throws GroupsException
Makes one category a child of another.

Specified by:
addCategoryToCategory in interface IChannelRegistryStore
Parameters:
child - the source category
parent - the destination category
Throws:
GroupsException

removeCategoryFromCategory

public void removeCategoryFromCategory(ChannelCategory child,
                                       ChannelCategory parent)
                                throws GroupsException
Makes one category a child of another.

Specified by:
removeCategoryFromCategory in interface IChannelRegistryStore
Parameters:
child - the category to remove
parent - the category to remove from
Throws:
GroupsException

addChannelToCategory

public void addChannelToCategory(ChannelDefinition channelDef,
                                 ChannelCategory category)
                          throws PortalException
Associates a channel definition with a category.

Specified by:
addChannelToCategory in interface IChannelRegistryStore
Parameters:
channelDef - the channel definition
category - the channel category to which to associate the channel definition
Throws:
PortalException

removeChannelFromCategory

public void removeChannelFromCategory(ChannelDefinition channelDef,
                                      ChannelCategory category)
                               throws PortalException
Disassociates a channel definition from a category.

Specified by:
removeChannelFromCategory in interface IChannelRegistryStore
Parameters:
channelDef - the channel definition
category - the channel category from which to disassociate the channel definition
Throws:
PortalException

getChannelPstmt

protected static final java.sql.PreparedStatement getChannelPstmt(java.sql.Connection con)
                                                           throws java.sql.SQLException
Throws:
java.sql.SQLException

getChannelParamPstmt

protected static final java.sql.PreparedStatement getChannelParamPstmt(java.sql.Connection con)
                                                                throws java.sql.SQLException
Throws:
java.sql.SQLException

getChannelMdataPstmt

protected static final java.sql.PreparedStatement getChannelMdataPstmt(java.sql.Connection con)
                                                                throws java.sql.SQLException
Throws:
java.sql.SQLException