View Javadoc

1   /*
2    *  User
3    *
4    *  author nambi sankaran
5    *  copyright (C) 2008 GnuRanch Inc.
6    *
7    *  This program is free software: you can redistribute it and/or modify
8    *  it under the terms of the GNU General Public License as published by
9    *  the Free Software Foundation, either version 3 of the License, or
10   *  (at your option) any later version.
11   *
12   *  This program is distributed in the hope that it will be useful,
13   *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14   *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15   *  GNU General Public License for more details.
16   *
17   *  You should have received a copy of the GNU General Public License
18   *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
19   *
20   */
21  
22  package net.sf.emarket.user.domain;
23  
24  import org.hibernate.annotations.AccessType;
25  
26  import javax.persistence.*;
27  import java.io.Serializable;
28  import java.sql.Timestamp;
29  
30  /***
31   * User Description.
32   *
33   * This Table contains the most used information related to an emarket user.
34   * This includes eMarketId, password, first name, last name and email.
35   *
36   * @author : snambi
37   */
38  
39  @Entity
40  @Table(name="EM_USERS")
41  public class User implements Serializable {
42  
43  	private static final long serialVersionUID = -452924108838376905L;
44  
45  	@Id
46      @Column(name="ID", length=255) 
47      private String id;
48  
49      @Column(name="EM_PASSWORD",length=255)
50      private String password = null;
51  
52      @Column(name="FIRSTNAME",length=255)
53      private String firstName = null;
54  
55      @Column(name="LASTNAME", length=255)
56      private String lastName = null;
57  
58      @Column(name="EM_TIME", length=255)
59      private Timestamp timestamp = null;
60  
61      public String getPassword() {
62          return password;
63      }
64  
65      public void setPassword(String password) {
66          this.password = password;
67      }
68  
69      public String getFirstName() {
70          return firstName;
71      }
72  
73      public void setFirstName(String firstName) {
74          this.firstName = firstName;
75      }
76  
77      public String getLastName() {
78          return lastName;
79      }
80  
81      public void setLastName(String lastName) {
82          this.lastName = lastName;
83      }
84  
85      public String getId() {
86          return id;
87      }
88  
89      public void setId(String Id) {
90          this.id = Id;
91      }
92   
93      public Timestamp getTimestamp() {
94  		return timestamp;
95  	}
96  
97  	public void setTimestamp(Timestamp timestamp) {
98  		this.timestamp = timestamp;
99  	}    
100 
101     public String toString() {
102 
103         StringBuilder sb = new StringBuilder();
104 
105         sb.append( getId());
106         sb.append(",");
107         sb.append( getFirstName());
108         sb.append(",");
109         sb.append( getLastName());
110 
111         return super.toString(); 
112     }
113 
114     public boolean equals(Object obj){
115 
116         if( this == obj ){
117             return true;
118         }
119 
120         if( obj == null || obj.getClass() != this.getClass() ){
121             return false;
122         }
123 
124         boolean result = false;
125         User user = (User) obj;
126         
127         if( this.getId().equals(user.getId()) ){
128         	result =true;
129         }
130 
131         return result;
132     }
133 
134     public int hashCode(){
135 
136         int hash = 7;
137         hash = 31 * hash + ( null == id ? 0: id.hashCode() );
138         return hash;
139     }
140 
141 }