FileDocCategorySizeDatePackage
User.javaAPI DocExample4894Sat Oct 27 15:52:34 BST 2001jabadot

User

public class User extends Object implements Serializable
Represents one logged in user

Fields Summary
protected String
name
The login name
protected String
password
protected String
firstName
protected String
lastName
protected String
email
protected String
address
protected String
address2
protected String
company
protected String
city
protected String
prov
protected String
country
protected Date
creationDate
protected Date
lastLoginDate
protected String
jobDescr
protected String
os
protected String
unixGUI
protected String
proglang
protected String
skin
user preference
protected boolean
editPrivs
protected boolean
adminPrivs
public static final int
P_ADMIN
public static final int
P_EDIT
Constructors Summary
public User()
Construct a user with no data -- must be a no-argument constructor for use in jsp:useBean.


	                	 
	  
		creationDate = new Date();
	
public User(String n)
Construct a user with just the name

		this();			// set credt
		name = n;
	
public User(String nick, String pw, String fname, String lName, String emaddr, String comp, String addr1, String addr2, String cty, String pr, String cntry, String jd, String os, String gui, String lang, String skin)
Construct a user with all text fields.

		this();			// set credt
		name = nick;
		password = pw;
		firstName = fname;
		lastName = lName;
		email = emaddr;
		address = addr1;
		address2 = addr2;
		company = comp;
		city = cty;
		prov = pr;
		country = cntry;
		this.skin = skin;
		jobDescr = jd;
		os = os;
		unixGUI = gui;
		proglang = lang;
	
Methods Summary
public booleancheckPassword(java.lang.String userInput)
Validate a given password against the user's.

		return password.equals(userInput);
	
public java.lang.StringgetCity()
Get city

		return city;
	
public java.lang.StringgetCountry()
Get country

		return country;
	
public java.util.DategetCreationDate()
Get the Creation Date (read only field)

		return creationDate;
	
public java.lang.StringgetEmail()
Get email

		return email;
	
public java.lang.StringgetFullName()
Get fullName

		return firstName + ' " + lastName;
	
public java.util.DategetLastLoginDate()
Get the LastLog Date (read only field)

		return lastLoginDate;
	
public java.lang.StringgetName()
Return the nickname.

		return name;
	
public java.lang.StringgetPassword()

		return password;
	
public intgetPrivs()
Get all privs, as an int, for use in the database

		int i = 0;
		if (adminPrivs)
			i |= P_ADMIN;
		if (editPrivs)
			i |= P_EDIT;
		return i;
	
public java.lang.StringgetProv()
Get prov

		return prov;
	
public booleanisAdminPrivileged()
Get adminPrivs

		return adminPrivs;
	
public booleanisComplete()
Check if all required fields have been set

		if (name == null || name.length()==0 ||
		    firstName == null || firstName.length()==0 ||
		    lastName == null || lastName.length()==0 ||
		    email == null || email.length()==0)
			return false;
		return true;
	
public booleanisEditPrivileged()
Get EditPrivs

		return editPrivs;
	
public voidsetAdminPrivileged(boolean adminPrivs)
Set adminPrivs

		this.adminPrivs = adminPrivs;
	
public voidsetCity(java.lang.String city)
Set city

		this.city = city;
	
public voidsetCountry(java.lang.String country)
Set country

		this.country = country;
	
public voidsetCreationDate(java.util.Date date)
Set the Creation Date (read only field)

		creationDate = date;
	
public voidsetEditPrivileged(boolean editPrivs)
Set EditPrivs

		this.editPrivs = editPrivs;
	
public voidsetEmail(java.lang.String email)
Set email

		this.email = email;
	
public voidsetFirstName(java.lang.String firstName)
Set firstName

		this.firstName = firstName;
	
public voidsetLastLoginDate(java.util.Date d)
Get the LastLog Date (read only field)

		lastLoginDate = d;
	
public voidsetName(java.lang.String nick)
The name should not be changeable, but we want to be able to say and get it all...

		name = nick;
	
public voidsetPassword(java.lang.String password)
Set password

		this.password = password;
	
public voidsetPrivs(int privs)

		if ((privs & P_ADMIN) != 0)
			adminPrivs = true;
		if ((privs & P_EDIT) != 0)
			editPrivs = true;
	
public voidsetProv(java.lang.String prov)
Set prov

		this.prov = prov;
	
public voidsetlastName(java.lang.String lastName)
Set lastName

		this.lastName = lastName;
	
public java.lang.StringtoString()
Return a String representation.

		return new StringBuffer("User[").append(name).append(',").
			append(firstName).append(' ").append(lastName).
			append(']").toString();