Class NewsServiceImpl
java.lang.Object
org.exoplatform.news.service.impl.NewsServiceImpl
- All Implemented Interfaces:
NewsService
Service managing News and storing them in ECMS
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionNewsServiceImpl(org.exoplatform.social.core.space.spi.SpaceService spaceService, org.exoplatform.social.core.manager.ActivityManager activityManager, org.exoplatform.social.core.manager.IdentityManager identityManager, org.exoplatform.upload.UploadService uploadService, NewsESSearchConnector newsESSearchConnector, org.exoplatform.commons.search.index.IndexingService indexingService, NewsStorage newsStorage, org.exoplatform.portal.config.UserACL userACL, NewsTargetingService newsTargetingService, org.exoplatform.social.metadata.MetadataService metadataService) -
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 username) 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 newsId, org.exoplatform.services.security.Identity currentIdentity, boolean isDraft) Delete newsgetNews(NewsFilter newsFilter, 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 newsType) Retrieves a news identified by its technical identifiergetNewsByTargetName(NewsFilter newsFilter, String targetName, org.exoplatform.services.security.Identity currentIdentity) Get list of news by a given target nameintgetNewsCount(NewsFilter newsFilter) 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 publishedNews, 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 newsType) Update a news If the uploadId of the news is null, the illustration is not updated.
-
Field Details
-
spaceService
public org.exoplatform.social.core.space.spi.SpaceService spaceService
-
-
Constructor Details
-
NewsServiceImpl
public NewsServiceImpl(org.exoplatform.social.core.space.spi.SpaceService spaceService, org.exoplatform.social.core.manager.ActivityManager activityManager, org.exoplatform.social.core.manager.IdentityManager identityManager, org.exoplatform.upload.UploadService uploadService, NewsESSearchConnector newsESSearchConnector, org.exoplatform.commons.search.index.IndexingService indexingService, NewsStorage newsStorage, org.exoplatform.portal.config.UserACL userACL, NewsTargetingService newsTargetingService, org.exoplatform.social.metadata.MetadataService metadataService)
-
-
Method Details
-
createNews
public 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.- Specified by:
createNewsin interfaceNewsService- Parameters:
news- The news to create- Returns:
- created News object
- Throws:
Exception- when error
-
canCreateNews
public 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- Specified by:
canCreateNewsin interfaceNewsService- 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).- Specified by:
updateNewsin interfaceNewsServiceupdater- user attempting to update news- Returns:
- updated News
- Throws:
Exception
-
updateNews
public News updateNews(News news, String updater, Boolean post, boolean publish, String newsType) 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).- Specified by:
updateNewsin interfaceNewsServiceupdater- user attempting to update news- Returns:
- updated News
- Throws:
Exception
-
deleteNews
public void deleteNews(String newsId, org.exoplatform.services.security.Identity currentIdentity, boolean isDraft) throws Exception Delete news- Specified by:
deleteNewsin interfaceNewsService- Parameters:
newsId- the news id to deletecurrentIdentity- user attempting to delete newsisDraft- if the News is still draft- Throws:
Exception- when error
-
getNewsById
Retrives a news identified by its technical identifier- Specified by:
getNewsByIdin interfaceNewsService- Parameters:
newsId-NewsidentifiereditMode- access mode to news: whether to edit news to to view it.- Returns:
Newsif found else null- Throws:
Exception- when user doesn't have access toNews
-
getNewsById
public News getNewsById(String newsId, org.exoplatform.services.security.Identity currentIdentity, boolean editMode) throws IllegalAccessException Retrives a news identified by its technical identifier- Specified by:
getNewsByIdin interfaceNewsService- 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
public News getNewsById(String newsId, org.exoplatform.services.security.Identity currentIdentity, boolean editMode, String newsType) throws IllegalAccessException Retrieves a news identified by its technical identifier- Specified by:
getNewsByIdin interfaceNewsService- Parameters:
newsId-NewsidentifiercurrentIdentity- user attempting to access newseditMode- access mode to news: whether to edit news to to view it.newsType- news object type to be retrieved.- Returns:
Newsif found else null- Throws:
IllegalAccessException- when user doesn't have access toNews
-
getNews
public List<News> getNews(NewsFilter newsFilter, org.exoplatform.services.security.Identity currentIdentity) throws Exception Get all news- Specified by:
getNewsin interfaceNewsService- Returns:
- all news
- Throws:
Exception- when error
-
getNewsByTargetName
public List<News> getNewsByTargetName(NewsFilter newsFilter, String targetName, org.exoplatform.services.security.Identity currentIdentity) throws Exception Get list of news by a given target name- Specified by:
getNewsByTargetNamein interfaceNewsServicecurrentIdentity- user attempting to access news- Returns:
Newslist by target name.- Throws:
Exception- when error
-
getNewsCount
get the count of News after applying a filter- Specified by:
getNewsCountin interfaceNewsService- Returns:
- int the number of News
- Throws:
Exception
-
searchNews
Search news with the given text- Specified by:
searchNewsin interfaceNewsService- Parameters:
filter- news filterlang- language- Returns:
- List of News returned by the search
- Throws:
Exception- when error
-
getNewsByActivityId
public 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- Specified by:
getNewsByActivityIdin interfaceNewsService- 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
public News scheduleNews(News news, org.exoplatform.services.security.Identity currentIdentity) throws Exception Schedule publishing a News- Specified by:
scheduleNewsin interfaceNewsService- Returns:
- the published news
- Throws:
Exception- when error occurs
-
unScheduleNews
public News unScheduleNews(News news, org.exoplatform.services.security.Identity currentIdentity) throws Exception Un-schedule publishing a News- Specified by:
unScheduleNewsin interfaceNewsService- Returns:
- unscheduled News
- Throws:
Exception- when error occurs
-
search
public List<NewsESSearchResult> search(org.exoplatform.social.core.identity.model.Identity currentIdentity, NewsFilter filter) Search news by term- Specified by:
searchin interfaceNewsService- Returns:
- News Search Result
-
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.- Specified by:
postNewsin interfaceNewsService- Parameters:
news- The news to postposter- the Poster of the News- Returns:
- The posted News
- Throws:
Exception- when error
-
markAsRead
Increment the number of views for a news- Specified by:
markAsReadin interfaceNewsService- Parameters:
news- The news to be updateduserId- The current user id- Throws:
Exception- when error
-
publishNews
Publish a news- Specified by:
publishNewsin interfaceNewsService- Parameters:
publishedNews- to be publishedpublisher- of the News- Throws:
Exception- when error
-
unpublishNews
Unpublish a News- Specified by:
unpublishNewsin interfaceNewsService- Parameters:
newsId- the ID of the Newspublisher- the publisher of the News- Throws:
Exception- when an error occurs
-
archiveNews
Archive a news- Specified by:
archiveNewsin interfaceNewsService- Parameters:
newsId- The id of the news to be archivedcurrentUserName-Identityof user archiving the news- Throws:
Exception- when error
-
canViewNews
Checks if the user can view the News- Specified by:
canViewNewsin interfaceNewsService- Parameters:
news-Newsto checkusername- authenticated username- Returns:
- true if user has access to news, else false
-
unarchiveNews
Unarchive a news- Specified by:
unarchiveNewsin interfaceNewsService- Parameters:
newsId- The id of the news to be unarchivedcurrentUserName-Identityof user unarchiving the news- Throws:
Exception- when error
-
canScheduleNews
public boolean canScheduleNews(org.exoplatform.social.core.space.model.Space space, org.exoplatform.services.security.Identity currentIdentity) Checks if the user can schedule publishinga News- Specified by:
canScheduleNewsin interfaceNewsService- Returns:
- boolean : true if the user can schedule publishing a News
-
canArchiveNews
public boolean canArchiveNews(org.exoplatform.services.security.Identity currentIdentity, String newsAuthor) checks if the user can archive the news- Specified by:
canArchiveNewsin interfaceNewsService- Returns:
- boolean : true if user can archive the news
-