Subversion Repositories SmartDukaan

Rev

Rev 27124 | Rev 28763 | 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;
30
 
31
	public String getEmployeeCode() {
32
		return employeeCode;
33
	}
34
 
35
	public void setEmployeeCode(String employeeCode) {
36
		this.employeeCode = employeeCode;
37
	}
38
 
25570 tejbeer 39
	@Column(name = "active")
40
	private Boolean active;
41
 
27595 tejbeer 42
	@Column(name = "first_name", nullable = false)
43
	private String firstName;
44
 
45
	@Column(name = "last_name")
46
	private String lastName;
47
 
48
	@Column(name = "mobile_number", unique = true, updatable = false)
49
	private String mobileNumber;
50
 
51
	@Column(name = "password")
52
	private String password;
53
 
54
	@Column(name = "created_timestamp")
55
	private LocalDateTime createdTimestamp;
56
 
57
	@Column(name = "last_login_timestap", unique = true, updatable = true)
58
	private LocalDateTime lastLoginTimestamp;
59
 
25570 tejbeer 60
	public Boolean isActive() {
61
		return active;
62
	}
63
 
64
	public void setActive(Boolean active) {
65
		this.active = active;
66
	}
67
 
24479 amit.gupta 68
	public String getGmailId() {
69
		return gmailId;
70
	}
71
 
72
	public void setGmailId(String gmailId) {
73
		this.gmailId = gmailId;
74
	}
75
 
24383 amit.gupta 76
	public int getId() {
77
		return id;
78
	}
24330 amit.gupta 79
 
24383 amit.gupta 80
	public void setId(int id) {
81
		this.id = id;
82
	}
27595 tejbeer 83
 
27124 amit.gupta 84
	public String getName() {
85
		return this.firstName + " " + this.lastName;
86
	}
24383 amit.gupta 87
 
24330 amit.gupta 88
	public String getFirstName() {
89
		return firstName;
90
	}
91
 
92
	public void setFirstName(String firstName) {
93
		this.firstName = firstName;
94
	}
95
 
96
	public String getLastName() {
97
		return lastName;
98
	}
99
 
100
	public void setLastName(String lastName) {
101
		this.lastName = lastName;
102
	}
103
 
104
	public String getPassword() {
105
		return password;
106
	}
107
 
108
	public void setPassword(String password) {
109
		this.password = password;
110
	}
111
 
112
	@Override
113
	public int hashCode() {
114
		final int prime = 31;
115
		int result = 1;
27595 tejbeer 116
		result = prime * result + ((active == null) ? 0 : active.hashCode());
24383 amit.gupta 117
		result = prime * result + ((createdTimestamp == null) ? 0 : createdTimestamp.hashCode());
24330 amit.gupta 118
		result = prime * result + ((emailId == null) ? 0 : emailId.hashCode());
27595 tejbeer 119
		result = prime * result + ((employeeCode == null) ? 0 : employeeCode.hashCode());
24383 amit.gupta 120
		result = prime * result + ((firstName == null) ? 0 : firstName.hashCode());
24479 amit.gupta 121
		result = prime * result + ((gmailId == null) ? 0 : gmailId.hashCode());
24383 amit.gupta 122
		result = prime * result + id;
123
		result = prime * result + ((lastLoginTimestamp == null) ? 0 : lastLoginTimestamp.hashCode());
124
		result = prime * result + ((lastName == null) ? 0 : lastName.hashCode());
125
		result = prime * result + ((mobileNumber == null) ? 0 : mobileNumber.hashCode());
126
		result = prime * result + ((password == null) ? 0 : password.hashCode());
24330 amit.gupta 127
		return result;
128
	}
129
 
130
	@Override
131
	public boolean equals(Object obj) {
132
		if (this == obj)
133
			return true;
134
		if (obj == null)
135
			return false;
136
		if (getClass() != obj.getClass())
137
			return false;
138
		AuthUser other = (AuthUser) obj;
27595 tejbeer 139
		if (active == null) {
140
			if (other.active != null)
141
				return false;
142
		} else if (!active.equals(other.active))
143
			return false;
24383 amit.gupta 144
		if (createdTimestamp == null) {
145
			if (other.createdTimestamp != null)
146
				return false;
147
		} else if (!createdTimestamp.equals(other.createdTimestamp))
148
			return false;
24330 amit.gupta 149
		if (emailId == null) {
150
			if (other.emailId != null)
151
				return false;
152
		} else if (!emailId.equals(other.emailId))
153
			return false;
27595 tejbeer 154
		if (employeeCode == null) {
155
			if (other.employeeCode != null)
156
				return false;
157
		} else if (!employeeCode.equals(other.employeeCode))
158
			return false;
24383 amit.gupta 159
		if (firstName == null) {
160
			if (other.firstName != null)
161
				return false;
162
		} else if (!firstName.equals(other.firstName))
163
			return false;
24479 amit.gupta 164
		if (gmailId == null) {
165
			if (other.gmailId != null)
166
				return false;
167
		} else if (!gmailId.equals(other.gmailId))
168
			return false;
24383 amit.gupta 169
		if (id != other.id)
170
			return false;
171
		if (lastLoginTimestamp == null) {
172
			if (other.lastLoginTimestamp != null)
173
				return false;
174
		} else if (!lastLoginTimestamp.equals(other.lastLoginTimestamp))
175
			return false;
176
		if (lastName == null) {
177
			if (other.lastName != null)
178
				return false;
179
		} else if (!lastName.equals(other.lastName))
180
			return false;
181
		if (mobileNumber == null) {
182
			if (other.mobileNumber != null)
183
				return false;
184
		} else if (!mobileNumber.equals(other.mobileNumber))
185
			return false;
186
		if (password == null) {
187
			if (other.password != null)
188
				return false;
189
		} else if (!password.equals(other.password))
190
			return false;
24330 amit.gupta 191
		return true;
192
	}
193
 
194
	public String getEmailId() {
195
		return emailId;
196
	}
197
 
198
	public void setEmailId(String emailId) {
199
		this.emailId = emailId;
200
	}
201
 
202
	public String getMobileNumber() {
203
		return mobileNumber;
204
	}
205
 
206
	public void setMobileNumber(String mobileNumber) {
207
		this.mobileNumber = mobileNumber;
208
	}
209
 
210
	public LocalDateTime getCreatedTimestamp() {
211
		return createdTimestamp;
212
	}
213
 
214
	public void setCreatedTimestamp(LocalDateTime createdTimestamp) {
215
		this.createdTimestamp = createdTimestamp;
216
	}
217
 
218
	public LocalDateTime getLastLoginTimestamp() {
219
		return lastLoginTimestamp;
220
	}
221
 
222
	public void setLastLoginTimestamp(LocalDateTime lastLoginTimestamp) {
223
		this.lastLoginTimestamp = lastLoginTimestamp;
224
	}
225
 
25383 tejbeer 226
	public String getFormattedCreateTimestamp() {
227
		if (createdTimestamp == null) {
24383 amit.gupta 228
			return null;
229
		}
24402 amit.gupta 230
		DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd-MM-yyyy HH:mm");
24383 amit.gupta 231
		return createdTimestamp.format(formatter);
25383 tejbeer 232
	}
24330 amit.gupta 233
 
234
	@Override
235
	public String toString() {
27595 tejbeer 236
		return "AuthUser [id=" + id + ", emailId=" + emailId + ", gmailId=" + gmailId + ", employeeCode=" + employeeCode
237
				+ ", active=" + active + ", firstName=" + firstName + ", lastName=" + lastName + ", mobileNumber="
238
				+ mobileNumber + ", password=" + password + ", createdTimestamp=" + createdTimestamp
239
				+ ", lastLoginTimestamp=" + lastLoginTimestamp + "]";
24330 amit.gupta 240
	}
241
 
242
}