org.jasig.portal.layout.alm
Class AggregatedUserLayoutStore

java.lang.Object
  extended by org.jasig.portal.layout.simple.RDBMUserLayoutStore
      extended by org.jasig.portal.layout.alm.AggregatedUserLayoutStore
All Implemented Interfaces:
IAggregatedUserLayoutStore, IUserLayoutStore

public class AggregatedUserLayoutStore
extends RDBMUserLayoutStore
implements IAggregatedUserLayoutStore

AggregatedUserLayoutStore implementation using the relational database with SQL 92.

Company: Instructional Media & Magic Prior to uPortal 2.5, this class existed in the package org.jasig.portal.layout. It was moved to its present package to reflect that it is part of Aggregated Layouts.

Version:
$Revision: 1.1.2.7 $
Author:
Michael Ivanov

Field Summary
protected static java.lang.String CHANNEL_ADD_SQL
           
protected static java.lang.String CHANNEL_PARAM_ADD_SQL
           
protected static java.lang.String CHANNEL_PARAM_UPDATE_SQL
           
protected static java.lang.String CHANNEL_UPDATE_SQL
           
protected static java.lang.String FRAGMENT_ADD_SQL
           
protected static java.lang.String FRAGMENT_RESTRICTION_ADD_SQL
           
protected static java.lang.String FRAGMENT_RESTRICTION_UPDATE_SQL
           
protected static java.lang.String FRAGMENT_UPDATE_SQL
           
private static java.lang.String fragmentJoinQuery
           
protected static java.lang.String LAYOUT_ADD_SQL
           
protected static java.lang.String LAYOUT_RESTRICTION_ADD_SQL
           
protected static java.lang.String LAYOUT_RESTRICTION_UPDATE_SQL
           
protected static java.lang.String LAYOUT_UPDATE_SQL
           
private static int LOST_FOLDER_ID
           
private static java.lang.String NODE_SEPARATOR
           
private static boolean useOuterJoins
           
 
Fields inherited from class org.jasig.portal.layout.simple.RDBMUserLayoutStore
channelPrefix, crs, csdb, DEBUG, folderPrefix, localeAware, log
 
Constructor Summary
AggregatedUserLayoutStore()
           
 
Method Summary
private  ALNode addUserLayoutNode(int userId, int layoutId, ALNode node, java.sql.PreparedStatement psAddNode, java.sql.PreparedStatement psAddRestriction, java.sql.PreparedStatement psAddChannel, java.sql.PreparedStatement psAddChannelParam, java.sql.Statement stmt)
          Add the new user layout node.
 ALNode addUserLayoutNode(IPerson person, UserProfile profile, ALNode node)
          Add the new user layout node.
 void deleteFragment(IPerson person, java.lang.String fragmentId)
          Deletes the layout fragment
 boolean deleteUserLayoutNode(IPerson person, UserProfile profile, ALNode node)
          Delete the new user layout node.
 void fillChannelDescription(IALChannelDescription channelDesc)
           
 IAggregatedLayout getAggregatedLayout(IPerson person, UserProfile profile)
          Returns the user layout internal representation.
 ILayoutFragment getFragment(IPerson person, java.lang.String fragmentId)
          Returns the layout fragment as a user layout
protected  ILayoutFragment getFragment(java.lang.String fragmentIdStr)
          Returns the layout fragment as a user layout
 java.util.Map getFragments(IPerson person)
          Gets the fragment IDs/fragment descriptions for a given user
 java.util.Set getIncorrectPushedFragmentNodes(IPerson person, UserProfile profile)
          Returns the list of pushed fragment node IDs that must be removed from the user layout.
 java.lang.String getNextFragmentId()
          Returns the next fragment ID.
 java.lang.String getNextNodeId(IPerson person)
           
 int[] getPriorityRange(java.lang.String groupKey)
          Returns the priority range defined for the given user group
 java.util.Collection getPublishGroups(IPerson person, java.lang.String fragmentId)
          Returns the user group keys which the fragment is published to
