@DeclareRoles(value={"admin","user"}) @RolesAllowed(value="admin") public class EventEJB extends Object
| Constructor and Description |
|---|
EventEJB() |
| Modifier and Type | Method and Description |
|---|---|
void |
createEvent(es.uvigo.esei.dgss.lettab.domain.Event event)
Create an event and stores it in the database
|
List<es.uvigo.esei.dgss.lettab.domain.Event> |
findEvent(String text)
This method search events by title and description, and order them by
ascendant date and descendant participants
|
String |
getCurrentUserLogin() |
List<es.uvigo.esei.dgss.lettab.domain.Event> |
getFiveRandomEvents()
Get five random events using JPQL
|
List<es.uvigo.esei.dgss.lettab.domain.Event> |
getMyEvents(String login) |
List<es.uvigo.esei.dgss.lettab.domain.Event> |
getPopularEvents(int numEvents)
Get popular events and order them date asc and participants desc.
|
void |
linkEventToUser(es.uvigo.esei.dgss.lettab.domain.User participant,
es.uvigo.esei.dgss.lettab.domain.Event event)
Links an user to an event and increase the number of participants for
that event
|
public String getCurrentUserLogin()
@PermitAll public List<es.uvigo.esei.dgss.lettab.domain.Event> getFiveRandomEvents()
@PermitAll public List<es.uvigo.esei.dgss.lettab.domain.Event> getPopularEvents(int numEvents)
numEvents - The number of events to look for@RolesAllowed(value="user") public void linkEventToUser(es.uvigo.esei.dgss.lettab.domain.User participant, es.uvigo.esei.dgss.lettab.domain.Event event)
participant - The user that is linked to an eventevent - Event assigned to a user@RolesAllowed(value="user") public void createEvent(es.uvigo.esei.dgss.lettab.domain.Event event) throws IllegalArgumentException, javax.persistence.EntityExistsException, javax.persistence.PersistenceException
event - The event that we want to persistIllegalArgumentException - When the event we want to persist is nulljavax.persistence.PersistenceException - Happens when there is any error with the persistencejavax.persistence.EntityExistsException@PermitAll public List<es.uvigo.esei.dgss.lettab.domain.Event> findEvent(String text) throws javax.persistence.EntityNotFoundException
text - The String that should match with the title or description of
the eventsjavax.persistence.EntityNotFoundException - if there aren't any event that matches with the text@RolesAllowed(value="user") public List<es.uvigo.esei.dgss.lettab.domain.Event> getMyEvents(String login)
login - The String passed to retrieve the userCopyright © 2016. All rights reserved.