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-10-02 12:59:59 -0700 (Fri, 02 Oct 2009) $'
10
 * '$Revision: 5070 $'
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 String name = null;
43
	private final Calendar creationTime = Calendar.getInstance();
44
	private Calendar lastAccessedTime = Calendar.getInstance();
45
	private DocumentCart documentCart = null;
46
	
47
	private Logger logMetacat = Logger.getLogger(SessionData.class);
48
	
49
	/**
50
	 * 
51
	 * @param userName
52
	 * @param groupNames
53
	 * @param password
54
	 */
55
	public SessionData(String id, String userName, String[] groupNames, String password, String name) {
56
		this.id = id;
57
		this.userName = userName;
58
		this.groupNames = groupNames;
59
		this.password = password;
60
		this.name = name;
61
	}
62
	
63
	public String getId() {
64
		return id;
65
	}
66
	
67
	public String getUserName() {
68
		return userName;
69
	}
70
	
71
	public void setUserName(String userName) {
72
		this.userName = userName;
73
	}
74
	
75
	public String[] getGroupNames() {
76
		return groupNames;
77
	}
78
	
79
	public void setGroupNames(String[] groupNames) {
80
		this.groupNames = groupNames;
81
	}
82
	
83
	public String getPassword() {
84
		return password;
85
	}
86
	
87
	public void setPassword(String password) {
88
		this.password = password;
89
	}
90
	
91
	public String getName() {
92
		return name;
93
	}
94
	
95
	public void setName(String name) {
96
		this.name = name;
97
	}
98
	
99
	public Calendar getLastAccessedTime() {
100
		return lastAccessedTime;
101
	}
102
	
103
	public void setLastAccessedTime() {
104
		lastAccessedTime.setTime(new Date());
105
	}
106
	
107
	public Calendar getCreationTime() {
108
		return creationTime;
109
	}
110

    
111
	public DocumentCart getDocumentCart() {
112
		if (documentCart == null) {
113
			documentCart = new DocumentCart();
114
		}
115
		return documentCart;
116
	}
117

    
118
	public void setDocumentCart(DocumentCart documentCart) {
119
		this.documentCart = documentCart;
120
	}
121
}
(12-12/14)