Interface NewsService

  • All Known Implementing Classes:
    NewsServiceImpl

    public interface NewsService
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void archiveNews​(String newsId, String currentUserName)
      Archive a news
      boolean canArchiveNews​(org.exoplatform.services.security.Identity currentIdentity, String newsAuthor)  
      boolean canCreateNews​(org.exoplatform.social.core.space.model.Space space, org.exoplatform.services.security.Identity currentIdentity)  
      boolean canScheduleNews​(org.exoplatform.social.core.space.model.Space space, org.exoplatform.services.security.Identity currentIdentity)  
      boolean canViewNews​(News news, String authenticatedUser)  
      News createNews​(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.
      void deleteNews​(String id, org.exoplatform.services.security.Identity currentIdentity, boolean isDraft)
      Delete news
      List<News> getNews​(NewsFilter filter, org.exoplatform.services.security.Identity currentIdentity)
      Get all news
      News getNewsByActivityId​(String activityId, org.exoplatform.services.security.Identity currentIdentity)
      Retrives a news identified by originating Activity identifier or a shared activity identifier
      News getNewsById​(String newsId, boolean editMode)
      Retrives a news identified by its technical identifier
      News getNewsById​(String newsId, org.exoplatform.services.security.Identity currentIdentity, boolean editMode)
      Retrives a news identified by its technical identifier
      List<News> getNewsByTargetName​(NewsFilter filter, String targetName, org.exoplatform.services.security.Identity currentIdentity)
      Get list of news by a given target name
      int getNewsCount​(NewsFilter filter)  
      void markAsRead​(News news, String userId)
      Increment the number of views for a news
      News postNews​(News news, String poster)
      Create and publish a News A news is composed of an activity and a CMS node containing the data.
      void publishNews​(News news, String publisher)
      Publish a news
      News scheduleNews​(News news, org.exoplatform.services.security.Identity currentIdentity)  
      List<NewsESSearchResult> search​(org.exoplatform.social.core.identity.model.Identity currentIdentity, NewsFilter filter)
      Search news by term
      List<News> searchNews​(NewsFilter filter, String lang)
      Search news with the given text
      void shareNews​(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 space
      void unarchiveNews​(String newsId, String currentUserName)
      Unarchive a news
      void unpublishNews​(String newsId, String publisher)  
      News unScheduleNews​(News news, org.exoplatform.services.security.Identity currentIdentity)  
      News updateNews​(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 news
        post -
        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 delete
        currentIdentity - user attempting to delete news
        isDraft -
        Throws:
        Exception - when error
      • publishNews

        void publishNews​(News news,
                         String publisher)
                  throws Exception
        Publish a news
        Parameters:
        news - to be published
        publisher -
        Throws:
        Exception - when error
      • 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 - News identifier
        currentIdentity - user attempting to access news
        editMode - access mode to news: whether to edit news to to view it.
        Returns:
        News if found else null
        Throws:
        IllegalAccessException - when user doesn't have access to News
      • getNewsById

        News getNewsById​(String newsId,
                         boolean editMode)
                  throws Exception
        Retrives a news identified by its technical identifier
        Parameters:
        newsId - News identifier
        editMode - access mode to news: whether to edit news to to view it.
        Returns:
        News if found else null
        Throws:
        Exception - when user doesn't have access to News
      • 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
        Parameters:
        filter -
        targetName -
        currentIdentity - user attempting to access news
        Returns:
        News list by target name. throws Exception when error
        Throws:
        Exception
      • markAsRead

        void markAsRead​(News news,
                        String userId)
                 throws Exception
        Increment the number of views for a news
        Parameters:
        userId - The current user id
        news - The news to be updated
        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 - ExoSocialActivity identifier
        currentIdentity - user attempting to access news
        Returns:
        News if found else null
        Throws:
        IllegalAccessException - when user doesn't have access to News or ExoSocialActivity
        org.exoplatform.commons.exception.ObjectNotFoundException - when a News wasn'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 - News to check
        authenticatedUser - 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 - News to share
        space - Space to share with, the news
        userIdentity - Identity of user making the modification
        sharedActivityId - newly generated activity identifier
        Throws:
        IllegalAccessException - when user doesn't have access to News
        org.exoplatform.commons.exception.ObjectNotFoundException - when News is not found
        Exception
      • archiveNews

        void archiveNews​(String newsId,
                         String currentUserName)
                  throws Exception
        Archive a news
        Parameters:
        newsId - The id of the news to be archived
        currentUserName - Identity of 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 unarchived
        currentUserName - Identity of user unarchiving the news
        Throws:
        Exception - when error
      • canArchiveNews

        boolean canArchiveNews​(org.exoplatform.services.security.Identity currentIdentity,
                               String newsAuthor)
        Parameters:
        currentIdentity -
        newsAuthor -
        Returns: