org.locomotive.module.userpref
Class UserPref

java.lang.Object
  |
  +--org.locomotive.module.userpref.UserPref

public class UserPref
extends java.lang.Object

This class handles db processing and template interaction (except for saving error messages to template) for UserPref and UserMgt handlers.


Field Summary
 java.lang.String email
           
 java.lang.String fName
           
 java.lang.String hAddr
           
 java.lang.String hCity
           
 java.lang.String hCountry
           
 java.lang.String hPhone
           
 java.lang.String hState
           
 java.lang.String hZip
           
 java.lang.String lastLogin
           
 java.lang.String lName
           
 java.lang.String mName
           
 java.lang.String passHint
           
 java.lang.String passWd
           
 java.lang.String userId
           
 java.lang.String userName
           
 java.lang.String wAddr
           
 java.lang.String wCity
           
 java.lang.String wCountry
           
 java.lang.String wPhone
           
 java.lang.String wState
           
 java.lang.String wZip
           
 
Constructor Summary
UserPref()
           
UserPref(java.sql.Connection conn, int usrId)
          Inits object from database with userid = userID.
UserPref(int id, java.lang.String username)
          Returns an object with userId and userName fields
 
Method Summary
static boolean entryExists(java.sql.Connection conn, java.lang.String usrId)
          returns true if an entry already exists in loco_user_prefs for usrId.
static boolean getSearchResultTableRows(java.sql.Connection conn, java.lang.String username, java.lang.String lastname, java.lang.String emailaddr, java.lang.String userid, java.lang.StringBuffer resultTable, java.lang.StringBuffer errors, int maxNumRows)
          Searches database with criteria provided in the parameter list and creates a table with search results.
static boolean hasAdminPriveleges(java.sql.Connection conn, int userid)
          checks if the user with userid has admin priveleges for the UMS
 java.lang.String printData()
           
static boolean storeUserPrefsToDB(java.sql.Connection conn, UserPref user, java.lang.StringBuffer errors)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

userId

public java.lang.String userId

userName

public java.lang.String userName

fName

public java.lang.String fName

mName

public java.lang.String mName

lName

public java.lang.String lName

email

public java.lang.String email

hAddr

public java.lang.String hAddr

hCity

public java.lang.String hCity

hState

public java.lang.String hState

hZip

public java.lang.String hZip

hCountry

public java.lang.String hCountry

wAddr

public java.lang.String wAddr

wCity

public java.lang.String wCity

wState

public java.lang.String wState

wZip

public java.lang.String wZip

wCountry

public java.lang.String wCountry

hPhone

public java.lang.String hPhone

wPhone

public java.lang.String wPhone

passHint

public java.lang.String passHint

passWd

public java.lang.String passWd

lastLogin

public java.lang.String lastLogin
Constructor Detail

UserPref

public UserPref()

UserPref

public UserPref(int id,
                java.lang.String username)
Returns an object with userId and userName fields

UserPref

public UserPref(java.sql.Connection conn,
                int usrId)
         throws java.sql.SQLException
Inits object from database with userid = userID. If a db entry does not exist, an object is returned with userId and userName fields
Method Detail

getSearchResultTableRows

public static boolean getSearchResultTableRows(java.sql.Connection conn,
                                               java.lang.String username,
                                               java.lang.String lastname,
                                               java.lang.String emailaddr,
                                               java.lang.String userid,
                                               java.lang.StringBuffer resultTable,
                                               java.lang.StringBuffer errors,
                                               int maxNumRows)
                                        throws java.sql.SQLException
Searches database with criteria provided in the parameter list and creates a table with search results. Returns true if successful and the result is stored in parameter resultTable, otherwise false and an error string

printData

public java.lang.String printData()

storeUserPrefsToDB

public static boolean storeUserPrefsToDB(java.sql.Connection conn,
                                         UserPref user,
                                         java.lang.StringBuffer errors)
                                  throws LoadUserException,
                                         java.sql.SQLException

entryExists

public static boolean entryExists(java.sql.Connection conn,
                                  java.lang.String usrId)
                           throws java.sql.SQLException
returns true if an entry already exists in loco_user_prefs for usrId. (used by "storeUserPrefsToDB, indicating whether an insert or an update should be performed.

hasAdminPriveleges

public static boolean hasAdminPriveleges(java.sql.Connection conn,
                                         int userid)
                                  throws java.sql.SQLException
checks if the user with userid has admin priveleges for the UMS