kotkabeans
Class User

java.lang.Object
  |
  +--kotkabeans.User
All Implemented Interfaces:
java.lang.Comparable

public class User
extends java.lang.Object
implements java.lang.Comparable

implements User-object used in session handling.


Field Summary
protected  java.lang.String account
          Username typed in at login time.
protected  java.lang.String currentForm
          User's current form
protected  java.lang.String currentPage
          User's current page.
protected  java.lang.String currentStatus
          User's operation status
protected  java.lang.String expireTime
          User's automatic logout time.
protected  java.lang.String ipAddr
          IP-address from which the connection is made.
protected  java.lang.String language
          Selected language as text.
protected  int languageID
          Selected language as database form.
protected  long lastOpTime
          User's last operation time
protected  long opEndTime
          User's operation endtime
protected  long opStartTime
          User's operation starttime
protected  java.lang.String organisation
          Organisation which person belongs to.
protected  int organisationID
          the Identifier of the person's home organisation.
protected  java.lang.String person
          Name of the user.
protected  int personID
          Users personidentifier as database form.
 
Constructor Summary
User()
          Dummy empty constructor.
User(java.lang.String account)
          Constructs user object and sets account.
 
Method Summary
 int compareTo(java.lang.Object user)
          This method checks if two users are identical.
 boolean equals(java.lang.Object user)
          This method checks if two users are identical.
 java.lang.String getAccount()
          Simple access method
 java.lang.String getCurrentForm()
          Simple access method.
 java.lang.String getcurrentStatus()
          Simple access method.
 java.lang.String getIpAddr()
          Simple access method
 java.lang.String getLanguage()
          Simple access method
 int getLanguageID()
          Simple access method
 long getLastOpTime()
          Simple access method.
 long getOpEndTime()
          Simple access method.
 long getOpStartTime()
          Simple access method.
 java.lang.String getOrganisation()
          Simple access method
 int getOrganisationID()
          Simple access method.
 java.lang.String getPerson()
          Simple access method.
 int getPersonID()
          Simple access method
 int hashCode()
          Calculates hash index value based on account and IP-address.
 void setCurrentForm(java.lang.String formname)
          Simple access method.
 void setCurrentStatus(java.lang.String currentStatus)
          Used on every page to show user's session status
 void setIpAddr(java.lang.String ipAddr)
          Simple access method.
 void setLanguage(java.lang.String language)
          Sets the selected language as text.
 void setLanguageID(int languageID)
          Sets language preferred by the user.
 void setLastOpTime(long opStartTime, long opEndTime)
          Simple access method.
 void setOpEndTime()
          Simple access method.
 void setOpStartTime()
          Simple access method.
 void setOrganisation(java.lang.String organisation)
          Initializes the name of user's home organisation.
 void setOrganisationID(int organisationID)
          Initializes person's home organisation.
 void setPerson(java.lang.String person)
          Set person's name.
 void setPersonID(int personID)
          Sets user's personal identifier.
 java.lang.String toString()
          Used by compareTo-method
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

account

protected java.lang.String account
Username typed in at login time.

ipAddr

protected java.lang.String ipAddr
IP-address from which the connection is made.

languageID

protected int languageID
Selected language as database form.

language

protected java.lang.String language
Selected language as text. Textform is needed many times, so it is more efficient to make sql-query once and then use stored result.

personID

protected int personID
Users personidentifier as database form.

person

protected java.lang.String person
Name of the user. This is set at connection time.

organisationID

protected int organisationID
the Identifier of the person's home organisation.

organisation

protected java.lang.String organisation
Organisation which person belongs to.

currentPage

protected java.lang.String currentPage
User's current page.

currentStatus

protected java.lang.String currentStatus
User's operation status

expireTime

protected java.lang.String expireTime
User's automatic logout time.

opStartTime

protected long opStartTime
User's operation starttime

opEndTime

protected long opEndTime
User's operation endtime

lastOpTime

protected long lastOpTime
User's last operation time

currentForm

protected java.lang.String currentForm
User's current form
Constructor Detail

User

public User()
Dummy empty constructor.

User

public User(java.lang.String account)
Constructs user object and sets account.
Parameters:
account - Account of the user
Method Detail

getAccount

