001: /*
002: * Enhydra Java Application Server Project
003: *
004: * The contents of this file are subject to the Enhydra Public License
005: * Version 1.1 (the "License"); you may not use this file except in
006: * compliance with the License. You may obtain a copy of the License on
007: * the Enhydra web site ( http://www.enhydra.org/ ).
008: *
009: * Software distributed under the License is distributed on an "AS IS"
010: * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
011: * the License for the specific terms governing rights and limitations
012: * under the License.
013: *
014: * The Initial Developer of the Enhydra Application Server is Lutris
015: * Technologies, Inc. The Enhydra Application Server and portions created
016: * by Lutris Technologies, Inc. are Copyright Lutris Technologies, Inc.
017: * All Rights Reserved.
018: *
019: * Contributor(s):
020: *
021: * $Id: TransactionsDiscRackSessionData.java,v 1.1 2006-09-11 12:47:00 sinisa Exp $
022: */
023:
024: package transactionsDiscRack.presentation;
025:
026: import transactionsDiscRack.spec.*;
027:
028: /**
029: * Object that will be held in session data. This should be the only object held
030: * there. Methods should be called on this object to set and get data.
031: */
032: public class TransactionsDiscRackSessionData implements
033: java.io.Serializable {
034:
035: /**
036: * Hash key to save session data for the DiscRack app in the Session
037: */
038: public static final String SESSION_KEY = "DiscRackSessionData";
039:
040: protected String userHandle = null;
041:
042: protected String userLogin = null;
043:
044: protected String userPassword = null;
045:
046: protected String userFirstName = null;
047:
048: protected String userLastName = null;
049:
050: protected String userMessage = null;
051:
052: /**
053: * Sets the person object
054: *
055: * @param thePerson
056: * the person object
057: */
058: public void setUser(Person thePerson) {
059: // this.myUser = thePerson;
060: try {
061: this .userHandle = thePerson.getHandle();
062: this .userFirstName = thePerson.getFirstname();
063: this .userLastName = thePerson.getLastname();
064: this .userLogin = thePerson.getLogin();
065: this .userPassword = thePerson.getPassword();
066: } catch (TransactionsDiscRackException tdre) {
067: // user nopt initialized
068: }
069: }
070:
071: /**
072: * Gets the person attribute
073: *
074: * @return attValue
075: */
076:
077: public String getUserHandle() {
078: return this .userHandle;
079: }
080:
081: public String getUserFirstName() {
082: return this .userFirstName;
083: }
084:
085: public String getUserLastName() {
086: return this .userLastName;
087: }
088:
089: public String getUserLogin() {
090: return this .userLogin;
091: }
092:
093: public String getUserPassword() {
094: return this .userPassword;
095: }
096:
097: /**
098: * Method to remove the current user from the session
099: */
100: public void removeUser() {
101: // this.myUser = null;
102: this .userHandle = null;
103: this .userFirstName = null;
104: this .userLastName = null;
105: this .userLogin = null;
106: this .userPassword = null;
107: }
108:
109: /**
110: * Sets the message
111: *
112: * @param msg
113: * the message to be set
114: */
115: public void setUserMessage(String msg) {
116: this .userMessage = msg;
117: }
118:
119: /**
120: * Retrieve the most recent user message and then clear it so no other app
121: * tries to use it.
122: */
123: public String getAndClearUserMessage() {
124: String msg = this.userMessage;
125: this.userMessage = null;
126: return msg;
127: }
128: }
|