@Entity public class User extends Object
| Constructor and Description |
|---|
User(String login,
String name,
String surname,
String password,
String email,
Role role)
Creates a new instance of
User |
| Modifier and Type | Method and Description |
|---|---|
void |
addAssistantEvent(Event event)
Set this user to the event as assistant.
|
void |
addEvent(Event event)
Set this user to the event as creator.
|
void |
addOrganizerEvent(Event event)
Set this user to the event as organizer.
|
Set<Event> |
getAssistedEvents()
Returns events assisted by the user.
|
String |
getEmail()
Returns the email of this user.
|
Set<Event> |
getEventsCreated()
Returns events created by the user.
|
String |
getLogin()
Returns the login of this user.
|
String |
getName()
Returns the name of this user.
|
Set<Event> |
getOrganizedEvents()
Returns events organized by the user.
|
String |
getPassword()
Returns the MD5 of the user's password.
|
Role |
getRole()
Returns the role of the event.
|
String |
getSurname()
Returns the surname of this user.
|
boolean |
ownsAssistedEvents(Event event)
Checks if an assistant of an event is this user.
|
boolean |
ownsCreatedEvents(Event event)
Checks if the creator of an event is this user.
|
boolean |
ownsOrganizedEvents(Event event)
Checks if the organizer of an event is this user.
|
void |
setEmail(String email)
Sets the email of the user.
|
void |
setLogin(String login)
Sets the login of this user.
|
void |
setName(String name)
Sets the name of this user.
|
void |
setPassword(String password)
Changes the password of the user.
|
void |
setPasswordMD5(String password)
Sets the MD5 password of the user.
|
void |
setRole(Role role)
Sets the role of this event.
|
void |
setSurname(String surname)
Sets the surname of this user.
|
public User(String login, String name, String surname, String password, String email, Role role)
Userlogin - the login that identifies the user. This parameter must be a
non empty and non null string with a maximum length of 100 chars.name - the name of the event. This parameter must be a
non empty and non null string with a maximum length of 100 chars.surname - the surname of the event. This parameter must be a
non empty and non null string with a maximum length of 150 chars.password - the raw password of the user. This parameter must be a
non null string with a minimum length of 6 chars and with a maximum
length of 100 chars.email - the email of the event. This parameter must be a valid email,
non empty and non null string with a maximum length of 255 chars.role - the role of the event. This parameter is an enumerated of type Role
that must be a non null.NullPointerException - if a null value is passed as the
value for any parameter.IllegalArgumentException - if value provided for any parameter is
not valid according to its description.public String getLogin()
public void setLogin(String login)
login - the login that identifies the user. This parameter
must be a non empty and non null string with a maximum length of
100 chars.NullPointerException - if null is passed as parameter.IllegalArgumentException - if the length of the string passed is
not valid.public String getName()
public void setName(String name)
name - the name of this user. This parameter must be a non empty and non null
string with a maximum length of 100 chars.NullPointerException - if null is passed as parameter.IllegalArgumentException - if the length of the string passed is
not valid.public String getSurname()
public void setSurname(String surname)
surname - the surname of this user. This parameter must be a non empty and non null
string with a maximum length of 150 chars.NullPointerException - if null is passed as parameter.IllegalArgumentException - if the length of the string passed is
not valid.public String getPassword()
public void setPasswordMD5(String password)
password - the MD5 password of the user. This parameter must be a
non null MD5 string.NullPointerException - if null is passed as parameter.IllegalArgumentException - if the string passed is not a valid MD5
string.public void setPassword(String password)
password - the raw password of the user. This parameter must be a
non null string with a minimum length of 6 chars.NullPointerException - if the password is null.IllegalArgumentException - if the length of the string passed is
not valid.public String getEmail()
public void setEmail(String email)
email - the email of the user. This parameter must be a valid email
string, non empty and non null string with a maximum length of
100 chars.NullPointerException - if null is passed as parameter.IllegalArgumentException - if the string passed is not a valid email
string.public Role getRole()
public void setRole(Role role)
role - the new role of the event. This parameter is an enumerated of type Role
that must be a non null.NullPointerException - if a null value is passed.public void addEvent(Event event)
event - an event already created. null values not supported.NullPointerException - if the event is null.public void addOrganizerEvent(Event event)
event - an event already created. null values not supported.NullPointerException - if the event is null.public void addAssistantEvent(Event event)
event - an event already created. null values not supported.NullPointerException - if the event is null.public Set<Event> getEventsCreated()
public Set<Event> getOrganizedEvents()
public Set<Event> getAssistedEvents()
public boolean ownsOrganizedEvents(Event event)
event - the event whose property will be checked.true if the organizer of an event is this user. false
otherwise.public boolean ownsCreatedEvents(Event event)
event - the event whose property will be checked.true if the creator of an event is this user. false
otherwise.public boolean ownsAssistedEvents(Event event)
event - the event whose property will be checked.true if an assistant of an event is this user. false
otherwise.Copyright © 2016. All rights reserved.