edu.wpi.prc.user
Class Volunteer

java.lang.Object
  extended by edu.wpi.prc.user.Volunteer

public class Volunteer
extends java.lang.Object

The Volunteer class stores information about each user.

Author:
James Baldassari

Field Summary
private  java.lang.String eMailAddress
           
private  long id
           
private  java.util.Date joinDate
           
private  java.util.Date lastResultDate
           
private  long score
           
private  java.lang.String stateStr
           
private  java.lang.String userID
           
private  boolean waiting
           
 
Constructor Summary
Volunteer()
          Default constructor.
Volunteer(java.lang.String userID)
          Constructor specifying the user ID
Volunteer(java.lang.String userID, java.lang.String eMailAddress, java.util.Date joinDate)
          Constructor for new users.
Volunteer(java.lang.String userID, java.lang.String eMailAddress, long score, java.util.Date joinDate, java.util.Date lastResultDate)
          Constructor allowing the specification of all Volunteer attributes.
 
Method Summary
 java.lang.Object clone()
          Returns a copy of this Volunteer.
 void decreaseScore(int delta)
          Decreases this Volunteer's score by delta points.
 void delete()
          Deletes this Volunteer from the database.
 boolean equals(java.lang.Object o)
          Tests whether this Volunteer is the same as another.
 Volunteer[] find()
          Finds all Volunteers in the database that match the attributes set in the this Volunteer.
static Volunteer[] findAll()
          Finds all Volunteers in the database.
 java.lang.String getEMailAddress()
           
protected  long getId()
           
 java.util.Date getJoinDate()
           
 java.util.Date getLastResultDate()
           
static int getNumUsersWaiting()
           
 long getScore()
           
 VolunteerState getState()
           
protected  java.lang.String getStateStr()
           
 java.lang.String getUserID()
           
 boolean getWaiting()
           
 void increaseScore(int delta)
          Increase this Volunteer's score by delta points.
 void save()
          Saves this Volunteer to the database.
 void setEMailAddress(java.lang.String mailAddress)
           
protected  void setId(long id)
           
 void setJoinDate(java.util.Date joinDate)
           
 void setLastResultDate(java.util.Date lastResultDate)
           
 void setScore(long score)
           
 void setState(VolunteerState state)
          Sets the state of this volunteer.
protected  void setStateStr(java.lang.String stateStr)
           
 void setUserID(java.lang.String userID)
           
 void setWaiting(boolean isWaiting)
           
 java.lang.String toString()
          Converts this Volunteer to a String.
 void update()
          Updates this Volunteer in the database.
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

id

private long id

userID

private java.lang.String userID

eMailAddress

private java.lang.String eMailAddress

score

private long score

joinDate

private java.util.Date joinDate

lastResultDate

private java.util.Date lastResultDate

stateStr

private java.lang.String stateStr

waiting

private boolean waiting
Constructor Detail

Volunteer

public Volunteer()
Default constructor.


Volunteer

public Volunteer(java.lang.String userID)
Constructor specifying the user ID

Parameters:
userID - The user ID.

Volunteer

public Volunteer(java.lang.String userID,
                 java.lang.String eMailAddress,
                 java.util.Date joinDate)
Constructor for new users.

Parameters:
userID - The user ID.
eMailAddress - The user's e-mail address.
joinDate - The date the user joined the PRC project.

Volunteer

public Volunteer(java.lang.String userID,
                 java.lang.String eMailAddress,
                 long score,
                 java.util.Date joinDate,
                 java.util.Date lastResultDate)
Constructor allowing the specification of all Volunteer attributes.

Parameters:
userID - The user ID.
eMailAddress - The user's e-mail address.
score - The user's score.
joinDate - The date the user joined the PRC project.
lastResultDate - The date the user last returned a result.
Method Detail

getId

protected long getId()
Returns:
Returns the id.

setId

protected void setId(long id)
Parameters:
id - The id to set.

getEMailAddress

public java.lang.String getEMailAddress()
Returns:
Returns the eMailAddress.

setEMailAddress

public void setEMailAddress(java.lang.String mailAddress)
Parameters:
mailAddress - The eMailAddress to set.

getScore

public long getScore()
Returns:
Returns the score.

setScore

public void setScore(long score)
Parameters:
score - The score to set.

increaseScore

public void increaseScore(int delta)
Increase this Volunteer's score by delta points.

Parameters:
delta - The amount by which to increase the score.

decreaseScore

public void decreaseScore(int delta)
Decreases this Volunteer's score by delta points.

Parameters:
delta - The amount by which to decrease the score.

getUserID

public java.lang.String getUserID()
Returns:
Returns the userID.

setUserID

public void setUserID(java.lang.String userID)
Parameters:
userID - The userID to set.

getJoinDate

public java.util.Date getJoinDate()
Returns:
Returns the joinDate.

setJoinDate

public void setJoinDate(java.util.Date joinDate)
Parameters:
joinDate - The joinDate to set.

getLastResultDate

public java.util.Date getLastResultDate()
Returns:
Returns the lastResultDate.

setLastResultDate

public void setLastResultDate(java.util.Date lastResultDate)
Parameters:
lastResultDate - The lastResultDate to set.

getStateStr

protected java.lang.String getStateStr()
Returns:
Returns the stateStr.

setStateStr

protected void setStateStr(java.lang.String stateStr)
Parameters:
stateStr - The stateStr to set.

getState

public VolunteerState getState()
Returns:
Returns the state of this volunteer.

setState

public void setState(VolunteerState state)
Sets the state of this volunteer.

Parameters:
state - The state to set.

getWaiting

public boolean getWaiting()
Returns:
Returns the isWaiting.

setWaiting

public void setWaiting(boolean isWaiting)
Parameters:
isWaiting - The isWaiting to set.

save

public void save()
Saves this Volunteer to the database.


update

public void update()
Updates this Volunteer in the database.


find

public Volunteer[] find()
Finds all Volunteers in the database that match the attributes set in the this Volunteer. NOTE: user names and e-mail addresses are case-insensitive.

Returns:
An array of all matching Volunteers in the database.

findAll

public static Volunteer[] findAll()
Finds all Volunteers in the database.

Returns:
An array of all Volunteers in the database.

delete

public void delete()
Deletes this Volunteer from the database.


getNumUsersWaiting

public static int getNumUsersWaiting()
Returns:
Returns the number of users who are waiting for work units.

equals

public boolean equals(java.lang.Object o)
Tests whether this Volunteer is the same as another. Delegates to the Hibernate EqualsHelper.

Overrides:
equals in class java.lang.Object
Parameters:
o - The other Volunteer.
Returns:
True if the the two Volunteers are the same, false otherwise.

clone

public java.lang.Object clone()
Returns a copy of this Volunteer.

Overrides:
clone in class java.lang.Object
Returns:
A copy of this Volunteer.

toString

public java.lang.String toString()
Converts this Volunteer to a String.

Overrides:
toString in class java.lang.Object
Returns:
The String representation of this Volunteer.