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) |
| Modifier and Type | Method and Description |
|---|---|
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 |
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()
Get all news
|
News |
getNewsById(String id)
Get a news by id
|
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
|
void |
shareNews(SharedNews sharedNews,
List<org.exoplatform.social.core.space.model.Space> spaces)
Share a news to a list of spaces
|
void |
unpinNews(String newsId) |
News |
updateNews(News news)
Update a news
If the uploadId of the news is null, the illustration is not updated.
|
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)
public News createNews(News news) throws Exception
createNews in interface NewsServicenews - The news to createjavax.jcr.RepositoryExceptionExceptionpublic News getNewsById(String id) throws Exception
getNewsById in interface NewsServiceid - Id of the newsExceptionpublic List<News> getNews() throws Exception
getNews 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 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 NewsServiceCopyright © 2003–2019 eXo Platform SAS. All rights reserved.