Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package lapr.project.model;
- import java.util.ArrayList;
- import java.util.List;
- import java.util.Objects;
- /**
- *
- * @author Filipa
- */
- public class Event {
- private String title;
- private String description;
- private String date;
- private String location;
- private ApplicationSubmissionPeriod appPeriod;
- private ApplicationRegister applicationRegister;
- private StandsRegister standRegister;
- private UserRegister userRegister;
- private List<User> organizersList;
- private List<User> staffList;
- private List<User> eventManagerList;
- public Event(String title, String description, String date, String location, ApplicationSubmissionPeriod appPeriod) {
- this.title = title;
- this.description = description;
- this.date = date;
- this.location = location;
- this.appPeriod = appPeriod;
- applicationRegister = new ApplicationRegister();
- standRegister = new StandsRegister();
- userRegister = new UserRegister();
- organizersList = new ArrayList<>();
- staffList = new ArrayList<>();
- eventManagerList = new ArrayList<>();
- }
- public String getTitle() {
- return title;
- }
- public String getDescription() {
- return description;
- }
- public String getDate() {
- return date;
- }
- public String getLocation() {
- return location;
- }
- public ApplicationSubmissionPeriod getApplicationSubmissionPeriod() {
- return appPeriod;
- }
- public ApplicationRegister getApplicationRegister() {
- return applicationRegister;
- }
- public StandsRegister getStandsRegister() {
- return standRegister;
- }
- public UserRegister getUserRegister() {
- return userRegister;
- }
- public List<User> getOrganizersList() {
- return organizersList;
- }
- public List<User> getStaffList() {
- return staffList;
- }
- public List<User> getEventManagerList() {
- return eventManagerList;
- }
- public void setTitle(String title) {
- this.title = title;
- }
- public void setDescription(String description) {
- this.description = description;
- }
- public void setDate(String date) {
- this.date = date;
- }
- public void setLocation(String location) {
- this.location = location;
- }
- public void setApplicationSubmissionPeriod(ApplicationSubmissionPeriod appPeriod) {
- this.appPeriod = appPeriod;
- }
- public void setApplicationRegister(ApplicationRegister applicationRegister) {
- this.applicationRegister = applicationRegister;
- }
- public void setStandsRegister(StandsRegister standRegister) {
- this.standRegister = standRegister;
- }
- public void setUserRegister(UserRegister userRegister) {
- this.userRegister = userRegister;
- }
- public void setOrganizersList(List<User> organizersList) {
- this.organizersList = organizersList;
- }
- public void setStaffList(List<User> staffList) {
- this.staffList = staffList;
- }
- public void setEventManagerList(List<User> eventManagerList) {
- this.eventManagerList = eventManagerList;
- }
- public static boolean isOrganizer(Event event, User user) {
- return event.getOrganizersList().stream().anyMatch((u) -> (u.equals(user)));
- }
- public static boolean isStaff(Event event, User user) {
- return event.getStaffList().stream().anyMatch((u) -> (u.equals(user)));
- }
- public static boolean isEventManager(Event event, User user) {
- return event.getEventManagerList().stream().anyMatch((u) -> (u.equals(user)));
- }
- public void addStaff(User user, Event event) {
- }
- @Override
- public boolean equals(Object other) {
- if (other == null) {
- return false;
- }
- if (other.getClass() != this.getClass()) {
- return false;
- }
- if (this == other) {
- return true;
- }
- Event e = (Event) other;
- return (this.title.equals(e.getTitle())
- && this.description.equals(e.getDescription())
- && this.date.equals(e.getDate())
- && this.location.equals(e.getLocation())
- && this.appPeriod.equals(e.getApplicationSubmissionPeriod())
- && this.applicationRegister.equals(e.getApplicationRegister())
- && this.standRegister.equals(e.getStandsRegister())
- && this.userRegister.equals(e.getUserRegister())
- && this.organizersList.equals(e.getOrganizersList())
- && this.staffList.equals(e.getStaffList())
- && this.eventManagerList.equals(e.getEventManagerList()));
- }
- @Override
- public int hashCode() {
- int hash = 5;
- hash = 59 * hash + Objects.hashCode(this.title);
- hash = 59 * hash + Objects.hashCode(this.description);
- hash = 59 * hash + Objects.hashCode(this.date);
- hash = 59 * hash + Objects.hashCode(this.location);
- hash = 59 * hash + Objects.hashCode(this.appPeriod);
- hash = 59 * hash + Objects.hashCode(this.applicationRegister);
- hash = 59 * hash + Objects.hashCode(this.standRegister);
- hash = 59 * hash + Objects.hashCode(this.userRegister);
- hash = 59 * hash + Objects.hashCode(this.organizersList);
- hash = 59 * hash + Objects.hashCode(this.staffList);
- hash = 59 * hash + Objects.hashCode(this.eventManagerList);
- return hash;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement