public class StoryService extends Object
| Constructor and Description |
|---|
StoryService() |
| Modifier and Type | Method and Description |
|---|---|
void |
addReading(int storyId)
Create or increase a reading depending on whether that story has
already been read that day or not.
|
Integer |
countByText(String text)
Returns the number of stories that contains in its title or text a string passed by param.
|
es.uvigo.esei.dgss.teama.microstories.domain.entities.Story |
findById(int id)
Returns the story identified by
id. |
List<es.uvigo.esei.dgss.teama.microstories.domain.entities.Story> |
findByText(String text)
Returns a list of stories that contains in its title or text a string passed by param.
|
List<es.uvigo.esei.dgss.teama.microstories.domain.entities.Story> |
findByText(String text,
int page,
int limit)
Returns a list of paginated stories that contains in its title or text a string passed by param.
|
List<es.uvigo.esei.dgss.teama.microstories.domain.entities.Story> |
findByThemeAndGenreAndDate(es.uvigo.esei.dgss.teama.microstories.domain.enums.Theme theme,
es.uvigo.esei.dgss.teama.microstories.domain.enums.Genre genre,
es.uvigo.esei.dgss.teama.microstories.domain.enums.DateRange range)
Returns a list of stories that matched with the specified params.
|
List<es.uvigo.esei.dgss.teama.microstories.domain.entities.Story> |
findByThemeAndGenreAndDate(es.uvigo.esei.dgss.teama.microstories.domain.enums.Theme theme,
es.uvigo.esei.dgss.teama.microstories.domain.enums.Genre genre,
es.uvigo.esei.dgss.teama.microstories.domain.enums.DateRange range,
int page,
int limit)
Returns a list of stories that matched with the specified params.
|
List<es.uvigo.esei.dgss.teama.microstories.domain.entities.Story> |
findMostRead()
Return a list of stories most reader of each genre.
|
List<es.uvigo.esei.dgss.teama.microstories.domain.entities.Story> |
findRecent()
Returns the list of recent stories published.
|
@PermitAll @Produces(value="application/json") public List<es.uvigo.esei.dgss.teama.microstories.domain.entities.Story> findRecent()
@PermitAll @Produces(value="application/json") public Integer countByText(String text)
text - the string that we want to use to filter stories.@PermitAll @Produces(value="application/json") public List<es.uvigo.esei.dgss.teama.microstories.domain.entities.Story> findByText(String text, int page, int limit)
text - the string that we want to use to filter stories.page - the page number. If it is less than 0 it returns the first page.limit - the number of stories contained in a page. If it is less than 0 or greater than 100, it
returns at most 100 stories.@PermitAll @Produces(value="application/json") public List<es.uvigo.esei.dgss.teama.microstories.domain.entities.Story> findByText(String text)
text - the string that we want to use to filter stories.@PermitAll @Produces(value="application/json") public es.uvigo.esei.dgss.teama.microstories.domain.entities.Story findById(int id)
id.id - the id of a story.null if there is no
story with the specified id.IllegalArgumentException - if a story with the specified identifier do not exists.javax.ejb.EJBAccessException - if the story is not published.@PermitAll @Produces(value="application/json") public List<es.uvigo.esei.dgss.teama.microstories.domain.entities.Story> findByThemeAndGenreAndDate(es.uvigo.esei.dgss.teama.microstories.domain.enums.Theme theme, es.uvigo.esei.dgss.teama.microstories.domain.enums.Genre genre, es.uvigo.esei.dgss.teama.microstories.domain.enums.DateRange range, int page, int limit)
theme - the theme of the storygenre - the genre of storyrange - the date ranges to filterpage - the number o pagelimit - the stories in each page@PermitAll @Produces(value="application/json") public List<es.uvigo.esei.dgss.teama.microstories.domain.entities.Story> findByThemeAndGenreAndDate(es.uvigo.esei.dgss.teama.microstories.domain.enums.Theme theme, es.uvigo.esei.dgss.teama.microstories.domain.enums.Genre genre, es.uvigo.esei.dgss.teama.microstories.domain.enums.DateRange range)
theme - the theme of the storygenre - the genre of storyrange - the date ranges to filter@PermitAll @Produces(value="application/json") public List<es.uvigo.esei.dgss.teama.microstories.domain.entities.Story> findMostRead()
@PermitAll public void addReading(int storyId)
storyId - the id of the story readCopyright © 2018. All rights reserved.