Subversion Repositories SmartDukaan

Rev

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