public class User
extends org.apache.struts.action.ActionForm
implements java.io.Serializable
Modifier and Type | Class and Description |
---|---|
protected static class |
User.ConfirmationType
Type of confirmation
|
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
additionalNames
Other names, middle, patronymic, etc.
|
protected java.lang.String |
affiliation
Institutional affiliations
|
protected java.lang.String |
confirmationToken
The token value
|
protected User.ConfirmationType |
confirmationType
The type of confirmation needed
|
protected java.lang.String |
country
Country of residence?
|
protected boolean |
educator
True if an educator
|
protected java.lang.String |
emailAddress
Email address.
|
protected java.lang.String |
familyName
Family name
|
protected java.lang.String |
givenName
Given name (typically first)
|
protected java.lang.String |
gradeLevel
Current grade level.
|
protected java.lang.String |
gradeLevelOther
Other grade level, if not a value in GRADES
|
static java.lang.String[] |
GRADES
Possible values of gradeLevel.
|
static java.lang.String[] |
HIGHEST_GRADES
Possible values of highestGradeCompleted
|
protected java.lang.String |
highestGradeCompleted
Highest grade completed.
|
static java.lang.String |
LOGIN_COOKIE_KEY
Key used for the 'remember me' cookie
|
static byte |
MAXLEN_ADDITIONAL_NAMES
Maximum number of characters in additional names
|
static byte |
MAXLEN_AFFILIATION
Maximum number of characters allowed in the affiliation field
|
static byte |
MAXLEN_COUNTRY
Maximum number of characters in country
|
static byte |
MAXLEN_EMAIL_ADDRESS
Maximum number of characters in email address
|
static byte |
MAXLEN_FAMILY_NAME
Maximum number of characters in family name
|
static byte |
MAXLEN_GIVEN_NAME
Maximum number of characters in given name
|
static byte |
MAXLEN_GRADE_LEVEL_OTHER
Maximum number of characters allowed in the grade level 'other' field
|
static byte |
MAXLEN_NAME_SUFFIX
Maximum number of characters in the name suffix
|
static short |
MAXLEN_NOTE
Maximum number of characters allowed in the note field
|
static byte |
MAXLEN_OCCUPATION
Maximum number of characters in occupation
|
static byte |
MAXLEN_POSTAL_CODE
Maximum number of characters in postal code
|
static byte |
MAXLEN_USERNAME
Maximum number of characters in username
|
static byte |
MINLEN_PASSWORD
Minimum number of characters in password (undigested)
|
static byte |
MINLEN_USERNAME
Minimum number of characters in username
|
protected java.lang.String |
nameSuffix
Suffix / title
|
protected java.lang.String |
note
Additional notes (provided by the user?)
|
protected boolean |
notifyOnGeometry
True if notify on geometry completion is requested (team members only
|
protected boolean |
notifyOnRelease
True if notify on release is requested
|
protected boolean |
notifyOnUpdate
True if notify on update is requested
|
protected java.lang.String |
occupation
Current occupation
|
protected java.lang.String |
password
Undigested password.
|
protected java.lang.String |
postalCode
Postal (zip) code
|
protected boolean |
privileged
True if the user is special
|
protected java.lang.String |
publicKey
Public key, probably unused (what kind is it?)
|
static java.util.regex.Pattern |
REGEX_USERNAME
Allowed values of username.
|
protected boolean |
student
True if a student
|
protected java.lang.String |
username
The username.
|
protected java.lang.String |
verifyEmail
For cases where user must provide the email twice
|
protected java.lang.String |
verifyPassword
For cases where user must provide the password twice
|
Constructor and Description |
---|
User()
Empty constructor for the JavaBeans
|
User(long id,
java.lang.String username)
Create a user form for a particular known user.
|
User(long id,
java.lang.String username,
java.lang.String... groups)
Create a user form for a particular known user.
|
Modifier and Type | Method and Description |
---|---|
void |
addSTL(int themeID)
Set science theme ownership (or co-ownership)
|
java.lang.String |
getAdditionalNames()
Get the value for additional names
|
java.lang.String |
getAffiliation()
Get the affiliation
|
java.lang.String |
getConfirmationToken()
Get the confirmation token value
|
User.ConfirmationType |
getConfirmationType()
Get the confirmation type
|
java.lang.String |
getCountry()
Get the country name
|
java.lang.String |
getEmailAddress()
Get the email address value
|
java.lang.String |
getFamilyName()
Get the family name value
|
java.lang.String |
getGivenName()
Get the given name value
|
java.lang.String |
getGradeLevel()
Get the value for grade level
|
java.lang.String |
getGradeLevelOther()
Get the 'other' grade level
|
java.lang.String[] |
getGrades()
Get the values in the Grades array
|
java.lang.String[] |
getGroups()
Get the groups for this user
|
java.lang.String |
getHighestGradeCompleted()
Get the value for highest grade completed
|
java.lang.String[] |
getHighestGrades()
Get the values in the Highest Grades array
|
long |
getID()
Get the database ID for this user.
|
java.lang.String |
getNameSuffix()
Get the name suffix value
|
java.lang.String |
getNote()
Get the note
|
boolean |
getNotifyOnGeometry()
True if the user has requested notification on geometry completion
|
boolean |
getNotifyOnRelease()
True if user has requested notification on release
|
boolean |
getNotifyOnUpdate()
True if the user has requested notification on update
|
java.lang.String |
getOccupation()
Get the occupation
|
java.lang.String |
getPassword()
Get the value for password
|
java.lang.String |
getPostalCode()
Get the postal code
|
java.lang.String |
getPublicKey()
Get the value for public key
|
java.lang.String |
getUsername()
Get the user's username
|
java.lang.String |
getVerifyEmail()
Get the 2nd email which was input.
|
java.lang.String |
getVerifyPassword()
Get the 2nd password which was input.
|
boolean |
hasRole(java.lang.String group)
Returns true if the user is a member of the given group.
|
boolean |
hasRoles()
Returns true if the user is any groups
|
boolean |
isEducator()
Get the value for educator
|
boolean |
isEmail()
Return true if the input looks like an email address.
|
boolean |
isPrivileged()
True if the user is special
|
boolean |
isStudent()
Get the value for student
|
boolean |
leadsTheme(int themeID)
Check to see if the user is a lead (or co-lead) of a science theme
|
void |
reset(org.apache.struts.action.ActionMapping map,
javax.servlet.http.HttpServletRequest req)
Reset the boolean fields, so that unchecked checkboxes are detected.
|
void |
setAdditionalNames(java.lang.String additionalNames)
Set additional names
|
void |
setAffiliation(java.lang.String affiliation)
Set the affiliation
|
void |
setConfirmationToken(java.lang.String token)
Set the token value for confirmation
|
void |
setConfirmationType(java.lang.String type)
Set the confirmation type
|
void |
setConfirmationType(User.ConfirmationType type)
Set the confirmation type
|
void |
setCountry(java.lang.String country)
Set the country
|
void |
setEducator(boolean educator)
Set the educator value
|
void |
setEmailAddress(java.lang.String emailAddress)
Set the email address
|
void |
setFamilyName(java.lang.String familyName)
Set the family name
|
void |
setGivenName(java.lang.String givenName)
Set the given name
|
void |
setGradeLevel(java.lang.String gradeLevel)
Set the grade level
|
void |
setGradeLevelOther(java.lang.String gradeLevelOther)
Set the 'other' grade level
|
void |
setGroups(java.lang.String... groups)
Set the groups to be used for this user (will not be saved to DB)
|
void |
setHighestGradeCompleted(java.lang.String highestGradeCompleted)
Set the highest grade completed
|
void |
setNameSuffix(java.lang.String nameSuffix)
Set the name suffix
|
void |
setNote(java.lang.String note)
Set the note for this user
|
void |
setNotifyOnGeometry(boolean notifyOnGeometry)
Pass true if the user requests notification on geometry
|
void |
setNotifyOnRelease(boolean notifyOnRelease)
Pass true if the user requests notification on release
|
void |
setNotifyOnUpdate(boolean notifyOnUpdate)
Pass true if the user requests notification on update
|
void |
setOccupation(java.lang.String occupation)
Set the occupation
|
void |
setPassword(java.lang.String password)
Set the password
|
void |
setPostalCode(java.lang.String postalCode)
Set the postal code
|
void |
setPublicKey(java.lang.String publicKey)
Set the public key
|
void |
setStudent(boolean student)
Set the student value
|
void |
setUsername(java.lang.String username)
Set the username to be used for this user (will not be saved to DB)
|
void |
setVerifyEmail(java.lang.String verifyEmail)
Set the value from the 2nd email element.
|
void |
setVerifyPassword(java.lang.String verifyPassword)
Set the value from the 2nd password element.
|
java.lang.String |
toString() |
org.apache.struts.action.ActionErrors |
validate(org.apache.struts.action.ActionMapping map,
javax.servlet.http.HttpServletRequest req)
Note this does not validate everything.
|
public static final java.lang.String LOGIN_COOKIE_KEY
protected java.lang.String username
protected java.lang.String givenName
protected java.lang.String familyName
protected java.lang.String additionalNames
protected java.lang.String nameSuffix
protected java.lang.String emailAddress
protected java.lang.String postalCode
protected java.lang.String country
protected java.lang.String occupation
protected java.lang.String password
protected java.lang.String highestGradeCompleted
protected java.lang.String affiliation
protected boolean educator
protected boolean student
protected java.lang.String gradeLevel
protected java.lang.String gradeLevelOther
protected java.lang.String publicKey
protected java.lang.String note
protected java.lang.String verifyEmail
protected java.lang.String verifyPassword
protected java.lang.String confirmationToken
protected User.ConfirmationType confirmationType
protected boolean privileged
protected boolean notifyOnRelease
protected boolean notifyOnUpdate
protected boolean notifyOnGeometry
public static final java.lang.String[] HIGHEST_GRADES
public static final java.lang.String[] GRADES
public static final byte MINLEN_USERNAME
public static final byte MINLEN_PASSWORD
public static final byte MAXLEN_USERNAME
public static final byte MAXLEN_GIVEN_NAME
public static final byte MAXLEN_FAMILY_NAME
public static final byte MAXLEN_ADDITIONAL_NAMES
public static final byte MAXLEN_NAME_SUFFIX
public static final byte MAXLEN_EMAIL_ADDRESS
public static final byte MAXLEN_POSTAL_CODE
public static final byte MAXLEN_COUNTRY
public static final byte MAXLEN_OCCUPATION
public static final byte MAXLEN_AFFILIATION
public static final byte MAXLEN_GRADE_LEVEL_OTHER
public static final short MAXLEN_NOTE
public static final java.util.regex.Pattern REGEX_USERNAME
public User()
public User(long id, java.lang.String username)
id
- DB keyusername
- Value of usernamepublic User(long id, java.lang.String username, java.lang.String... groups)
id
- People table ID keyusername
- People table usernamegroups
- People table groups (1 or more)public boolean isEmail()
public long getID()
public void setGroups(java.lang.String... groups)
groups
- One or more groupspublic java.lang.String[] getGroups()
public void addSTL(int themeID)
themeID
- corresponds to Science_Themes table IDpublic boolean leadsTheme(int themeID)
themeID
- corresponds to Science_Themes table IDpublic java.lang.String[] getGrades()
public java.lang.String[] getHighestGrades()
public java.lang.String getUsername()
public void setUsername(java.lang.String username)
username
- Username textpublic java.lang.String getVerifyEmail()
public void setVerifyEmail(java.lang.String verifyEmail)
verifyEmail
- Email address inputpublic java.lang.String getVerifyPassword()
public void setVerifyPassword(java.lang.String verifyPassword)
verifyPassword
- Password inputpublic java.lang.String getGivenName()
public void setGivenName(java.lang.String givenName)
givenName
- value for given namepublic java.lang.String getFamilyName()
public void setFamilyName(java.lang.String familyName)
familyName
- value for family namepublic java.lang.String getAdditionalNames()
public void setAdditionalNames(java.lang.String additionalNames)
additionalNames
- valuespublic java.lang.String getNameSuffix()
public void setNameSuffix(java.lang.String nameSuffix)
nameSuffix
- value for name suffixpublic java.lang.String getEmailAddress()
public void setEmailAddress(java.lang.String emailAddress)
emailAddress
- value for email addresspublic java.lang.String getPostalCode()
public void setPostalCode(java.lang.String postalCode)
postalCode
- value for postal codepublic java.lang.String getCountry()
public void setCountry(java.lang.String country)
country
- value for country namepublic java.lang.String getOccupation()
public void setOccupation(java.lang.String occupation)
occupation
- value for occupation namepublic java.lang.String getPassword()
public void setPassword(java.lang.String password)
password
- unhashed password textpublic java.lang.String getHighestGradeCompleted()
public void setHighestGradeCompleted(java.lang.String highestGradeCompleted)
highestGradeCompleted
- value for highest grade completedpublic java.lang.String getAffiliation()
public void setAffiliation(java.lang.String affiliation)
affiliation
- value for affiliationpublic boolean isEducator()
public void setEducator(boolean educator)
educator
- true for educatorspublic boolean isStudent()
public void setStudent(boolean student)
student
- true for studentspublic java.lang.String getGradeLevel()
public void setGradeLevel(java.lang.String gradeLevel)
gradeLevel
- value for grade levelpublic java.lang.String getGradeLevelOther()
public void setGradeLevelOther(java.lang.String gradeLevelOther)
gradeLevelOther
- value for other grade levelpublic java.lang.String getPublicKey()
public void setPublicKey(java.lang.String publicKey)
publicKey
- value for public keypublic boolean isPrivileged()
public java.lang.String getNote()
public void setNote(java.lang.String note)
note
- textpublic java.lang.String getConfirmationToken()
public void setConfirmationToken(java.lang.String token)
token
- valuepublic User.ConfirmationType getConfirmationType()
public void setConfirmationType(java.lang.String type)
type
- null or a valid confirmation type stringpublic void setConfirmationType(User.ConfirmationType type)
type
- null or a valid confirmation typepublic boolean getNotifyOnRelease()
public boolean getNotifyOnUpdate()
public boolean getNotifyOnGeometry()
public void setNotifyOnRelease(boolean notifyOnRelease)
notifyOnRelease
- input from userpublic void setNotifyOnUpdate(boolean notifyOnUpdate)
notifyOnUpdate
- input from userpublic void setNotifyOnGeometry(boolean notifyOnGeometry)
notifyOnGeometry
- input from userpublic boolean hasRole(java.lang.String group)
group
- Name of grouppublic boolean hasRoles()
public java.lang.String toString()
toString
in class java.lang.Object
public org.apache.struts.action.ActionErrors validate(org.apache.struts.action.ActionMapping map, javax.servlet.http.HttpServletRequest req)
validate
in class org.apache.struts.action.ActionForm
map
- Struts mappingreq
- Incoming requestpublic void reset(org.apache.struts.action.ActionMapping map, javax.servlet.http.HttpServletRequest req)
reset
in class org.apache.struts.action.ActionForm
map
- Struts action mappingreq
- Incoming requestCopyright \ (C) Arizona Board of Regents on behalf of the \ Planetary Image Research Laboratory, Lunar and \ Planetary Laboratory at the University of Arizona