package eu.smartlm.abs.portal.security.login.model; import org.hibernate.validator.constraints.NotEmpty; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; /** * POJO object that contains all the User information for the Accounting and Billing Portlets * @author David García Pérez - CESGA */ @Entity @Table(name="USER_TBL") public class User { @Id @GeneratedValue(strategy=GenerationType.AUTO) @Column(name="id") private int id; @NotEmpty @Column(name="username", unique=true) private String username; @NotEmpty @Column(name="password") private String password; @NotEmpty @Column(name="accounting_username") private String accountingUsername; @Column(name="accounting_group") private String accountingGroup; @Column(name="see_accounting_group_data") private boolean seeAccountingGroupData; @Column(name="see_all") private boolean seeAll; public User(String username, String password, String accountingUsername, String accountingGroup, boolean seeAccountingGroupData, boolean seeAll) { this.username = username; this.password = password; this.accountingUsername = accountingUsername; this.accountingGroup = accountingGroup; this.seeAccountingGroupData = seeAccountingGroupData; this.seeAll = seeAll; } public User() {} public int getId() { return id; } public void setId(int id) { this.id = id; } public void setUsername(String username) { this.username = username; } public String getUsername() { return username; } public void setPassword(String password) { this.password = password; } public String getPassword() { return password; } public void setAccountingUsername(String accountingUsername) { this.accountingUsername = accountingUsername; } public String getAccountingUsername() { return accountingUsername; } public void setAccountingGroup(String accountingGroup) { this.accountingGroup = accountingGroup; } public String getAccountingGroup() { return accountingGroup; } public void setSeeAccountingGroupData(boolean seeAccountingGroupData) { this.seeAccountingGroupData = seeAccountingGroupData; } public boolean isSeeAccountingGroupData() { return seeAccountingGroupData; } public void setSeeAll(boolean seeAll) { this.seeAll = seeAll; } public boolean isSeeAll() { return seeAll; } @Override public boolean equals(Object otherObject) { User otherUser = (User) otherObject; if(otherUser.getUsername().equals(this.username)) { return true; } else { return false; } } }