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.services.security.torque
Class TorqueUser

    java.lang.Object
      org.apache.turbine.services.security.torque.TorqueObject
          org.apache.turbine.services.security.torque.TorqueUser

All Implemented Interfaces:
  Serializable, Comparable, EventListener, javax.servlet.http.HttpSessionBindingListener, org.apache.torque.om.Persistent, SecurityEntity, User

    public class TorqueUser

extends TorqueObject
implements User

This is the User class used by the TorqueSecurity Service. It decouples all the database peer access from the actual Peer object

Version:
  $Id: TorqueUser.java 1096130 2011-04-23 10:37:19Z ludwig $
Author:
  Josh Lucas, Jon S. Stevens, John D. McNally, Frank Y. Kim, Craig D. Berry, Martin Poeschl, Daniel Rall, Henning P. Schmiedehausen
See Also:
  Serialized Form

Field Summary

Fields inherited from class org.apache.turbine.services.security.torque.TorqueObject
`obj`

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
`TorqueUser()` Constructor.
`TorqueUser(org.apache.torque.om.Persistent obj)` This Constructor is used when the UserPeerManager has retrieved a list of Database Objects from the peer and must 'wrap' them into TorqueRole Objects.

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()` Returns the confirm value of the user
`Date` | `getCreateDate()` Returns the creation date of the user
`String` | `getEmail()` Returns the email address of the user
`String` | `getFirstName()` Returns the first name of the User
`int` | `getId()` Gets the Id of this object
`Integer` | `getIdAsObj()` Gets the Id of this object
`Date` | `getLastAccessDate()` Gets the last access date for this User.
`Date` | `getLastLogin()` Returns the date of the last login of the user
`String` | `getLastName()` Returns the last name of the User
`String` | `getName()` Returns the name of this object.
`byte[]` | `getObjectdata()` Returns the value of the objectdata for this user.
`String` | `getPassword()` Returns the password of the 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` | `getPermStorage()` Returns the permanent storage.
`org.apache.torque.om.Persistent` | `getPersistentObj()` Returns the underlying Object for the Peer Used in the UserPeerManager when building a new Criteria.
`Object` | `getTemp(String name)` Get an object from temporary storage.
`Object` | `getTemp(String name, Object def)` Get an object from temporary storage; return default if value is null.
`Hashtable` | `getTempStorage()` Returns the temporary storage.
`String` | `getUserName()` Deprecated. Use getName() instead.
`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()` Makes changes made to the User attributes permanent.
`void` | `save(Connection con)` Stores the object in the database.
`void` | `save(String torqueName)` Stores the object in the database.
`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 confirm)` Sets the new confirm value of the user
`void` | `setCreateDate(Date createDate)` Sets the new creation date of the user
`void` | `setEmail(String email)` Sets the new email address of the user
`void` | `setFirstName(String firstName)` Sets the first name of the User
`void` | `setHasLoggedIn(Boolean value)` This sets whether or not someone has logged in.
`void` | `setId(int id)` Sets the Id of this object
`void` | `setLastAccessDate()` Sets the last access date for this User.
`void` | `setLastLogin(Date lastLogin)` Sets the new date of the last login of the user
`void` | `setLastName(String lastName)` Sets the last name of User
`void` | `setName(String name)` Sets the name of this object
`void` | `setObjectdata(byte[] objectdata)` Sets the value of the objectdata for the user
`void` | `setPassword(String password)` Sets the password of the User
`void` | `setPerm(String name, Object value)` Put an object into permanent storage.
`void` | `setPermStorage(Hashtable 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 tempStorage)` This should only be used in the case where we want to save the data to the database.
`void` | `setUserName(String name)` Sets the name of this user.
`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.services.security.torque.TorqueObject
`compareTo, equals, equals, getPrimaryKey, hashCode, isModified, isNew, setModified, setNew, setPrimaryKey, setPrimaryKey`

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

Constructor Detail

### TorqueUser

    public TorqueUser()

  Constructor. Create a new User and set the createDate.

### TorqueUser

    public TorqueUser(org.apache.torque.om.Persistent obj)

  This Constructor is used when the UserPeerManager has retrieved a list of Database Objects from the peer and must 'wrap' them into TorqueRole Objects. You should not use it directly!

  Parameters:
    `obj` - An Object from the peer

Method Detail

### getPersistentObj

    public org.apache.torque.om.Persistent getPersistentObj()

  Returns the underlying Object for the Peer Used in the UserPeerManager when building a new Criteria.

  Specified by:
    `getPersistentObj` in class `TorqueObject`
  Returns:
    The underlying persistent object

### save

    public void save(String torqueName)
              throws Exception

  Stores the object in the database. If the object is new, it inserts it; otherwise an update is performed.

  Specified by:
    `save` in interface `org.apache.torque.om.Persistent`
  Overrides:
    `save` in class `TorqueObject`
  Parameters:
    `torqueName` - The name under which the object should be stored.
  Throws:
    `Exception` - This method might throw an exceptions

### save

    public void save(Connection con)
              throws Exception

  Stores the object in the database. If the object is new, it inserts it; otherwise an update is performed. This method is meant to be used as part of a transaction, otherwise use the save() method and the connection details will be handled internally

  Specified by:
    `save` in interface `org.apache.torque.om.Persistent`
  Overrides:
    `save` in class `TorqueObject`
  Parameters:
    `con` - A Connection object to save the object
  Throws:
    `Exception` - This method might throw an exceptions

### save

    public void save()
              throws TurbineSecurityException

  Makes changes made to the User attributes permanent.

  Specified by:
    `save` in interface `org.apache.torque.om.Persistent`
  Specified by:
    `save` in class `TorqueObject`
  Throws:
    `TurbineSecurityException` - if there is a problem while saving data.

### getName

    public String getName()

  Returns the name of this object.

  Specified by:
    `getName` in interface `SecurityEntity`
  Specified by:
    `getName` in class `TorqueObject`
  Returns:
    The name of the object.

### setName

    public void setName(String name)

  Sets the name of this object

  Specified by:
    `setName` in interface `SecurityEntity`
  Specified by:
    `setName` in class `TorqueObject`
  Parameters:
    `name` - The name of the object

### getId

    public int getId()

  Gets the Id of this object

  Specified by:
    `getId` in interface `SecurityEntity`
  Returns:
    The Id of the object

### getIdAsObj

    public Integer getIdAsObj()

  Gets the Id of this object

  Specified by:
    `getIdAsObj` in interface `SecurityEntity`
  Returns:
    The Id of the object

### setId

    public void setId(int id)

  Sets the Id of this object

  Specified by:
    `setId` in interface `SecurityEntity`
  Parameters:
    `id` - The new Id

### getUserName

    public String getUserName()

  Deprecated. Use getName() instead.

  Returns the name of this user.

  Returns:
    The name of the user.

### setUserName

    public void setUserName(String name)

  Sets the name of this user.

  Parameters:
    `name` - The name of the user.

### getPassword

    public String getPassword()

  Returns the password of the User

  Specified by:
    `getPassword` in interface `User`
  Returns:
    The password of the User

### setPassword

    public void setPassword(String password)

  Sets the password of the User

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

### getFirstName

    public String getFirstName()

  Returns the first name of the User

  Specified by:
    `getFirstName` in interface `User`
  Returns:
    The first name of the User

### setFirstName

    public void setFirstName(String firstName)

  Sets the first name of the User

  Specified by:
    `setFirstName` in interface `User`
  Parameters:
    `firstName` - The new first name of the User

### getLastName

    public String getLastName()

  Returns the last name of the User

  Specified by:
    `getLastName` in interface `User`
  Returns:
    The last name of the User

### setLastName

    public void setLastName(String lastName)

  Sets the last name of User

  Specified by:
    `setLastName` in interface `User`
  Parameters:
    `lastName` - The new last name of the User

### getEmail

    public String getEmail()

  Returns the email address of the user

  Specified by:
    `getEmail` in interface `User`
  Returns:
    The email address of the user

### setEmail

    public void setEmail(String email)

  Sets the new email address of the user

  Specified by:
    `setEmail` in interface `User`
  Parameters:
    `email` - The new email address of the user

### getConfirmed

    public String getConfirmed()

  Returns the confirm value of the user

  Specified by:
    `getConfirmed` in interface `User`
  Returns:
    The confirm value of the user

### setConfirmed

    public void setConfirmed(String confirm)

  Sets the new confirm value of the user

  Specified by:
    `setConfirmed` in interface `User`
  Parameters:
    `confirm` - The new confirm value of the user

### getCreateDate

    public Date getCreateDate()

  Returns the creation date of the user

  Specified by:
    `getCreateDate` in interface `User`
  Returns:
    The creation date of the user

### setCreateDate

    public void setCreateDate(Date createDate)

  Sets the new creation date of the user

  Specified by:
    `setCreateDate` in interface `User`
  Parameters:
    `createDate` - The new creation date of the user

### getLastLogin

    public Date getLastLogin()

  Returns the date of the last login of the user

  Specified by:
    `getLastLogin` in interface `User`
  Returns:
    The date of the last login of the user

### setLastLogin

    public void setLastLogin(Date lastLogin)

  Sets the new date of the last login of the user

  Specified by:
    `setLastLogin` in interface `User`
  Parameters:
    `lastLogin` - The new the date of the last login of the user

### getObjectdata

    public byte[] getObjectdata()

  Returns the value of the objectdata for this user. Objectdata is a VARBINARY column in the table used to store the permanent storage table from the User object.

  Returns:
    The bytes in the objectdata for this user

### setObjectdata

    public void setObjectdata(byte[] objectdata)

  Sets the value of the objectdata for the user

  Parameters:
    `objectdata` - The new the date of the last login of the user

### 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.

### 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.

### 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`

### 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.

### 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.

### 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.

### 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.

### 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.

### 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`

### getPermStorage

    public Hashtable getPermStorage()

  Returns the permanent storage. This is implemented as a Hashtable and backed by an VARBINARY column in the database.

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

### setPermStorage

    public void setPermStorage(Hashtable 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:
    `storage` - A Hashtable.

### getTempStorage

    public Hashtable getTempStorage()

  Returns the temporary storage. This is implemented as a Hashtable

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

### setTempStorage

    public void setTempStorage(Hashtable 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.

### 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.

### 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.

### 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 TorqueUser 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.

### getTemp

    public Object getTemp(String name)

  Get an object from temporary storage.

  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.

### 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 TorqueUser 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.

### 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.

### 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:
    `event` - Indication of value/session binding.

### 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:
    `event` - Indication of value/session unbinding.

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.