org.jasig.portal.layout.dlm
Class RDBMDistributedLayoutStore

java.lang.Object
  extended by org.jasig.portal.layout.simple.RDBMUserLayoutStore
      extended by org.jasig.portal.layout.dlm.RDBMDistributedLayoutStore
All Implemented Interfaces:
IUserLayoutStore

public class RDBMDistributedLayoutStore
extends RDBMUserLayoutStore

This class extends RDBMUserLayoutStore and implements instantiating and storing layouts that conform to the design of the distribute layout management system. These layouts consist of two types: layout fragments that are the layouts owned by a user specified in dlm.xml, and composite view layouts which represent regular users with zero or more UI elements incorporated from layout fragments. Only a user's personal layout fragment is

Since:
uPortal 2.5
Version:
$Revision: 21852 $ $Date: 2010-10-01 16:08:52 -0500 (Fri, 01 Oct 2010) $

Field Summary
static String RCS_ID
           
 
Fields inherited from class org.jasig.portal.layout.simple.RDBMUserLayoutStore
channelPrefix, channelRegistryStore, counterStore, DEBUG, folderPrefix, localeAware, log, personManager
 
Constructor Summary
RDBMDistributedLayoutStore()
           
 
Method Summary
 Integer addStructureStylesheetDescription(StructureStylesheetDescription ssd)
          Registers a NEW structure stylesheet with the database.
 Integer addThemeStylesheetDescription(ThemeStylesheetDescription tsd)
          Registers a NEW theme stylesheet with the database.
 void cleanFragments()
          Cleans out the layout fragments.
 org.dom4j.Element exportLayout(IPerson person, UserProfile profile)
          Returns an Element representing the user's layout and UserPreferences (but not portlet preferences) formatted for export.
 Map<String,Document> getFragmentLayoutCopies()
          Method for acquiring copies of fragment layouts to assist in debugging.
 double getFragmentPrecedence(int index)
          Returns a double value indicating the precedence value declared for a fragment in the dlm.xml.
 String getNextStructDirectiveId(IPerson person)
          Generates a new struct id for directive elements that dlm places in the PLF version of the layout tree.
static Document getPLF(IPerson person)
           
 String getProperty(String name)
          Returns the specified property loaded from dlm.xml or null if not found.
 int getPropertyCount()
          Returns the number of properties loaded from the dlm.xml file.
protected  Element getStructure(Document doc, LayoutStructure ls)
           
 StructureStylesheetDescription getStructureStylesheetDescription(int stylesheetId)
          Obtain structure stylesheet description object for a given structure stylesheet id.
 StructureStylesheetUserPreferences getStructureStylesheetUserPreferences(IPerson person, int profileId, int stylesheetId)
          Obtain structure stylesheet user preferences
 ThemeStylesheetDescription getThemeStylesheetDescription(int stylesheetId)
          Obtain theme stylesheet description object for a given theme stylesheet id.
 ThemeStylesheetUserPreferences getThemeStylesheetUserPreferences(IPerson person, int profileId, int stylesheetId)
          Obtain theme stylesheet user preferences
 Document getUserLayout(IPerson person, UserProfile profile)
          Returns the layout for a user decorated with any specified decorator.
 void importLayout(org.dom4j.Element layout)
          Performs the reverse of exportLayout.
 boolean isFragmentOwner(IPerson person)
          Determines if a user is a fragment owner.
 void removeStructureStylesheetDescription(int stylesheetId)
          Removes a structure stylesheet description object for a given structure stylesheet id.
 void removeThemeStylesheetDescription(int stylesheetId)
          Removes a theme stylesheet description object for a given theme stylesheet id.
protected  int saveStructure(Node node, PreparedStatement structStmt, PreparedStatement parmStmt)
           
 void setLookupNoderefTask(org.danann.cernunnos.Task k)
           
 void setLookupPathrefTask(org.danann.cernunnos.Task k)
           
 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
 void setUserLayout(IPerson person, UserProfile profile, Document layoutXML, boolean channelsAdded)
          This method overrides the same method in the super class to persist only layout information stored in the user's person layout fragment or PLF.
 void updateStructureStylesheetDescription(StructureStylesheetDescription ssd)
          Updates an existing structure stylesheet description with a new one.
 void updateThemeStylesheetDescription(ThemeStylesheetDescription tsd)
          Updates an existing structure stylesheet description with a new one.
 