protected  java.lang.String getStructId(int structId, int chanId)
          Return the Structure ID tag (Overloaded)
 StructureStylesheetUserPreferences getStructureStylesheetUserPreferences(IPerson person, int profileId, int stylesheetId)
          Obtain structure stylesheet user preferences
 java.util.Collection getSubscribableFragments(IPerson person)
          Returns the list of Ids of the fragments that the user can subscribe to
 ThemeStylesheetUserPreferences getThemeStylesheetUserPreferences(IPerson person, int profileId, int stylesheetId)
          Obtain theme stylesheet user preferences
 ALNode getUserLayoutNode(IPerson person, UserProfile profile, java.lang.String nodeId)
          Gets the user layout node.
 void setAggregatedLayout(IPerson person, UserProfile profile, IAggregatedLayout layoutImpl)
          Persists user layout document.
 void setFragment(IPerson person, ILayoutFragment fragment)
          Sets the fragment
 void setPublishGroups(IGroupMember[] groups, IPerson person, java.lang.String fragmentId)
          Persists the user groups which the fragment is published to
 void setStructureStylesheetUserPreferences(IPerson person, int profileId, StructureStylesheetUserPreferences ssup)
          Save structure stylesheet user pferences
 void setThemeStylesheetUserPreferences(IPerson person, int profileId, ThemeStylesheetUserPreferences tsup)
          Save theme stylesheet user preferences
private  boolean updateUserLayoutNode(int userId, int layoutId, ALNode node, java.sql.PreparedStatement psUpdateNode, java.sql.PreparedStatement psUpdateRestriction, java.sql.PreparedStatement psUpdateChannel, java.sql.PreparedStatement psUpdateChannelParam)
          Update the new user layout node.
 boolean updateUserLayoutNode(IPerson person, UserProfile profile, ALNode node)
          Update the new user layout node.
 
Methods inherited from class org.jasig.portal.layout.simple.RDBMUserLayoutStore
addStructureStylesheetDescription, addStructureStylesheetDescription, addSystemProfile, addThemeStylesheetDescription, addThemeStylesheetDescription, addUserProfile, channelApproved, createLayout, deleteSystemProfile, deleteUserProfile, dumpDoc, generateNewChannelSubscribeId, generateNewFolderId, getLayoutID, getMimeTypeList, getNextStructId, getStructure, getStructureStylesheetDescription, getStructureStylesheetId, getStructureStylesheetList, getStructureStylesheetList, getSystemProfile, getSystemProfileById, getSystemProfileList, getThemeStylesheetDescription, getThemeStylesheetId, getThemeStylesheetList, getThemeStylesheetList, getUserLayout, getUserPreferences, getUserPreferences, getUserProfile, getUserProfileById, getUserProfileList, putUserPreferences, removeStructureStylesheetDescription, removeThemeStylesheetDescription, saveStructure, setSystemBrowserMapping, setUserBrowserMapping, setUserLayout, updateStructureStylesheetDescription, updateStructureStylesheetDescription, updateSystemProfile, updateThemeStylesheetDescription, updateThemeStylesheetDescription, updateUserProfile, xmlBool
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jasig.portal.layout.IUserLayoutStore
addStructureStylesheetDescription, addSystemProfile, addThemeStylesheetDescription, addUserProfile, deleteSystemProfile, deleteUserProfile, generateNewChannelSubscribeId, generateNewFolderId, getMimeTypeList, getStructureStylesheetDescription, getStructureStylesheetList, getStructureStylesheetList, getSystemProfile, getSystemProfileById, getSystemProfileList, getThemeStylesheetDescription, getThemeStylesheetList, getThemeStylesheetList, getUserLayout, getUserPreferences, getUserProfile, getUserProfileById, getUserProfileList, putUserPreferences, removeStructureStylesheetDescription, removeThemeStylesheetDescription, setSystemBrowserMapping, setUserBrowserMapping, setUserLayout, updateStructureStylesheetDescription, updateSystemProfile, updateThemeStylesheetDescription, updateUserProfile
 

Field Detail

LOST_FOLDER_ID

private static final int LOST_FOLDER_ID
See Also:
Constant Field Values

NODE_SEPARATOR

private static final java.lang.String NODE_SEPARATOR
See Also:
Constant Field Values

FRAGMENT_UPDATE_SQL

protected static final java.lang.String FRAGMENT_UPDATE_SQL
See Also:
Constant Field Values

LAYOUT_UPDATE_SQL

protected static final java.lang.String LAYOUT_UPDATE_SQL
See Also:
Constant Field Values

FRAGMENT_RESTRICTION_UPDATE_SQL

protected static final java.lang.String FRAGMENT_RESTRICTION_UPDATE_SQL
See Also:
Constant Field Values

LAYOUT_RESTRICTION_UPDATE_SQL

protected static final java.lang.String LAYOUT_RESTRICTION_UPDATE_SQL
See Also:
Constant Field Values

