Subversion Repositories SmartDukaan

Rev

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