edu.jhu.tmaj.beans
Class UserBean

java.lang.Object
  extended by edu.jhu.tmaj.beans.JBean
      extended by edu.jhu.tmaj.beans.UserBean
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable
Direct Known Subclasses:
UserBeanLimited

public class UserBean
extends JBean
implements java.io.Serializable

Represents the User table, which contains information such as username,password, and permissions of any person using TMAJ.

See Also:
Serialized Form

Field Summary
static DatabaseField ACCESS_IMAGES_APP_FIELD
           
static DatabaseField ACCESS_IMPORT_APP_FIELD
           
static DatabaseField ACCESS_SAMPLES_APP_FIELD
           
static DatabaseField ADMIN_APP_FIELD
           
static DatabaseField ARRAY_BUILDER_APP_FIELD
           
static DatabaseField ARRAY_MANAGER_APP_FIELD
           
static DatabaseField DEPARTMENT_FIELD
           
static DatabaseField EMAIL_FIELD
           
static DatabaseField ID_FIELD
           
static DatabaseField INPUT_LOG_FIELD
           
static DatabaseField INSTITUTION_FIELD
           
static DatabaseField META_DATA_APP_FIELD
           
static DatabaseField NAME_FIRST_FIELD
           
static DatabaseField NAME_LAST_FIELD
           
static DatabaseField PATIENT_DATA_FIELD
           
static DatabaseField PHONE_FIELD
           
static DatabaseField SPECIMEN_APP_FIELD
           
static DatabaseField USERNAME_FIELD
           
 
Fields inherited from class edu.jhu.tmaj.beans.JBean
staticMetaData
 
Constructor Summary
UserBean()
           
 
Method Summary
 boolean accessAdminApp()
           
 boolean accessArrayBuilderApplication()
          Returns true if the user may access the Array Builder application.
 boolean accessArrayManagerApplication()
          Returns true if the user may access the ArrayManager application.
 boolean accessDetailedPatientData()
          Returns true if the user can access detailed patient data like the history number and date of birth.
 boolean accessImagesApplication()
          Returns true if the user may access the Image Analysis application.
 boolean accessImportApplication()
          Returns true if the user may access the Import application.
 boolean accessMetaDataApplication()
          Returns true if the user may access the Meta Data application.
 boolean accessSamplesApplication()
          Returns true if the user may access the Samples application.
 boolean accessSpecimensApp()
          Returns true if the user may access the Specimenss application.
 boolean accessSurgPathNumber()
           
 AdminAppPermission getAdminAppPermission()
          Returns the Permission Object related to the Array Builder App
 ArrayBuilderPermission getArrayBuilderPermission()
          Returns the Permission Object related to the Array Builder App
 DatabaseField[] getFieldsArray()
          Returns an Array of TFields representing the columnnames of this bean.
 MetaDataAppPermission getMetaDataAppPermission()
          Returns the Permission Object related to the MetaData App
 java.lang.String getNameFirst()
          Returns the User's first name.
 java.lang.String getNameLast()
          Returns the User's last name.
 JBean getNewInstance()
          Returns a new instance of this bean.
 java.lang.String getPassword()
          Returns the digested password of the user.
 PatientDataPermission getPatientDataPermission()
           
 SpecimensAppPermission getSpecimensAppPermission()
          Returns the Permission Object related to the Specimens App
 DatabaseTable getTable()
           
 java.lang.String getUsername()
          Returns the userName of the user.
 void insert()
          Inserts this new user into the database, and assigns a random password.
 boolean isAdmin()
          Returns true if the user is a group admin or full admin.
 boolean isFullAdmin()
           
 boolean isGroupAdmin()
           
 boolean isGuest()
          Returns true if the user's username is guest.
static CommandResponse lookup(java.lang.String username, java.lang.String digestedPassword)
          Returns a UserBean given a username and password.
 void setPassword(java.lang.String password)
          Sets the digested password of this UserBean.
 void setUsername(java.lang.String string)
           
 java.lang.String toString()
          Returns the primary key name of the bean's table, along with the bean's ID.
 void verify()
          Overwritten by subclasses, this method may throw an exception before an insert() or update() is done if there is something wrong with the JBean.
 
Methods inherited from class edu.jhu.tmaj.beans.JBean
compareTo, createFromResultSet, createFromSwingMap, delete, equals, getAllStaticColumnIdentifiers, getBaseSQL, getBeanInDatabase, getBeanList, getBeanList, getBooleanField, getClassForType, getColumnIdentifiers, getColumnNamesSet, getDateField, getDefaultBeanObjectForType, getDefaultSwingObjectForType, getDoubleField, getEnumerations, getFieldValue, getID_Bean_Map, getID, getIntegerField, getNonNullString, getPrimaryKeyField, getPrimaryKeyName, getSelectResponse, getSQL, getStaticMetaData, getStringField, getSwingHash, getSwingToBeanObject, getTableName, getUserBean, getWantedColumnsString, getWantedStaticColumnIdentifiers, getWhereClause, hashCode, isEnumerated, setBooleanField, setDateField, setDoubleField, setID, setIntegerField, setStringField, setUserBean, update
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ID_FIELD

public static final DatabaseField ID_FIELD

USERNAME_FIELD

public static final DatabaseField USERNAME_FIELD

NAME_LAST_FIELD

public static final DatabaseField NAME_LAST_FIELD

NAME_FIRST_FIELD

public static final DatabaseField NAME_FIRST_FIELD

INSTITUTION_FIELD

