Interface NewsService

All Known Implementing Classes:
NewsServiceImpl, NewsServiceImplV2

public interface NewsService
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    archiveNews(String newsId, String currentUserName)
    Archive a news
    boolean
    canArchiveNews(org.exoplatform.services.security.Identity currentIdentity, String newsAuthor)
    checks if the user can archive the news
    boolean
    canCreateNews(org.exoplatform.social.core.space.model.Space space, org.exoplatform.services.security.Identity currentIdentity)
    Checks if the user can create a News
    boolean
    canScheduleNews(org.exoplatform.social.core.space.model.Space space, org.exoplatform.services.security.Identity currentIdentity)
    Checks if the user can schedule publishinga News
    boolean
    canViewNews(News news, String authenticatedUser)
    Checks if the user can view the 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
    getNews(NewsFilter filter, org.exoplatform.services.security.Identity currentIdentity)
    Get all news
    getNewsByActivityId(String activityId, org.exoplatform.services.security.Identity currentIdentity)
    Retrieves a news item identified by originating Activity identifier or a shared activity identifier
    getNewsById(String newsId, boolean editMode)
    Retrives a news identified by its technical identifier
    getNewsById(String newsId, org.exoplatform.services.security.Identity currentIdentity, boolean editMode)
    Retrives a news identified by its technical identifier
    getNewsById(String newsId, org.exoplatform.services.security.Identity currentIdentity, boolean editMode, String newsObjectType)
    Retrieves a news identified by its technical identifier
    getNewsByTargetName(NewsFilter filter, String targetName, org.exoplatform.services.security.Identity currentIdentity)
    Get list of news by a given target name
    int
    get the count of News after applying a filter
    void
    markAsRead(News news, String userId)
    Increment the number of views for a 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
    scheduleNews(News news, org.exoplatform.services.security.Identity currentIdentity)
    Schedule publishing a News
    search(org.exoplatform.social.core.identity.model.Identity currentIdentity, NewsFilter filter)
    Search news by term
    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 item into a dedicated space
    void
    unarchiveNews(String newsId, String currentUserName)
    Unarchive a news
    void
    unpublishNews(String newsId, String publisher)
    Unpublish a News
    unScheduleNews(News news, org.exoplatform.services.security.Identity currentIdentity)
    Un-schedule publishing a 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.
    updateNews(News news, String updater, Boolean post, boolean publish, String newsObjectType)
    Update a news If the uploadId of the news is null, the illustration is not updated.
  • Method Details

    • 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
      Returns:
      created News object
      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
      poster - the Poster of the News
      Returns:
      The posted News
      Throws:
      Exception - when error
    • canCreateNews

      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
      Parameters:
      space -
      currentIdentity -
      Returns:
      boolean true if the user can create the news
      Throws:
      Exception - if an error occurred
    • 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:
      updated News
      Throws:
      Exception
    • updateNews

      News updateNews(News news, String updater, Boolean post, boolean publish, String newsObjectType) 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 -
      newsObjectType -
      Returns:
      updated News
      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 - if the News is still draft
      Throws:
      Exception - when error
    • publishNews

      void publishNews(News news, String publisher) throws Exception
      Publish a news
      Parameters:
      news - to be published
      publisher - of the News
      Throws:
      Exception - when error
    • unpublishNews

      void unpublishNews(String newsId, String publisher) throws Exception
      Unpublish a News
      Parameters:
      newsId - the ID of the News
      publisher - the publisher of the News
      Throws:
      Exception - when an error occurs
    • 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
    • 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, org.exoplatform.services.security.Identity currentIdentity, boolean editMode, String newsObjectType) throws IllegalAccessException
      Retrieves 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.
      newsObjectType - news object type to be retrieved.
      Returns:
      News if found else null
      Throws:
      IllegalAccessException - 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
    • getNewsCount

      int getNewsCount(NewsFilter filter) throws Exception
      get the count of News after applying a filter
      Parameters:
      filter -
      Returns:
      int the number of News
      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
    • searchNews

      List<News> searchNews(NewsFilter filter, String lang) throws Exception
      Search news with the given text
      Parameters:
      filter - news filter
      lang - language
      Returns:
      List of News returned by the search
      Throws:
      Exception - when error
    • getNewsByActivityId

      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
      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
      Schedule publishing a News
      Parameters:
      news -
      currentIdentity -
      Returns:
      the published news
      Throws:
      Exception - when error occurs
    • unScheduleNews

      News unScheduleNews(News news, org.exoplatform.services.security.Identity currentIdentity) throws Exception
      Un-schedule publishing a News
      Parameters:
      news -
      currentIdentity -
      Returns:
      unscheduled News
      Throws:
      Exception - when error occurs
    • 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)
      Checks if the user can schedule publishinga News
      Parameters:
      space -
      currentIdentity -
      Returns:
      boolean : true if the user can schedule publishing a News
    • canViewNews

      boolean canViewNews(News news, String authenticatedUser)
      Checks if the user can view the News
      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 item 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:
      Exception - when user doesn't have access to News
    • 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)
      checks if the user can archive the news
      Parameters:
      currentIdentity -
      newsAuthor -
      Returns:
      boolean : true if user can archive the news