cmu.survey.data.users
Class UserStorageStub

java.lang.Object
  extended by cmu.survey.data.users.UserStorageStub
All Implemented Interfaces:
UserStorage

public class UserStorageStub
extends java.lang.Object
implements UserStorage


Nested Class Summary
 class UserStorageStub.DefaultUserStub
           
 
Field Summary
protected  UserAuthentication[] userAuthenticationsTechniquesToTry
           
 
Constructor Summary
UserStorageStub(DataTableModel userTable)
           
UserStorageStub(DataTableModel userTable, java.lang.String userIDColumn, java.lang.String passwordColumn, java.lang.String emailAddressColumn)
           
UserStorageStub(java.lang.String userIDColumn, java.lang.String passwordColumn, java.lang.String emailAddressColumn)
          If you use this constructor rather than the other one, you MUST call setUserTable() with the table you've skipped here.
 
Method Summary
 boolean deleteUser(User user)
           
 java.util.List getAllEditableUsers()
           
protected  java.lang.String getFirstNameColumn()
           
protected  java.lang.String getLastNameColumn()
           
 User getNewUser(java.lang.String userID)
          Override this method if you have a subclass of User besides DefaultUserStub that has more information than it.
 User getUser(java.lang.String userID)
          Get any possible user that matches this userID.
 User getUser(java.lang.String userID, java.lang.String password)
          Get any possible user that matches this userID and password.
protected  User getUserFromRow(ForwardOnlyData row)
           
protected  User makeUser(ForwardOnlyData row, java.lang.String userID, java.lang.String password, java.lang.String emailAddress, java.lang.String firstName, java.lang.String lastName, boolean isEditable)
          Override this method if you have a subclass of User besides DefaultUserStub that has more information than it.
protected  User makeUser(java.lang.String userID)
          Override this method if you have a subclass of User besides DefaultUserStub that has more information than it.
 boolean saveUser(User user)
           
protected  void setFirstNameColumn(java.lang.String firstNameColumn)
           
protected  void setLastNameColumn(java.lang.String lastNameColumn)
           
protected  void setUsersTable(DataTableModel usersTable)
           
protected  void setUsersTable(TableFormat tableFormat, DataTableModel usersTable)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

userAuthenticationsTechniquesToTry

protected UserAuthentication[] userAuthenticationsTechniquesToTry
Constructor Detail

UserStorageStub

public UserStorageStub(DataTableModel userTable,
                       java.lang.String userIDColumn,
                       java.lang.String passwordColumn,
                       java.lang.String emailAddressColumn)

UserStorageStub

public UserStorageStub(java.lang.String userIDColumn,
                       java.lang.String passwordColumn,
                       java.lang.String emailAddressColumn)
If you use this constructor rather than the other one, you MUST call setUserTable() with the table you've skipped here.

Parameters:
userIDColumn -
passwordColumn -
emailAddressColumn -

UserStorageStub

public UserStorageStub(DataTableModel userTable)
Method Detail

setUsersTable

protected void setUsersTable(DataTableModel usersTable)

setUsersTable

protected void setUsersTable(TableFormat tableFormat,
                             DataTableModel usersTable)

getFirstNameColumn

protected java.lang.String getFirstNameColumn()

setFirstNameColumn

protected void setFirstNameColumn(java.lang.String firstNameColumn)

getLastNameColumn

protected java.lang.String getLastNameColumn()

setLastNameColumn

protected void setLastNameColumn(java.lang.String lastNameColumn)

makeUser

protected User makeUser(ForwardOnlyData row,
                        java.lang.String userID,
                        java.lang.String password,
                        java.lang.String emailAddress,
                        java.lang.String firstName,
                        java.lang.String lastName,
                        boolean isEditable)
Override this method if you have a subclass of User besides DefaultUserStub that has more information than it. Load that extra information here.
ForwardOnlyData will be one of two things:
a) already on the correct row to load the data from.
b) null, if the user was not loaded from the database, but from another authentication technique.
Also override getNewUser(String), and makeUser(String) to make sure that your user will be created as the right default.

Parameters:
firstName - user's first name
lastName - user's last name
isEditable - whether the user should be editable or not

makeUser

protected User makeUser(java.lang.String userID)
Override this method if you have a subclass of User besides DefaultUserStub that has more information than it. This method should load an abstract user that will check userAuthenticationTechniquesToTry when User.passwordMatches(String) is called. This method will only be called if there some userAuthenticationTechniquesToTry.

Parameters:
userID -
Returns:

getUserFromRow

protected User getUserFromRow(ForwardOnlyData row)

getUser

public User getUser(java.lang.String userID)
Description copied from interface: UserStorage
Get any possible user that matches this userID. If there are abstract matches to users (i.e. other ways to authenticate a user), this returns a user that will match those authentication techniques when User.passwordMatches(String) is called.
Any other options are set to the default for users authenticated through that technique.

Specified by:
getUser in interface UserStorage
Returns:

getUser

public User getUser(java.lang.String userID,
                    java.lang.String password)
Description copied from interface: UserStorage
Get any possible user that matches this userID and password. Returns null if the userID/password is not correct.

Specified by:
getUser in interface UserStorage
Returns:

getNewUser

public User getNewUser(java.lang.String userID)
Override this method if you have a subclass of User besides DefaultUserStub that has more information than it.

Specified by:
getNewUser in interface UserStorage
Returns:

getAllEditableUsers

public java.util.List getAllEditableUsers()
Specified by:
getAllEditableUsers in interface UserStorage

saveUser

public boolean saveUser(User user)
Specified by:
saveUser in interface UserStorage

deleteUser

public boolean deleteUser(User user)
Specified by:
deleteUser in interface UserStorage