Subversion Repositories SmartDukaan

Rev

Rev 21924 | Rev 22216 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 21924 Rev 22009
Line 1... Line 1...
1
package com.spice.profitmandi.dao.entity.dtr;
1
package com.spice.profitmandi.dao.entity.dtr;
2
 
2
 
3
import java.io.Serializable;
3
import java.io.Serializable;
4
import java.time.LocalDateTime;
4
import java.time.LocalDateTime;
5
import java.util.Set;
-
 
6
 
5
 
7
import javax.persistence.Column;
6
import javax.persistence.Column;
-
 
7
import javax.persistence.Convert;
8
import javax.persistence.Entity;
8
import javax.persistence.Entity;
9
import javax.persistence.FetchType;
-
 
10
import javax.persistence.GeneratedValue;
9
import javax.persistence.GeneratedValue;
11
import javax.persistence.GenerationType;
10
import javax.persistence.GenerationType;
12
import javax.persistence.Id;
11
import javax.persistence.Id;
13
import javax.persistence.JoinColumn;
-
 
14
import javax.persistence.JoinTable;
-
 
15
import javax.persistence.NamedQueries;
12
import javax.persistence.NamedQueries;
16
import javax.persistence.NamedQuery;
13
import javax.persistence.NamedQuery;
17
import javax.persistence.OneToMany;
-
 
18
import javax.persistence.Table;
14
import javax.persistence.Table;
19
import javax.persistence.UniqueConstraint;
15
import javax.persistence.UniqueConstraint;
20
 
16
 
-
 
17
import com.spice.profitmandi.dao.convertor.LocalDateTimeAttributeConverter;
-
 
18
 
21
 
19
 
