Package org.xwiki.whatsnew
Interface NewsSource
-
@Unstable public interface NewsSourceQuery the news items for a given source of news (e.g. news located in a xwiki.org blog, news located in a Discourse category, etc).- Since:
- 15.1RC1
- Version:
- $Id: a04fbaf96d18dae138a67c4093fb526173c5eb46 $
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description List<NewsSourceItem>build()NewsSourceforCategories(Set<NewsCategory> wantedCategories)Filter the news so that only items matching the passed categories are returned.NewsSourceforExtraParameters(Map<String,Object> extraParameters)Filter the news in a way that's source-dependent.NewsSourceforUser(UserReference userReference)Filter the news for a given user (if the source supports that).NewsSourceforXWikiVersion(org.xwiki.extension.version.Version targetXWikiVersion)Filter the news for a given XWiki version (if the source supports it).NewsSourcewithCount(int count)Filter the news to only return a certain number of news items.
-
-
-
Method Detail
-
forUser
NewsSource forUser(UserReference userReference)
Filter the news for a given user (if the source supports that).- Parameters:
userReference- the reference to the user for which to return news for- Returns:
- the news source itself to allow for a fluent API
-
forCategories
NewsSource forCategories(Set<NewsCategory> wantedCategories)
Filter the news so that only items matching the passed categories are returned.- Parameters:
wantedCategories- the set of categories to filter for- Returns:
- the news source itself to allow for a fluent API
-
forXWikiVersion
NewsSource forXWikiVersion(org.xwiki.extension.version.Version targetXWikiVersion)
Filter the news for a given XWiki version (if the source supports it).- Parameters:
targetXWikiVersion- the XWiki version to return news for- Returns:
- the news source itself to allow for a fluent API
-
forExtraParameters
NewsSource forExtraParameters(Map<String,Object> extraParameters)
Filter the news in a way that's source-dependent. This is for future extensibility to allow some source implementations to filter on additional constraints without having to change the news source API.- Parameters:
extraParameters- the map of extra parameters to filter against- Returns:
- the news source itself to allow for a fluent API
-
withCount
NewsSource withCount(int count)
Filter the news to only return a certain number of news items.- Parameters:
count- the max number of new items to return- Returns:
- the news source itself to allow for a fluent API
-
build
List<NewsSourceItem> build() throws NewsException
- Returns:
- the list of news items, filtered with the passed constraints
- Throws:
NewsException- if there's an error while fetching the news
-
-