Package org.exoplatform.news.service
Interface NewsService
-
- All Known Implementing Classes:
NewsServiceImpl
public interface NewsService
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidarchiveNews(String newsId, String currentUserName)Archive a newsbooleancanArchiveNews(org.exoplatform.services.security.Identity currentIdentity, String newsAuthor)booleancanCreateNews(org.exoplatform.social.core.space.model.Space space, org.exoplatform.services.security.Identity currentIdentity)booleancanScheduleNews(org.exoplatform.social.core.space.model.Space space, org.exoplatform.services.security.Identity currentIdentity)booleancanViewNews(News news, String authenticatedUser)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 newsList<News>getNews(NewsFilter filter, org.exoplatform.services.security.Identity currentIdentity)Get all newsNewsgetNewsByActivityId(String activityId, org.exoplatform.services.security.Identity currentIdentity)Retrives a news identified by originating Activity identifier or a shared activity identifierNewsgetNewsById(String newsId, boolean editMode)Retrives a news identified by its technical identifierNewsgetNewsById(String newsId, org.exoplatform.services.security.Identity currentIdentity, boolean editMode)Retrives a news identified by its technical identifierList<News>getNewsByTargetName(NewsFilter filter, String targetName, org.exoplatform.services.security.Identity currentIdentity)Get list of news by a given target nameintgetNewsCount(NewsFilter filter)voidmarkAsRead(News news, String userId)Increment the number of views for a newsNewspostNews(News news, String poster)Create 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 newsNewsscheduleNews(News news, org.exoplatform.services.security.Identity currentIdentity)List<NewsESSearchResult>search(org.exoplatform.social.core.identity.model.Identity currentIdentity, NewsFilter filter)Search news by termList<News>searchNews(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 into a dedicated spacevoidunarchiveNews(String newsId, String currentUserName)Unarchive a newsvoidunpublishNews(String newsId, String publisher)NewsunScheduleNews(News news, org.exoplatform.services.security.Identity currentIdentity)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.
-
-
-
Method Detail
-
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- Throws:
Exception- when error
-
postNews
News postNews(News news, String poster) 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:
news- The news to post- Throws:
Exception- when error
-
canCreateNews
boolean canCreateNews(org.exoplatform.social.core.space.model.Space space, org.exoplatform.services.security.Identity currentIdentity) throws Exception- Parameters:
space-currentIdentity-- Returns:
- Throws:
Exception
-
updateNews
News updateNews(News news, String updater, Boolean post, boolean publish) 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-- Returns:
- 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-- Throws:
Exception- when error
-
publishNews
void publishNews(News news, String publisher) throws Exception
Publish a news- Parameters:
news- to be publishedpublisher-- Throws:
Exception- when error
-
unpublishNews
void unpublishNews(String newsId, String publisher) throws Exception
- Parameters:
newsId-publisher-- Throws:
Exception
-
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, boolean editMode) throws Exception
Retrives a news identified by its technical identifier
-
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
int getNewsCount(NewsFilter filter) throws Exception
- Parameters:
filter-- Returns:
- Throws:
Exception
-
markAsRead
void markAsRead(News news, String userId) throws Exception
Increment the number of views for a news- Parameters:
userId- The current user idnews- The news to be updated- Throws:
Exception- when error
-
searchNews
List<News> searchNews(NewsFilter filter, String lang) throws Exception
Search news with the given text- Parameters:
filter- news filterlang- language- Throws:
Exception- when error
-
getNewsByActivityId
News getNewsByActivityId(String activityId, org.exoplatform.services.security.Identity currentIdentity) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException
Retrives a news 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
- Parameters:
news-- Returns:
- Throws:
Exception
-
unScheduleNews
News unScheduleNews(News news, org.exoplatform.services.security.Identity currentIdentity) throws Exception
- Parameters:
news-- Returns:
- Throws:
Exception
-
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)- Parameters:
space-currentIdentity-- Returns:
-
canViewNews
boolean canViewNews(News news, String authenticatedUser)
- Parameters:
news-Newsto checkauthenticatedUser- authenticated username- Returns:
- true if user has access to news, else false
-
shareNews
void shareNews(News news, org.exoplatform.social.core.space.model.Space space, org.exoplatform.social.core.identity.model.Identity userIdentity, String sharedActivityId) throws Exception
Shares a news into a dedicated space- Parameters:
news-Newsto sharespace-Spaceto share with, the newsuserIdentity-Identityof user making the modificationsharedActivityId- newly generated activity identifier- Throws:
IllegalAccessException- when user doesn't have access toNewsorg.exoplatform.commons.exception.ObjectNotFoundException- whenNewsis not foundException
-
archiveNews
void archiveNews(String newsId, String currentUserName) throws Exception
Archive a news- Parameters:
newsId- The id of the news to be archivedcurrentUserName-Identityof user archiving the news- Throws:
Exception- when error
-
unarchiveNews
void unarchiveNews(String newsId, String currentUserName) throws Exception
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)- Parameters:
currentIdentity-newsAuthor-- Returns:
-
-