cmu.jspsurveymanager.data
Class Admin

java.lang.Object
  extended by cmu.jspsurveymanager.data.Admin

public class Admin
extends java.lang.Object


Field Summary
static int ADMINS
          Admin management permission constant
static int CREATE
          Survey creation permission constant
static int GLOBAL_ADMIN
          Global administration permission constant
 
Constructor Summary
Admin(AdminStorage a)
          Required default constructor.
Admin(int id, java.lang.String username, java.lang.String passHash, java.lang.String realname, java.lang.String email, boolean[] permissions, AdminStorage a)
           
 
Method Summary
 void delete()
          Deletes this admin.
 boolean equals(java.lang.Object two)
           
 boolean getCanAdmin()
          Returns CanAdmin
 boolean getCanCreate()
          Returns CanCreate
 boolean getCanGloballyAdmin()
          Returns CanAdmin
 java.lang.String getEmail()
          Returns Real Name
 boolean getHasBeenModified()
          Adds a bookmark to this user's collection.
 java.lang.String getHashedPassword()
          Get the password, as an MD5 hash.
 int getId()
          Checks whether this User bean has unsaved state.
 boolean[] getPermissions()
           
 java.lang.String getRealName()
          Returns Real Name
 java.lang.String getUsername()
          Returns Username
 boolean isInitialized()
          Checks whether this User bean has been initialized.
 boolean passwordMatches(java.lang.String testPassword)
           
 boolean save()
          Saves this admin.
 void setCanAdmin(boolean canAdmin)
          Sets CanAdmin
 void setCanCreate(boolean canCreate)
          Sets CanCreate
 void setCanGloballyAdmin(boolean canAdmin)
          Sets CanGloballyAdmin
 void setEmail(java.lang.String newEmail)
          Sets Real Name
 void setPassword(java.lang.String newPassword)
          Sets Password
 void setRealName(java.lang.String newName)
          Sets Real Name
 void setUsername(java.lang.String username)
          Sets Username
 java.lang.String toString()
           
static java.lang.String toString(Admin[] users)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CREATE

public static final int CREATE
Survey creation permission constant

See Also:
Constant Field Values

ADMINS

public static final int ADMINS
Admin management permission constant

See Also:
Constant Field Values

GLOBAL_ADMIN

public static final int GLOBAL_ADMIN
Global administration permission constant

See Also:
Constant Field Values
Constructor Detail

Admin

public Admin(AdminStorage a)
Required default constructor.


Admin

public Admin(int id,
             java.lang.String username,
             java.lang.String passHash,
             java.lang.String realname,
             java.lang.String email,
             boolean[] permissions,
             AdminStorage a)
Method Detail

getPermissions

public boolean[] getPermissions()

setCanAdmin

public void setCanAdmin(boolean canAdmin)
Sets CanAdmin

Parameters:
CanAdmin - a boolean

getCanAdmin

public boolean getCanAdmin()
Returns CanAdmin

Returns:
a boolean

setCanGloballyAdmin

public void setCanGloballyAdmin(boolean canAdmin)
Sets CanGloballyAdmin

Parameters:
CanAdmin - a boolean

getCanGloballyAdmin

public boolean getCanGloballyAdmin()
Returns CanAdmin

Returns:
a boolean

setCanCreate

public void setCanCreate(boolean canCreate)
Sets CanCreate

Parameters:
CanCreate - a boolean

getCanCreate

public boolean getCanCreate()
Returns CanCreate

Returns:
a boolean

isInitialized

public boolean isInitialized()
Checks whether this User bean has been initialized.


getId

public int getId()
Checks whether this User bean has unsaved state.


setUsername

public void setUsername(java.lang.String username)
Sets Username

Parameters:
Username - a max 16-character String

getUsername

public java.lang.String getUsername()
Returns Username

Returns:
a max 16-character String

setPassword

public void setPassword(java.lang.String newPassword)
Sets Password

Parameters:
Password -

getHashedPassword

public java.lang.String getHashedPassword()
Get the password, as an MD5 hash.

Returns:

setRealName

public void setRealName(java.lang.String newName)
Sets Real Name

Parameters:
Password -

getRealName

public java.lang.String getRealName()
Returns Real Name

Returns:
a String

setEmail

public void setEmail(java.lang.String newEmail)
Sets Real Name

Parameters:
Password -

getEmail

public java.lang.String getEmail()
Returns Real Name

Returns:
a String

passwordMatches

public boolean passwordMatches(java.lang.String testPassword)

getHasBeenModified

public boolean getHasBeenModified()
Adds a bookmark to this user's collection.

Parameters:
url -
comment -

save

public boolean save()
Saves this admin.


delete

public void delete()
Deletes this admin. Note that any references to this admin will be invalid after deleting it.


equals

public boolean equals(java.lang.Object two)
Overrides:
equals in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

toString

public static java.lang.String toString(Admin[] users)