DiscRackSessionData.java :  » J2EE » Enhydra-Demos » barracudaDiscRack » presentation » Java Open Source

Java Open Source » J2EE » Enhydra Demos 
Enhydra Demos » barracudaDiscRack » presentation » DiscRackSessionData.java
/*
 * Enhydra Java Application Server Project
 * 
 * The contents of this file are subject to the Enhydra Public License
 * Version 1.1 (the "License"); you may not use this file except in
 * compliance with the License. You may obtain a copy of the License on
 * the Enhydra web site ( http://www.enhydra.org/ ).
 * 
 * Software distributed under the License is distributed on an "AS IS"
 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 
 * the License for the specific terms governing rights and limitations
 * under the License.
 * 
 * The Initial Developer of the Enhydra Application Server is Lutris
 * Technologies, Inc. The Enhydra Application Server and portions created
 * by Lutris Technologies, Inc. are Copyright Lutris Technologies, Inc.
 * All Rights Reserved.
 * 
 * Contributor(s):
 * 
 * $Id: DiscRackSessionData.java,v 1.1 2006-09-11 12:30:36 sinisa Exp $
 */

package barracudaDiscRack.presentation;

import barracudaDiscRack.business.person.Person;

/**
 * Object that will be held in session data.  This should
 * be the only object held there.  Methods should be called
 * on this object to set and get data.
 */
public class DiscRackSessionData {
    
    /**
     * Hash key to save session data for the DiscRack app in the Session
     */
    public static final String SESSION_KEY = "DiscRackSessionData";
    
    protected Person myUser = null;
    protected String userMessage = null;
    
    /**
     * Sets the person object
     *
     * @param thePerson the person object
     */
    public void setUser(Person thePerson) {
        this.myUser = thePerson;
    }
    
    /**
     * Gets the person object
     *
     * @return person
     */
    public Person getUser() {
        return this.myUser;
    }    
    
    /**
     * Method to remove the current user from the session
     */
    public void removeUser() {
        this.myUser = null;
    }

    /**
     * Sets the message
     *
     * @param msg the message to be set
     */
    public void setUserMessage(String msg) {
        this.userMessage = msg;
    }
    
    /**
     * Retrieve the most recent user message and then clear it so no
     * other app tries to use it.
     */
    public String getAndClearUserMessage() {
        String msg = this.userMessage;
        this.userMessage = null;
        return msg;
    }
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.