Subversion Repositories SmartDukaan

Rev

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