001: /* Copyright 2001 The JA-SIG Collaborative. All rights reserved.
002: * See license distributed with this file and
003: * available online at http://www.uportal.org/license.html
004: */
005:
006: package org.jasig.portal;
007:
008: import javax.servlet.http.HttpServletRequest;
009: import javax.servlet.http.HttpSessionBindingEvent;
010:
011: import org.jasig.portal.layout.IUserLayoutManager;
012: import org.jasig.portal.security.IPerson;
013:
014: /**
015: * A class that allows <code>GuestUserPreferencesManager</code> to be presented as <code>IUserpreferencesManager</code>.
016: *
017: * @author Peter Kharchenko {@link <a href="mailto:pkharchenko@interactivebusiness.com">pkharchenko@interactivebusiness.com</a>}
018: * @version $Revision: 36690 $
019: */
020: public class GuestUserPreferencesManagerWrapper implements
021: IUserPreferencesManager {
022: String sessionId;
023: GuestUserPreferencesManager gulm;
024:
025: public GuestUserPreferencesManagerWrapper() {
026: sessionId = null;
027: gulm = null;
028: }
029:
030: /**
031: * Creates a new <code>GuestUserpreferencesManagerWrapper</code> instance.
032: *
033: * @param gulm a <code>GuestUserpreferencesManager</code> value
034: * @param sessionId a <code>String</code> value
035: */
036: public GuestUserPreferencesManagerWrapper(
037: GuestUserPreferencesManager gulm, String sessionId) {
038: this .gulm = gulm;
039: this .sessionId = sessionId;
040: }
041:
042: /* This function processes request parameters related to
043: * setting Structure/Theme stylesheet parameters and attributes.
044: * (uP_sparam, uP_tparam, uP_sfattr, uP_scattr uP_tcattr)
045: * It also processes layout root requests (uP_root)
046: * @param req current <code>HttpServletRequest</code>
047: */
048: public void processUserPreferencesParameters(HttpServletRequest req) {
049: this .gulm.processUserPreferencesParameters(req);
050: }
051:
052: /**
053: * Returns current person object
054: * @return current <code>IPerson</code>
055: */
056: public IPerson getPerson() {
057: return this .gulm.getPerson();
058: }
059:
060: /**
061: * Determine if the user agent associated with this session has been successfuly mapped to a profile
062: * @return <code>true</code> if no mapping was found
063: */
064: public boolean isUserAgentUnmapped() {
065: return this .gulm.isUserAgentUnmapped(this .sessionId);
066: }
067:
068: /*
069: * Resets both user layout and user preferences.
070: * Note that if any of the two are "null", old values will be used.
071: */
072: public void setNewUserLayoutAndUserPreferences(
073: IUserLayoutManager newLayout, UserPreferences newPreferences)
074: throws PortalException {
075: this .gulm.setNewUserLayoutAndUserPreferences(newLayout,
076: newPreferences, this .sessionId);
077: }
078:
079: /**
080: * Returns a copy of the user preferences
081: * @return a copy of the <code>UserPreferences</code> object
082: */
083: public UserPreferences getUserPreferencesCopy() {
084: return this .gulm.getUserPreferencesCopy(this .sessionId);
085: }
086:
087: /**
088: * Returns current profile.
089: * @return current <code>UserProfile</code>
090: */
091: public UserProfile getCurrentProfile() {
092: return this .gulm.getCurrentProfile(this .sessionId);
093: }
094:
095: /**
096: * Returns current theme stylesheet description
097: * @return current <code>ThemeStylesheetDescription</code>
098: */
099: public ThemeStylesheetDescription getThemeStylesheetDescription()
100: throws Exception {
101: return this .gulm.getThemeStylesheetDescription(this .sessionId);
102: }
103:
104: /**
105: * Returns current structure stylesheet description
106: * @return current <code>StructureStylesheetDescription</code>
107: */
108: public StructureStylesheetDescription getStructureStylesheetDescription()
109: throws Exception {
110: return this .gulm
111: .getStructureStylesheetDescription(this .sessionId);
112: }
113:
114: public IUserLayoutManager getUserLayoutManager() {
115: return this .gulm.getUserLayoutManager(this .sessionId);
116: }
117:
118: /**
119: * Returns current user preferences.
120: * @return current <code>UserPreferences</code>
121: */
122: public UserPreferences getUserPreferences() {
123: return this .gulm.getUserPreferences(this .sessionId);
124: }
125:
126: public void finishedSession(HttpSessionBindingEvent bindingEvent) {
127: this.gulm.finishedSession(bindingEvent, this.sessionId);
128: }
129:
130: }
|