CHANNEL_PARAM_UPDATE_SQL

protected static final java.lang.String CHANNEL_PARAM_UPDATE_SQL
See Also:
Constant Field Values

CHANNEL_UPDATE_SQL

protected static final java.lang.String CHANNEL_UPDATE_SQL
See Also:
Constant Field Values

FRAGMENT_ADD_SQL

protected static final java.lang.String FRAGMENT_ADD_SQL
See Also:
Constant Field Values

LAYOUT_ADD_SQL

protected static final java.lang.String LAYOUT_ADD_SQL
See Also:
Constant Field Values

FRAGMENT_RESTRICTION_ADD_SQL

protected static final java.lang.String FRAGMENT_RESTRICTION_ADD_SQL
See Also:
Constant Field Values

LAYOUT_RESTRICTION_ADD_SQL

protected static final java.lang.String LAYOUT_RESTRICTION_ADD_SQL
See Also:
Constant Field Values

CHANNEL_PARAM_ADD_SQL

protected static final java.lang.String CHANNEL_PARAM_ADD_SQL
See Also:
Constant Field Values

CHANNEL_ADD_SQL

protected static final java.lang.String CHANNEL_ADD_SQL
See Also:
Constant Field Values

fragmentJoinQuery

private static java.lang.String fragmentJoinQuery

useOuterJoins

private static boolean useOuterJoins
Constructor Detail

AggregatedUserLayoutStore

public AggregatedUserLayoutStore()
                          throws java.lang.Exception
Throws:
java.lang.Exception
Method Detail

getStructId

protected java.lang.String getStructId(int structId,
                                       int chanId)
Return the Structure ID tag (Overloaded)

Overrides:
getStructId in class RDBMUserLayoutStore
Parameters:
structId -
chanId -
Returns:
ID tag

setStructureStylesheetUserPreferences

public void setStructureStylesheetUserPreferences(IPerson person,
                                                  int profileId,
                                                  StructureStylesheetUserPreferences ssup)
                                           throws java.lang.Exception
Description copied from interface: IUserLayoutStore
Save structure stylesheet user pferences

Specified by:
setStructureStylesheetUserPreferences in interface IUserLayoutStore
Overrides:
setStructureStylesheetUserPreferences in class RDBMUserLayoutStore
Parameters:
person - User
profileId - profile id
ssup - structure stylesheet user preferences
Throws:
java.lang.Exception

setThemeStylesheetUserPreferences

public void setThemeStylesheetUserPreferences(IPerson person,
                                              int profileId,
                                              ThemeStylesheetUserPreferences tsup)
                                       throws java.lang.Exception
Description copied from interface: IUserLayoutStore
Save theme stylesheet user preferences

Specified by:
setThemeStylesheetUserPreferences in interface IUserLayoutStore
Overrides:
setThemeStylesheetUserPreferences in class RDBMUserLayoutStore
Parameters:
person - User
profileId - profile id
tsup - structure stylesheet user preferneces
Throws:
java.lang.Exception

addUserLayoutNode

public ALNode addUserLayoutNode(IPerson person,
                                UserProfile profile,
                                ALNode node)
                         throws PortalException
Add the new user layout node.

Specified by:
addUserLayoutNode in interface IAggregatedUserLayoutStore
Parameters:
person - an IPerson object specifying the user
profile - a user profile for which the layout is being stored
node - a ALNode object specifying the node
Returns:
a ALNode object specifying the node with the generated node ID
Throws:
PortalException - if an error occurs

addUserLayoutNode

private ALNode addUserLayoutNode(int userId,
                                 int layoutId,
                                 ALNode node,
                                 java.sql.PreparedStatement psAddNode,
                                 java.sql.PreparedStatement psAddRestriction,
                                 java.sql.PreparedStatement psAddChannel,
                                 java.sql.PreparedStatement psAddChannelParam,
                                 java.sql.Statement stmt)
                          throws PortalException
Add the new user layout node.

Parameters:
userId - the user
layoutId - identities the layout
node - a ALNode object specifying the node
Returns:
a ALNode object specifying the node with the generated node ID
Throws:
PortalException - if an error occurs

updateUserLayoutNode

public boolean updateUserLayoutNode(IPerson person,
                                    UserProfile profile,
                                    ALNode node)
                             throws PortalException
Update the new user layout node.

Specified by:
updateUserLayoutNode in interface IAggregatedUserLayoutStore
Parameters:
person - an IPerson object specifying the user
profile - a user profile for which the layout is being stored
node - a ALNode object specifying the node
Returns:
a boolean result of this operation
Throws:
PortalException - if an error occurs

