package org.webonweb.runtime.impl.repository.db.jpa; import java.io.Serializable; import java.math.BigInteger; import java.util.Date; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.NamedQueries; import javax.persistence.NamedQuery; import javax.persistence.OneToOne; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; /** * Entity class DbWowUser * * @author girix */ @Entity @Table(name = "WOW_USER") @NamedQueries( { @NamedQuery(name = "DbWowUser.findByUserName", query = "SELECT d FROM DbWowUser d WHERE d.userName = :userName"), @NamedQuery(name = "DbWowUser.findByLocale", query = "SELECT d FROM DbWowUser d WHERE d.locale = :locale"), @NamedQuery(name = "DbWowUser.findByCreated", query = "SELECT d FROM DbWowUser d WHERE d.created = :created"), @NamedQuery(name = "DbWowUser.findByModified", query = "SELECT d FROM DbWowUser d WHERE d.modified = :modified"), @NamedQuery(name = "DbWowUser.findByLastLogin", query = "SELECT d FROM DbWowUser d WHERE d.lastLogin = :lastLogin"), @NamedQuery(name = "DbWowUser.findByEmail", query = "SELECT d FROM DbWowUser d WHERE d.email = :email"), @NamedQuery(name = "DbWowUser.findByPassword", query = "SELECT d FROM DbWowUser d WHERE d.password = :password"), @NamedQuery(name = "DbWowUser.findByOpenId", query = "SELECT d FROM DbWowUser d WHERE d.openId = :openId"), @NamedQuery(name = "DbWowUser.findBySalt", query = "SELECT d FROM DbWowUser d WHERE d.salt = :salt"), @NamedQuery(name = "DbWowUser.findByUserKey", query = "SELECT d FROM DbWowUser d WHERE d.userKey = :userKey"), @NamedQuery(name = "DbWowUser.findByAccountType", query = "SELECT d FROM DbWowUser d WHERE d.accountType = :accountType"), @NamedQuery(name = "DbWowUser.findById", query = "SELECT d FROM DbWowUser d WHERE d.id = :id") }) public class DbWowUser implements Serializable { @Column(name = "USER_NAME", nullable = false) private String userName; @Column(name = "LOCALE") private String locale; @Column(name = "CREATED", insertable=false, updatable=false) @Temporal(TemporalType.TIMESTAMP) private Date created; @Column(name = "MODIFIED") @Temporal(TemporalType.TIMESTAMP) private Date modified; @Column(name = "LAST_LOGIN") @Temporal(TemporalType.TIMESTAMP) private Date lastLogin; @Column(name = "EMAIL", nullable = false) private String email; @Column(name = "PASSWORD", nullable = false) private String password; @Column(name = "OPEN_ID") private String openId; @Column(name = "SALT", nullable = false) private String salt; @Column(name = "USER_KEY") private String userKey; @Column(name = "AVATAR_HANDLE") private String avatarHandle; @Column(name = "ACCOUNT_TYPE", nullable = false) private String accountType; @Id @Column(name = "ID", nullable = false) private BigInteger id; @JoinColumn(name = "PRINCIPAL", referencedColumnName = "ID") @ManyToOne private DbPrincipal principal; @OneToOne(cascade={CascadeType.REMOVE,CascadeType.PERSIST}, mappedBy = "dbWowUser") private DbWowUserProfile dbWowUserProfile; /** Creates a new instance of DbWowUser */ public DbWowUser() { } /** * Creates a new instance of DbWowUser with the specified values. * @param id the id of the DbWowUser */ public DbWowUser(BigInteger id) { this.id = id; } /** * Creates a new instance of DbWowUser with the specified values. * @param id the id of the DbWowUser * @param userName the userName of the DbWowUser * @param email the email of the DbWowUser * @param password the password of the DbWowUser * @param salt the salt of the DbWowUser * @param accountType the accountType of the DbWowUser */ public DbWowUser(BigInteger id, String userName, String email, String password, String salt, String accountType) { this.id = id; this.userName = userName; this.email = email; this.password = password; this.salt = salt; this.accountType = accountType; } /** * Gets the userName of this DbWowUser. * @return the userName */ public String getUserName() { return this.userName; } /** * Sets the userName of this DbWowUser to the specified value. * @param userName the new userName */ public void setUserName(String userName) { this.userName = userName; } /** * Gets the locale of this DbWowUser. * @return the locale */ public String getLocale() { return this.locale; } /** * Sets the locale of this DbWowUser to the specified value. * @param locale the new locale */ public void setLocale(String locale) { this.locale = locale; } /** * Gets the created of this DbWowUser. * @return the created */ public Date getCreated() { return this.created; } /** * Sets the created of this DbWowUser to the specified value. * @param created the new created */ public void setCreated(Date created) { this.created = created; } /** * Gets the modified of this DbWowUser. * @return the modified */ public Date getModified() { return this.modified; } /** * Sets the modified of this DbWowUser to the specified value. * @param modified the new modified */ public void setModified(Date modified) { this.modified = modified; } /** * Gets the lastLogin of this DbWowUser. * @return the lastLogin */ public Date getLastLogin() { return this.lastLogin; } /** * Sets the lastLogin of this DbWowUser to the specified value. * @param lastLogin the new lastLogin */ public void setLastLogin(Date lastLogin) { this.lastLogin = lastLogin; } /** * Gets the email of this DbWowUser. * @return the email */ public String getEmail() { return this.email; } /** * Sets the email of this DbWowUser to the specified value. * @param email the new email */ public void setEmail(String email) { this.email = email; } /** * Gets the password of this DbWowUser. * @return the password */ public String getPassword() { return this.password; } /** * Sets the password of this DbWowUser to the specified value. * @param password the new password */ public void setPassword(String password) { this.password = password; } /** * Gets the openId of this DbWowUser. * @return the openId */ public String getOpenId() { return this.openId; } /** * Sets the openId of this DbWowUser to the specified value. * @param openId the new openId */ public void setOpenId(String openId) { this.openId = openId; } /** * Gets the salt of this DbWowUser. * @return the salt */ public String getSalt() { return this.salt; } /** * Sets the salt of this DbWowUser to the specified value. * @param salt the new salt */ public void setSalt(String salt) { this.salt = salt; } public String getUserKey() { return this.userKey; } public void setUserKey(String key) { this.userKey = key; } public String getAvatarHandle() { return this.avatarHandle; } public void setAvatarHandle(String avatar) { this.avatarHandle = avatar; } /** * Gets the accountType of this DbWowUser. * @return the accountType */ public String getAccountType() { return this.accountType; } /** * Sets the accountType of this DbWowUser to the specified value. * @param accountType the new accountType */ public void setAccountType(String accountType) { this.accountType = accountType; } /** * Gets the id of this DbWowUser. * @return the id */ public BigInteger getId() { return this.id; } /** * Sets the id of this DbWowUser to the specified value. * @param id the new id */ public void setId(BigInteger id) { this.id = id; } /** * Gets the principal of this DbWowUser. * @return the principal */ public DbPrincipal getPrincipal() { return this.principal; } /** * Sets the principal of this DbWowUser to the specified value. * @param principal the new principal */ public void setPrincipal(DbPrincipal principal) { this.principal = principal; } /** * Gets the dbWowUserProfile of this DbWowUser. * @return the dbWowUserProfile */ public DbWowUserProfile getDbWowUserProfile() { return this.dbWowUserProfile; } /** * Sets the dbWowUserProfile of this DbWowUser to the specified value. * @param dbWowUserProfile the new dbWowUserProfile */ public void setDbWowUserProfile(DbWowUserProfile dbWowUserProfile) { this.dbWowUserProfile = dbWowUserProfile; } /** * Returns a hash code value for the object. This implementation computes * a hash code value based on the id fields in this object. * @return a hash code value for this object. */ @Override public int hashCode() { int hash = 0; hash += (this.id != null ? this.id.hashCode() : 0); return hash; } /** * Determines whether another object is equal to this DbWowUser. The result is * true if and only if the argument is not null and is a DbWowUser object that * has the same id field values as this object. * @param object the reference object with which to compare * @return true if this object is the same as the argument; * false otherwise. */ @Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof DbWowUser)) { return false; } DbWowUser other = (DbWowUser)object; if (this.id != other.id && (this.id == null || !this.id.equals(other.id))) return false; return true; } /** * Returns a string representation of the object. This implementation constructs * that representation based on the id fields. * @return a string representation of the object. */ @Override public String toString() { return "org.webonweb.runtime.impl.repository.db.jpa.DbWowUser[id=" + id + "]"; } }