Advertisement
Guest User

Untitled

a guest
Jun 13th, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.77 KB | None | 0 0
  1. /*
  2. * To change this license header, choose License Headers in Project Properties.
  3. * To change this template file, choose Tools | Templates
  4. * and open the template in the editor.
  5. */
  6. package lapr.project.model;
  7.  
  8. import java.util.ArrayList;
  9. import java.util.List;
  10. import java.util.Objects;
  11.  
  12. /**
  13. *
  14. * @author Filipa
  15. */
  16. public class Event {
  17.  
  18. private String title;
  19. private String description;
  20. private String date;
  21. private String location;
  22. private ApplicationSubmissionPeriod appPeriod;
  23. private ApplicationRegister applicationRegister;
  24. private StandsRegister standRegister;
  25. private UserRegister userRegister;
  26. private List<User> organizersList;
  27. private List<User> staffList;
  28. private List<User> eventManagerList;
  29.  
  30. public Event(String title, String description, String date, String location, ApplicationSubmissionPeriod appPeriod) {
  31. this.title = title;
  32. this.description = description;
  33. this.date = date;
  34. this.location = location;
  35. this.appPeriod = appPeriod;
  36. applicationRegister = new ApplicationRegister();
  37. standRegister = new StandsRegister();
  38. userRegister = new UserRegister();
  39. organizersList = new ArrayList<>();
  40. staffList = new ArrayList<>();
  41. eventManagerList = new ArrayList<>();
  42. }
  43.  
  44. public String getTitle() {
  45. return title;
  46. }
  47.  
  48. public String getDescription() {
  49. return description;
  50. }
  51.  
  52. public String getDate() {
  53. return date;
  54. }
  55.  
  56. public String getLocation() {
  57. return location;
  58. }
  59.  
  60. public ApplicationSubmissionPeriod getApplicationSubmissionPeriod() {
  61. return appPeriod;
  62. }
  63.  
  64. public ApplicationRegister getApplicationRegister() {
  65. return applicationRegister;
  66. }
  67.  
  68. public StandsRegister getStandsRegister() {
  69. return standRegister;
  70. }
  71.  
  72. public UserRegister getUserRegister() {
  73. return userRegister;
  74. }
  75.  
  76. public List<User> getOrganizersList() {
  77. return organizersList;
  78. }
  79.  
  80. public List<User> getStaffList() {
  81. return staffList;
  82. }
  83.  
  84. public List<User> getEventManagerList() {
  85. return eventManagerList;
  86. }
  87.  
  88. public void setTitle(String title) {
  89. this.title = title;
  90. }
  91.  
  92. public void setDescription(String description) {
  93. this.description = description;
  94. }
  95.  
  96. public void setDate(String date) {
  97. this.date = date;
  98. }
  99.  
  100. public void setLocation(String location) {
  101. this.location = location;
  102. }
  103.  
  104. public void setApplicationSubmissionPeriod(ApplicationSubmissionPeriod appPeriod) {
  105. this.appPeriod = appPeriod;
  106. }
  107.  
  108. public void setApplicationRegister(ApplicationRegister applicationRegister) {
  109. this.applicationRegister = applicationRegister;
  110. }
  111.  
  112. public void setStandsRegister(StandsRegister standRegister) {
  113. this.standRegister = standRegister;
  114. }
  115.  
  116. public void setUserRegister(UserRegister userRegister) {
  117. this.userRegister = userRegister;
  118. }
  119.  
  120. public void setOrganizersList(List<User> organizersList) {
  121. this.organizersList = organizersList;
  122. }
  123.  
  124. public void setStaffList(List<User> staffList) {
  125. this.staffList = staffList;
  126. }
  127.  
  128. public void setEventManagerList(List<User> eventManagerList) {
  129. this.eventManagerList = eventManagerList;
  130. }
  131.  
  132. public static boolean isOrganizer(Event event, User user) {
  133. return event.getOrganizersList().stream().anyMatch((u) -> (u.equals(user)));
  134. }
  135.  
  136. public static boolean isStaff(Event event, User user) {
  137. return event.getStaffList().stream().anyMatch((u) -> (u.equals(user)));
  138. }
  139.  
  140. public static boolean isEventManager(Event event, User user) {
  141. return event.getEventManagerList().stream().anyMatch((u) -> (u.equals(user)));
  142. }
  143.  
  144. public void addStaff(User user, Event event) {
  145.  
  146. }
  147.  
  148. @Override
  149. public boolean equals(Object other) {
  150. if (other == null) {
  151. return false;
  152. }
  153. if (other.getClass() != this.getClass()) {
  154. return false;
  155. }
  156. if (this == other) {
  157. return true;
  158. }
  159. Event e = (Event) other;
  160. return (this.title.equals(e.getTitle())
  161. && this.description.equals(e.getDescription())
  162. && this.date.equals(e.getDate())
  163. && this.location.equals(e.getLocation())
  164. && this.appPeriod.equals(e.getApplicationSubmissionPeriod())
  165. && this.applicationRegister.equals(e.getApplicationRegister())
  166. && this.standRegister.equals(e.getStandsRegister())
  167. && this.userRegister.equals(e.getUserRegister())
  168. && this.organizersList.equals(e.getOrganizersList())
  169. && this.staffList.equals(e.getStaffList())
  170. && this.eventManagerList.equals(e.getEventManagerList()));
  171. }
  172.  
  173. @Override
  174. public int hashCode() {
  175. int hash = 5;
  176. hash = 59 * hash + Objects.hashCode(this.title);
  177. hash = 59 * hash + Objects.hashCode(this.description);
  178. hash = 59 * hash + Objects.hashCode(this.date);
  179. hash = 59 * hash + Objects.hashCode(this.location);
  180. hash = 59 * hash + Objects.hashCode(this.appPeriod);
  181. hash = 59 * hash + Objects.hashCode(this.applicationRegister);
  182. hash = 59 * hash + Objects.hashCode(this.standRegister);
  183. hash = 59 * hash + Objects.hashCode(this.userRegister);
  184. hash = 59 * hash + Objects.hashCode(this.organizersList);
  185. hash = 59 * hash + Objects.hashCode(this.staffList);
  186. hash = 59 * hash + Objects.hashCode(this.eventManagerList);
  187. return hash;
  188. }
  189. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement