001: /*
002: * Copyright (c) 1999-2001 Lutris Technologies, Inc. All Rights
003: * Reserved.
004: *
005: * This source code file is distributed by Lutris Technologies, Inc. for
006: * use only by licensed users of product(s) that include this source
007: * file. Use of this source file or the software that uses it is covered
008: * by the terms and conditions of the Lutris Enhydra Development License
009: * Agreement included with this product.
010: *
011: * This Software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF
012: * ANY KIND, either express or implied. See the License for the specific terms
013: * governing rights and limitations under the License.
014: *
015: * Contributor(s):
016: *
017: * $Id: AirSentSessionData.java,v 1.1 2006-09-11 12:29:11 sinisa Exp $
018: */
019:
020: package com.lutris.airsent.presentation;
021:
022: import com.lutris.airsent.spec.customer.*;
023: import com.lutris.airsent.spec.messenger.Messenger;
024: import com.lutris.airsent.spec.delivery.OrderForm;
025:
026: import java.util.*;
027:
028: /**
029: * Object that will be held in session data. This should
030: * be the only object held there. Methods should be called
031: * on this object to set and get data.
032: */
033: public class AirSentSessionData implements java.io.Serializable {
034:
035: /**
036: * Hash key to save session data for the CoreTest app in the Session
037: */
038: public static final String SESSION_KEY = "AirSentSessionData";
039: private int AUTHORIZATION = AirSentConstants.UNAUTH_USER;
040: protected String userMessage = null;
041: private Messenger messenger = null;
042: private Customer customer = null;
043: private OrderForm orderForm = null;
044: private long browserState = System.currentTimeMillis();
045:
046: /**
047: * Gets the user authentication code.
048: *
049: *
050: * @return
051: *
052: */
053: public int getUserAuth() {
054: return AUTHORIZATION;
055: }
056:
057: /**
058: * Sets the user authentication code.
059: *
060: *
061: * @param auth
062: *
063: *
064: */
065: public void setUserAuth(int auth) {
066: this .AUTHORIZATION = auth;
067: }
068:
069: /**
070: * Set the messenger in the session data.
071: *
072: *
073: * @param messenger
074: *
075: *
076: */
077: public void setMessenger(Messenger messenger) {
078: this .messenger = messenger;
079: }
080:
081: /**
082: * Set the customer in the session data.
083: *
084: *
085: * @param customer
086: *
087: *
088: */
089: public void setCustomer(Customer customer) {
090: this .customer = customer;
091: }
092:
093: /**
094: * Gets the messenger user
095: *
096: */
097: public Messenger getMessenger() {
098: return messenger;
099: }
100:
101: /**
102: * Gets the customer user
103: *
104: */
105: public Customer getCustomer() {
106: return customer;
107: }
108:
109: /**
110: * Sets the user message
111: *
112: * @param msg the message to be set
113: */
114: public void setUserMessage(String msg) {
115: this .userMessage = msg;
116: }
117:
118: /**
119: * Retrieve the most recent user message and then clear it so no
120: * other app tries to use it.
121: */
122: public String getAndClearUserMessage() {
123: String msg = this .userMessage;
124:
125: this .userMessage = null;
126:
127: return msg;
128: }
129:
130: /**
131: * Sets the browser state for
132: * server push functionality.
133: *
134: * @param browserState
135: *
136: *
137: */
138: public void setBrowserState(long browserState) {
139: this .browserState = browserState;
140: }
141:
142: /**
143: * Gets the browser state for
144: * server push functionality.
145: *
146: *
147: * @return
148: *
149: *
150: */
151: public long getBrowserState() {
152: return browserState;
153: }
154:
155: public void setOrderForm(OrderForm d) {
156: orderForm = d;
157: }
158:
159: public OrderForm getOrderForm() {
160: return orderForm;
161: }
162: }
|