- All Implemented Interfaces:
public class User
- extends IdentityBean<Integer>
Main user account object, designed to be serialized to a database.
A couple of design notes:
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
implementations and migration between them.
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
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.
- See Also:
public Integer getId()
- Specified by:
getId in class
public void setId(Integer id)
- Specified by:
setId in class
public Date getCreationTime()
public void setCreationTime(Date creationTime)
public Date getLastAccessTime()
public void setLastAccessTime(Date lastAccessTime)
public boolean isTemporary()
public void setTemporary(boolean temporary)
public UserProperties getProperties()
public void setProperties(UserProperties properties)
public Set<UserRole> getRoles()
public void setRoles(Set<UserRole> roles)
public Set<UserIndex> getUserIndices()
public void setUserIndices(Set<UserIndex> userIndices)
public String toString()
toString in class
Copyright © 2012 OneBusAway. All Rights Reserved.