Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.turbine.om.security
Class TurbineUser

    java.lang.Object
      org.apache.turbine.om.security.SecurityObject<User>
          org.apache.turbine.om.security.TurbineUser

All Implemented Interfaces:
  Serializable, Comparable<User>, EventListener, javax.servlet.http.HttpSessionBindingListener, SecurityEntity, User

    public class TurbineUser

extends SecurityObject<User>
implements User

A generic implementation of User interface. This basic implementation contains the functionality that is expected to be common among all User implementations. You are welcome to extend this class if you wish to have custom functionality in your user objects (like accessor methods for custom attributes). Note that implementing a different scheme of user data storage normally involves writing an implementation of `UserManager` interface.

Version:
  $Id: TurbineUser.java 1078552 2011-03-06 19:58:46Z tv $
Author:
  Josh Lucas, Jon S. Stevens, John D. McNally, Frank Y. Kim, Craig D. Berry, Eric Pugh, Henning P. Schmiedehausen
See Also:
  Serialized Form

Field Summary

Fields inherited from interface org.apache.turbine.om.security.User
`ACCESS_COUNTER, CONFIRM_DATA, CONFIRM_VALUE, EMAIL, FIRST_NAME, HAS_LOGGED_IN, LAST_LOGIN, LAST_NAME, PASSWORD, SESSION_ACCESS_COUNTER, SESSION_KEY, USERNAME`

Constructor Summary
`TurbineUser()` Constructor.

Method Summary
`int` | `getAccessCounter()` Gets the access counter for a user from perm storage.
`int` | `getAccessCounterForSession()` Gets the access counter for a user during a session.
`String` | `getConfirmed()` Gets the confirmation value.
`Date` | `getCreateDate()` Gets the create date for this User.
`String` | `getEmail()` Returns the email address for this user.
`String` | `getFirstName()` Returns the first name for this user.
`Date` | `getLastAccessDate()` Gets the last access date for this User.
`Date` | `getLastLogin()` Get last login date/time for this user.
`String` | `getLastName()` Returns the last name for this user.
`String` | `getName()` Returns the name of this user.
`String` | `getPassword()` Get password for this user.
`Object` | `getPerm(String name)` Get an object from permanent storage.
`Object` | `getPerm(String name, Object def)` Get an object from permanent storage; return default if value is null.
`Hashtable<String,Object>` | `getPermStorage()` This should only be used in the case where we want to save the data to the database.
`Object` | `getTemp(String name)` Get an object from temporary storage; return null if the object can't be found.
`Object` | `getTemp(String name, Object def)` Get an object from temporary storage; return default if value is null.
`Hashtable<String,Object>` | `getTempStorage()` This should only be used in the case where we want to save the data to the database.
`boolean` | `hasLoggedIn()` The user is considered logged in if they have not timed out.
`void` | `incrementAccessCounter()` Increments the permanent hit counter for the user.
`void` | `incrementAccessCounterForSession()` Increments the session hit counter for the user.
`boolean` | `isConfirmed()` This method reports whether or not the user has been confirmed in the system by checking the User.CONFIRM_VALUE column in the users record to see if it is equal to User.CONFIRM_DATA.
`Object` | `removeTemp(String name)` Remove an object from temporary storage and return the object.
`void` | `save()` Saves this object to the data store.
`void` | `save(Connection conn)` not implemented
`void` | `save(String dbname)` not implemented
`void` | `setAccessCounter(int cnt)` Sets the access counter for a user, saved in perm storage.
`void` | `setAccessCounterForSession(int cnt)` Sets the session access counter for a user, saved in temp storage.
`void` | `setConfirmed(String value)` Sets the confirmation value.
`void` | `setCreateDate(Date date)` Sets the create date for this User.
`void` | `setEmail(String address)` Sets the email address.
`void` | `setFirstName(String firstName)` Sets the first name for this user.
`void` | `setHasLoggedIn(Boolean value)` This sets whether or not someone has logged in.
`void` | `setLastAccessDate()` Sets the last access date for this User.
`void` | `setLastLogin(Date date)` Set last login date/time.
`void` | `setLastName(String lastName)` Sets the last name for this user.
`void` | `setName(String name)` Sets the name of this user.
`void` | `setPassword(String password)` Set password.
`void` | `setPerm(String name, Object value)` Put an object into permanent storage.
`void` | `setPermStorage(Hashtable<String,Object> permStorage)` This should only be used in the case where we want to save the data to the database.
`void` | `setTemp(String name, Object value)` Put an object into temporary storage.
`void` | `setTempStorage(Hashtable<String,Object> tempStorage)` This should only be used in the case where we want to save the data to the database.
`void` | `updateLastLogin()` Updates the last login date in the database.
`void` | `valueBound(javax.servlet.http.HttpSessionBindingEvent hsbe)` Implement this method if you wish to be notified when the User has been Bound to the session.
`void` | `valueUnbound(javax.servlet.http.HttpSessionBindingEvent hsbe)` Implement this method if you wish to be notified when the User has been Unbound from the session.

