| 21720 |
ashik.ali |
1 |
package com.spice.profitmandi.dao.entity.dtr;
|
| 21545 |
ashik.ali |
2 |
|
|
|
3 |
import java.io.Serializable;
|
|
|
4 |
import java.time.LocalDateTime;
|
|
|
5 |
|
|
|
6 |
import javax.persistence.Column;
|
| 22009 |
ashik.ali |
7 |
import javax.persistence.Convert;
|
| 21545 |
ashik.ali |
8 |
import javax.persistence.Entity;
|
|
|
9 |
import javax.persistence.GeneratedValue;
|
|
|
10 |
import javax.persistence.GenerationType;
|
|
|
11 |
import javax.persistence.Id;
|
|
|
12 |
import javax.persistence.NamedQueries;
|
|
|
13 |
import javax.persistence.NamedQuery;
|
|
|
14 |
import javax.persistence.Table;
|
|
|
15 |
import javax.persistence.UniqueConstraint;
|
|
|
16 |
|
| 22216 |
ashik.ali |
17 |
import org.hibernate.annotations.UpdateTimestamp;
|
|
|
18 |
|
| 22009 |
ashik.ali |
19 |
import com.spice.profitmandi.dao.convertor.LocalDateTimeAttributeConverter;
|
| 21545 |
ashik.ali |
20 |
|
| 22009 |
ashik.ali |
21 |
|
| 21545 |
ashik.ali |
22 |
/**
|
|
|
23 |
* This is used to store information of end user.
|
|
|
24 |
* @author ashikali
|
|
|
25 |
*
|
|
|
26 |
*/
|
|
|
27 |
@Entity
|
| 21720 |
ashik.ali |
28 |
@Table(name="dtr.users", schema = "dtr",uniqueConstraints = {@UniqueConstraint(columnNames = {"email","mobile_number"})})
|
| 21545 |
ashik.ali |
29 |
@NamedQueries({
|
|
|
30 |
@NamedQuery(name = "User.selectCount", query = "select count(u) from User u"),
|
|
|
31 |
@NamedQuery(name = "User.selectAll",query="select u from User u"),
|
|
|
32 |
@NamedQuery(name = "User.selectById",query="select u from User u where u.id= :id"),
|
|
|
33 |
@NamedQuery(name = "User.selectByEmailId", query = "select u from User u where u.emailId= :emailId"),
|
|
|
34 |
@NamedQuery(name = "User.selectByMobileNumber", query = "select u from User u where u.mobileNumber= :mobileNumber"),
|
|
|
35 |
@NamedQuery(name = "User.countByEmailId", query = "select count(u) from User u where u.emailId= :emailId"),
|
|
|
36 |
@NamedQuery(name = "User.countByMobileNumber", query = "select count(u) from User u where u.mobileNumber= :mobileNumber"),
|
|
|
37 |
@NamedQuery(name = "User.selectIdAndSololicUserId", query = "select u.id, ua.account_key, u.createTimestamp, u.updateTimestamp from User u join UserAccounts ua on u.id = ua.user_id where ua.account_type = 'saholic'")
|
|
|
38 |
})
|
|
|
39 |
public class User implements Serializable{
|
|
|
40 |
|
|
|
41 |
|
|
|
42 |
private static final long serialVersionUID = 1L;
|
|
|
43 |
|
|
|
44 |
public User(){
|
|
|
45 |
|
|
|
46 |
}
|
|
|
47 |
|
|
|
48 |
@Id
|
|
|
49 |
@Column(name="id",updatable=false, unique=true)
|
|
|
50 |
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
|
51 |
private int id;
|
|
|
52 |
|
|
|
53 |
@Column(name = "first_name", length = 64, nullable = false)
|
|
|
54 |
private String firstName;
|
|
|
55 |
|
|
|
56 |
@Column(name = "last_name", length = 64, nullable = false)
|
|
|
57 |
private String lastName;
|
|
|
58 |
|
|
|
59 |
@Column(length=25,name="email",unique=true)
|
|
|
60 |
private String emailId;
|
|
|
61 |
|
|
|
62 |
@Column(length = 10, name = "mobile_number")
|
|
|
63 |
private String mobileNumber;
|
|
|
64 |
|
|
|
65 |
@Column(name = "city", length = 128)
|
|
|
66 |
private String city;
|
|
|
67 |
|
|
|
68 |
@Column(name = "pincode", length = 6)
|
|
|
69 |
private Integer pinCode;
|
|
|
70 |
|
| 22009 |
ashik.ali |
71 |
@Convert(converter = LocalDateTimeAttributeConverter.class)
|
| 21545 |
ashik.ali |
72 |
@Column(name="created",updatable=false)
|
|
|
73 |
private LocalDateTime createTimestamp;
|
|
|
74 |
|
| 22009 |
ashik.ali |
75 |
@Convert(converter = LocalDateTimeAttributeConverter.class)
|
| 21545 |
ashik.ali |
76 |
@Column(name="modified")
|
| 22216 |
ashik.ali |
77 |
@UpdateTimestamp
|
| 21545 |
ashik.ali |
78 |
private LocalDateTime updateTimestamp;
|
|
|
79 |
|
|
|
80 |
private String username;
|
|
|
81 |
private String password;
|
|
|
82 |
private boolean mobile_verified;
|
|
|
83 |
private String referral_url;
|
|
|
84 |
private String referrer;
|
|
|
85 |
|
|
|
86 |
private int group_id;
|
|
|
87 |
@Column(columnDefinition="tinyint(1) default 0")
|
|
|
88 |
private int status;
|
|
|
89 |
@Column(columnDefinition="tinyint(1) default 0")
|
|
|
90 |
private boolean activated;
|
|
|
91 |
|
|
|
92 |
public int getId() {
|
|
|
93 |
return id;
|
|
|
94 |
}
|
|
|
95 |
|
|
|
96 |
public void setId(int id) {
|
|
|
97 |
this.id = id;
|
|
|
98 |
}
|
|
|
99 |
|
|
|
100 |
public String getFirstName() {
|
|
|
101 |
return firstName;
|
|
|
102 |
}
|
|
|
103 |
public void setFirstName(String firstName) {
|
|
|
104 |
this.firstName = firstName;
|
|
|
105 |
}
|
|
|
106 |
public String getLastName() {
|
|
|
107 |
return lastName;
|
|
|
108 |
}
|
|
|
109 |
public void setLastName(String lastName) {
|
|
|
110 |
this.lastName = lastName;
|
|
|
111 |
}
|
|
|
112 |
|
|
|
113 |
public String getEmailId() {
|
|
|
114 |
return emailId;
|
|
|
115 |
}
|
|
|
116 |
public void setEmailId(String emailId) {
|
|
|
117 |
this.emailId = emailId;
|
|
|
118 |
}
|
|
|
119 |
|
|
|
120 |
|
|
|
121 |
public String getMobileNumber() {
|
|
|
122 |
return mobileNumber;
|
|
|
123 |
}
|
|
|
124 |
|
|
|
125 |
public void setMobileNumber(String mobileNumber) {
|
|
|
126 |
this.mobileNumber = mobileNumber;
|
|
|
127 |
}
|
|
|
128 |
|
|
|
129 |
public String getCity() {
|
|
|
130 |
return city;
|
|
|
131 |
}
|
|
|
132 |
public void setCity(String city) {
|
|
|
133 |
this.city = city;
|
|
|
134 |
}
|
|
|
135 |
public Integer getPinCode() {
|
|
|
136 |
return pinCode;
|
|
|
137 |
}
|
|
|
138 |
public void setPinCode(Integer pinCode) {
|
|
|
139 |
this.pinCode = pinCode;
|
|
|
140 |
}
|
|
|
141 |
|
|
|
142 |
public LocalDateTime getCreateTimestamp() {
|
|
|
143 |
return createTimestamp;
|
|
|
144 |
}
|
|
|
145 |
|
|
|
146 |
public void setCreateTimestamp(LocalDateTime createTimestamp) {
|
|
|
147 |
this.createTimestamp = createTimestamp;
|
|
|
148 |
}
|
|
|
149 |
|
|
|
150 |
public LocalDateTime getUpdateTimestamp() {
|
|
|
151 |
return updateTimestamp;
|
|
|
152 |
}
|
|
|
153 |
public void setUpdateTimestamp(LocalDateTime updateTimestamp) {
|
|
|
154 |
this.updateTimestamp = updateTimestamp;
|
|
|
155 |
}
|
|
|
156 |
|
|
|
157 |
public String getUsername() {
|
|
|
158 |
return username;
|
|
|
159 |
}
|
|
|
160 |
|
|
|
161 |
public void setUsername(String username) {
|
|
|
162 |
this.username = username;
|
|
|
163 |
}
|
|
|
164 |
|
|
|
165 |
public String getPassword() {
|
|
|
166 |
return password;
|
|
|
167 |
}
|
|
|
168 |
|
|
|
169 |
public void setPassword(String password) {
|
|
|
170 |
this.password = password;
|
|
|
171 |
}
|
|
|
172 |
|
|
|
173 |
public boolean isMobile_verified() {
|
|
|
174 |
return mobile_verified;
|
|
|
175 |
}
|
|
|
176 |
|
|
|
177 |
public void setMobile_verified(boolean mobile_verified) {
|
|
|
178 |
this.mobile_verified = mobile_verified;
|
|
|
179 |
}
|
|
|
180 |
|
|
|
181 |
public String getReferral_url() {
|
|
|
182 |
return referral_url;
|
|
|
183 |
}
|
|
|
184 |
|
|
|
185 |
public void setReferral_url(String referral_url) {
|
|
|
186 |
this.referral_url = referral_url;
|
|
|
187 |
}
|
|
|
188 |
|
|
|
189 |
public int getGroup_id() {
|
|
|
190 |
return group_id;
|
|
|
191 |
}
|
|
|
192 |
|
|
|
193 |
public void setGroup_id(int group_id) {
|
|
|
194 |
this.group_id = group_id;
|
|
|
195 |
}
|
|
|
196 |
|
|
|
197 |
public String getReferrer() {
|
|
|
198 |
return referrer;
|
|
|
199 |
}
|
|
|
200 |
|
|
|
201 |
public void setReferrer(String referrer) {
|
|
|
202 |
this.referrer = referrer;
|
|
|
203 |
}
|
|
|
204 |
|
|
|
205 |
public int isStatus() {
|
|
|
206 |
return status;
|
|
|
207 |
}
|
|
|
208 |
|
|
|
209 |
public void setStatus(int status) {
|
|
|
210 |
this.status = status;
|
|
|
211 |
}
|
|
|
212 |
|
|
|
213 |
public boolean isActivated() {
|
|
|
214 |
return activated;
|
|
|
215 |
}
|
|
|
216 |
|
|
|
217 |
public void setActivated(boolean activated) {
|
|
|
218 |
this.activated = activated;
|
|
|
219 |
}
|
|
|
220 |
|
| 22009 |
ashik.ali |
221 |
|
| 21545 |
ashik.ali |
222 |
@Override
|
|
|
223 |
public int hashCode() {
|
|
|
224 |
final int prime = 31;
|
|
|
225 |
int result = 1;
|
| 22009 |
ashik.ali |
226 |
result = prime * result + id;
|
| 21545 |
ashik.ali |
227 |
return result;
|
|
|
228 |
}
|
|
|
229 |
|
|
|
230 |
@Override
|
|
|
231 |
public boolean equals(Object obj) {
|
|
|
232 |
if (this == obj)
|
|
|
233 |
return true;
|
|
|
234 |
if (obj == null)
|
|
|
235 |
return false;
|
|
|
236 |
if (getClass() != obj.getClass())
|
|
|
237 |
return false;
|
|
|
238 |
User other = (User) obj;
|
|
|
239 |
if (id != other.id)
|
|
|
240 |
return false;
|
|
|
241 |
return true;
|
|
|
242 |
}
|
|
|
243 |
|
| 21924 |
ashik.ali |
244 |
@Override
|
|
|
245 |
public String toString() {
|
|
|
246 |
return "User [id=" + id + ", firstName=" + firstName + ", lastName=" + lastName + ", emailId=" + emailId
|
|
|
247 |
+ ", mobileNumber=" + mobileNumber + ", city=" + city + ", pinCode=" + pinCode + ", createTimestamp="
|
|
|
248 |
+ createTimestamp + ", updateTimestamp=" + updateTimestamp + ", username=" + username + ", password="
|
|
|
249 |
+ password + ", mobile_verified=" + mobile_verified + ", referral_url=" + referral_url + ", referrer="
|
| 22009 |
ashik.ali |
250 |
+ referrer + ", group_id=" + group_id + ", status=" + status + ", activated=" + activated + "]";
|
| 21924 |
ashik.ali |
251 |
}
|
|
|
252 |
|
| 21545 |
ashik.ali |
253 |
|
|
|
254 |
|
|
|
255 |
}
|