public static final DatabaseField INSTITUTION_FIELD

DEPARTMENT_FIELD

public static final DatabaseField DEPARTMENT_FIELD

PHONE_FIELD

public static final DatabaseField PHONE_FIELD

EMAIL_FIELD

public static final DatabaseField EMAIL_FIELD

ACCESS_IMPORT_APP_FIELD

public static final DatabaseField ACCESS_IMPORT_APP_FIELD

ACCESS_IMAGES_APP_FIELD

public static final DatabaseField ACCESS_IMAGES_APP_FIELD

SPECIMEN_APP_FIELD

public static final DatabaseField SPECIMEN_APP_FIELD

ARRAY_BUILDER_APP_FIELD

public static final DatabaseField ARRAY_BUILDER_APP_FIELD

ADMIN_APP_FIELD

public static final DatabaseField ADMIN_APP_FIELD

ACCESS_SAMPLES_APP_FIELD

public static final DatabaseField ACCESS_SAMPLES_APP_FIELD

ARRAY_MANAGER_APP_FIELD

public static final DatabaseField ARRAY_MANAGER_APP_FIELD

META_DATA_APP_FIELD

public static final DatabaseField META_DATA_APP_FIELD

PATIENT_DATA_FIELD

public static final DatabaseField PATIENT_DATA_FIELD

INPUT_LOG_FIELD

public static final DatabaseField INPUT_LOG_FIELD
Constructor Detail

UserBean

public UserBean()
Method Detail

getPatientDataPermission

public PatientDataPermission getPatientDataPermission()

accessSurgPathNumber

public boolean accessSurgPathNumber()

accessDetailedPatientData

public boolean accessDetailedPatientData()
Returns true if the user can access detailed patient data like the history number and date of birth. The information is further protected by an option in the config file (SHOULD_DISPLAY_PATIENTS_TAB) that prevents even an admin from seeing this HIPPA-sensitive data.


getAdminAppPermission

public AdminAppPermission getAdminAppPermission()
Returns the Permission Object related to the Array Builder App


getArrayBuilderPermission

public ArrayBuilderPermission getArrayBuilderPermission()
Returns the Permission Object related to the Array Builder App


getMetaDataAppPermission

public MetaDataAppPermission getMetaDataAppPermission()
Returns the Permission Object related to the MetaData App


getSpecimensAppPermission

public SpecimensAppPermission getSpecimensAppPermission()
Returns the Permission Object related to the Specimens App


isAdmin

public boolean isAdmin()
Returns true if the user is a group admin or full admin.


isGroupAdmin

public boolean isGroupAdmin()

isFullAdmin

public boolean isFullAdmin()

accessAdminApp

public boolean accessAdminApp()

accessArrayBuilderApplication

public boolean accessArrayBuilderApplication()
Returns true if the user may access the Array Builder application.


accessArrayManagerApplication

public boolean accessArrayManagerApplication()
Returns true if the user may access the ArrayManager application.


accessImagesApplication

public boolean accessImagesApplication()
Returns true if the user may access the Image Analysis application.


accessImportApplication

public boolean accessImportApplication()
Returns true if the user may access the Import application.


accessMetaDataApplication

public boolean accessMetaDataApplication()
Returns true if the user may access the Meta Data application.


accessSamplesApplication

public boolean accessSamplesApplication()
Returns true if the user may access the Samples application.


accessSpecimensApp

public boolean accessSpecimensApp()
Returns true if the user may access the Specimenss application.


isGuest

public boolean isGuest()
Returns true if the user's username is guest. In TMAJ, they way to designate an account with guest privileges is to name the account "guest". A more sophicated way may later be developed, and would ideally be a field name in the users table.


getUsername

public java.lang.String getUsername()
Returns the userName of the user. This username and the password is sent with each Request.


getNameFirst

public java.lang.String getNameFirst()
Returns the User's first name.


getNameLast

public java.lang.String getNameLast()
Returns the User's last name.


lookup

public static CommandResponse lookup(java.lang.String username,
                                     java.lang.String digestedPassword)
                              throws java.sql.SQLException
Returns a UserBean given a username and password. This method is called before each request to the database.

Throws:
java.sql.SQLException

insert

public void insert()
            throws java.sql.SQLException
Inserts this new user into the database, and assigns a random password.

Overrides:
insert in class JBean
Throws:
java.sql.SQLException

toString

public java.lang.String toString()
Description copied from class: JBean
Returns the primary key name of the bean's table, along with the bean's ID. Example: ProjectID#5

Overrides:
toString in class JBean

setPassword

public void setPassword(java.lang.String password)
Sets the digested password of this UserBean. Passwords are not set by the createFromResultSet() for security.


getPassword

public java.lang.String getPassword()
Returns the digested password of the user. This username and the password is sent with each Request.


getNewInstance

public JBean getNewInstance()
Description copied from class: JBean
Returns a new instance of this bean.

Specified by:
getNewInstance in class JBean

getTable

public DatabaseTable getTable()
Specified by:
getTable in class JBean

getFieldsArray

public DatabaseField[] getFieldsArray()
Description copied from class: JBean
Returns an Array of TFields representing the columnnames of this bean.

Specified by:
getFieldsArray in class JBean

setUsername

public void setUsername(java.lang.String string)

verify

public void verify()
            throws java.sql.SQLException
Description copied from class: JBean
Overwritten by subclasses, this method may throw an exception before an insert() or update() is done if there is something wrong with the JBean.

Overrides:
verify in class JBean
Throws:
java.sql.SQLException