public class NewsServiceImpl extends Object implements NewsService
| Modifier and Type | Field and Description |
|---|---|
static String |
APPLICATION_DATA_PATH |
static String |
NEWS_NODES_FOLDER |
static String |
PINNED_NEWS_NODES_FOLDER |
| Constructor and Description |
|---|
NewsServiceImpl(org.exoplatform.services.jcr.RepositoryService repositoryService,
org.exoplatform.services.jcr.ext.app.SessionProviderService sessionProviderService,
org.exoplatform.services.jcr.ext.hierarchy.NodeHierarchyCreator nodeHierarchyCreator,
org.exoplatform.services.jcr.ext.distribution.DataDistributionManager dataDistributionManager,
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,
org.exoplatform.social.ckeditor.HTMLUploadImageProcessor imageProcessor,
org.exoplatform.services.cms.link.LinkManager linkManager,
org.exoplatform.services.ecm.publication.PublicationService publicationService,
org.exoplatform.services.wcm.extensions.publication.PublicationManager publicationManager,
org.exoplatform.services.wcm.publication.WCMPublicationService wCMPublicationService,
NewsSearchConnector newsSearchConnector,
NewsAttachmentsService newsAttachmentsService) |
| Modifier and Type | Method and Description |
|---|---|
void |
archiveNews(String newsId)
Archive a news
|
boolean |
canArchiveNews(String newsAuthor) |
boolean |
canEditNews(String posterId,
String spaceId)
Return a boolean that indicates if the current user can edit the news or
not
|
boolean |
canPinNews()
Return a boolean that indicates if the current user can pin the news or not
|
News |
convertNodeToNews(javax.jcr.Node node) |
News |
createNews(News news)
Create and publish a News A news is composed of an activity and a CMS node
containing the data.
|
News |
createNewsDraft(News news)
Create the exo:news draft node in CMS
|
void |
deleteNews(String newsId)
Delete news
|
List<News> |
getNews(NewsFilter filter)
Get all news
|
News |
getNewsById(String id)
Get a news by id
|
int |
getNewsCount(NewsFilter filter) |
List<News> |
getNewsDrafts(String spaceId,
String author)
Get news drafts
|
void |
markAsRead(News news,
String userId)
Increment the number of views for a news
|
void |
pinNews(String newsId)
Pin a news
|
List<News> |
searchNews(NewsFilter filter,
String lang)
Search news with the given text
|
protected void |
sendNotification(News news,
NotificationConstants.NOTIFICATION_CONTEXT context) |
void |
shareNews(SharedNews sharedNews,
List<org.exoplatform.social.core.space.model.Space> spaces)
Share a news to a list of spaces
|
void |
unarchiveNews(String newsId)
Unarchive a news
|
void |
unpinNews(String newsId) |
News |
updateNews(News news)
Update a news If the uploadId of the news is null, the illustration is not
updated.
|
protected void |
updateNewsActivities(org.exoplatform.social.core.activity.model.ExoSocialActivity activity,
News news) |
public static final String NEWS_NODES_FOLDER
public static final String PINNED_NEWS_NODES_FOLDER
public static final String APPLICATION_DATA_PATH
public NewsServiceImpl(org.exoplatform.services.jcr.RepositoryService repositoryService,
org.exoplatform.services.jcr.ext.app.SessionProviderService sessionProviderService,
org.exoplatform.services.jcr.ext.hierarchy.NodeHierarchyCreator nodeHierarchyCreator,
org.exoplatform.services.jcr.ext.distribution.DataDistributionManager dataDistributionManager,
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,
org.exoplatform.social.ckeditor.HTMLUploadImageProcessor imageProcessor,
org.exoplatform.services.cms.link.LinkManager linkManager,
org.exoplatform.services.ecm.publication.PublicationService publicationService,
org.exoplatform.services.wcm.extensions.publication.PublicationManager publicationManager,
org.exoplatform.services.wcm.publication.WCMPublicationService wCMPublicationService,
NewsSearchConnector newsSearchConnector,
NewsAttachmentsService newsAttachmentsService)
public News createNews(News news) throws Exception
createNews in interface NewsServicenews - The news to createExceptionpublic News getNewsById(String id) throws Exception
getNewsById in interface NewsServiceid - Id of the newsExceptionpublic List<News> getNews(NewsFilter filter) throws Exception
getNews in interface NewsServiceExceptionpublic boolean canArchiveNews(String newsAuthor)
canArchiveNews in interface NewsServicepublic int getNewsCount(NewsFilter filter) throws Exception
getNewsCount in interface NewsServiceExceptionpublic News updateNews(News news) throws Exception
updateNews in interface NewsServicenews - The new newsExceptionpublic void markAsRead(News news, String userId) throws Exception
markAsRead in interface NewsServiceuserId - The current user idnews - The news to be updatedExceptionpublic void pinNews(String newsId) throws Exception
pinNews in interface NewsServicenewsId - The id of the news to be pinnedExceptionpublic void unpinNews(String newsId) throws Exception
unpinNews in interface NewsServiceExceptionpublic void shareNews(SharedNews sharedNews, List<org.exoplatform.social.core.space.model.Space> spaces) throws Exception
shareNews in interface NewsServicesharedNews - Data of the shared newsspaces - List of spaces to share the news withExceptionpublic List<News> getNewsDrafts(String spaceId, String author) throws Exception
getNewsDrafts in interface NewsServicespaceId - News spaceauthor - News drafts authorExceptionpublic void deleteNews(String newsId) throws Exception
deleteNews in interface NewsServicenewsId - the news id to deleteExceptionpublic News convertNodeToNews(javax.jcr.Node node) throws Exception
convertNodeToNews in interface NewsServiceExceptionpublic News createNewsDraft(News news) throws Exception
createNewsDraft in interface NewsServicenews - Exceptionpublic boolean canEditNews(String posterId, String spaceId)
canEditNews in interface NewsServiceposterId - the poster id of the newsspaceId - the space id of the newspublic boolean canPinNews()
canPinNews in interface NewsServiceprotected void updateNewsActivities(org.exoplatform.social.core.activity.model.ExoSocialActivity activity,
News news)
throws Exception
Exceptionprotected void sendNotification(News news, NotificationConstants.NOTIFICATION_CONTEXT context) throws Exception
Exceptionpublic List<News> searchNews(NewsFilter filter, String lang) throws Exception
searchNews in interface NewsServicefilter - news filterlang - languageExceptionpublic void archiveNews(String newsId) throws Exception
archiveNews in interface NewsServicenewsId - The id of the news to be archivedExceptionpublic void unarchiveNews(String newsId) throws Exception
unarchiveNews in interface NewsServicenewsId - The id of the news to be unarchivedExceptionCopyright © 2003–2020 eXo Platform SAS. All rights reserved.