@Entity(name="Event") public class Event extends Object implements Serializable
| Constructor and Description |
|---|
Event()
Constructor a new instance of
Event. |
Event(Integer id,
String title,
Category category,
String description,
String longDescription,
Date eventDate,
String location,
int participants,
long duration,
User creator,
boolean isActive)
Constructs a new instance of
Event. |
Event(String title,
Category category,
String description,
String longDescription,
Date eventDate,
String location,
long duration,
User creator,
boolean isActive)
Constructs a new instance of
Event. |
| Modifier and Type | Method and Description |
|---|---|
void |
addCreator(User creator)
Adds a creator to an event
|
void |
addParticipant(User participant)
Adds a participant to an event and increase the participants number for
that event
|
boolean |
equals(Object obj)
Override equals() method
|
Category |
getCategory()
Returns the category of the event
|
User |
getCreator()
Returns the owner of the event
|
String |
getDescription()
Returns the description of the event.
|
long |
getDuration()
Returns the duration of the event
|
Date |
getEventDate()
Returns event date.
|
int |
getId()
Return the identifier of the event
|
String |
getLocation()
Returns the location of the event
|
String |
getLongDescription()
Returns the long description of the event
|
int |
getParticipants()
Returns the participants of the event
|
List<User> |
getParticipantsList()
Returns the list of event participants
|
String |
getTitle()
Return the event's title
|
int |
hashCode()
Override hashCode() method
|
boolean |
isActive()
Returns the status of the event
|
void |
removeCreator(User creator)
Remove a creator from an event
|
void |
removeParticipant(User participant)
Remove a participant from an event and decrease the participants number
for the event
|
void |
setActive(boolean isActive)
Sets the status of the event
|
void |
setCategory(Category category)
Sets the category of the event
|
void |
setCreator(User creator)
Sets the owner of the event
|
void |
setDescription(String description)
Sets the description of the event
|
void |
setDuration(long duration)
Sets the duration of the event
|
void |
setEventDate(Date eventDate)
Sets the event date
|
void |
setId(int id) |
void |
setLocation(String location)
Sets the location of the event
|
void |
setLongDescription(String longDescription)
Sets the long description of the event
|
void |
setParticipants(int participants)
Sets the participants of the event
|
void |
setTitle(String title)
Sets the title of the event
|
String |
toString()
Override the toString method
|
public Event()
Event. This constructor is empty
because is requiredpublic Event(Integer id, String title, Category category, String description, String longDescription, Date eventDate, String location, int participants, long duration, User creator, boolean isActive)
Event. This constructor is necessary
and only used for the realization of the datasets.id - id for eventtitle - The title of the events. It must be non-null, non-empty and no
greater than 20 characters.category - The category of the event. It cannot be null.description - The description of the event. It must be non-null, non-empty
and no greater than 50 characters.longDescription - The long description of the event. It must be non-null,
non-empty and no greater than 1000 characters.eventDate - The date of the eventlocation - The location of the eventparticipants - number of participants for the eventduration - The duration of the eventcreator - The owner of the eventisActive - The status of the eventpublic Event(String title, Category category, String description, String longDescription, Date eventDate, String location, long duration, User creator, boolean isActive)
Event. Creates a new event with an
authortitle - The title of the events. It must be non-null, non-empty and no
greater than 20 characters.category - The category of the event. It cannot be null.description - The description of the event. It must be non-null, non-empty
and no greater than 50 characters.longDescription - The long description of the event. It must be non-null,
non-empty and no greater than 1000 characters.eventDate - The date of the eventlocation - The location of the eventduration - The duration of the eventcreator - The owner of the eventisActive - The status of the eventpublic int getId()
public void setId(int id)
public String getTitle()
public void setTitle(String title)
title - The new event's title.IllegalArgumentException - If the title is 20 characters long or less than 1 characterpublic long getDuration()
public void setDuration(long duration)
duration - The new event's duration.IllegalArgumentException - If the duration is less than 0public Category getCategory()
public void setCategory(Category category)
category - The new event's categorypublic String getDescription()
public void setDescription(String description)
description - The new event's descriptionIllegalArgumentException - If the description is 50 characters long or less than 1
characterpublic String getLongDescription()
public void setLongDescription(String longDescription)
longDescription - The new event's long descriptionIllegalArgumentException - If the long description is 1000 characters long or less than
1 characterpublic Date getEventDate()
public void setEventDate(Date eventDate)
eventDate - The new event's datepublic String getLocation()
public void setLocation(String location)
location - The new event's locationpublic int getParticipants()
public void setParticipants(int participants)
participants - The new event's participantsIllegalArgumentException - If participants are more than 1000 persons and less than 1
person.public List<User> getParticipantsList()
public User getCreator()
public void setCreator(User creator)
creator - The new owner of the eventpublic boolean isActive()
public void setActive(boolean isActive)
isActive - The new status of the eventpublic void addParticipant(User participant)
participant - The new participant in the eventNullPointerException - if null is passed as parameterpublic void removeParticipant(User participant)
participant - participants of the eventNullPointerException - if null is passed as parameterpublic void addCreator(User creator)
creator - The new owner in the event.NullPointerException - if null is passed as parameterpublic void removeCreator(User creator)
creator - The new owner in the event.NullPointerException - if null is passed as parameterpublic final int hashCode()
public final boolean equals(Object obj)
Copyright © 2016. All rights reserved.