org.jasig.portal.layout.simple
Class RDBMUserLayoutStore

java.lang.Object
  extended by org.jasig.portal.layout.simple.RDBMUserLayoutStore
All Implemented Interfaces:
IUserLayoutStore
Direct Known Subclasses:
AggregatedUserLayoutStore, OracleUserLayoutStore, RDBMDistributedLayoutStore

public class RDBMUserLayoutStore
extends java.lang.Object
implements IUserLayoutStore

SQL implementation for the 2.x relational database model. Prior to uPortal 2.5, this class existed in the org.jasig.portal package. It was moved to its present package to express that it is part of the Simple Layout Manager implementation.

Version:
$Revision: 1.1.2.4 $ $Date: 2006/01/30 18:08:29 $
Author:
George Lindholm

Nested Class Summary
private  class RDBMUserLayoutStore.SystemUser
           
 
Field Summary
protected static java.lang.String channelPrefix
           
protected  IChannelRegistryStore crs
           
protected  ICounterStore csdb
           
protected static int DEBUG
           
protected static java.lang.String folderPrefix
           
protected static boolean localeAware
           
protected  org.apache.commons.logging.Log log
           
private  IPerson systemUser
           
 
Constructor Summary
RDBMUserLayoutStore()
           
 
Method Summary
 java.lang.Integer addStructureStylesheetDescription(java.lang.String stylesheetDescriptionURI, java.lang.String stylesheetURI)
          Add a structure stylesheet description
 java.lang.Integer addStructureStylesheetDescription(StructureStylesheetDescription ssd)
          Registers a NEW structure stylesheet with the database.
 UserProfile addSystemProfile(UserProfile profile)
          add a new system profile to the database.
 java.lang.Integer addThemeStylesheetDescription(java.lang.String stylesheetDescriptionURI, java.lang.String stylesheetURI)
          Add theme stylesheet description
 java.lang.Integer addThemeStylesheetDescription(ThemeStylesheetDescription tsd)
          Registers a NEW theme stylesheet with the database.
 UserProfile addUserProfile(IPerson person, UserProfile profile)
          Add a user profile
protected static boolean channelApproved(java.util.Date approvedDate)
          Checks if a channel has been approved
protected  void createLayout(java.util.HashMap layoutStructure, org.w3c.dom.Document doc, org.w3c.dom.Element root, int structId)
          Create a layout
 void deleteSystemProfile(int profileId)
          remove system profile from the database
private  void deleteUserProfile(int userId, int profileId)
           
 void deleteUserProfile(IPerson person, int profileId)
          remove user profile from the database
static void dumpDoc(org.w3c.dom.Node node, java.lang.String indent)
          Dump a document tree structure on stdout
 java.lang.String generateNewChannelSubscribeId(IPerson person)
          Return the next available channel structure id for a user
 java.lang.String generateNewFolderId(IPerson person)
          Return the next available folder structure id for a user
private  java.lang.String getDescription(org.w3c.dom.Document descr)
           
private  org.w3c.dom.Document getDOM(java.lang.String uri)
           
protected  int getLayoutID(int userId, int profileId)
          Returns the current layout ID for the user and profile.
 java.util.Hashtable getMimeTypeList()
          CoreStyleSheet
private  java.lang.String getName(org.w3c.dom.Document descr)
           
protected  java.lang.String getNextStructId(IPerson person, java.lang.String prefix)
          Return the next available structure id for a user
private  java.lang.String getRootElementTextValue(org.w3c.dom.Document descr, java.lang.String elementName)
           
protected  java.lang.String getStructId(int structId, int chanId)
          Return the Structure ID tag
protected  org.w3c.dom.Element getStructure(org.w3c.dom.Document doc, LayoutStructure ls)
           
 StructureStylesheetDescription getStructureStylesheetDescription(int stylesheetId)
          Obtain structure stylesheet description object for a given structure stylesheet id.
 java.lang.Integer getStructureStylesheetId(java.lang.String ssName)
          Obtain ID for known structure stylesheet name
 java.util.Hashtable getStructureStylesheetList()
          Obtain a list of strcture stylesheet descriptions registered on the system
 java.util.Hashtable getStructureStylesheetList(java.lang.String mimeType)
          Obtain a list of structure stylesheet descriptions that have stylesheets for a given mime type.
 StructureStylesheetUserPreferences getStructureStylesheetUserPreferences(IPerson person, int profileId, int stylesheetId)
          Obtain structure stylesheet user preferences
private  int getSystemBrowserMapping(java.lang.String userAgent)
           
 UserProfile getSystemProfile(java.lang.String userAgent)
          retreive a system profile associated with a given browser
 UserProfile getSystemProfileById(int profileId)
          Obtain a system profile
 java.util.Hashtable getSystemProfileList()
          obtain a list of system profiles
private  java.lang.String getTextChildNodeValue(org.w3c.dom.Node node)
           
 ThemeStylesheetDescription getThemeStylesheetDescription(int stylesheetId)
          Obtain theme stylesheet description object for a given theme stylesheet id.
 java.lang.Integer getThemeStylesheetId(java.lang.String tsName)
          Obtain ID for known theme stylesheet name
 java.util.Hashtable getThemeStylesheetList()
          Obtain a list of theme stylesheet descriptions registered on the system
 java.util.Hashtable getThemeStylesheetList(int structureStylesheetId)
          Obtain a list of theme stylesheet descriptions for a given structure stylesheet
 ThemeStylesheetUserPreferences getThemeStylesheetUserPreferences(IPerson person, int profileId, int stylesheetId)
          Obtain theme stylesheet user preferences
private  int getUserBrowserMapping(IPerson person, java.lang.String userAgent)
          UserPreferences
 org.w3c.dom.Document getUserLayout(IPerson person, UserProfile profile)
          Retreive a user layout document.
 UserPreferences getUserPreferences(IPerson person, int profileId)
           
 UserPreferences getUserPreferences(IPerson person, UserProfile profile)
          Retreive the entire UserPreferences object
 UserProfile getUserProfile(IPerson person, java.lang.String userAgent)
          Obtain user profile associated with a particular browser
 UserProfile getUserProfileById(IPerson person, int profileId)
          Obtains a user profile by profile id.
 java.util.Hashtable getUserProfileList(IPerson person)
          retreive a list of profiles associated with a user
private  java.util.Vector getVectorOfSimpleTextElementValues(org.w3c.dom.Document descr, java.lang.String elementName)
           
private  void populateChannelAttributeTable(org.w3c.dom.Document descr, CoreXSLTStylesheetDescription cxsd)
           
private  void populateFolderAttributeTable(org.w3c.dom.Document descr, StructureStylesheetDescription cxsd)
           
private  void populateParameterTable(org.w3c.dom.Document descr, CoreStylesheetDescription csd)
           
 void putUserPreferences(IPerson person, UserPreferences up)
          save user preferences
private  void removeStructureChannelAttribute(int stylesheetId, java.lang.String pName, java.sql.Connection con)
          Remove (with cleanup) a structure stylesheet channel attribute
private  void removeStructureFolderAttribute(int stylesheetId, java.lang.String pName, java.sql.Connection con)
          Remove (with cleanup) a structure stylesheet folder attribute
 void removeStructureStylesheetDescription(int stylesheetId)
          removes stylesheet description
private  void removeStructureStylesheetParam(int stylesheetId, java.lang.String pName, java.sql.Connection con)
          Remove (with cleanup) a structure stylesheet param
private  void removeThemeChannelAttribute(int stylesheetId, java.lang.String pName, java.sql.Connection con)
          Remove (with cleanup) a theme stylesheet channel attribute
 void removeThemeStylesheetDescription(int stylesheetId)
          Removes theme stylesheet
private  void removeThemeStylesheetParam(int stylesheetId, java.lang.String pName, java.sql.Connection con)
          Remove (with cleanup) a theme stylesheet param
protected  int saveStructure(org.w3c.dom.Node node, java.sql.PreparedStatement structStmt, java.sql.PreparedStatement parmStmt)
           
 void setStructureStylesheetUserPreferences(IPerson person, int profileId, StructureStylesheetUserPreferences ssup)
          Save structure stylesheet user pferences
 void setSystemBrowserMapping(java.lang.String userAgent, int profileId)
          establish system profile browser mapping
 void setThemeStylesheetUserPreferences(IPerson person, int profileId, ThemeStylesheetUserPreferences tsup)
          Save theme stylesheet user preferences
 void setUserBrowserMapping(IPerson person, java.lang.String userAgent, int profileId)
          establish a browser - user profile mapping
 void setUserLayout(IPerson person, UserProfile profile, org.w3c.dom.Document layoutXML, boolean channelsAdded)
          Save the user layout.
 boolean updateStructureStylesheetDescription(java.lang.String stylesheetDescriptionURI, java.lang.String stylesheetURI, int stylesheetId)
          Update the structure stylesheet description
 void updateStructureStylesheetDescription(StructureStylesheetDescription ssd)
          Updates an existing structure stylesheet description with a new one.
 void updateSystemProfile(UserProfile profile)
          update system profile
 boolean updateThemeStylesheetDescription(java.lang.String stylesheetDescriptionURI, java.lang.String stylesheetURI, int stylesheetId)
          Update the theme stylesheet description.
 void updateThemeStylesheetDescription(ThemeStylesheetDescription tsd)
          Updates an existing structure stylesheet description with a new one.
 void updateUserProfile(IPerson person, UserProfile profile)
          update user profile
protected static boolean xmlBool(java.lang.String value)
          convert true/false into Y/N for database
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected final org.apache.commons.logging.Log log

DEBUG

protected static int DEBUG

channelPrefix

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

folderPrefix

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

crs

protected IChannelRegistryStore crs

csdb

protected ICounterStore csdb

localeAware

protected static final boolean localeAware

systemUser

private IPerson systemUser
Constructor Detail

RDBMUserLayoutStore

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

addStructureStylesheetDescription

public java.lang.Integer addStructureStylesheetDescription(StructureStylesheetDescription ssd)
                                                    throws java.lang.Exception
Registers a NEW structure stylesheet with the database.

Parameters:
ssd - the Stylesheet description object
Returns:
an Integer id for the registered Stylesheet description object
Throws:
java.lang.Exception

addThemeStylesheetDescription

public java.lang.Integer addThemeStylesheetDescription(ThemeStylesheetDescription tsd)
                                                throws java.lang.Exception
Registers a NEW theme stylesheet with the database.

Parameters:
tsd - Stylesheet description object
Returns:
an Integer id of the registered Theme Stylesheet if successful; null otherwise.
Throws:
java.lang.Exception

updateThemeStylesheetDescription

public boolean updateThemeStylesheetDescription(java.lang.String stylesheetDescriptionURI,
                                                java.lang.String stylesheetURI,
                                                int stylesheetId)
Update the theme stylesheet description.

Specified by:
updateThemeStylesheetDescription in interface IUserLayoutStore
Parameters:
stylesheetDescriptionURI -
stylesheetURI -
stylesheetId -
Returns:
true if update succeeded, otherwise false

updateStructureStylesheetDescription

public boolean updateStructureStylesheetDescription(java.lang.String stylesheetDescriptionURI,
                                                    java.lang.String stylesheetURI,
                                                    int stylesheetId)
Update the structure stylesheet description

Specified by:
updateStructureStylesheetDescription in interface IUserLayoutStore
Parameters:
stylesheetDescriptionURI -
stylesheetURI -
stylesheetId -
Returns:
true if update succeeded, otherwise false

addStructureStylesheetDescription

public java.lang.Integer addStructureStylesheetDescription(java.lang.String stylesheetDescriptionURI,
                                                           java.lang.String stylesheetURI)
Add a structure stylesheet description

Specified by:
addStructureStylesheetDescription in interface IUserLayoutStore
Parameters:
stylesheetDescriptionURI -
stylesheetURI -
Returns:
an Integer id of the registered Structure Stylesheet description object if successful; null otherwise.

addThemeStylesheetDescription

public java.lang.Integer addThemeStylesheetDescription(java.lang.String stylesheetDescriptionURI,
                                                       java.lang.String stylesheetURI)
Add theme stylesheet description

Specified by:
addThemeStylesheetDescription in interface IUserLayoutStore
Parameters:
stylesheetDescriptionURI -
stylesheetURI -
Returns:
an Integer id of the registered Theme Stylesheet if successful; null otherwise.

addUserProfile

public UserProfile addUserProfile(IPerson person,
                                  UserProfile profile)
                           throws java.lang.Exception
Add a user profile

Specified by:
addUserProfile in interface IUserLayoutStore
Parameters:
person -
profile -
Returns:
userProfile
Throws:
java.lang.Exception

channelApproved

protected static boolean channelApproved(java.util.Date approvedDate)
Checks if a channel has been approved

Parameters:
approvedDate -
Returns:
boolean Channel is approved

createLayout

protected final void createLayout(java.util.HashMap layoutStructure,
                                  org.w3c.dom.Document doc,
                                  org.w3c.dom.Element root,
                                  int structId)
                           throws java.sql.SQLException,
                                  java.lang.Exception
Create a layout

Parameters:
layoutStructure -
doc -
root -
structId -
Throws:
java.sql.SQLException
java.lang.Exception

xmlBool

protected static final boolean xmlBool(java.lang.String value)
convert true/false into Y/N for database

Parameters:
value - to check

deleteUserProfile

public void deleteUserProfile(IPerson person,
                              int profileId)
                       throws java.lang.Exception
Description copied from interface: IUserLayoutStore
remove user profile from the database

Specified by:
deleteUserProfile in interface IUserLayoutStore
Parameters:
person - User
profileId - profile id
Throws:
java.lang.Exception

getDOM

private org.w3c.dom.Document getDOM(java.lang.String uri)
                             throws java.lang.Exception
Throws:
java.lang.Exception

deleteUserProfile

private void deleteUserProfile(int userId,
                               int profileId)
                        throws java.lang.Exception
Throws:
java.lang.Exception

dumpDoc

public static final void dumpDoc(org.w3c.dom.Node node,
                                 java.lang.String indent)
Dump a document tree structure on stdout

Parameters:
node -
indent -

getMimeTypeList

public java.util.Hashtable getMimeTypeList()
                                    throws java.lang.Exception
CoreStyleSheet

Specified by:
getMimeTypeList in interface IUserLayoutStore
Returns:
Returns a hasbtale mapping mime type strings to their word descriptions (simple String)
Throws:
java.lang.Exception

generateNewChannelSubscribeId

public java.lang.String generateNewChannelSubscribeId(IPerson person)
                                               throws java.lang.Exception
Return the next available channel structure id for a user

Specified by:
generateNewChannelSubscribeId in interface IUserLayoutStore
Parameters:
person -
Returns:
the next available channel structure id
Throws:
java.lang.Exception - if an error occurs

generateNewFolderId

public java.lang.String generateNewFolderId(IPerson person)
                                     throws java.lang.Exception
Return the next available folder structure id for a user

Specified by:
generateNewFolderId in interface IUserLayoutStore
Parameters:
person -
Returns:
a String that is the next free structure ID
Throws:
java.lang.Exception

getNextStructId

protected java.lang.String getNextStructId(IPerson person,
                                           java.lang.String prefix)
                                    throws java.lang.Exception
Return the next available structure id for a user

Parameters:
person -
prefix -
Returns:
next free structure ID
Throws:
java.lang.Exception

getStructId

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

Parameters:
structId -
chanId -
Returns:
ID tag

getStructureStylesheetDescription

public StructureStylesheetDescription getStructureStylesheetDescription(int stylesheetId)
                                                                 throws java.lang.Exception
Obtain structure stylesheet description object for a given structure stylesheet id.

Specified by:
getStructureStylesheetDescription in interface IUserLayoutStore
Parameters:
stylesheetId - the id of the structure stylesheet
Returns:
structure stylesheet description
Throws:
java.lang.Exception

getStructureStylesheetId

public java.lang.Integer getStructureStylesheetId(java.lang.String ssName)
                                           throws java.lang.Exception
Obtain ID for known structure stylesheet name

Parameters:
ssName - name of the structure stylesheet
Returns:
id or null if no stylesheet matches the name given.
Throws:
java.lang.Exception

getStructureStylesheetList

public java.util.Hashtable getStructureStylesheetList(java.lang.String mimeType)
                                               throws java.lang.Exception
Obtain a list of structure stylesheet descriptions that have stylesheets for a given mime type.

Specified by:
getStructureStylesheetList in interface IUserLayoutStore
Parameters:
mimeType -
Returns:
a mapping from stylesheet names to structure stylesheet description objects
Throws:
java.lang.Exception

getStructureStylesheetList

public java.util.Hashtable getStructureStylesheetList()
                                               throws java.lang.Exception
Obtain a list of strcture stylesheet descriptions registered on the system

Specified by:
getStructureStylesheetList in interface IUserLayoutStore
Returns:
a Hashtable mapping stylesheet id (Integer objects) to StructureStylesheetDescription objects
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
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

getThemeStylesheetDescription

public ThemeStylesheetDescription getThemeStylesheetDescription(int stylesheetId)
                                                         throws java.lang.Exception
Obtain theme stylesheet description object for a given theme stylesheet id.

Specified by:
getThemeStylesheetDescription in interface IUserLayoutStore
Parameters:
stylesheetId - the id of the theme stylesheet
Returns:
theme stylesheet description
Throws:
java.lang.Exception

getThemeStylesheetId

public java.lang.Integer getThemeStylesheetId(java.lang.String tsName)
                                       throws java.lang.Exception
Obtain ID for known theme stylesheet name

Parameters:
tsName - name of the theme stylesheet
Returns:
id or null if no theme matches the name given.
Throws:
java.lang.Exception

getThemeStylesheetList

public java.util.Hashtable getThemeStylesheetList(int structureStylesheetId)
                                           throws java.lang.Exception
Obtain a list of theme stylesheet descriptions for a given structure stylesheet

Specified by:
getThemeStylesheetList in interface IUserLayoutStore
Parameters:
structureStylesheetId -
Returns:
a map of stylesheet names to theme stylesheet description objects
Throws:
java.lang.Exception

getThemeStylesheetList

public java.util.Hashtable getThemeStylesheetList()
                                           throws java.lang.Exception
Obtain a list of theme stylesheet descriptions registered on the system

Specified by:
getThemeStylesheetList in interface IUserLayoutStore
Returns:
a Hashtable mapping stylesheet id (Integer objects) to ThemeStylesheetDescription objects
Throws:
java.lang.Exception

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
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

getName

private java.lang.String getName(org.w3c.dom.Document descr)

getRootElementTextValue

private java.lang.String getRootElementTextValue(org.w3c.dom.Document descr,
                                                 java.lang.String elementName)

getDescription

private java.lang.String getDescription(org.w3c.dom.Document descr)

populateParameterTable

private void populateParameterTable(org.w3c.dom.Document descr,
                                    CoreStylesheetDescription csd)

populateFolderAttributeTable

private void populateFolderAttributeTable(org.w3c.dom.Document descr,
                                          StructureStylesheetDescription cxsd)

populateChannelAttributeTable

private void populateChannelAttributeTable(org.w3c.dom.Document descr,
                                           CoreXSLTStylesheetDescription cxsd)

getVectorOfSimpleTextElementValues

private java.util.Vector getVectorOfSimpleTextElementValues(org.w3c.dom.Document descr,
                                                            java.lang.String elementName)

getTextChildNodeValue

private java.lang.String getTextChildNodeValue(org.w3c.dom.Node node)

getUserBrowserMapping

private int getUserBrowserMapping(IPerson person,
                                  java.lang.String userAgent)
                           throws java.lang.Exception
UserPreferences

Throws:
java.lang.Exception

getUserLayout

public org.w3c.dom.Document getUserLayout(IPerson person,
                                          UserProfile profile)
                                   throws java.lang.Exception
Description copied from interface: IUserLayoutStore
Retreive a user layout document.

Specified by:
getUserLayout in interface IUserLayoutStore
Parameters:
person - an IPerson object specifying the user
profile - a user profile
Returns:
a Document containing user layout (conforms to userLayout.dtd)
Throws:
java.lang.Exception - if an error occurs

getUserProfileById

public UserProfile getUserProfileById(IPerson person,
                                      int profileId)
                               throws java.lang.Exception
Description copied from interface: IUserLayoutStore
Obtains a user profile by profile id.

Specified by:
getUserProfileById in interface IUserLayoutStore
Parameters:
person - an IPerson object representing the user
profileId - profile id
Throws:
java.lang.Exception

getUserProfileList

public java.util.Hashtable getUserProfileList(IPerson person)
                                       throws java.lang.Exception
Description copied from interface: IUserLayoutStore
retreive a list of profiles associated with a user

Specified by:
getUserProfileList in interface IUserLayoutStore
Parameters:
person - User
Returns:
a Hashtable mapping user profile ids (Integer objects) to the UserProfile objects
Throws:
java.lang.Exception

removeStructureChannelAttribute

private void removeStructureChannelAttribute(int stylesheetId,
                                             java.lang.String pName,
                                             java.sql.Connection con)
                                      throws java.sql.SQLException
Remove (with cleanup) a structure stylesheet channel attribute

Parameters:
stylesheetId - id of the structure stylesheet
pName - name of the attribute
con - active database connection
Throws:
java.sql.SQLException

removeStructureFolderAttribute

private void removeStructureFolderAttribute(int stylesheetId,
                                            java.lang.String pName,
                                            java.sql.Connection con)
                                     throws java.sql.SQLException
Remove (with cleanup) a structure stylesheet folder attribute

Parameters:
stylesheetId - id of the structure stylesheet
pName - name of the attribute
con - active database connection
Throws:
java.sql.SQLException

removeStructureStylesheetDescription

public void removeStructureStylesheetDescription(int stylesheetId)
                                          throws java.lang.Exception
Description copied from interface: IUserLayoutStore
removes stylesheet description

Specified by:
removeStructureStylesheetDescription in interface IUserLayoutStore
Parameters:
stylesheetId - id of the stylesheet
Throws:
java.lang.Exception

removeStructureStylesheetParam

private void removeStructureStylesheetParam(int stylesheetId,
                                            java.lang.String pName,
                                            java.sql.Connection con)
                                     throws java.sql.SQLException
Remove (with cleanup) a structure stylesheet param

Parameters:
stylesheetId - id of the structure stylesheet
pName - name of the parameter
con - active database connection
Throws:
java.sql.SQLException

removeThemeChannelAttribute

private void removeThemeChannelAttribute(int stylesheetId,
                                         java.lang.String pName,
                                         java.sql.Connection con)
                                  throws java.sql.SQLException
Remove (with cleanup) a theme stylesheet channel attribute

Parameters:
stylesheetId - id of the theme stylesheet
pName - name of the attribute
con - active database connection
Throws:
java.sql.SQLException

