-
Notifications
You must be signed in to change notification settings - Fork 54
Expand file tree
/
Copy pathUser.java
More file actions
554 lines (467 loc) · 12.7 KB
/
User.java
File metadata and controls
554 lines (467 loc) · 12.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
/*
* AMRIT – Accessible Medical Records via Integrated Technology
* Integrated EHR (Electronic Health Records) Solution
*
* Copyright (C) "Piramal Swasthya Management and Research Institute"
*
* This file is part of AMRIT.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*/
package com.iemr.common.data.users;
import java.io.Serializable;
import java.sql.Timestamp;
import java.util.List;
import java.util.Set;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.gson.annotations.Expose;
import com.iemr.common.data.callhandling.OutboundCallRequest;
import com.iemr.common.data.feedback.FeedbackDetails;
import com.iemr.common.data.institute.Designation;
import com.iemr.common.data.userbeneficiarydata.Gender;
import com.iemr.common.data.userbeneficiarydata.MaritalStatus;
import com.iemr.common.data.userbeneficiarydata.Status;
import com.iemr.common.data.userbeneficiarydata.Title;
import com.iemr.common.utils.mapper.OutputMapper;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.FetchType;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.OneToMany;
import jakarta.persistence.OneToOne;
import jakarta.persistence.Table;
import jakarta.persistence.Transient;
import lombok.Data;
@Entity
@Table(name = "m_user")
@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class User implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Expose
@Column(name = "UserID")
private Long userID;
@OneToMany(mappedBy = "m_user", fetch = FetchType.EAGER)
@Expose
@Transient
private List<UserServiceRoleMapping> m_UserServiceRoleMapping;
@OneToMany(mappedBy = "user", fetch = FetchType.EAGER)
@Transient
@Expose
private Set<OutboundCallRequest> outboundCallRequests;
@OneToMany(fetch = FetchType.EAGER, mappedBy = "language")
@Transient
private Set<UserServiceRoleMapping> roleMappings;
@Expose
// @Transient
@OneToMany(fetch = FetchType.EAGER)
@JoinColumn(updatable = false, insertable = false, name = "userID", referencedColumnName = "userID")
private Set<UserLangMapping> m_UserLangMappings;
@OneToMany(mappedBy = "mUser", fetch = FetchType.EAGER)
@Transient
@Expose
private Set<FeedbackDetails> feedbackDetails;
@Expose
@Column(name = "TitleID")
private Integer titleID;
@OneToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "TitleID", insertable = false, updatable = false)
@JsonIgnore
@Expose
private Title m_title;
@Expose
@Column(name = "FirstName")
private String firstName;
@Expose
@Column(name = "MiddleName")
private String middleName;
@Expose
@Column(name = "LastName")
private String lastName;
@Expose
@Column(name = "GenderID")
private Integer genderID;
@OneToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "GenderID", insertable = false, updatable = false)
@JsonIgnore
@Expose
private Gender m_gender;
@Expose
@Column(name = "MaritalStatusID")
private Integer maritalStatusID;
@OneToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "maritalStatusID", insertable = false, updatable = false)
@JsonIgnore
@Expose
private MaritalStatus m_maritalstatus;
@Expose
@Column(name = "StatusID")
private Integer statusID;
@OneToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "StatusID", insertable = false, updatable = false)
@JsonIgnore
@Expose
private Status m_status;
@Expose
@Column(name = "EmployeeID")
private String employeeID;
@Expose
@Column(name = "AadhaarNo")
private String aadhaarNo;
@Expose
@JsonProperty("pan")
@Column(name = "PAN")
private String pAN;
@Expose
@JsonProperty("dob")
@Column(name = "DOB")
private Timestamp dOB;
@Expose
@JsonProperty("doj")
@Column(name = "DOJ")
private Timestamp dOJ;
@Expose
@Column(name = "QualificationID")
private Integer qualificationID;
@Expose
@Column(name = "userName")
private String userName;
// @Expose
@Column(name = "Password")
private String password;
@Expose
@Column(name = "EmailID")
private String emailID;
@Expose
@Column(name = "EmergencyContactPerson")
private String emergencyContactPerson;
@Expose
@Column(name = "EmergencyContactNo")
private String emergencyContactNo;
@Expose
@Column(name = "IsSupervisor")
private Boolean isSupervisor;
@Expose
@Column(name = "Deleted", insertable = false, updatable = true)
private Boolean deleted;
@Expose
@Column(name = "CreatedBy")
private String createdBy;
@Column(name = "CreatedDate", insertable = false, updatable = false)
private Timestamp createdDate;
@Column(name = "ModifiedBy")
private String modifiedBy;
@Column(name = "LastModDate", insertable = false, updatable = false)
private Timestamp lastModDate;
@Expose
@Column(name = "AgentID")
private String agentID;
@Expose
@Column(name = "DesignationID")
private Integer designationID;
@JoinColumn(name = "DesignationID", insertable = false, updatable = false)
@Expose
@OneToOne(fetch = FetchType.EAGER)
private Designation designation;
@Expose
@Column(name = "AgentPassword")
private String agentPassword;
@Transient
private String newPassword = null;
@Transient
@JsonIgnore
private OutputMapper outPutMapper = new OutputMapper();
// new field for rate-limit, failed authentication
@Expose
@Column(name = "failed_attempt")
private Integer failedAttempt;
@Expose
@Column(name = "dhistoken")
private String dhistoken;
/*
* protected User() { }
*/
public static User initializeUsers(Long userID, Integer titleID, String firstName, String middleName,
String lastName, Integer genderID, Integer maritalStatusID, String aadhaarNo, String pAN, Timestamp dOB,
Timestamp dOJ, Integer qualificationID, String userName, String password, String emailID, Status m_Status,
List<UserServiceRoleMapping> m_UserServiceRoleMapping, String emergencyContactPerson,
String emergencyContactNo, Boolean isSupervisor, Boolean deleted, String createdBy, Timestamp createdDate,
String modifiedBy, Timestamp lastModDate, String newPassword, String dhistoken) {
User user = new User();
user.userID = userID;
user.titleID = titleID;
user.firstName = firstName;
user.middleName = middleName;
user.lastName = lastName;
user.genderID = genderID;
user.maritalStatusID = maritalStatusID;
user.aadhaarNo = aadhaarNo;
user.pAN = pAN;
user.dOB = dOB;
user.dOJ = dOJ;
user.qualificationID = qualificationID;
user.userName = userName;
user.password = password;
user.emailID = emailID;
user.m_UserServiceRoleMapping = m_UserServiceRoleMapping;
user.emergencyContactPerson = emergencyContactPerson;
user.emergencyContactNo = emergencyContactNo;
user.isSupervisor = isSupervisor;
user.deleted = deleted;
user.createdBy = createdBy;
user.createdDate = createdDate;
user.modifiedBy = modifiedBy;
user.lastModDate = lastModDate;
user.newPassword = newPassword;
user.dhistoken = dhistoken;
return user;
}
public Long getUserID() {
return userID;
}
public void setUserID(Long userID) {
this.userID = userID;
}
// public List<UserServiceRoleMapping> getM_UserServiceRoleMapping()
// {
// return m_UserServiceRoleMapping;
// }
//
// public void setM_UserServiceRoleMapping(List<UserServiceRoleMapping> m_UserServiceRoleMapping)
// {
// this.m_UserServiceRoleMapping = m_UserServiceRoleMapping;
// }
public Integer getTitleID() {
return titleID;
}
public void setTitleID(Integer titleID) {
this.titleID = titleID;
}
// public Title getM_title()
// {
// return m_title;
// }
//
// public void setM_title(Title m_title)
// {
// this.m_title = m_title;
// }
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getMiddleName() {
return middleName;
}
public void setMiddleName(String middleName) {
this.middleName = middleName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public Integer getGenderID() {
return genderID;
}
public void setGenderID(Integer genderID) {
this.genderID = genderID;
}
// public Gender getM_gender()
// {
// return m_gender;
// }
//
// public void setM_gender(Gender m_gender)
// {
// this.m_gender = m_gender;
// }
public Integer getMaritalStatusID() {
return maritalStatusID;
}
public void setMaritalStatusID(Integer maritalStatusID) {
this.maritalStatusID = maritalStatusID;
}
// public MaritalStatus getM_maritalstatus()
// {
// return m_maritalstatus;
// }
//
// public void setM_maritalstatus(MaritalStatus m_maritalstatus)
// {
// this.m_maritalstatus = m_maritalstatus;
// }
public Integer getStatusID() {
return statusID;
}
public void setStatusID(Integer statusID) {
this.statusID = statusID;
}
// public Status getM_status()
// {
// return m_status;
// }
//
// public void setM_status(Status m_status)
// {
// this.m_status = m_status;
// }
public String getAadhaarNo() {
return aadhaarNo;
}
public void setAadhaarNo(String aadhaarNo) {
this.aadhaarNo = aadhaarNo;
}
public String getpAN() {
return pAN;
}
public void setpAN(String pAN) {
this.pAN = pAN;
}
public Timestamp getdOB() {
return dOB;
}
public void setdOB(Timestamp dOB) {
this.dOB = dOB;
}
public Timestamp getdOJ() {
return dOJ;
}
public void setdOJ(Timestamp dOJ) {
this.dOJ = dOJ;
}
public Integer getQualificationID() {
return qualificationID;
}
public void setQualificationID(Integer qualificationID) {
this.qualificationID = qualificationID;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getEmailID() {
return emailID;
}
public void setEmailID(String emailID) {
this.emailID = emailID;
}
public String getEmergencyContactPerson() {
return emergencyContactPerson;
}
public void setEmergencyContactPerson(String emergencyContactPerson) {
this.emergencyContactPerson = emergencyContactPerson;
}
public String getEmergencyContactNo() {
return emergencyContactNo;
}
public void setEmergencyContactNo(String emergencyContactNo) {
this.emergencyContactNo = emergencyContactNo;
}
public Boolean getIsSupervisor() {
return isSupervisor;
}
public void setIsSupervisor(Boolean isSupervisor) {
this.isSupervisor = isSupervisor;
}
public Boolean getDeleted() {
return deleted;
}
public void setDeleted(Boolean deleted) {
this.deleted = deleted;
}
public String getCreatedBy() {
return createdBy;
}
public void setCreatedBy(String createdBy) {
this.createdBy = createdBy;
}
public Timestamp getCreatedDate() {
return createdDate;
}
public void setCreatedDate(Timestamp createdDate) {
this.createdDate = createdDate;
}
public String getModifiedBy() {
return modifiedBy;
}
public void setModifiedBy(String modifiedBy) {
this.modifiedBy = modifiedBy;
}
public Timestamp getLastModDate() {
return lastModDate;
}
public void setLastModDate(Timestamp lastModDate) {
this.lastModDate = lastModDate;
}
public String getNewPassword() {
return newPassword;
}
public void setNewPassword(String newPassword) {
this.newPassword = newPassword;
}
public OutputMapper getOutPutMapper() {
return outPutMapper;
}
public void setOutPutMapper(OutputMapper outPutMapper) {
this.outPutMapper = outPutMapper;
}
public String getAgentID() {
return agentID;
}
public String getEmployeeID() {
return employeeID;
}
public String getAgentPassword() {
return agentPassword;
}
// public Set<UserLangMapping> getM_UserLangMappings()
// {
// return m_UserLangMappings;
// }
@Override
public String toString() {
return OutputMapper.gson().toJson(this);
}
public Integer getDesignationID() {
return designationID;
}
public Designation getDesignation() {
return designation;
}
public String getDhistoken() {
return dhistoken;
}
/*
* public User(String userName, String password) { this.userName = userName;
* this.password = password; }
*/
}