Expresso 5-6

com.jcorporate.expresso.core.security
Class MapBasedUserInfo

java.lang.Object
  extended bycom.jcorporate.expresso.core.security.MapBasedUserInfo
All Implemented Interfaces:
LookupInterface, UserInfo

public class MapBasedUserInfo
extends Object
implements UserInfo

A User Info implementation that is Map based instead of database object based. Although this isn't usually used in Expresso, a few cases, where we need a SuperUser, for example when database access doesn't exist. It is not considered something to use on a broad basis, more as a workaround for some special startup conditions.

Author:
Michael Rimov

Constructor Summary
MapBasedUserInfo()
          Default constructor.
 
Method Summary
 void add()
          Adds the current UserInfo object into the repository
 void delete()
          Deletes the current UserInfo object from the repository
 boolean find()
          Find a UserInfo object in the repository that matches the non-empty properties filled in the current UserInfo object
 String getAccountStatus()
          Retrieve the current account status.
 Vector getAllUsers()
          Unsupported operation
 String getCreateDate()
          Returns the date that this UserInfo object was created
 String getDataContext()
          gets the DB context; can return null
 String getDBName()
          gets the DB context; can return null
 String getEmail()
          Returns the email address for this user
 String getEmailAuthCode()
          Returns the email auth code previously set for this user
 String getEmailValCode()
          Retrieve the validation code required for authorization by email
 String getField(String fieldName)
          Deprecated. Use the direct getLoginName, getEmail, getPassword, etc.
 Vector getGroups()
          Currently unsupported.
 String getLoginName()
          Returns the login name of this user
 String getPassword()
          Returns the password for this user
 String getPrimaryGroup()
          the primary group of this user is appropriate for unix-like purposes, such as setting the group for a file permission
 boolean getRegComplete()
          Returns the status of whether extended registration has been completed or not Valid values are "Y" or "N"
 String getRegistrationDomain()
          Returns the unique integer for the registration domain that this user belongs to
 int getUid()
          Returns the user id for this user
 String getUpdateDate()
          Returns the date that this UserInfo object was last modified
 String getUserName()
          Returns the descriptive string for this user
 Vector getValues()
          Unsupported Operation
 String hashEncodePassword(String password)
          this returns an appropriately hashed password.
 boolean passwordEquals(String testPassword)
          Checks if the given password equals what we have on file.
 void retrieve()
          Retrieves the current user from the repository
 void sendAuthEmail()
          Not Implemented
 void sendFollowUpEmail()
          Not Implemented
 void setAccountStatus(String accountStatus)
          Sets the current status of the account - "A" (active), "D" (disabled), "I" (inactive)
 void setDBName(String newDBName)
          Sets the DB context
 void setEmail(String email)
          Sets the email address
 void setEmailValCode(String code)
          Sets the code required for auth.
 void setLoginName(String loginName)
          Sets the login name
 void setPassword(String password)
          Sets the password
 void setRegComplete(boolean status)
          Sets the extended registration complete flag - "Y" or "N"
 void setRegistrationDomain(String id)
          Sets the registration domain
 void setUid(int uid)
          Sets the user UID
 void setUserName(String name)
          Sets the user name
 void update()
          There should be no copying and detaching from the datasource.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MapBasedUserInfo

public MapBasedUserInfo()
Default constructor.

Method Detail

add

public void add()
         throws DBException
Description copied from interface: UserInfo
Adds the current UserInfo object into the repository

Specified by:
add in interface UserInfo
Throws:
DBException - If the add fails

delete

public void delete()
            throws DBException
Description copied from interface: UserInfo
Deletes the current UserInfo object from the repository

Specified by:
delete in interface UserInfo
Throws:
DBException - If the delete fails

find

public boolean find()
             throws DBException
Description copied from interface: UserInfo
Find a UserInfo object in the repository that matches the non-empty properties filled in the current UserInfo object

Specified by:
find in interface UserInfo
Returns:
true if the user is found
Throws:
DBException - If the find fails

getAccountStatus

public String getAccountStatus()
                        throws DBException
Retrieve the current account status.

Specified by:
getAccountStatus in interface UserInfo
Returns:
java.lang.String
Throws:
DBException - If the find fails

getAllUsers

public Vector getAllUsers()
                   throws DBException
Unsupported operation

