@PermitAll public class StoryService extends Object
| Constructor and Description |
|---|
StoryService() |
| Modifier and Type | Method and Description |
|---|---|
Long |
countExploreStories(es.uvigo.esei.dgss.teamc.microstories.entities.Genre genre,
es.uvigo.esei.dgss.teamc.microstories.entities.Theme theme,
Date today,
DateRange dateRange)
Returns the number of stories matching given values for not
null
arguments. |
Long |
countExploreStories(es.uvigo.esei.dgss.teamc.microstories.entities.Genre genre,
es.uvigo.esei.dgss.teamc.microstories.entities.Theme theme,
DateRange dateRange)
Returns the number of stories matching given values for not
null
arguments. |
es.uvigo.esei.dgss.teamc.microstories.entities.Story |
create(es.uvigo.esei.dgss.teamc.microstories.entities.Story story)
Creates a new story written by current user.
|
List<es.uvigo.esei.dgss.teamc.microstories.entities.Story> |
exploreStories(es.uvigo.esei.dgss.teamc.microstories.entities.Genre genre,
es.uvigo.esei.dgss.teamc.microstories.entities.Theme theme,
Date today,
DateRange dateRange,
int pageSize,
int pageIndex)
Returns a list of stories matching given values for not
null
arguments. |
List<es.uvigo.esei.dgss.teamc.microstories.entities.Story> |
exploreStories(es.uvigo.esei.dgss.teamc.microstories.entities.Genre genre,
es.uvigo.esei.dgss.teamc.microstories.entities.Theme theme,
DateRange dateRange,
int pageSize,
int pageIndex)
Returns the number of stories matching given values for not
null
arguments. |
es.uvigo.esei.dgss.teamc.microstories.entities.Story |
get(Long id)
Returns the Story with the given id
|
Long |
getNumberStoriesByAuthor(String author)
Returns the number of stories created by an author
|
Long |
getNumberStoriesByText(String text)
Returns the number of stories matching the search text
|
List<es.uvigo.esei.dgss.teamc.microstories.entities.Story> |
getStoriesByAuthor(String author,
int noOfStories,
int pageIndex)
Returns the stories created by a given author order by date
|
List<es.uvigo.esei.dgss.teamc.microstories.entities.Story> |
getStoriesByText(String text,
int noOfStories,
int pageIndex)
Returns a list of stories filtered by a string
|
List<es.uvigo.esei.dgss.teamc.microstories.entities.Story> |
listHottest()
Returns last month's 2 most read stories of each genre sorted by number of views.
|
List<es.uvigo.esei.dgss.teamc.microstories.entities.Story> |
listHottest(Date today)
Returns last month's 2 most read stories of each genre sorted by number of views.
|
List<es.uvigo.esei.dgss.teamc.microstories.entities.Story> |
listRecent()
Returns the 6 most recent Stories
|
es.uvigo.esei.dgss.teamc.microstories.entities.Story |
update(es.uvigo.esei.dgss.teamc.microstories.entities.Story story)
Updates a story.
|
public List<es.uvigo.esei.dgss.teamc.microstories.entities.Story> listRecent()
public es.uvigo.esei.dgss.teamc.microstories.entities.Story get(Long id) throws IllegalArgumentException
id - the id of the Story to returnIllegalArgumentException - if given id is nullpublic List<es.uvigo.esei.dgss.teamc.microstories.entities.Story> getStoriesByText(String text, int noOfStories, int pageIndex) throws IllegalArgumentException
text - search string to filter the listnoOfStories - number of stories to be shown per pagepageIndex - index of page to be shownIllegalArgumentException - if given text is null or the page index is
negative or out of rangepublic Long getNumberStoriesByText(String text)
public List<es.uvigo.esei.dgss.teamc.microstories.entities.Story> exploreStories(es.uvigo.esei.dgss.teamc.microstories.entities.Genre genre, es.uvigo.esei.dgss.teamc.microstories.entities.Theme theme, Date today, DateRange dateRange, int pageSize, int pageIndex) throws IllegalArgumentException
null
arguments.genre - genre to filter the stories by. It's not taken into account
if it's nulltheme - theme to filter the stories by. It's not taken into account
if it0s nulltoday - date used as today's date in order to calculate the date
rangedateRange - range of date to filter the stories. Can't be nullpageSize - number of stories to show per page. Can't be equal to or
less than 0pageIndex - index of the page to be returned. Can't be less than 0null
argumentsIllegalArgumentException - if: - dateRange is null - pageSize is equal
to or less than 0 - pageIndex is less than 0
or it refers to a page that is out of rangepublic List<es.uvigo.esei.dgss.teamc.microstories.entities.Story> exploreStories(es.uvigo.esei.dgss.teamc.microstories.entities.Genre genre, es.uvigo.esei.dgss.teamc.microstories.entities.Theme theme, DateRange dateRange, int pageSize, int pageIndex) throws IllegalArgumentException
null
arguments.genre - genre to filter the stories by. It's not taken into account
if it's nulltheme - theme to filter the stories by. It's not taken into account
if it0s nulldateRange - range of date to filter the stories. Can't be nullpageSize - number of stories to show per page. Can't be equal to or
less than 0pageIndex - index of the page to be returned. Can't be less than 0null
argumentsIllegalArgumentException - if: - dateRange is null - pageSize is equal
to or less than 0 - pageIndex is less than 0
or it refers to a page that is out of rangepublic Long countExploreStories(es.uvigo.esei.dgss.teamc.microstories.entities.Genre genre, es.uvigo.esei.dgss.teamc.microstories.entities.Theme theme, Date today, DateRange dateRange) throws IllegalArgumentException
null
arguments.genre - genre to filter the stories by. It's not taken into account
if it's nulltheme - theme to filter the stories by. It's not taken into account
if it0s nulldateRange - range of date to filter the stories. Can't be nullnull
argumentsIllegalArgumentException - if dateRange is nullpublic Long countExploreStories(es.uvigo.esei.dgss.teamc.microstories.entities.Genre genre, es.uvigo.esei.dgss.teamc.microstories.entities.Theme theme, DateRange dateRange) throws IllegalArgumentException
null
arguments.genre - genre to filter the stories by. It's not taken into account
if it's nulltheme - theme to filter the stories by. It's not taken into account
if it0s nulldateRange - range of date to filter the stories. Can't be nullnull
argumentsIllegalArgumentException - if dateRange is nullpublic List<es.uvigo.esei.dgss.teamc.microstories.entities.Story> listHottest(Date today)
today - today's datepublic List<es.uvigo.esei.dgss.teamc.microstories.entities.Story> listHottest()
public es.uvigo.esei.dgss.teamc.microstories.entities.Story create(es.uvigo.esei.dgss.teamc.microstories.entities.Story story)
story - Story to be createdIllegalArgumentException - if a story with the same id already existsNullPointerException - if story is nulljavax.ejb.EJBAccessException - if current user is not the story's author or if current user is not logged inpublic es.uvigo.esei.dgss.teamc.microstories.entities.Story update(es.uvigo.esei.dgss.teamc.microstories.entities.Story story)
story - Story to be updatedNullPointerException - if story is nulljavax.ejb.EJBAccessException - if current user is not the story's author or if the current user not logged inpublic List<es.uvigo.esei.dgss.teamc.microstories.entities.Story> getStoriesByAuthor(String author, int noOfStories, int pageIndex) throws IllegalArgumentException
author - author to filter the listnoOfStories - number of stories to be shown per pagepageIndex - index of page to be shownIllegalArgumentException - if given author is null or the page index is
negative or out of rangejavax.ejb.EJBAccessException - if the current user not logged inCopyright © 2021. All rights reserved.