Subversion Repositories SmartDukaan

Rev

Rev 28774 | Rev 29209 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
24330 amit.gupta 1
package com.spice.profitmandi.dao.entity.auth;
2
 
3
import java.time.LocalDateTime;
24383 amit.gupta 4
import java.time.format.DateTimeFormatter;
24330 amit.gupta 5
 
6
import javax.persistence.Column;
7
import javax.persistence.Entity;
24383 amit.gupta 8
import javax.persistence.GeneratedValue;
9
import javax.persistence.GenerationType;
24330 amit.gupta 10
import javax.persistence.Id;
11
import javax.persistence.Table;
12
 
13
@Entity
14
@Table(name = "auth.auth_user", schema = "auth")
15
public class AuthUser {
25383 tejbeer 16
 
24330 amit.gupta 17
	@Id
24383 amit.gupta 18
	@Column
19
	@GeneratedValue(strategy = GenerationType.IDENTITY)
20
	private int id;
21
 
25383 tejbeer 22
	@Column(name = "email_id", unique = true, updatable = false)
24330 amit.gupta 23
	private String emailId;
25383 tejbeer 24
 
25
	@Column(name = "gmail_id", unique = true)
26
	private String gmailId;
27
 
27595 tejbeer 28
	@Column(name = "employee_code")
29
	private String employeeCode;
28763 amit.gupta 30
 
31
	@Column(name = "ho_user")
28966 amit.gupta 32
	private boolean hoUser;
27595 tejbeer 33
 
34
	public String getEmployeeCode() {
35
		return employeeCode;
36
	}
28966 amit.gupta 37
 
27595 tejbeer 38
 
28966 amit.gupta 39
	public boolean isHoUser() {
40
		return hoUser;
41
	}
42
 
43
 
44
 
45
	public void setHoUser(boolean hoUser) {
46
		this.hoUser = hoUser;
47
	}
48
 
49
 
50
 
51
	public Boolean getActive() {
52
		return active;
53
	}
54
 
55
 
56
 
27595 tejbeer 57
	public void setEmployeeCode(String employeeCode) {
58
		this.employeeCode = employeeCode;
59
	}
60
 
25570 tejbeer 61
	@Column(name = "active")
62
	private Boolean active;
63
 
27595 tejbeer 64
	@Column(name = "first_name", nullable = false)
65
	private String firstName;
66
 
67
	@Column(name = "last_name")
68
	private String lastName;
69
 
70
	@Column(name = "mobile_number", unique = true, updatable = false)
71
	private String mobileNumber;
72
 
73
	@Column(name = "password")
74
	private String password;
75
 
76
	@Column(name = "created_timestamp")
77
	private LocalDateTime createdTimestamp;
78
 
79
	@Column(name = "last_login_timestap", unique = true, updatable = true)
80
	private LocalDateTime lastLoginTimestamp;
28769 amit.gupta 81
 
82
	public String getFullName() {
28774 amit.gupta 83
		return (this.firstName + " " + this.lastName).trim();
28769 amit.gupta 84
	}
27595 tejbeer 85
 
25570 tejbeer 86
	public Boolean isActive() {
87
		return active;
88
	}
89
 
90
	public void setActive(Boolean active) {
91
		this.active = active;
92
	}
93
 
24479 amit.gupta 94
	public String getGmailId() {
95
		return gmailId;
96
	}
97
 
98
	public void setGmailId(String gmailId) {
99
		this.gmailId = gmailId;
100
	}
101
 
24383 amit.gupta 102
	public int getId() {
103
		return id;
104
	}
24330 amit.gupta 105
 
24383 amit.gupta 106
	public void setId(int id) {
107
		this.id = id;
108
	}
27595 tejbeer 109
 
27124 amit.gupta 110
	public String getName() {
111
		return this.firstName + " " + this.lastName;
112
	}
24383 amit.gupta 113
 
24330 amit.gupta 114
	public String getFirstName() {
115
		return firstName;
116
	}
117
 
118
	public void setFirstName(String firstName) {
119
		this.firstName = firstName;
120
	}
121
 
122
	public String getLastName() {
123
		return lastName;
124
	}
125
 
126
	public void setLastName(String lastName) {
127
		this.lastName = lastName;
128
	}
129
 
130
	public String getPassword() {
131
		return password;
132
	}
133
 
134
	public void setPassword(String password) {
135
		this.password = password;
136
	}
137
 
138
	@Override
139
	public int hashCode() {
140
		final int prime = 31;
141
		int result = 1;
27595 tejbeer 142
		result = prime * result + ((active == null) ? 0 : active.hashCode());
24383 amit.gupta 143
		result = prime * result + ((createdTimestamp == null) ? 0 : createdTimestamp.hashCode());
24330 amit.gupta 144
		result = prime * result + ((emailId == null) ? 0 : emailId.hashCode());
27595 tejbeer 145
		result = prime * result + ((employeeCode == null) ? 0 : employeeCode.hashCode());
24383 amit.gupta 146
		result = prime * result + ((firstName == null) ? 0 : firstName.hashCode());
24479 amit.gupta 147
		result = prime * result + ((gmailId == null) ? 0 : gmailId.hashCode());
24383 amit.gupta 148
		result = prime * result + id;
149
		result = prime * result + ((lastLoginTimestamp == null) ? 0 : lastLoginTimestamp.hashCode());
150
		result = prime * result + ((lastName == null) ? 0 : lastName.hashCode());
151
		result = prime * result + ((mobileNumber == null) ? 0 : mobileNumber.hashCode());
152
		result = prime * result + ((password == null) ? 0 : password.hashCode());
24330 amit.gupta 153
		return result;
154
	}
155
 
156
	@Override
157
	public boolean equals(Object obj) {
158
		if (this == obj)
159
			return true;
160
		if (obj == null)
161
			return false;
162
		if (getClass() != obj.getClass())
163
			return false;
164
		AuthUser other = (AuthUser) obj;
27595 tejbeer 165
		if (active == null) {
166
			if (other.active != null)
167
				return false;
168
		} else if (!active.equals(other.active))
169
			return false;
24383 amit.gupta 170
		if (createdTimestamp == null) {
171
			if (other.createdTimestamp != null)
172
				return false;
173
		} else if (!createdTimestamp.equals(other.createdTimestamp))
174
			return false;
24330 amit.gupta 175
		if (emailId == null) {
176
			if (other.emailId != null)
177
				return false;
178
		} else if (!emailId.equals(other.emailId))
179
			return false;
27595 tejbeer 180
		if (employeeCode == null) {
181
			if (other.employeeCode != null)
182
				return false;
183
		} else if (!employeeCode.equals(other.employeeCode))
184
			return false;
24383 amit.gupta 185
		if (firstName == null) {
186
			if (other.firstName != null)
187
				return false;
188
		} else if (!firstName.equals(other.firstName))
189
			return false;
24479 amit.gupta 190
		if (gmailId == null) {
191
			if (other.gmailId != null)
192
				return false;
193
		} else if (!gmailId.equals(other.gmailId))
194
			return false;
24383 amit.gupta 195
		if (id != other.id)
196
			return false;
197
		if (lastLoginTimestamp == null) {
198
			if (other.lastLoginTimestamp != null)
199
				return false;
200
		} else if (!lastLoginTimestamp.equals(other.lastLoginTimestamp))
201
			return false;
202
		if (lastName == null) {
203
			if (other.lastName != null)
204
				return false;
205
		} else if (!lastName.equals(other.lastName))
206
			return false;
207
		if (mobileNumber == null) {
208
			if (other.mobileNumber != null)
209
				return false;
210
		} else if (!mobileNumber.equals(other.mobileNumber))
211
			return false;
212
		if (password == null) {
213
			if (other.password != null)
214
				return false;
215
		} else if (!password.equals(other.password))
216
			return false;
24330 amit.gupta 217
		return true;
218
	}
219
 
220
	public String getEmailId() {
221
		return emailId;
222
	}
223
 
224
	public void setEmailId(String emailId) {
225
		this.emailId = emailId;
226
	}
227
 
228
	public String getMobileNumber() {
229
		return mobileNumber;
230
	}
231
 
232
	public void setMobileNumber(String mobileNumber) {
233
		this.mobileNumber = mobileNumber;
234
	}
235
 
236
	public LocalDateTime getCreatedTimestamp() {
237
		return createdTimestamp;
238
	}
239
 
240
	public void setCreatedTimestamp(LocalDateTime createdTimestamp) {
241
		this.createdTimestamp = createdTimestamp;
242
	}
243
 
244
	public LocalDateTime getLastLoginTimestamp() {
245
		return lastLoginTimestamp;
246
	}
247
 
248
	public void setLastLoginTimestamp(LocalDateTime lastLoginTimestamp) {
249
		this.lastLoginTimestamp = lastLoginTimestamp;
250
	}
251
 
25383 tejbeer 252
	public String getFormattedCreateTimestamp() {
253
		if (createdTimestamp == null) {
24383 amit.gupta 254
			return null;
255
		}
24402 amit.gupta 256
		DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd-MM-yyyy HH:mm");
24383 amit.gupta 257
		return createdTimestamp.format(formatter);
25383 tejbeer 258
	}
24330 amit.gupta 259
 
260
	@Override
261
	public String toString() {
27595 tejbeer 262
		return "AuthUser [id=" + id + ", emailId=" + emailId + ", gmailId=" + gmailId + ", employeeCode=" + employeeCode
263
				+ ", active=" + active + ", firstName=" + firstName + ", lastName=" + lastName + ", mobileNumber="
264
				+ mobileNumber + ", password=" + password + ", createdTimestamp=" + createdTimestamp
265
				+ ", lastLoginTimestamp=" + lastLoginTimestamp + "]";
24330 amit.gupta 266
	}
267
 
268
}