Specified by:
getAllUsers in interface UserInfo
Returns:
java.util.Vector
Throws:
DBException - If there is an error during the retrieval

getCreateDate

public String getCreateDate()
                     throws DBException
Description copied from interface: UserInfo
Returns the date that this UserInfo object was created

Specified by:
getCreateDate in interface UserInfo
Returns:
java.lang.String
Throws:
DBException - If there is an error during the retrieval

getDBName

public String getDBName()
Description copied from interface: UserInfo
gets the DB context; can return null

Specified by:
getDBName in interface UserInfo
Returns:
String

getDataContext

public String getDataContext()
Description copied from interface: UserInfo
gets the DB context; can return null

Specified by:
getDataContext in interface UserInfo
Returns:
String

getEmail

public String getEmail()
                throws DBException
Description copied from interface: UserInfo
Returns the email address for this user

Specified by:
getEmail in interface UserInfo
Returns:
java.lang.String
Throws:
DBException - If there is an error during the retrieval

getEmailAuthCode

public String getEmailAuthCode()
                        throws DBException
Description copied from interface: UserInfo
Returns the email auth code previously set for this user

Specified by:
getEmailAuthCode in interface UserInfo
Returns:
java.lang.String
Throws:
DBException - If there is an error during the retrieval

getEmailValCode

public String getEmailValCode()
                       throws DBException
Description copied from interface: UserInfo
Retrieve the validation code required for authorization by email

Specified by:
getEmailValCode in interface UserInfo
Returns:
java.lang.String
Throws:
DBException - If the find fails

getField

public String getField(String fieldName)
                throws DBException
Deprecated. Use the direct getLoginName, getEmail, getPassword, etc.

Not Implemented

Specified by:
getField in interface UserInfo
Parameters:
fieldName - The field to retrieve
Returns:
Vector Group names that this user belongs to
Throws:
DBException - If an error occurs when the group info is read
UnsupportedOperationException - This is not Implemented

getGroups

public Vector getGroups()
                 throws DBException
Currently unsupported. Returns a blank Vector

Specified by:
getGroups in interface UserInfo
Returns:
Vector Group names that this user belongs to
Throws:
DBException - If an error occurs when the group info is read

getLoginName

public String getLoginName()
                    throws DBException
Description copied from interface: UserInfo
Returns the login name of this user

Specified by:
getLoginName in interface UserInfo
Returns:
java.lang.String
Throws:
DBException - If there is an error during the retrieval

getPassword

public String getPassword()
                   throws DBException
Description copied from interface: UserInfo
Returns the password for this user

Specified by:
getPassword in interface UserInfo
Returns:
java.lang.String
Throws:
DBException - If there is an error during the retrieval

getPrimaryGroup

public String getPrimaryGroup()
                       throws DBException
Description copied from interface: UserInfo
the primary group of this user is appropriate for unix-like purposes, such as setting the group for a file permission

Specified by:
getPrimaryGroup in interface UserInfo
Returns:
name of the primary group of this user; null if no group is found
Throws:
DBException

hashEncodePassword

public String hashEncodePassword(String password)
                          throws DBException
this returns an appropriately hashed password.

Specified by:
hashEncodePassword in interface UserInfo
Parameters:
password - to be hashed
Returns:
appropriately hashed password.
Throws:
DBException

getRegComplete

public boolean getRegComplete()
                       throws DBException
Description copied from interface: UserInfo
Returns the status of whether extended registration has been completed or not Valid values are "Y" or "N"

Specified by:
getRegComplete in interface UserInfo
Returns:
java.lang.String
Throws:
DBException - If there is an error during the retrieval

getRegistrationDomain

public String getRegistrationDomain()
                             throws DBException
Description copied from interface: UserInfo
Returns the unique integer for the registration domain that this user belongs to

Specified by:
getRegistrationDomain in interface UserInfo
Returns:
java.lang.String
Throws:
DBException - If the underlying User implementation throws the same

getUid

public int getUid()
           throws DBException
Description copied from interface: UserInfo
Returns the user id for this user

Specified by:
getUid in interface UserInfo
Returns:
java.lang.String
Throws:
DBException - If there is an error during the retrieval

getUpdateDate

public String getUpdateDate()
                     throws DBException
Description copied from interface: UserInfo
Returns the date that this UserInfo object was last modified