removeThemeStylesheetDescription

public void removeThemeStylesheetDescription(int stylesheetId)
                                      throws java.lang.Exception
Description copied from interface: IUserLayoutStore
Removes theme stylesheet

Specified by:
removeThemeStylesheetDescription in interface IUserLayoutStore
Parameters:
stylesheetId - id of the stylesheet
Throws:
java.lang.Exception

removeThemeStylesheetParam

private void removeThemeStylesheetParam(int stylesheetId,
                                        java.lang.String pName,
                                        java.sql.Connection con)
                                 throws java.sql.SQLException
Remove (with cleanup) a theme stylesheet param

Parameters:
stylesheetId - id of the theme stylesheet
pName - name of the parameter
con - active database connection
Throws:
java.sql.SQLException

getStructure

protected org.w3c.dom.Element getStructure(org.w3c.dom.Document doc,
                                           LayoutStructure ls)
                                    throws java.lang.Exception
Throws:
java.lang.Exception

saveStructure

protected int saveStructure(org.w3c.dom.Node node,
                            java.sql.PreparedStatement structStmt,
                            java.sql.PreparedStatement parmStmt)
                     throws java.sql.SQLException
Throws:
java.sql.SQLException

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
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
Parameters:
person - User
profileId - profile id
tsup - structure stylesheet user preferneces
Throws:
java.lang.Exception

setUserBrowserMapping

public void setUserBrowserMapping(IPerson person,
                                  java.lang.String userAgent,
                                  int profileId)
                           throws java.lang.Exception
Description copied from interface: IUserLayoutStore
establish a browser - user profile mapping

Specified by:
setUserBrowserMapping in interface IUserLayoutStore
Parameters:
person - User
userAgent - User-Agent header string
profileId - profile id to which given user agent will be mapped
Throws:
java.lang.Exception

setUserLayout

public void setUserLayout(IPerson person,
                          UserProfile profile,
                          org.w3c.dom.Document layoutXML,
                          boolean channelsAdded)
                   throws java.lang.Exception
Save the user layout.

Specified by:
setUserLayout in interface IUserLayoutStore
Parameters:
person -
profile -
layoutXML -
channelsAdded - a boolean flag specifying if new channels have been added to the current user layout (for performance optimization purposes)
Throws:
java.lang.Exception

updateStructureStylesheetDescription

public void updateStructureStylesheetDescription(StructureStylesheetDescription ssd)
                                          throws java.lang.Exception
Updates an existing structure stylesheet description with a new one. Old stylesheet description is found based on the Id provided in the parameter structure.

Parameters:
ssd - new stylesheet description
Throws:
java.lang.Exception

updateThemeStylesheetDescription

public void updateThemeStylesheetDescription(ThemeStylesheetDescription tsd)
                                      throws java.lang.Exception
Updates an existing structure stylesheet description with a new one. Old stylesheet description is found based on the Id provided in the parameter structure.

Parameters:
tsd - new theme stylesheet description
Throws:
java.lang.Exception

updateUserProfile

public void updateUserProfile(IPerson person,
                              UserProfile profile)
                       throws java.lang.Exception
Description copied from interface: IUserLayoutStore
update user profile

Specified by:
updateUserProfile in interface IUserLayoutStore
Parameters:
person - User
profile - profile update
Throws:
java.lang.Exception

setSystemBrowserMapping

public void setSystemBrowserMapping(java.lang.String userAgent,
                                    int profileId)
                             throws java.lang.Exception
Description copied from interface: IUserLayoutStore
establish system profile browser mapping

Specified by:
setSystemBrowserMapping in interface IUserLayoutStore
Parameters:
userAgent - User-Agent header string
profileId - profile id of a profile to which given user-agent will be mapped
Throws:
java.lang.Exception

getSystemBrowserMapping

private int getSystemBrowserMapping(java.lang.String userAgent)
                             throws java.lang.Exception
