Class User

  • All Implemented Interfaces:
    Serializable

    @Entity
    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 Detail

      • User

        public User()
    • Method Detail

      • 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)
      • setProperties

        public void setProperties​(UserProperties properties)
      • setRoles

        public void setRoles​(Set<UserRole> roles)
      • setUserIndices

        public void setUserIndices​(Set<UserIndex> userIndices)