22
/**
20
/**
23
 * This is used to store information of end user.
21
 * This is used to store information of end user.
24
 * @author ashikali
22
 * @author ashikali
25
 *
23
 *
Line 66... Line 64...
66
	private String city;
64
	private String city;
67
	
65
	
68
	@Column(name = "pincode", length = 6)
66
	@Column(name = "pincode", length = 6)
69
	private Integer pinCode;
67
	private Integer pinCode;
70
	
68
	
-
 
69
	@Convert(converter = LocalDateTimeAttributeConverter.class)
71
	@Column(name="created",updatable=false)
70
	@Column(name="created",updatable=false)
72
	private LocalDateTime createTimestamp;
71
	private LocalDateTime createTimestamp;
73
	
72
	
-
 
73
	@Convert(converter = LocalDateTimeAttributeConverter.class)
74
	@Column(name="modified")
74
	@Column(name="modified")
75
	private LocalDateTime updateTimestamp;
75
	private LocalDateTime updateTimestamp;
76
	
76
	
77
	private String username;
77
	private String username;
78
	private String password;
78
	private String password;
Line 84... Line 84...
84
	@Column(columnDefinition="tinyint(1) default 0")
84
	@Column(columnDefinition="tinyint(1) default 0")
85
	private int status;
85
	private int status;
86
	@Column(columnDefinition="tinyint(1) default 0")
86
	@Column(columnDefinition="tinyint(1) default 0")
87
	private boolean activated;
87
	private boolean activated;
88
	
88
	
89
	@OneToMany(fetch = FetchType.EAGER)
-
 
90
    @JoinTable(
-
 
91
            name="user_role",
-
 
92
            joinColumns = @JoinColumn( name="user_id"),
-
 
93
            inverseJoinColumns = @JoinColumn( name="role_id"), schema = "dtr"
-
 
94
    )
-
 
95
	private Set<Role> roles;
-
 
96
	
-
 
97
	public int getId() {
89
	public int getId() {
98
		return id;
90
		return id;
99
	}
91
	}
100
	
92
	
101
	public void setId(int id) {
93
	public void setId(int id) {
Line 156... Line 148...
156
		return updateTimestamp;
148
		return updateTimestamp;
157
	}
149
	}
158
	public void setUpdateTimestamp(LocalDateTime updateTimestamp) {
150
	public void setUpdateTimestamp(LocalDateTime updateTimestamp) {
159
		this.updateTimestamp = updateTimestamp;
151
		this.updateTimestamp = updateTimestamp;
160
	}
152
	}
161
	
-
 
162
	public Set<Role> getRoles() {
-
 
163
		return roles;
-
 
164
	}
-
 
165
	public void addRole(Role role){
-
 
166
		roles.add(role);
-
 
167
	}
-
 
168
 
153
 
169
	public String getUsername() {
154
	public String getUsername() {
170
		return username;
155
		return username;
171
	}
156
	}
172
 
157
 
Line 228... Line 213...
228
 
213
 
229
	public void setActivated(boolean activated) {
214
	public void setActivated(boolean activated) {
230
		this.activated = activated;
215
		this.activated = activated;
231
	}
216
	}
232
 
217
 
-
 
218
	
233
	@Override
219
	@Override
234
	public int hashCode() {
220
	public int hashCode() {
235
		final int prime = 31;
221
		final int prime = 31;
236
		int result = 1;
222
		int result = 1;
237
		result = prime * result + ((city == null) ? 0 : city.hashCode());
-
 
238
		result = prime * result + ((createTimestamp == null) ? 0 : createTimestamp.hashCode());
-
 
239
		result = prime * result + ((emailId == null) ? 0 : emailId.hashCode());
-
 
240
		result = prime * result + ((firstName == null) ? 0 : firstName.hashCode());
-
 
241
		result = prime * result + (int) (id ^ (id >>> 32));
223
		result = prime * result + id;
242
		result = prime * result + ((lastName == null) ? 0 : lastName.hashCode());
-
 
243
		result = prime * result + ((mobileNumber == null) ? 0 : mobileNumber.hashCode());
-
 
244
		result = prime * result + ((pinCode == null) ? 0 : pinCode.hashCode());
-
 
245
		result = prime * result + ((roles == null) ? 0 : roles.hashCode());
-
 
246
		result = prime * result + ((updateTimestamp == null) ? 0 : updateTimestamp.hashCode());
-
 
247
		return result;
224
		return result;
248
	}
225
	}
249
 
226
 
250
	@Override
227
	@Override
251
	public boolean equals(Object obj) {
228
	public boolean equals(Object obj) {
Line 254... Line 231...
254
		if (obj == null)
231
		if (obj == null)
255
			return false;
232
			return false;
256
		if (getClass() != obj.getClass())
233
		if (getClass() != obj.getClass())
257
			return false;
234
			return false;
258
		User other = (User) obj;
235
		User other = (User) obj;
259
		if (city == null) {
-
 
260
			if (other.city != null)
-
 
261
				return false;
-
 
262
		} else if (!city.equals(other.city))
-
 
263
			return false;
-
 
264
		if (createTimestamp == null) {
-
 
265
			if (other.createTimestamp != null)
-
 
266
				return false;
-
 
267
		} else if (!createTimestamp.equals(other.createTimestamp))
-
 
268
			return false;
-
 
269
		if (emailId == null) {
-
 
270
			if (other.emailId != null)
-
 
271
				return false;
-
 
272
		} else if (!emailId.equals(other.emailId))
-
 
273
			return false;
-
 
274
		if (firstName == null) {
-
 
275
			if (other.firstName != null)
-
 
276
				return false;
-
 
277
		} else if (!firstName.equals(other.firstName))
-
 
278
			return false;
-
 
279
		if (id != other.id)
236
		if (id != other.id)
280
			return false;
237
			return false;
281
		if (lastName == null) {
-
 
282
			if (other.lastName != null)
-
 
283
				return false;
-
 
284
		} else if (!lastName.equals(other.lastName))
-
 
285
			return false;
-
 
286
		if (mobileNumber == null) {
-
 
287
			if (other.mobileNumber != null)
-
 
288
				return false;
-
 
289
		} else if (!mobileNumber.equals(other.mobileNumber))
-
 
290
			return false;
-
 
291
		if (pinCode == null) {
-
 
292
			if (other.pinCode != null)
-
 
293
				return false;
-
 
294
		} else if (!pinCode.equals(other.pinCode))
-
 
295
			return false;
-
 
296
		if (roles == null) {
-
 
297
			if (other.roles != null)
-
 
298
				return false;
-
 
299
		} else if (!roles.equals(other.roles))
-
 
300
			return false;
-
 
301
		if (updateTimestamp == null) {
-
 
302
			if (other.updateTimestamp != null)
-
 
303
				return false;
-
 
304
		} else if (!updateTimestamp.equals(other.updateTimestamp))
-
 
305
			return false;
-
 
306
		return true;
238
		return true;
307
	}
239
	}
308
 
240
 
309
	@Override
241
	@Override
310
	public String toString() {
242
	public String toString() {
311
		return "User [id=" + id + ", firstName=" + firstName + ", lastName=" + lastName + ", emailId=" + emailId
243
		return "User [id=" + id + ", firstName=" + firstName + ", lastName=" + lastName + ", emailId=" + emailId
312
				+ ", mobileNumber=" + mobileNumber + ", city=" + city + ", pinCode=" + pinCode + ", createTimestamp="
244
				+ ", mobileNumber=" + mobileNumber + ", city=" + city + ", pinCode=" + pinCode + ", createTimestamp="
313
				+ createTimestamp + ", updateTimestamp=" + updateTimestamp + ", username=" + username + ", password="
245
				+ createTimestamp + ", updateTimestamp=" + updateTimestamp + ", username=" + username + ", password="
314
				+ password + ", mobile_verified=" + mobile_verified + ", referral_url=" + referral_url + ", referrer="
246
				+ password + ", mobile_verified=" + mobile_verified + ", referral_url=" + referral_url + ", referrer="
315
				+ referrer + ", group_id=" + group_id + ", status=" + status + ", activated=" + activated + ", roles="
247
				+ referrer + ", group_id=" + group_id + ", status=" + status + ", activated=" + activated  + "]";
316
				+ roles + "]";
-
 
317
	}
248
	}
318
 
249
 
319
	
250
	
320
	
251
	
321
}
252
}
322
253