Methods inherited from class org.apache.turbine.om.security.SecurityObject
`compareTo, getAttribute, getAttributes, getId, getIdAsObj, setAttribute, setAttributes, setId, toString`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Methods inherited from interface org.apache.turbine.om.security.SecurityEntity
`getId, getIdAsObj, setId`

Constructor Detail

### TurbineUser

    public TurbineUser()

  Constructor. Create a new User and set the createDate.

Method Detail

### getAccessCounterForSession

    public int getAccessCounterForSession()

  Gets the access counter for a user during a session.

  Specified by:
    `getAccessCounterForSession` in interface `User`
  Returns:
    The access counter for the user for the session.

### getAccessCounter

    public int getAccessCounter()

  Gets the access counter for a user from perm storage.

  Specified by:
    `getAccessCounter` in interface `User`
  Returns:
    The access counter for the user.

### getCreateDate

    public Date getCreateDate()

  Gets the create date for this User. This is the time at which the user object was created.

  Specified by:
    `getCreateDate` in interface `User`
  Returns:
    A Java Date with the date of creation for the user.

### getLastAccessDate

    public Date getLastAccessDate()

  Gets the last access date for this User. This is the last time that the user object was referenced.

  Specified by:
    `getLastAccessDate` in interface `User`
  Returns:
    A Java Date with the last access date for the user.

### getLastLogin

    public Date getLastLogin()

  Get last login date/time for this user.

  Specified by:
    `getLastLogin` in interface `User`
  Returns:
    A Java Date with the last login date for the user.

### getPassword

    public String getPassword()

  Get password for this user.

  Specified by:
    `getPassword` in interface `User`
  Returns:
    A String with the password for the user.

### getPerm

    public Object getPerm(String name)

  Get an object from permanent storage.

  Specified by:
    `getPerm` in interface `User`
  Parameters:
    `name` - The object's name.
  Returns:
    An Object with the given name, or null if not found.

### getPerm

    public Object getPerm(String name,
                          Object def)

  Get an object from permanent storage; return default if value is null.

  Specified by:
    `getPerm` in interface `User`
  Parameters:
    `name` - The object's name.
    `def` - A default value to return.
  Returns:
    An Object with the given name.

### getPermStorage

    public Hashtable<String,Object> getPermStorage()

  This should only be used in the case where we want to save the data to the database.

  Specified by:
    `getPermStorage` in interface `User`
  Returns:
    A Hashtable.

### getTemp

    public Object getTemp(String name)

  Get an object from temporary storage; return null if the object can't be found.

  Specified by:
    `getTemp` in interface `User`
  Parameters:
    `name` - The object's name.
  Returns:
    An Object with the given name.

### getTemp

    public Object getTemp(String name,
                          Object def)

  Get an object from temporary storage; return default if value is null.

  Specified by:
    `getTemp` in interface `User`
  Parameters:
    `name` - The object's name.
    `def` - A default value to return.
  Returns:
    An Object with the given name.

### getFirstName

    public String getFirstName()

  Returns the first name for this user.

  Specified by:
    `getFirstName` in interface `User`
  Returns:
    A String with the user's first name.

### getLastName

    public String getLastName()

  Returns the last name for this user.

  Specified by:
    `getLastName` in interface `User`
  Returns:
    A String with the user's last name.

### hasLoggedIn

    public boolean hasLoggedIn()

  The user is considered logged in if they have not timed out.

  Specified by:
    `hasLoggedIn` in interface `User`
  Returns:
    Whether the user has logged in.

### getEmail

    public String getEmail()

  Returns the email address for this user.

  Specified by:
    `getEmail` in interface `User`
  Returns:
    A String with the user's email address.

### incrementAccessCounter

    public void incrementAccessCounter()

  Increments the permanent hit counter for the user.

  Specified by:
    `incrementAccessCounter` in interface `User`

### incrementAccessCounterForSession

    public void incrementAccessCounterForSession()

  Increments the session hit counter for the user.

  Specified by:
    `incrementAccessCounterForSession` in interface `User`

### removeTemp

    public Object removeTemp(String name)

  Remove an object from temporary storage and return the object.

  Specified by:
    `removeTemp` in interface `User`
  Parameters:
    `name` - The name of the object to remove.
  Returns:
    An Object.

### setAccessCounter

    public void setAccessCounter(int cnt)

  Sets the access counter for a user, saved in perm storage.

  Specified by:
    `setAccessCounter` in interface `User`
  Parameters:
    `cnt` - The new count.

### setAccessCounterForSession

    public void setAccessCounterForSession(int cnt)

  Sets the session access counter for a user, saved in temp storage.

  Specified by:
    `setAccessCounterForSession` in interface `User`
  Parameters:
    `cnt` - The new count.

### setLastAccessDate

    public void setLastAccessDate()

  Sets the last access date for this User. This is the last time that the user object was referenced.

  Specified by:
    `setLastAccessDate` in interface `User`

### setCreateDate

    public void setCreateDate(Date date)

  Sets the create date for this User. This is the time at which the user object was created.

  Specified by:
    `setCreateDate` in interface `User`
  Parameters:
    `date` - The create date.

