Package org.exoplatform.news.service
Interface NewsService
- All Known Implementing Classes:
NewsServiceImpl,NewsServiceImplV2
public interface NewsService
-
Method Summary
Modifier and TypeMethodDescriptionvoidarchiveNews(String newsId, String currentUserName) Archive a newsbooleancanArchiveNews(org.exoplatform.services.security.Identity currentIdentity, String newsAuthor) checks if the user can archive the newsbooleancanCreateNews(org.exoplatform.social.core.space.model.Space space, org.exoplatform.services.security.Identity currentIdentity) Checks if the user can create a NewsbooleancanScheduleNews(org.exoplatform.social.core.space.model.Space space, org.exoplatform.services.security.Identity currentIdentity) Checks if the user can schedule publishinga NewsbooleancanViewNews(News news, String authenticatedUser) Checks if the user can view the NewscreateNews(News news, org.exoplatform.services.security.Identity currentIdentity) Create and publish a News A news is composed of an activity and a CMS node containing the data.voiddeleteNews(String id, org.exoplatform.services.security.Identity currentIdentity, boolean isDraft) Delete newsgetNews(NewsFilter filter, org.exoplatform.services.security.Identity currentIdentity) Get all newsgetNewsByActivityId(String activityId, org.exoplatform.services.security.Identity currentIdentity) Retrieves a news item identified by originating Activity identifier or a shared activity identifiergetNewsById(String newsId, boolean editMode) Retrives a news identified by its technical identifiergetNewsById(String newsId, org.exoplatform.services.security.Identity currentIdentity, boolean editMode) Retrives a news identified by its technical identifiergetNewsById(String newsId, org.exoplatform.services.security.Identity currentIdentity, boolean editMode, String newsObjectType) Retrieves a news identified by its technical identifiergetNewsByTargetName(NewsFilter filter, String targetName, org.exoplatform.services.security.Identity currentIdentity) Get list of news by a given target nameintgetNewsCount(NewsFilter filter) get the count of News after applying a filtervoidmarkAsRead(News news, String userId) Increment the number of views for a newsCreate and publish a News A news is composed of an activity and a CMS node containing the data.voidpublishNews(News news, String publisher) Publish a newsscheduleNews(News news, org.exoplatform.services.security.Identity currentIdentity) Schedule publishing a Newssearch(org.exoplatform.social.core.identity.model.Identity currentIdentity, NewsFilter filter) Search news by termsearchNews(NewsFilter filter, String lang) Search news with the given textvoidshareNews(News news, org.exoplatform.social.core.space.model.Space space, org.exoplatform.social.core.identity.model.Identity userIdentity, String sharedActivityId) Shares a news item into a dedicated spacevoidunarchiveNews(String newsId, String currentUserName) Unarchive a newsvoidunpublishNews(String newsId, String publisher) Unpublish a NewsunScheduleNews(News news, org.exoplatform.services.security.Identity currentIdentity) Un-schedule publishing a NewsupdateNews(News news, String updater, Boolean post, boolean publish) Update a news If the uploadId of the news is null, the illustration is not updated.updateNews(News news, String updater, Boolean post, boolean publish, String newsObjectType) Update a news If the uploadId of the news is null, the illustration is not updated.
-
Method Details
-
createNews
News createNews(News news, org.exoplatform.services.security.Identity currentIdentity) throws Exception Create and publish a News A news is composed of an activity and a CMS node containing the data. If the given News has an id and that a draft already exists with this id, the draft is updated and published.- Parameters:
currentIdentity-news- The news to create- Returns:
- created News object
- Throws:
Exception- when error
-
postNews
Create and publish a News A news is composed of an activity and a CMS node containing the data. If the given News has an id and that a draft already exists with this id, the draft is updated and published.- Parameters:
news- The news to postposter- the Poster of the News- Returns:
- The posted News
- Throws:
Exception- when error
-
canCreateNews
boolean canCreateNews(org.exoplatform.social.core.space.model.Space space, org.exoplatform.services.security.Identity currentIdentity) throws Exception Checks if the user can create a News- Parameters:
space-currentIdentity-- Returns:
- boolean true if the user can create the news
- Throws:
Exception- if an error occurred
-
updateNews
Update a news If the uploadId of the news is null, the illustration is not updated. If the uploadId of the news is empty, the illustration is removed (if any).- Parameters:
news-updater- user attempting to update newspost-publish-- Returns:
- updated News
- Throws:
Exception
-
updateNews
News updateNews(News news, String updater, Boolean post, boolean publish, String newsObjectType) throws Exception Update a news If the uploadId of the news is null, the illustration is not updated. If the uploadId of the news is empty, the illustration is removed (if any).- Parameters:
news-updater- user attempting to update newspost-publish-newsObjectType-- Returns:
- updated News
- Throws:
Exception
-
deleteNews
void deleteNews(String id, org.exoplatform.services.security.Identity currentIdentity, boolean isDraft) throws Exception Delete news- Parameters:
id- the news id to deletecurrentIdentity- user attempting to delete newsisDraft- if the News is still draft- Throws:
Exception- when error
-
publishNews
Publish a news- Parameters:
news- to be publishedpublisher- of the News- Throws:
Exception- when error
-
unpublishNews
Unpublish a News- Parameters:
newsId- the ID of the Newspublisher- the publisher of the News- Throws:
Exception- when an error occurs
-
getNewsById
Retrives a news identified by its technical identifier -
getNewsById
News getNewsById(String newsId, org.exoplatform.services.security.Identity currentIdentity, boolean editMode) throws IllegalAccessException Retrives a news identified by its technical identifier- Parameters:
newsId-NewsidentifiercurrentIdentity- user attempting to access newseditMode- access mode to news: whether to edit news to to view it.- Returns:
Newsif found else null- Throws:
IllegalAccessException- when user doesn't have access toNews
-
getNewsById
News getNewsById(String newsId, org.exoplatform.services.security.Identity currentIdentity, boolean editMode, String newsObjectType) throws IllegalAccessException Retrieves a news identified by its technical identifier- Parameters:
newsId-NewsidentifiercurrentIdentity- user attempting to access newseditMode- access mode to news: whether to edit news to to view it.newsObjectType- news object type to be retrieved.- Returns:
Newsif found else null- Throws:
IllegalAccessException- when user doesn't have access toNews
-
getNews
List<News> getNews(NewsFilter filter, org.exoplatform.services.security.Identity currentIdentity) throws Exception Get all news- Parameters:
filter-currentIdentity-- Returns:
- all news
- Throws:
Exception- when error
-
getNewsByTargetName
List<News> getNewsByTargetName(NewsFilter filter, String targetName, org.exoplatform.services.security.Identity currentIdentity) throws Exception Get list of news by a given target name -
getNewsCount
get the count of News after applying a filter- Parameters:
filter-- Returns:
- int the number of News
- Throws:
Exception
-
markAsRead
Increment the number of views for a news- Parameters:
userId- The current user idnews- The news to be updated- Throws:
Exception- when error
-
searchNews
Search news with the given text- Parameters:
filter- news filterlang- language- Returns:
- List of News returned by the search
- Throws:
Exception- when error
-
getNewsByActivityId
News getNewsByActivityId(String activityId, org.exoplatform.services.security.Identity currentIdentity) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException Retrieves a news item identified by originating Activity identifier or a shared activity identifier- Parameters:
activityId-ExoSocialActivityidentifiercurrentIdentity- user attempting to access news- Returns:
Newsif found else null- Throws:
IllegalAccessException- when user doesn't have access toNewsorExoSocialActivityorg.exoplatform.commons.exception.ObjectNotFoundException- when aNewswasn't found for this activity identifier
-
scheduleNews
News scheduleNews(News news, org.exoplatform.services.security.Identity currentIdentity) throws Exception Schedule publishing a News- Parameters:
news-currentIdentity-- Returns:
- the published news
- Throws:
Exception- when error occurs
-
unScheduleNews
News unScheduleNews(News news, org.exoplatform.services.security.Identity currentIdentity) throws Exception Un-schedule publishing a News- Parameters:
news-currentIdentity-- Returns:
- unscheduled News
- Throws:
Exception- when error occurs
-
search
List<NewsESSearchResult> search(org.exoplatform.social.core.identity.model.Identity currentIdentity, NewsFilter filter) Search news by term- Parameters:
currentIdentity-filter-- Returns:
- News Search Result
-
canScheduleNews
boolean canScheduleNews(org.exoplatform.social.core.space.model.Space space, org.exoplatform.services.security.Identity currentIdentity) Checks if the user can schedule publishinga News- Parameters:
space-currentIdentity-- Returns:
- boolean : true if the user can schedule publishing a News
-
canViewNews
Checks if the user can view the News- Parameters:
news-Newsto checkauthenticatedUser- authenticated username- Returns:
- true if user has access to news, else false
-
archiveNews
Archive a news- Parameters:
newsId- The id of the news to be archivedcurrentUserName-Identityof user archiving the news- Throws:
Exception- when error
-
unarchiveNews
Unarchive a news- Parameters:
newsId- The id of the news to be unarchivedcurrentUserName-Identityof user unarchiving the news- Throws:
Exception- when error
-
canArchiveNews
boolean canArchiveNews(org.exoplatform.services.security.Identity currentIdentity, String newsAuthor) checks if the user can archive the news- Parameters:
currentIdentity-newsAuthor-- Returns:
- boolean : true if user can archive the news
-