updateUserLayoutNode

private boolean updateUserLayoutNode(int userId,
                                     int layoutId,
                                     ALNode node,
                                     java.sql.PreparedStatement psUpdateNode,
                                     java.sql.PreparedStatement psUpdateRestriction,
                                     java.sql.PreparedStatement psUpdateChannel,
                                     java.sql.PreparedStatement psUpdateChannelParam)
                              throws PortalException
Update the new user layout node.

Parameters:
userId - the user
layoutId - identities the layout is being stored
node - a ALNode object specifying the node
Returns:
a boolean result of this operation
Throws:
PortalException - if an error occurs

deleteUserLayoutNode

public boolean deleteUserLayoutNode(IPerson person,
                                    UserProfile profile,
                                    ALNode node)
                             throws PortalException
Delete the new user layout node.

Specified by:
deleteUserLayoutNode in interface IAggregatedUserLayoutStore
Parameters:
person - an IPerson object specifying the user
profile - a user profile for which the layout is being stored
node - a ALNode node ID specifying the node
Returns:
a boolean result of this operation
Throws:
PortalException - if an error occurs

getUserLayoutNode

public ALNode getUserLayoutNode(IPerson person,
                                UserProfile profile,
                                java.lang.String nodeId)
                         throws PortalException
Gets the user layout node.

Specified by:
getUserLayoutNode in interface IAggregatedUserLayoutStore
Parameters:
person - an IPerson object specifying the user
profile - a user profile for which the layout is being stored
nodeId - a String node ID specifying the node
Returns:
a ALNode object
Throws:
PortalException - if an error occurs

setAggregatedLayout

public void setAggregatedLayout(IPerson person,
                                UserProfile profile,
                                IAggregatedLayout layoutImpl)
                         throws PortalException
Description copied from interface: IAggregatedUserLayoutStore
Persists user layout document.

Specified by:
setAggregatedLayout in interface IAggregatedUserLayoutStore
Parameters:
person - an IPerson object specifying the user
profile - a user profile for which the layout is being stored
layoutImpl - a IAggregatedLayout containing an aggregated user layout
Throws:
PortalException - if an error occurs

getFragments

public java.util.Map getFragments(IPerson person)
                           throws PortalException
Gets the fragment IDs/fragment descriptions for a given user

Specified by:
getFragments in interface IAggregatedUserLayoutStore
Parameters:
person - an IPerson object specifying the user
Returns:
a Map object containing the IDs of the fragments the user owns
Throws:
PortalException - if an error occurs

setFragment

public void setFragment(IPerson person,
                        ILayoutFragment fragment)
                 throws PortalException
Sets the fragment

Specified by:
setFragment in interface IAggregatedUserLayoutStore
Parameters:
person - an IPerson object specifying the user
fragment - a ILayoutFragment containing a fragment
Throws:
PortalException - if an error occurs

deleteFragment

public void deleteFragment(IPerson person,
                           java.lang.String fragmentId)
                    throws PortalException
Deletes the layout fragment

Specified by:
deleteFragment in interface IAggregatedUserLayoutStore
Parameters:
person - an IPerson object specifying the user
fragmentId - a fragment ID
Throws:
PortalException - if an error occurs

getAggregatedLayout

public IAggregatedLayout getAggregatedLayout(IPerson person,
                                             UserProfile profile)
                                      throws PortalException
Returns the user layout internal representation.

Specified by:
getAggregatedLayout in interface IAggregatedUserLayoutStore
Parameters:
person - an IPerson object specifying the user
profile - a user profile for which the layout is being stored
Returns:
a IAggregatedLayout object containing the internal representation of the user layout
Throws:
PortalException - if an error occurs

getFragment

public ILayoutFragment getFragment(IPerson person,
                                   java.lang.String fragmentId)
                            throws PortalException
Returns the layout fragment as a user layout

Specified by:
getFragment in interface IAggregatedUserLayoutStore
Parameters:
person - an IPerson object specifying the user
fragmentId - a fragment ID
Returns:
a IAggregatedLayout object containing the internal representation of the user layout
Throws:
PortalException - if an error occurs

getFragment

protected ILayoutFragment getFragment(java.lang.String fragmentIdStr)
                               throws PortalException
Returns the layout fragment as a user layout

Parameters:
fragmentIdStr - a fragment ID
Returns:
a IAggregatedLayout object containing the internal representation of the user layout
Throws:
PortalException - if an error occurs