### setLastLogin

    public void setLastLogin(Date date)

  Set last login date/time.

  Specified by:
    `setLastLogin` in interface `User`
  Parameters:
    `date` - The last login date.

### setPassword

    public void setPassword(String password)

  Set password.

  Specified by:
    `setPassword` in interface `User`
  Parameters:
    `password` - The new password.

### setPerm

    public void setPerm(String name,
                        Object value)

  Put an object into permanent storage. If the value is null, it will convert that to a "" because the underlying storage mechanism within TurbineUser is currently a Hashtable and null is not a valid value.

  Specified by:
    `setPerm` in interface `User`
  Parameters:
    `name` - The object's name.
    `value` - The object.

### setPermStorage

    public void setPermStorage(Hashtable<String,Object> permStorage)

  This should only be used in the case where we want to save the data to the database.

  Specified by:
    `setPermStorage` in interface `User`
  Parameters:
    `permStorage` - A Hashtable.

### getTempStorage

    public Hashtable<String,Object> getTempStorage()

  This should only be used in the case where we want to save the data to the database.

  Specified by:
    `getTempStorage` in interface `User`
  Returns:
    A Hashtable.

### setTempStorage

    public void setTempStorage(Hashtable<String,Object> tempStorage)

  This should only be used in the case where we want to save the data to the database.

  Specified by:
    `setTempStorage` in interface `User`
  Parameters:
    `storage` - A Hashtable.

### setHasLoggedIn

    public void setHasLoggedIn(Boolean value)

  This sets whether or not someone has logged in. hasLoggedIn() returns this value.

  Specified by:
    `setHasLoggedIn` in interface `User`
  Parameters:
    `value` - Whether someone has logged in or not.

### setTemp

    public void setTemp(String name,
                        Object value)

  Put an object into temporary storage. If the value is null, it will convert that to a "" because the underlying storage mechanism within TurbineUser is currently a Hashtable and null is not a valid value.

  Specified by:
    `setTemp` in interface `User`
  Parameters:
    `name` - The object's name.
    `value` - The object.

### setFirstName

    public void setFirstName(String firstName)

  Sets the first name for this user.

  Specified by:
    `setFirstName` in interface `User`
  Parameters:
    `firstName` - User's first name.

### setLastName

    public void setLastName(String lastName)

  Sets the last name for this user.

  Specified by:
    `setLastName` in interface `User`
  Parameters:
    `lastName` - User's last name.

### setEmail

    public void setEmail(String address)

  Sets the email address.

  Specified by:
    `setEmail` in interface `User`
  Parameters:
    `address` - The email address.

### isConfirmed

    public boolean isConfirmed()

  This method reports whether or not the user has been confirmed in the system by checking the User.CONFIRM_VALUE column in the users record to see if it is equal to User.CONFIRM_DATA.

  Specified by:
    `isConfirmed` in interface `User`
  Returns:
    True if the user has been confirmed.

### setConfirmed

    public void setConfirmed(String value)

  Sets the confirmation value. The value should be either a random string or User.CONFIRM_DATA

  Specified by:
    `setConfirmed` in interface `User`
  Parameters:
    `value` - The confirmation key value.

### getConfirmed

    public String getConfirmed()

  Gets the confirmation value.

  Specified by:
    `getConfirmed` in interface `User`
  Returns:
    status The confirmation value for this User

### updateLastLogin

    public void updateLastLogin()
                         throws Exception

  Updates the last login date in the database.

  Specified by:
    `updateLastLogin` in interface `User`
  Throws:
    `Exception` - a generic exception.

### valueBound

    public void valueBound(javax.servlet.http.HttpSessionBindingEvent hsbe)

  Implement this method if you wish to be notified when the User has been Bound to the session.

  Specified by:
    `valueBound` in interface `javax.servlet.http.HttpSessionBindingListener`
  Parameters:
    `hsbe` - The HttpSessionBindingEvent.

### valueUnbound

    public void valueUnbound(javax.servlet.http.HttpSessionBindingEvent hsbe)

  Implement this method if you wish to be notified when the User has been Unbound from the session.

  Specified by:
    `valueUnbound` in interface `javax.servlet.http.HttpSessionBindingListener`
  Parameters:
    `hsbe` - The HttpSessionBindingEvent.

### save

    public void save()
              throws Exception

  Saves this object to the data store.

  Throws:
    `Exception`

### save

    public void save(Connection conn)
              throws Exception

  not implemented

  Parameters:
    `conn` -
  Throws:
    `Exception`

### save

    public void save(String dbname)
              throws Exception

  not implemented

  Parameters:
    `dbname` -
  Throws:
    `Exception`

### getName

    public String getName()

  Returns the name of this user. This will be the user name/ login name.

  Specified by:
    `getName` in interface `SecurityEntity`
  Overrides:
    `getName` in class `SecurityObject<User>`
  Returns:
    The name of the user.

### setName

    public void setName(String name)

  Sets the name of this user. This will be the user name/ login name.

  Specified by:
    `setName` in interface `SecurityEntity`
  Overrides:
    `setName` in class `SecurityObject<User>`
  Parameters:
    `name` - The name of the object.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000-2011 The Apache Software Foundation. All Rights Reserved.