Advertisement
Guest User

Untitled

a guest
Jun 30th, 2017
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.07 KB | None | 0 0
  1. package com.epolsoft.model;
  2.  
  3. import com.epolsoft.dto.user.UserCoachLiteInfo;
  4. import com.fasterxml.jackson.annotation.JsonIgnore;
  5.  
  6. import javax.persistence.*;
  7. import java.util.ArrayList;
  8. import java.util.HashSet;
  9. import java.util.List;
  10. import java.util.Set;
  11.  
  12.  
  13. @Entity
  14. public class User {
  15.  
  16. @Id
  17. @GeneratedValue(strategy = GenerationType.AUTO)
  18. private Long userId;
  19.  
  20. @Column(unique = true, nullable = false, length = 32)
  21. private String username;
  22.  
  23. @Column(nullable = false)
  24. private String password;
  25.  
  26. @Transient
  27. private String passwordConfirm;
  28.  
  29. @Column(nullable = false, length = 50)
  30. private String firstName;
  31.  
  32. @Column(nullable = false, length = 50)
  33. private String lastName;
  34.  
  35. @Column(unique = true, nullable = false, length = 50)
  36. private String email;
  37.  
  38. @ManyToMany
  39. @JoinTable(name = "User_Role",
  40. joinColumns = @JoinColumn(name = "userId"),
  41. inverseJoinColumns = @JoinColumn(name = "roleId"))
  42. private Set<Role> roles;
  43.  
  44. @ManyToMany(fetch = FetchType.LAZY, mappedBy = "students")
  45. private List<Training> trainings = new ArrayList<Training>();
  46.  
  47. @OneToMany(fetch = FetchType.LAZY, mappedBy = "student", cascade = CascadeType.ALL, orphanRemoval = true)
  48. private List<StudentTaskAssignment> studentTaskAssignments = new ArrayList<>();
  49.  
  50. @OneToMany(fetch = FetchType.LAZY, mappedBy = "coach", cascade = CascadeType.ALL, orphanRemoval = true)
  51. private List<Training> coachsTrainings = new ArrayList<>();
  52.  
  53. @OneToMany(fetch = FetchType.LAZY, mappedBy = "coachId", cascade = CascadeType.ALL, orphanRemoval = true)
  54. private List<Task> coachList = new ArrayList<>();
  55.  
  56. public User() {
  57.  
  58. }
  59.  
  60. public User(UserCoachLiteInfo coach) {
  61. userId = coach.getUserId();
  62. username = coach.getUsername();
  63. firstName = coach.getFirstName();
  64. lastName = coach.getLastName();
  65. email = coach.getEmail();
  66. }
  67.  
  68. public Long getUserId() {
  69. return userId;
  70. }
  71.  
  72. public void setUserId(Long userId) {
  73. this.userId = userId;
  74. }
  75.  
  76. public String getUsername() {
  77. return username;
  78. }
  79.  
  80. public void setUsername(String username) {
  81. this.username = username;
  82. }
  83.  
  84. public String getPassword() {
  85. return password;
  86. }
  87.  
  88. public void setPassword(String password) {
  89. this.password = password;
  90. }
  91.  
  92. public String getPasswordConfirm() {
  93. return passwordConfirm;
  94. }
  95.  
  96. public void setPasswordConfirm(String passwordConfirm) {
  97. this.passwordConfirm = passwordConfirm;
  98. }
  99.  
  100. public String getFirstName() {
  101. return firstName;
  102. }
  103.  
  104. public void setFirstName(String firstName) {
  105. this.firstName = firstName;
  106. }
  107.  
  108. public String getLastName() {
  109. return lastName;
  110. }
  111.  
  112. public void setLastName(String lastName) {
  113. this.lastName = lastName;
  114. }
  115.  
  116. public String getEmail() {
  117. return email;
  118. }
  119.  
  120. public void setEmail(String email) {
  121. this.email = email;
  122. }
  123.  
  124. public List<Training> getTrainings() {
  125. return trainings;
  126. }
  127.  
  128. public void setTrainings(List<Training> trainings) {
  129. this.trainings = trainings;
  130. }
  131.  
  132. public Set<Role> getRoles() {
  133. return roles;
  134. }
  135.  
  136. public void setRoles(Set<Role> roles) {
  137. this.roles = roles;
  138. }
  139.  
  140. public List<StudentTaskAssignment> getStudentTaskAssignments() {
  141. return studentTaskAssignments;
  142. }
  143.  
  144. public void setStudentTaskAssignments(List<StudentTaskAssignment> studentTaskAssignments) {
  145. this.studentTaskAssignments = studentTaskAssignments;
  146. }
  147.  
  148. public List<Training> getCoachsTrainings() {
  149. return coachsTrainings;
  150. }
  151.  
  152. public void setCoachsTrainings(List<Training> coachsTrainings) {
  153. this.coachsTrainings = coachsTrainings;
  154. }
  155.  
  156. public List<Task> getCoachList() {
  157. return coachList;
  158. }
  159.  
  160. public void setCoachList(List<Task> coachList) {
  161. this.coachList = coachList;
  162. }
  163. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement