Project

General

Profile

1
/**
2
 *  '$RCSfile$'
3
 *    Purpose: A Class that stores user session information 
4
 *  Copyright: 2008 Regents of the University of California and the
5
 *             National Center for Ecological Analysis and Synthesis
6
 *    Authors: Michael Daigle
7
 * 
8
 *   '$Author: daigle $'
9
 *     '$Date: 2009-08-14 14:26:08 -0700 (Fri, 14 Aug 2009) $'
10
 * '$Revision: 5027 $'
11
 *
12
 * This program is free software; you can redistribute it and/or modify
13
 * it under the terms of the GNU General Public License as published by
14
 * the Free Software Foundation; either version 2 of the License, or
15
 * (at your option) any later version.
16
 *
17
 * This program is distributed in the hope that it will be useful,
18
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20
 * GNU General Public License for more details.
21
 *
22
 * You should have received a copy of the GNU General Public License
23
 * along with this program; if not, write to the Free Software
24
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
25
 */
26

    
27
package edu.ucsb.nceas.metacat.util;
28

    
29
import java.util.Calendar;
30
import java.util.Date;
31

    
32
import org.apache.log4j.Logger;
33

    
34
import edu.ucsb.nceas.metacat.cart.DocumentCart;
35

    
36
public class SessionData {
37
	
38
	private String id = null;
39
	private String userName = null;
40
	private String[] groupNames = null;
41
	private String password = null;
42
	private final Calendar creationTime = Calendar.getInstance();
43
	private Calendar lastAccessedTime = Calendar.getInstance();
44
	private DocumentCart documentCart = null;
45
	
46
	private Logger logMetacat = Logger.getLogger(SessionData.class);
47
	
48
	/**
49
	 * 
50
	 * @param userName
51
	 * @param groupNames
52
	 * @param password
53
	 */
54
	public SessionData(String id, String userName, String[] groupNames, String password) {
55
		this.id = id;
56
		this.userName = userName;
57
		this.groupNames = groupNames;
58
		this.password = password;
59
	}
60
	
61
	public String getId() {
62
		return id;
63
	}
64
	
65
	public String getUserName() {
66
		return userName;
67
	}
68
	
69
	public void setUserName(String userName) {
70
		this.userName = userName;
71
	}
72
	
73
	public String[] getGroupNames() {
74
		return groupNames;
75
	}
76
	
77
	public void setGroupNames(String[] groupNames) {
78
		this.groupNames = groupNames;
79
	}
80
	
81
	public String getPassword() {
82
		return password;
83
	}
84
	
85
	public void setPassword(String password) {
86
		this.password = password;
87
	}
88
	
89
	public Calendar getLastAccessedTime() {
90
		return lastAccessedTime;
91
	}
92
	
93
	public void setLastAccessedTime() {
94
		lastAccessedTime.setTime(new Date());
95
	}
96
	
97
	public Calendar getCreationTime() {
98
		return creationTime;
99
	}
100

    
101
	public DocumentCart getDocumentCart() {
102
		if (documentCart == null) {
103
			documentCart = new DocumentCart();
104
		}
105
		return documentCart;
106
	}
107

    
108
	public void setDocumentCart(DocumentCart documentCart) {
109
		this.documentCart = documentCart;
110
	}
111
}
(12-12/14)