org.onebusaway.users.model
Class User

java.lang.Object
  extended by org.onebusaway.container.model.IdentityBean<Integer>
      extended by org.onebusaway.users.model.User
All Implemented Interfaces:
Serializable

public class User
extends IdentityBean<Integer>

Main user account object, designed to be serialized to a database. A couple of design notes:

User Properties

The only properites that are included in the User object itself are those that need be accessible from SQL/HQL queries. For the most part, there aren't many of those. The bulk of user properties and data is stored in the UserProperties object attached to each user. This is just a Java bean that is serialized to and from the database for each user. Why the serialized bean for user properties? This approach gives us more flexibility as user properties change over time, as driven by new functionality. The addition, modification, or deletion of a property can get quite complex when it means changing the underlying database schema, especially as the user table grows larger and you consider the need to upgrade production systems on the fly. Instead, the serialized bean approach allows us to lazily upgrade beans as they are accessed. We rely on handlers registered with the UserPropertiesService to manage versioning of UserProperties implementations and migration between them.

User Indices

Each user has a numeric id that uniquely identifies the user account. However, we often want to lookup and authenticate a user by a variety of other indices: username, phone number, web cookie, OpenID id, Twitter account, email, Facebook account. To support all those mechanisms in a flexible way, each User object has a set of UserIndex objects associated with it (see getUserIndices()). Each user index has a type (ex. username) and value (ex. admin), plus some credential information that can be used for authenticating a user through that user index.

Author:
bdferris
See Also:
UserIndex, UserRole, UserProperties, UserDao, UserService, UserPropertiesService, UserPropertiesMigration, Serialized Form

Constructor Summary
User()
           
 
Method Summary
 Date getCreationTime()
           
 Integer getId()
           
 Date getLastAccessTime()
           
 UserProperties getProperties()
           
 Set<UserRole> getRoles()
           
 Set<UserIndex> getUserIndices()
           
 boolean isTemporary()
           
 void setCreationTime(Date creationTime)
           
 void setId(Integer id)
           
 void setLastAccessTime(Date lastAccessTime)
           
 void setProperties(UserProperties properties)
           
 void setRoles(Set<UserRole> roles)
           
 void setTemporary(boolean temporary)
           
 void setUserIndices(Set<UserIndex> userIndices)
           
 String toString()
           
 
Methods inherited from class org.onebusaway.container.model.IdentityBean
equals, hashCode
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

User

public User()
Method Detail

getId

public Integer getId()
Specified by:
getId in class IdentityBean<Integer>

setId

public void setId(Integer id)
Specified by:
setId in class IdentityBean<Integer>

getCreationTime

public Date getCreationTime()

setCreationTime

public void setCreationTime(Date creationTime)

getLastAccessTime

public Date getLastAccessTime()

setLastAccessTime

public void setLastAccessTime(Date lastAccessTime)

isTemporary

public boolean isTemporary()

setTemporary

public void setTemporary(boolean temporary)

getProperties

public UserProperties getProperties()

setProperties

public void setProperties(UserProperties properties)

getRoles

public Set<UserRole> getRoles()

setRoles

public void setRoles(Set<UserRole> roles)

getUserIndices

public Set<UserIndex> getUserIndices()

setUserIndices

public void setUserIndices(Set<UserIndex> userIndices)

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2012 OneBusAway. All Rights Reserved.