001/*
002 $Id: SessionData.java 3207 2009-04-09 06:48:11Z gregory $
003
004        Copyright (C) 2006 Gregory Vincic, Olle Mansson
005        Copyright (C) 2007 Gregory Vincic
006
007        This file is part of Proteios.
008        Available at http://www.proteios.org/
009
010        Proteios is free software; you can redistribute it and/or modify it
011        under the terms of the GNU General Public License as published by
012        the Free Software Foundation; either version 2 of the License, or
013        (at your option) any later version.
014
015        Proteios is distributed in the hope that it will be useful, but
016        WITHOUT ANY WARRANTY; without even the implied warranty of
017        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
018        General Public License for more details.
019
020        You should have received a copy of the GNU General Public License
021        along with this program; if not, write to the Free Software
022        Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
023        02111-1307, USA.
024 */
025package org.proteios.core.data;
026
027import java.util.Date;
028
029/**
030        This class holds information about a session.
031 
032        @author enell
033        @version 2.0
034        @see org.proteios.core.Session
035        @see <a href="../../../../../../../development/overview/data/clients.html">Session and client overview</a>
036        @hibernate.class table="`Sessions`" lazy="false"
037*/
038public class SessionData
039        extends BasicData
040{
041        public SessionData()
042        {}
043        
044        private UserData user;
045        /**
046                Get the user that logged in with this session.
047                @hibernate.many-to-one column="`user_id`" not-null="true" update="false" outer-join="false"
048        */
049        public UserData getUser()
050        {
051                return user;
052        }
053        
054        public void setUser(UserData user)
055        {
056                this.user = user;
057        }
058                
059        private Date loginTime;
060        /**
061                Get the date and time the user logged in.
062                @hibernate.property column="`login_time`" type="timestamp" not-null="true" update="false"
063        */
064        public Date getLoginTime()
065        {
066                return loginTime;
067        }
068        
069        public void setLoginTime(Date loginTime)
070        {
071                this.loginTime = loginTime;
072        }
073
074        private Date logoutTime;
075        /**
076                Get the date and time the user logged out.
077                @hibernate.property column="`logout_time`" type="timestamp" not-null="false"
078        */
079        public Date getLogoutTime()
080        {
081                return logoutTime;
082        }
083        
084        public void setLogoutTime(Date logoutTime)
085        {
086                this.logoutTime = logoutTime;
087        }
088
089        /**
090                The maximum length of the login comment that can be stored in the database.
091                @see #setLoginComment(String)
092        */
093        public static final int MAX_LOGIN_COMMENT_LENGTH = 65535;
094        private String loginComment;
095        /**
096                Get the login comment.
097                @hibernate.property column="`login_comment`" type="text" not-null="false" update="false"
098        */
099        public String getLoginComment()
100        {
101                return loginComment;
102        }
103        
104        public void setLoginComment(String loginComment)
105        {
106                this.loginComment = loginComment;
107        }
108
109        private boolean impersonated = false;
110        /**
111                Check if another user is acting as the user of this session.
112                @hibernate.property column="`impersonated`" type="boolean" not-null="true" update="false"
113        */
114        public boolean getImpersonated()
115        {
116                return impersonated;
117        }
118        
119        public void setImpersonated(boolean impersonated)
120        {
121                this.impersonated = impersonated;
122        }
123
124        private ClientData client;
125        /**
126                Get the client application the user was using.
127                @hibernate.many-to-one column="`client_id`" not-null="false" update="false" outer-join="false"
128        */
129        public ClientData getClient()
130        {
131                return client;
132        }
133        
134        public void setClient(ClientData client)
135        {
136                this.client = client;
137        }
138        
139        /**
140                The maximum length of the remote ID that can be stored in the database.
141                @see #setRemoteId(String)
142        */
143        public static final int MAX_REMOTE_ID_LENGTH = 255;
144        private String remoteId;
145        /**
146                Get the login comment.
147                @hibernate.property column="`remote_id`" type="string" length="255" not-null="false" update="false"
148        */
149        public String getRemoteId()
150        {
151                return remoteId;
152        }
153        public void setRemoteId(String remoteId)
154        {
155                this.remoteId = remoteId;
156        }
157
158}