net.sourceforge.jsurveyor
Class User

java.lang.Object
  extended bynet.sourceforge.jsurveyor.UserComponent
      extended bynet.sourceforge.jsurveyor.User

public class User
extends UserComponent

Class to model users. The class holds all information about the user.

Version:
1.0
Author:
Claus Methmann Christensen, Anders Spliid Hansen, Esben Iversen Hansen, Lars H Jensen, Marcus Overheu, Thomas Ramdal, Peter Thomsen

Constructor Summary
User()
          Construct a user with no data, to use the class as a bean.
User(java.lang.String userName, java.lang.String password, java.lang.String userType, java.lang.String email, java.lang.String fullName, java.lang.String city, java.lang.String country)
          Construct a user with all fields except ArrayList refChildren and refParents
User(java.lang.String userName, java.lang.String password, java.lang.String userType, java.lang.String email, java.lang.String fullName, java.lang.String city, java.lang.String country, java.util.ArrayList adminUserGroups, java.util.ArrayList refParents)
          Construct a user with all fields.
 
Method Summary
 boolean checkPassword(java.lang.String pass)
          Validate the password passed as argument, against the User's.
 AccessControl getAccessControl()
          Returns the AccessControl object that belongs to this user.
 java.lang.String getCity()
          Returns the city.
 java.lang.String getCountry()
          Returns the country.
 java.lang.String getEmail()
          Returns the email.
 java.lang.String getFullName()
          Returns the fullname.
 java.lang.String getPassword()
          Returns the encrypted form of the password.
 java.lang.String getUserName()
          Returns the username.
 boolean isAllSet()
          Checks that all fields have been set
 boolean isCitySet()
          checks that the city is set
 boolean isCountrySet()
          checks that the country is set
 boolean isEmailSet()
          checks that the email is set
 boolean isEmailValid()
          Validates the e-mail address.
 boolean isFullNameSet()
          checks that the fullName is set
 boolean isPasswordSet()
          checks that the password is set
 boolean isUserNameSet()
          checks that the userName is set
 void setCity(java.lang.String city)
          Sets the city.
 void setCountry(java.lang.String country)
          Sets the country.
 void setEmail(java.lang.String email)
          Sets the email
 void setFullName(java.lang.String fullName)
          Sets the fullname.
 void setPassword(java.lang.String password)
          Sets the password.
 void setUserName(java.lang.String userName)
          Sets the username.
 java.lang.String toString()
          Returns a String representation, consisting of the userName prefixed with an "U".
 
Methods inherited from class net.sourceforge.jsurveyor.UserComponent
addChild, addParent, clearParents, equals, getParents, getRefChildren, getRefParents, isRefParentsEmpty, removeChild, removeParent
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

User

public User()
Construct a user with no data, to use the class as a bean.


User

public User(java.lang.String userName,
            java.lang.String password,
            java.lang.String userType,
            java.lang.String email,
            java.lang.String fullName,
            java.lang.String city,
            java.lang.String country)
Construct a user with all fields except ArrayList refChildren and refParents

Parameters:
userName - String
password - String
userType - String
email - String
fullName - String
city - String
country - String

User

public User(java.lang.String userName,
            java.lang.String password,
            java.lang.String userType,
            java.lang.String email,
            java.lang.String fullName,
            java.lang.String city,
            java.lang.String country,
            java.util.ArrayList adminUserGroups,
            java.util.ArrayList refParents)
Construct a user with all fields. Usage only through DataAccess.

Parameters:
userName - String
password - String
userType - String
email - String
fullName - String
city - String
country - String
adminUserGroups - ArrayList
refParents - ArrayList
Method Detail

getUserName

public java.lang.String getUserName()
Returns the username.

Returns:
String

setUserName

public void setUserName(java.lang.String userName)
Sets the username.

Parameters:
userName - String

getPassword

public java.lang.String getPassword()
Returns the encrypted form of the password.

Returns:
String

checkPassword

public boolean checkPassword(java.lang.String pass)
Validate the password passed as argument, against the User's.

Parameters:
pass - String
Returns:
boolean

setPassword

public void setPassword(java.lang.String password)
Sets the password. Encrypts the String passed as argument using PasswordService.

Parameters:
password - String

getEmail

public java.lang.String getEmail()
Returns the email.

Returns:
String

setEmail

public void setEmail(java.lang.String email)
Sets the email

Parameters:
email - String

isEmailValid

public boolean isEmailValid()
Validates the e-mail address. Please note that this is a very simple regular expression, and that it will only catch common errors. For a specification of e-mail and syntax of e-mail adresses, check RFC-2822.

Returns:
boolean

getAccessControl

public AccessControl getAccessControl()
Returns the AccessControl object that belongs to this user.

Returns:
AccessControl

getFullName

public java.lang.String getFullName()
Returns the fullname.

Returns:
String

setFullName

public void setFullName(java.lang.String fullName)
Sets the fullname.

Parameters:
fullName - String

getCity

public java.lang.String getCity()
Returns the city.

Returns:
String

setCity

public void setCity(java.lang.String city)
Sets the city.

Parameters:
city - String

getCountry

public java.lang.String getCountry()
Returns the country.

Returns:
String

setCountry

public void setCountry(java.lang.String country)
Sets the country.

Parameters:
country - String

isAllSet

public boolean isAllSet()
Checks that all fields have been set

Returns:
boolean

isUserNameSet

public boolean isUserNameSet()
checks that the userName is set

Returns:
boolean

isPasswordSet

public boolean isPasswordSet()
checks that the password is set

Returns:
boolean

isFullNameSet

public boolean isFullNameSet()
checks that the fullName is set

Returns:
boolean

isEmailSet

public boolean isEmailSet()
checks that the email is set

Returns:
boolean

isCitySet

public boolean isCitySet()
checks that the city is set

Returns:
boolean

isCountrySet

public boolean isCountrySet()
checks that the country is set

Returns:
boolean

toString

public java.lang.String toString()
Returns a String representation, consisting of the userName prefixed with an "U".

Returns:
String