public java.lang.String getAccount()
Simple access method
Returns:
user's account

getIpAddr

public java.lang.String getIpAddr()
Simple access method
Returns:
IP-address from which the user connection is made.

setCurrentStatus

public void setCurrentStatus(java.lang.String currentStatus)
Used on every page to show user's session status

getcurrentStatus

public java.lang.String getcurrentStatus()
Simple access method. Used in system monitoring.
Returns:
user's current status

setOpStartTime

public void setOpStartTime()
Simple access method. Used in system monitoring. Set's operation starttime.

setOpEndTime

public void setOpEndTime()
Simple access method. Used in system monitoring. Set's operation endtime.

getOpStartTime

public long getOpStartTime()
Simple access method. Used in system monitoring.
Returns:
operation starttime.

getOpEndTime

public long getOpEndTime()
Simple access method. Used in system monitoring.
Returns:
operation endtime.

getLastOpTime

public long getLastOpTime()
Simple access method. Used in system monitoring.
Returns:
last operation time.

setLastOpTime

public void setLastOpTime(long opStartTime,
                          long opEndTime)
Simple access method. Used in system monitoring.
Parameters:
opstarttime - and opendtime are user's last operation times.

setCurrentForm

public void setCurrentForm(java.lang.String formname)
Simple access method. Used in system monitoring.
Parameters:
formname - is user's current form.

getCurrentForm

public java.lang.String getCurrentForm()
Simple access method. Used in system monitoring.
Returns:
user's current form.

setIpAddr

public void setIpAddr(java.lang.String ipAddr)
Simple access method. Used during objects setup process.
Parameters:
ipAddr - User's IP-address.

getLanguageID

public int getLanguageID()
Simple access method
Returns:
Language identifier of the user's native language.

setLanguageID

public void setLanguageID(int languageID)
Sets language preferred by the user.
Parameters:
languageID - Language identifier of the selected language.

getLanguage

public java.lang.String getLanguage()
Simple access method
Returns:
Name of the selected language.

setLanguage

public void setLanguage(java.lang.String language)
Sets the selected language as text. This method should be implemented so that it cooperates with the setLanguageID() -method.
Parameters:
language - Name of the selected language
See Also:
setLanguageID(int)

getPersonID

public int getPersonID()
Simple access method
Returns:
User's personal identifier

setPersonID

public void setPersonID(int personID)
Sets user's personal identifier. This method is called during initialization of the user object.
Parameters:
personID - User's personal identifier

getPerson

public java.lang.String getPerson()
Simple access method.
Returns:
Name of the user.

setPerson

public void setPerson(java.lang.String person)
Set person's name. This method should be implemented so that it cooperates with the setPersonID() -method.
Parameters:
person - Name of the user
See Also:
setPersonID(int)

getOrganisationID

public int getOrganisationID()
Simple access method.
Returns:
Organisation identifier of the home organisation of the user.

setOrganisationID

public void setOrganisationID(int organisationID)
Initializes person's home organisation.
Parameters:
organisationID - Organisation identifier of the new home organisation of the user.

getOrganisation

public java.lang.String getOrganisation()
Simple access method
Returns:
Name of the home organisation of the user.

setOrganisation

public void setOrganisation(java.lang.String organisation)
Initializes the name of user's home organisation. This method should be implmented so that it cooperates with the setOrganisationID()-method
Parameters:
organisation - Name of the new home organisation of the user

toString

public java.lang.String toString()
Used by compareTo-method
Overrides:
toString in class java.lang.Object
Returns:
Account of the user
See Also:
compareTo(Object)

hashCode

public int hashCode()
Calculates hash index value based on account and IP-address.
Overrides:
hashCode in class java.lang.Object
Returns:
Calculated code

equals

public boolean equals(java.lang.Object user)
This method checks if two users are identical. Uses compareTo method to perform this task.
Overrides:
equals in class java.lang.Object
Returns:
true if both users have same account and IP-address, false otherwise.

compareTo

public int compareTo(java.lang.Object user)
This method checks if two users are identical. For internal use of the bean (private??). Hash table needs this methos.
Specified by:
compareTo in interface java.lang.Comparable
Parameters:
user - The other user which is used in comparison.
Returns:
0 if both users have same account and IP-address, nonZero otherwise.