AppUser.java 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. package pl.sudra.domain;
  2. import jakarta.persistence.*;
  3. import jakarta.validation.constraints.NotNull;
  4. import jakarta.validation.constraints.Size;
  5. import java.util.HashSet;
  6. import java.util.Set;
  7. @Entity
  8. @Table(name = "appuser")
  9. public class AppUser {
  10. @Id
  11. @GeneratedValue(strategy = GenerationType.IDENTITY)
  12. long id;
  13. @NotNull
  14. @Column(name = "firstName", nullable = false)
  15. @Size(min = 2, max = 30, message = "{error.size.firstName}")
  16. private String firstName;
  17. @NotNull
  18. @Size(min = 2, max = 30)
  19. private String lastName;
  20. @NotNull
  21. private String email;
  22. @Size(min = 9, max = 9)
  23. private String telephone;
  24. @NotNull
  25. @Column(unique = true)
  26. private String login;
  27. @NotNull
  28. private String password;
  29. private boolean enabled;
  30. @ManyToMany(fetch = FetchType.EAGER)
  31. private Set<AppUserRole> appUserRole = new HashSet<AppUserRole>(0);
  32. @OneToOne(cascade = CascadeType.ALL)
  33. private Pesel pesel;
  34. @ManyToOne
  35. private Address address;
  36. public Address getAddress() {
  37. return address;
  38. }
  39. public void setAddress(Address address) {
  40. this.address = address;
  41. }
  42. public long getId() {
  43. return id;
  44. }
  45. public void setId(long id) {
  46. this.id = id;
  47. }
  48. public String getFirstName() {
  49. return firstName;
  50. }
  51. public void setFirstName(String firstName) {
  52. this.firstName = firstName;
  53. }
  54. public String getLastName() {
  55. return lastName;
  56. }
  57. public void setLastName(String lastName) {
  58. this.lastName = lastName;
  59. }
  60. public String getEmail() {
  61. return email;
  62. }
  63. public void setEmail(String email) {
  64. this.email = email;
  65. }
  66. public String getTelephone() {
  67. return telephone;
  68. }
  69. public void setTelephone(String telephone) {
  70. this.telephone = telephone;
  71. }
  72. public String getLogin() {
  73. return login;
  74. }
  75. public void setLogin(String login) {
  76. this.login = login;
  77. }
  78. public String getPassword() {
  79. return password;
  80. }
  81. public void setPassword(String password) {
  82. this.password = password;
  83. }
  84. public boolean isEnabled() {
  85. return enabled;
  86. }
  87. public void setEnabled(boolean enabled) {
  88. this.enabled = enabled;
  89. }
  90. public Set<AppUserRole> getAppUserRole() {
  91. return appUserRole;
  92. }
  93. public void setAppUserRole(Set<AppUserRole> appUserRole) {
  94. this.appUserRole = appUserRole;
  95. }
  96. public Pesel getPesel() {
  97. return pesel;
  98. }
  99. public void setPesel(Pesel pesel) {
  100. this.pesel = pesel;
  101. }
  102. }