Specified by:
getUpdateDate in interface UserInfo
Returns:
java.lang.String
Throws:
DBException - If there is an error during the retrieval

getUserName

public String getUserName()
                   throws DBException
Description copied from interface: UserInfo
Returns the descriptive string for this user

Specified by:
getUserName in interface UserInfo
Returns:
java.lang.String
Throws:
DBException - If there is an error during the retrieval

getValues

public Vector getValues()
                 throws DBException
Unsupported Operation

Specified by:
getValues in interface LookupInterface
Returns:
A ValidValue vector describing what can be looked up.
Throws:
DBException

passwordEquals

public boolean passwordEquals(String testPassword)
                       throws DBException
Checks if the given password equals what we have on file.

Specified by:
passwordEquals in interface UserInfo
Parameters:
testPassword - The string to test if it's a correct password
Returns:
true if the testPassword equals the password on file.
Throws:
DBException - If an error occurs when the group info is read

retrieve

public void retrieve()
              throws DBException
Description copied from interface: UserInfo
Retrieves the current user from the repository

Specified by:
retrieve in interface UserInfo
Throws:
DBException - If the retrieve fails

sendAuthEmail

public void sendAuthEmail()
                   throws DBException
Not Implemented

Specified by:
sendAuthEmail in interface UserInfo
Throws:
DBException

sendFollowUpEmail

public void sendFollowUpEmail()
                       throws DBException
Not Implemented

Specified by:
sendFollowUpEmail in interface UserInfo
Throws:
DBException

setAccountStatus

public void setAccountStatus(String accountStatus)
                      throws DBException
Description copied from interface: UserInfo
Sets the current status of the account - "A" (active), "D" (disabled), "I" (inactive)

Specified by:
setAccountStatus in interface UserInfo
Parameters:
accountStatus - java.lang.String
Throws:
DBException - If there is an error

setDBName

public void setDBName(String newDBName)
               throws DBException
Description copied from interface: UserInfo
Sets the DB context

Specified by:
setDBName in interface UserInfo
Parameters:
newDBName - java.lang.String
Throws:
DBException - If there is an error

setEmail

public void setEmail(String email)
              throws DBException
Description copied from interface: UserInfo
Sets the email address

Specified by:
setEmail in interface UserInfo
Parameters:
email - java.lang.String
Throws:
DBException - If there is an error

setEmailValCode

public void setEmailValCode(String code)
                     throws DBException
Sets the code required for auth.

Specified by:
setEmailValCode in interface UserInfo
Parameters:
code - java.lang.String
Throws:
DBException - If there is an error

setLoginName

public void setLoginName(String loginName)
                  throws DBException
Description copied from interface: UserInfo
Sets the login name

Specified by:
setLoginName in interface UserInfo
Parameters:
loginName - java.lang.String
Throws:
DBException - If there is an error

setPassword

public void setPassword(String password)
                 throws DBException
Description copied from interface: UserInfo
Sets the password

Specified by:
setPassword in interface UserInfo
Parameters:
password - java.lang.String
Throws:
DBException - If there is an error

setRegComplete

public void setRegComplete(boolean status)
                    throws DBException
Description copied from interface: UserInfo
Sets the extended registration complete flag - "Y" or "N"

Specified by:
setRegComplete in interface UserInfo
Parameters:
status - java.lang.String
Throws:
DBException - If there is an error

setRegistrationDomain

public void setRegistrationDomain(String id)
                           throws DBException
Description copied from interface: UserInfo
Sets the registration domain

Specified by:
setRegistrationDomain in interface UserInfo
Parameters:
id - java.lang.String
Throws:
DBException - If there is an error
See Also:
RegistrationDomain

setUid

public void setUid(int uid)
            throws DBException
Description copied from interface: UserInfo
Sets the user UID

Specified by:
setUid in interface UserInfo
Parameters:
uid - The uid of the user
Throws:
DBException - If there is an error

setUserName

public void setUserName(String name)
                 throws DBException
Description copied from interface: UserInfo
Sets the user name

Specified by:
setUserName in interface UserInfo
Parameters:
name - java.lang.String
Throws:
DBException - If there is an error

update

public void update()
            throws DBException
There should be no copying and detaching from the datasource. This does nothing.

Specified by:
update in interface UserInfo
Throws:
DBException - If the add fails

Expresso 5-6

Please see www.jcorporate.com for information about new Expresso releases.