Throws:
java.lang.Exception

getUserProfile

public UserProfile getUserProfile(IPerson person,
                                  java.lang.String userAgent)
                           throws java.lang.Exception
Description copied from interface: IUserLayoutStore
Obtain user profile associated with a particular browser

Specified by:
getUserProfile in interface IUserLayoutStore
Parameters:
person - User
userAgent - User-Agent header string
Returns:
user profile or null if no user profiles are associated with the given user agent.
Throws:
java.lang.Exception

getSystemProfile

public UserProfile getSystemProfile(java.lang.String userAgent)
                             throws java.lang.Exception
Description copied from interface: IUserLayoutStore
retreive a system profile associated with a given browser

Specified by:
getSystemProfile in interface IUserLayoutStore
Parameters:
userAgent - User-Agent header string
Returns:
profile object
Throws:
java.lang.Exception

getSystemProfileById

public UserProfile getSystemProfileById(int profileId)
                                 throws java.lang.Exception
Description copied from interface: IUserLayoutStore
Obtain a system profile

Specified by:
getSystemProfileById in interface IUserLayoutStore
Parameters:
profileId - system profile id
Throws:
java.lang.Exception

getSystemProfileList

public java.util.Hashtable getSystemProfileList()
                                         throws java.lang.Exception
Description copied from interface: IUserLayoutStore
obtain a list of system profiles

Specified by:
getSystemProfileList in interface IUserLayoutStore
Returns:
a Hashtable mapping system profile ids (Integer objects) to the UserProfile objects
Throws:
java.lang.Exception

updateSystemProfile

public void updateSystemProfile(UserProfile profile)
                         throws java.lang.Exception
Description copied from interface: IUserLayoutStore
update system profile

Specified by:
updateSystemProfile in interface IUserLayoutStore
Parameters:
profile - profile object
Throws:
java.lang.Exception

addSystemProfile

public UserProfile addSystemProfile(UserProfile profile)
                             throws java.lang.Exception
Description copied from interface: IUserLayoutStore
add a new system profile to the database. During this process, a new profile id will be assigned to the profile.

Specified by:
addSystemProfile in interface IUserLayoutStore
Parameters:
profile - profile object (profile id within will be overwritten)
Returns:
profile with an newly assigned id
Throws:
java.lang.Exception

deleteSystemProfile

public void deleteSystemProfile(int profileId)
                         throws java.lang.Exception
Description copied from interface: IUserLayoutStore
remove system profile from the database

Specified by:
deleteSystemProfile in interface IUserLayoutStore
Parameters:
profileId - profile id
Throws:
java.lang.Exception

getUserPreferences

public UserPreferences getUserPreferences(IPerson person,
                                          int profileId)
                                   throws java.lang.Exception
Throws:
java.lang.Exception

getUserPreferences

public UserPreferences getUserPreferences(IPerson person,
                                          UserProfile profile)
                                   throws java.lang.Exception
Description copied from interface: IUserLayoutStore
Retreive the entire UserPreferences object

Specified by:
getUserPreferences in interface IUserLayoutStore
Parameters:
person - User
profile - profile
Returns:
user preferences
Throws:
java.lang.Exception

putUserPreferences

public void putUserPreferences(IPerson person,
                               UserPreferences up)
                        throws java.lang.Exception
Description copied from interface: IUserLayoutStore
save user preferences

Specified by:
putUserPreferences in interface IUserLayoutStore
Parameters:
person - User
up - user preferences object
Throws:
java.lang.Exception

getLayoutID

protected int getLayoutID(int userId,
                          int profileId)
                   throws java.sql.SQLException
Returns the current layout ID for the user and profile. If the profile doesn't exist or the layout_id field is null 0 is returned.

Parameters:
userId - The userId for the profile
profileId - The profileId for the profile
Returns:
The layout_id field or 0 if it does not exist or is null
Throws:
java.sql.SQLException