fillChannelDescription

public void fillChannelDescription(IALChannelDescription channelDesc)
                            throws PortalException
Throws:
PortalException

getNextFragmentId

public java.lang.String getNextFragmentId()
                                   throws PortalException
Returns the next fragment ID.

Specified by:
getNextFragmentId in interface IAggregatedUserLayoutStore
Returns:
a String next fragment ID
Throws:
PortalException - if an error occurs

getThemeStylesheetUserPreferences

public ThemeStylesheetUserPreferences getThemeStylesheetUserPreferences(IPerson person,
                                                                        int profileId,
                                                                        int stylesheetId)
                                                                 throws java.lang.Exception
Description copied from interface: IUserLayoutStore
Obtain theme stylesheet user preferences

Specified by:
getThemeStylesheetUserPreferences in interface IUserLayoutStore
Overrides:
getThemeStylesheetUserPreferences in class RDBMUserLayoutStore
Parameters:
person - User
profileId - profile id
stylesheetId - theme stylesheet id
Returns:
theme stylesheet user preferences. null is returned only if userId, profileId or stylesheet with an appropriate name do not exist. If all of the parameters are valid, but the user does not have any user preference settings associated with this stylesheet, return contains stylesheet preference object filled in with the defaults defined in stylesheet description.
Throws:
java.lang.Exception

getStructureStylesheetUserPreferences

public StructureStylesheetUserPreferences getStructureStylesheetUserPreferences(IPerson person,
                                                                                int profileId,
                                                                                int stylesheetId)
                                                                         throws java.lang.Exception
Description copied from interface: IUserLayoutStore
Obtain structure stylesheet user preferences

Specified by:
getStructureStylesheetUserPreferences in interface IUserLayoutStore
Overrides:
getStructureStylesheetUserPreferences in class RDBMUserLayoutStore
Parameters:
person - User
profileId - profile id
stylesheetId - structure stylesheet id
Returns:
structure stylesheet user preferences. null is returned only if userId, profileId or stylesheet with an appropriate name do not exist. If all of the parameters are valid, but the user does not have any user preference settings associated with this stylesheet, return contains stylesheet preference object filled in with the defaults defined in stylesheet description.
Throws:
java.lang.Exception

getIncorrectPushedFragmentNodes

public java.util.Set getIncorrectPushedFragmentNodes(IPerson person,
                                                     UserProfile profile)
                                              throws PortalException
Returns the list of pushed fragment node IDs that must be removed from the user layout.

Parameters:
person - an IPerson object specifying the user
profile - a user profile for which the layout is being stored
Returns:
a Set list containing the fragment node IDs to be deleted from the user layout
Throws:
PortalException - if an error occurs

getSubscribableFragments

public java.util.Collection getSubscribableFragments(IPerson person)
                                              throws PortalException
Returns the list of Ids of the fragments that the user can subscribe to

Specified by:
getSubscribableFragments in interface IAggregatedUserLayoutStore
Parameters:
person - an IPerson object specifying the user
Returns:
Collection a set of the fragment IDs
Throws:
PortalException - if an error occurs

getPublishGroups

public java.util.Collection getPublishGroups(IPerson person,
                                             java.lang.String fragmentId)
                                      throws PortalException
Returns the user group keys which the fragment is published to

Specified by:
getPublishGroups in interface IAggregatedUserLayoutStore
Parameters:
person - an IPerson object specifying the user
fragmentId - a String value
Returns:
a Collection object containing the group keys
Throws:
PortalException - if an error occurs

setPublishGroups

public void setPublishGroups(IGroupMember[] groups,
                             IPerson person,
                             java.lang.String fragmentId)
                      throws PortalException
Persists the user groups which the fragment is published to

Specified by:
setPublishGroups in interface IAggregatedUserLayoutStore
Parameters:
groups - an array of IGroupMember objects
person - an IPerson object specifying the user
fragmentId - a String value
Throws:
PortalException - if an error occurs

getPriorityRange

public int[] getPriorityRange(java.lang.String groupKey)
                       throws PortalException
Returns the priority range defined for the given user group

Specified by:
getPriorityRange in interface IAggregatedUserLayoutStore
Parameters:
groupKey - a String group key
Returns:
a int array containing the min and max priority values
Throws:
PortalException - if an error occurs

getNextNodeId

public java.lang.String getNextNodeId(IPerson person)
                               throws PortalException
Throws:
PortalException