bocajbee

Untitled

Nov 29th, 2021
921
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package com.example.passwordKeepr.passwordKeeprTest.Users;
  2. import com.example.passwordKeepr.passwordKeeprTest.Passwords.Password;
  3. import javax.persistence.*;
  4. import java.time.LocalDateTime;
  5. import java.util.List;
  6.  
  7. /* https://stackoverflow.com/questions/41791802/autoincrement-id-postgresql-and-spring-boot-data-jpa
  8.  * https://attacomsian.com/blog/spring-data-jpa-one-to-many-mapping */
  9. @Entity // for hibernate
  10. @Table(name = "users") // for the table in our database
  11. public class User {
  12.  
  13.     @Id
  14.     @GeneratedValue(strategy = GenerationType.IDENTITY)
  15.     private int id;
  16.  
  17.     @Column(columnDefinition = "serial")
  18.     private String email;
  19.     private String master_password;
  20.     private String uuid;
  21.     private Boolean enabled;
  22.     private String verificationCode;
  23.     private LocalDateTime timestamp_pw_reset;
  24.     private int failed_attempt;
  25.     private Boolean account_locked;
  26.     private LocalDateTime lock_time;
  27.     private LocalDateTime first_failed_attempt_time;
  28.  
  29.     @OneToMany(fetch = FetchType.LAZY,
  30.         mappedBy = "user",
  31.         cascade = CascadeType.ALL)
  32.     private List<Password> passwordList;
  33.  
  34.     public User() {
  35.     }
  36.  
  37.     public User(int id, String email, String master_password, String uuid, Boolean enabled, String verificationCode, LocalDateTime timestamp_pw_reset, int failed_attempt, Boolean account_locked, LocalDateTime lock_time, LocalDateTime first_failed_attempt_time) {
  38.         this.id = id;
  39.         this.email = email;
  40.         this.master_password = master_password;
  41.         this.uuid = uuid;
  42.         this.enabled = enabled;
  43.         this.verificationCode = verificationCode;
  44.         this.timestamp_pw_reset = timestamp_pw_reset;
  45.         this.failed_attempt = failed_attempt;
  46.         this.account_locked = account_locked;
  47.         this.lock_time = lock_time;
  48.         this.first_failed_attempt_time = first_failed_attempt_time;
  49.     }
  50.  
  51.     public int getId() {
  52.         return id;
  53.     }
  54.  
  55.     public void setId(int id) {
  56.         this.id = id;
  57.     }
  58.  
  59.     public String getEmail() {
  60.         return email;
  61.     }
  62.  
  63.     public void setEmail(String email) {
  64.         this.email = email;
  65.     }
  66.  
  67.     public String getMasterPassword() {
  68.         return master_password;
  69.     }
  70.  
  71.     public void setMasterPassword(String masterPassword) {
  72.         this.master_password = masterPassword;
  73.     }
  74.  
  75.     public String getUuid() { return uuid; }
  76.  
  77.     public void setUuid(String uuid) { this.uuid = uuid; }
  78.  
  79.     public List<Password> getPasswordList() {
  80.         return passwordList;
  81.     }
  82.  
  83.     public Boolean getEnabled() {
  84.         return enabled;
  85.     }
  86.  
  87.     public void setEnabled(Boolean enabled) {
  88.         this.enabled = enabled;
  89.     }
  90.  
  91.     public String getVerificationCode() {
  92.         return verificationCode;
  93.     }
  94.  
  95.     public void setVerificationCode(String verification_code) {
  96.         this.verificationCode = verification_code;
  97.     }
  98.  
  99.     public void setPasswordList(List<Password> passwordList) {
  100.         this.passwordList = passwordList;
  101.     }
  102.  
  103.     public LocalDateTime getTimestamp_pw_reset() {
  104.         return timestamp_pw_reset;
  105.     }
  106.  
  107.     public void setTimestamp_pw_reset(LocalDateTime timestamp_pw_reset) {
  108.         this.timestamp_pw_reset = timestamp_pw_reset;
  109.     }
  110.  
  111.     public int getFailed_attempt() {
  112.         return failed_attempt;
  113.     }
  114.  
  115.     public void setFailed_attempt(int failed_attempt) {
  116.         this.failed_attempt = failed_attempt;
  117.     }
  118.  
  119.     public Boolean getAccount_locked() {
  120.         return account_locked;
  121.     }
  122.  
  123.     public void setAccount_locked(Boolean account_non_locked) {
  124.         this.account_locked = account_non_locked;
  125.     }
  126.  
  127.     public LocalDateTime getLock_time() {
  128.         return lock_time;
  129.     }
  130.  
  131.     public void setLock_time(LocalDateTime lock_time) {
  132.         this.lock_time = lock_time;
  133.     }
  134.  
  135.     public LocalDateTime getFirst_failed_attempt_time() {
  136.         return first_failed_attempt_time;
  137.     }
  138.  
  139.     public void setFirst_failed_attempt_time(LocalDateTime first_failed_attempt_time) {
  140.         this.first_failed_attempt_time = first_failed_attempt_time;
  141.     }
  142. }
  143.  
RAW Paste Data