Methods inherited from class org.jasig.portal.layout.simple.RDBMUserLayoutStore
addStructureStylesheetDescription, addSystemProfile, addThemeStylesheetDescription, addUserProfile, channelApproved, createLayout, deleteSystemProfile, deleteUserProfile, dumpDoc, generateNewChannelSubscribeId, generateNewFolderId, getLayoutID, getMimeTypeList, getNextStructId, getStructId, getStructureStylesheetId, getStructureStylesheetList, getStructureStylesheetList, getSystemProfile, getSystemProfileByFname, getSystemProfileById, getSystemProfileList, getThemeStylesheetId, getThemeStylesheetList, getThemeStylesheetList, getUserPreferences, getUserPreferences, getUserProfile, getUserProfileByFname, getUserProfileById, getUserProfileList, putUserPreferences, setSystemBrowserMapping, setUserBrowserMapping, updateStructureStylesheetDescription, updateSystemProfile, updateThemeStylesheetDescription, updateUserProfile, xmlBool
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RCS_ID

public static final String RCS_ID
See Also:
Constant Field Values
Constructor Detail

RDBMDistributedLayoutStore

public RDBMDistributedLayoutStore()
                           throws Exception
Throws:
Exception
Method Detail

setLookupNoderefTask

public void setLookupNoderefTask(org.danann.cernunnos.Task k)

setLookupPathrefTask

public void setLookupPathrefTask(org.danann.cernunnos.Task k)

getFragmentLayoutCopies

public Map<String,Document> getFragmentLayoutCopies()
                                             throws Exception
Method for acquiring copies of fragment layouts to assist in debugging. No infrastructure code calls this but channels designed to expose the structure of the cached fragments use this to obtain copies.

Returns:
Map
Throws:
Exception

addStructureStylesheetDescription

public Integer addStructureStylesheetDescription(StructureStylesheetDescription ssd)
                                          throws Exception
Registers a NEW structure stylesheet with the database. This overloads the version in the parent to add caching of stylesheets.

Overrides:
addStructureStylesheetDescription in class RDBMUserLayoutStore
Parameters:
ssd - Stylesheet description object
Returns:
Integer
Throws:
Exception

addThemeStylesheetDescription

public Integer addThemeStylesheetDescription(ThemeStylesheetDescription tsd)
                                      throws Exception
Registers a NEW theme stylesheet with the database. This overloads the version in the parent to add caching of stylesheets.

Overrides:
addThemeStylesheetDescription in class RDBMUserLayoutStore
Parameters:
tsd - Stylesheet description object
Returns:
an Integer id of the registered Theme Stylesheet if successful; null otherwise.
Throws:
Exception

getStructureStylesheetDescription

public StructureStylesheetDescription getStructureStylesheetDescription(int stylesheetId)
                                                                 throws Exception
Obtain structure stylesheet description object for a given structure stylesheet id. Overloads parent version to add caching of stylesheets.

Specified by:
getStructureStylesheetDescription in interface IUserLayoutStore
Overrides:
getStructureStylesheetDescription in class RDBMUserLayoutStore
Parameters:
stylesheetId - id of the structure stylesheet
Returns:
structure stylesheet description
Throws:
Exception

getThemeStylesheetDescription

public ThemeStylesheetDescription getThemeStylesheetDescription(int stylesheetId)
                                                         throws Exception
Obtain theme stylesheet description object for a given theme stylesheet id. Overloads a parent version to add caching.

Specified by:
getThemeStylesheetDescription in interface IUserLayoutStore
Overrides:
getThemeStylesheetDescription in class RDBMUserLayoutStore
Parameters:
stylesheetId - id of the theme stylesheet
Returns:
theme stylesheet description
Throws:
Exception

removeStructureStylesheetDescription

public void removeStructureStylesheetDescription(int stylesheetId)
                                          throws Exception
Removes a structure stylesheet description object for a given structure stylesheet id. Overloads a parent version for cache handling.

Specified by:
removeStructureStylesheetDescription in interface IUserLayoutStore
Overrides:
removeStructureStylesheetDescription in class RDBMUserLayoutStore
Parameters:
stylesheetId - id of the structure stylesheet
Throws:
Exception

removeThemeStylesheetDescription

public void removeThemeStylesheetDescription(int stylesheetId)
                                      throws Exception
Removes a theme stylesheet description object for a given theme stylesheet id. Overloads a parent version for cache handling.

Specified by:
removeThemeStylesheetDescription in interface IUserLayoutStore
Overrides:
removeThemeStylesheetDescription in class RDBMUserLayoutStore
Parameters:
stylesheetId - id of the theme stylesheet
Throws:
Exception

updateStructureStylesheetDescription

public void updateStructureStylesheetDescription(StructureStylesheetDescription ssd)
                                          throws 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. Overloads version in parent to add cache support.

Overrides:
updateStructureStylesheetDescription in class RDBMUserLayoutStore
Parameters:
ssd - new stylesheet description
Throws:
Exception

updateThemeStylesheetDescription

public void updateThemeStylesheetDescription(ThemeStylesheetDescription tsd)
                                      throws 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. Overloads version in parent to add cache support.

Overrides:
updateThemeStylesheetDescription in class RDBMUserLayoutStore
Parameters:
tsd - new stylesheet description
Throws:
Exception

cleanFragments

public void cleanFragments()
Cleans out the layout fragments. This is done so that changes made to the channels within a layout are visible to the users who have that layout incorporated into their own. The interval at which this thread runs is set in the dlm.xml file as 'org.jasig.portal.layout.dlm.RDBMDistributedLayoutStore.fragment_cache_refresh', specified in minutes.


getFragmentPrecedence

public double getFragmentPrecedence(int index)
Returns a double value indicating the precedence value declared for a fragment in the dlm.xml. Precedence is actually based on two elements in a fragment definition: the precedence and the index of the fragment definition in the dlm.xml file. If two fragments are given equal precedence then the index if relied upon to resolve conflicts with UI elements.


getUserLayout

public Document getUserLayout(IPerson person,
                              UserProfile profile)
                       throws Exception
Returns the layout for a user decorated with any specified decorator. The layout returned is a composite layout for non fragment owners and a regular layout for layout owners. A composite layout is made up of layout pieces from potentially multiple incorporated layouts. If no layouts are defined then the composite layout will be the same as the user's personal layout fragment or PLF, the one holding only those UI elements that they own or incorporated elements that they have been allowed to changed.

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

exportLayout

public org.dom4j.Element exportLayout(IPerson person,
                                      UserProfile profile)
Description copied from interface: IUserLayoutStore
Returns an Element representing the user's layout and UserPreferences (but not portlet preferences) formatted for export. This element must have an element name of <layout>. Exported documents must not reference database identifiers and should exclude unnecessary items like channel publishing parameters, etc. Layout store implementations are may return null for users that don't have layout or preferences customizations.

Parameters:
person - An IPerson object specifying the user
profile - A valid profile for person
Returns:
A streamlined Document containing user layout and UserPreferences data

importLayout

public void importLayout(org.dom4j.Element layout)
Description copied from interface: IUserLayoutStore
Performs the reverse of exportLayout. The specified element must have an element name of <layout> and contain both content and UserPreferences data.

Parameters:
layout - XML representing a user's layout and UserPreferences

getNextStructDirectiveId

public String getNextStructDirectiveId(IPerson person)
                                throws Exception
Generates a new struct id for directive elements that dlm places in the PLF version of the layout tree. These elements are atifacts of the dlm storage model and used during merge but do not appear in the user's composite view.

Throws:
Exception

isFragmentOwner

public boolean isFragmentOwner(IPerson person)
Determines if a user is a fragment owner.

Parameters:
person -
Returns:

setUserLayout

public void setUserLayout(IPerson person,
                          UserProfile profile,
                          Document layoutXML,
                          boolean channelsAdded)
                   throws Exception
This method overrides the same method in the super class to persist only layout information stored in the user's person layout fragment or PLF. If this person is a layout owner then their changes are pushed into the appropriate layout fragment.

Specified by:
setUserLayout in interface IUserLayoutStore
Overrides:
setUserLayout in class RDBMUserLayoutStore
Parameters:
person - an IPerson object specifying the user
profile - a user profile for which the layout is being stored
layoutXML - a Document containing user layout (conforming to userLayout.dtd)
channelsAdded - a boolean flag specifying if new channels have been added to the current user layout (for performance optimization purposes)
Throws:
Exception - if an error occurs

getPropertyCount

public int getPropertyCount()
Returns the number of properties loaded from the dlm.xml file.


getProperty

public String getProperty(String name)
Returns the specified property loaded from dlm.xml or null if not found.


getStructureStylesheetUserPreferences

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

Specified by:
getStructureStylesheetUserPreferences in interface IUserLayoutStore
Specified by:
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:
Exception

getThemeStylesheetUserPreferences

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

Specified by:
getThemeStylesheetUserPreferences in interface IUserLayoutStore
Specified by:
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:
Exception

getStructure

protected Element getStructure(Document doc,
                               LayoutStructure ls)
                        throws Exception
Specified by:
getStructure in class RDBMUserLayoutStore
Throws:
Exception

saveStructure

protected int saveStructure(Node node,
                            PreparedStatement structStmt,
                            PreparedStatement parmStmt)
                     throws Exception
Specified by:
saveStructure in class RDBMUserLayoutStore
Throws:
Exception

getPLF

public static Document getPLF(IPerson person)
                       throws PortalException
Throws:
PortalException

setStructureStylesheetUserPreferences

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

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

setThemeStylesheetUserPreferences

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

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


Copyright © 2010 Jasig. All Rights Reserved.