Class DefaultForumService

java.lang.Object
org.silverpeas.components.forums.service.DefaultForumService
All Implemented Interfaces:
ForumService

@Service public class DefaultForumService extends Object implements ForumService
Forums service layer which manage forums application
  • Constructor Details

    • DefaultForumService

      public DefaultForumService()
  • Method Details

    • getForums

      public Collection<ForumDetail> getForums(Collection<ForumPK> forumPKs)
      Specified by:
      getForums in interface ForumService
    • getForum

      public Forum getForum(ForumPK forumPK)
      Specified by:
      getForum in interface ForumService
    • getForumPath

      public ForumPath getForumPath(ForumPK forumPK)
      Specified by:
      getForumPath in interface ForumService
    • getForumName

      public String getForumName(int forumId)
      Specified by:
      getForumName in interface ForumService
    • deleteAll

      public void deleteAll(String instanceId)
      Specified by:
      deleteAll in interface ForumService
    • isForumActive

      public boolean isForumActive(int forumId)
      Specified by:
      isForumActive in interface ForumService
    • getForumParentId

      public int getForumParentId(int forumId)
      Specified by:
      getForumParentId in interface ForumService
    • getForumInstanceId

      public String getForumInstanceId(int forumId)
      Specified by:
      getForumInstanceId in interface ForumService
    • getForumCreatorId

      public String getForumCreatorId(int forumId)
    • getForums

      public List<Forum> getForums(ForumPK forumPK)
      Specified by:
      getForums in interface ForumService
    • getForumDetail

      public ForumDetail getForumDetail(ForumPK forumPK)
      Specified by:
      getForumDetail in interface ForumService
      Parameters:
      forumPK - forum primary key
      Returns:
      a ForumDetail from the forum primary key identifier
    • getForumsByCategory

      public List<Forum> getForumsByCategory(ForumPK forumPK, String categoryId)
      Specified by:
      getForumsByCategory in interface ForumService
    • getForumSonsIds

      public List<String> getForumSonsIds(ForumPK forumPK)
      Specified by:
      getForumSonsIds in interface ForumService
    • lockForum

      public void lockForum(ForumPK forumPK, int level)
      Locks recursively in writing the tree of a given forum.
      Specified by:
      lockForum in interface ForumService
      Parameters:
      forumPK - the unique identifier of the forum.
      level - the locking level.
    • unlockForum

      public int unlockForum(ForumPK forumPK, int level)
      Unlock the forum in writing forum.
      Specified by:
      unlockForum in interface ForumService
      Parameters:
      forumPK - the unique identifier of the forum.
      level - the level of the forum locking
      Returns:
      the result of the operation. Greater than 0 means error.
    • deleteForum

      public void deleteForum(ForumPK forumPK)
      Supprime un forum et tous ses sous-forums a partir de sa primary key
      Specified by:
      deleteForum in interface ForumService
      Parameters:
      forumPK - la primary key du forum
    • createForum

      public int createForum(ForumPK forumPK, String forumName, String forumDescription, String forumCreator, int forumParent, String categoryId, String keywords)
      Creates a new forum.
      Specified by:
      createForum in interface ForumService
      Parameters:
      forumPK - the global identifier of the forum to create
      forumName - the name of the forum
      forumDescription - a short description of the forum.
      forumCreator - the unique identifier of the creator.
      forumParent - the unique identifier of a parent forum (if any).
      categoryId - the unique identifier of the category for which the forum will be created
      keywords - keywords
      Returns:
      the unique identifier of the forum.
    • updateForum

      public void updateForum(ForumPK forumPK, String forumName, String forumDescription, int forumParent, String categoryId, String keywords)
      Updates the specified forum with the given information.
      Specified by:
      updateForum in interface ForumService
      Parameters:
      forumPK - the unique identifier of a forum
      forumName - the new name of the forum
      forumDescription - the new description of the forum
      forumParent - the unique identifier of the new parent forum
      categoryId - the unique identifier of the new category
      keywords - the new keywords of the forum.
    • getMessages

      public Collection<Message> getMessages(ForumPK forumPK)
      Specified by:
      getMessages in interface ForumService
    • getNbMessages

      public int getNbMessages(int forumId, String type, String status)
      Specified by:
      getNbMessages in interface ForumService
    • getAuthorNbMessages

      public int getAuthorNbMessages(String userId, String status)
      Specified by:
      getAuthorNbMessages in interface ForumService
    • getNbResponses

      public int getNbResponses(int forumId, int messageId, String status)
      Specified by:
      getNbResponses in interface ForumService
    • getLastMessage

      public Message getLastMessage(ForumPK forumPK, String status)
      Gets the last message posted into the given forum.
      Specified by:
      getLastMessage in interface ForumService
      Parameters:
      forumPK - the unique identifier of the forum.
      status - the status of the message to get.
      Returns:
      the last message in the forum with the specified status.
    • getLastMessageRSS

      public Collection<Message> getLastMessageRSS(String instanceId, int nbReturned)
      Specified by:
      getLastMessageRSS in interface ForumService
    • getLastMessage

      public Message getLastMessage(ForumPK forumPK, int messageParentId, String status)
      Specified by:
      getLastMessage in interface ForumService
    • getLastMessage

      public Message getLastMessage(ForumPK forumPK, List<String> messageParentIds, String status)
      Specified by:
      getLastMessage in interface ForumService
    • isNewMessageByForum

      public boolean isNewMessageByForum(String userId, ForumPK forumPK, String status)
      Is there any non read messages with the given status in the specified forum?
      Specified by:
      isNewMessageByForum in interface ForumService
      Parameters:
      userId - the unique identifier of a user
      forumPK - the unique identifier of the forum
      status - the status of the non read messages (validated, waiting, ...)
      Returns:
      true if there is at least one message with the given status non read by the user. False otherwise.
    • isNewMessage

      public boolean isNewMessage(String userId, ForumPK forumPK, int messageParentId, String status)
      Specified by:
      isNewMessage in interface ForumService
    • setLastVisit

      public void setLastVisit(String userId, int messageId)
      Saves the date of the last visit of the given user to the specified message.
      Specified by:
      setLastVisit in interface ForumService
      Parameters:
      userId - the unique identifier of the user
      messageId - the unique identifier of the message
    • getMessage

      public Message getMessage(MessagePK messagePK)
      Specified by:
      getMessage in interface ForumService
    • getMessagePath

      public MessagePath getMessagePath(MessagePK messagePK)
      Specified by:
      getMessagePath in interface ForumService
    • getMessageTitle

      public String getMessageTitle(int messageId)
      Specified by:
      getMessageTitle in interface ForumService
    • getMessageParentId

      public int getMessageParentId(int messageId)
      Specified by:
      getMessageParentId in interface ForumService
    • createMessage

      public int createMessage(MessagePK messagePK, String title, String authorId, Date creationDate, int forumId, int parentId, String content, String keywords, String status)
      Create new forum message
      Specified by:
      createMessage in interface ForumService
      Parameters:
      messagePK - message primary key identifier
      title - message title
      authorId - message author identifier
      creationDate - creation date
      forumId - forum identifier
      parentId - parent message identifier
      content - message content
      keywords - the message keywords
      status - the message status
      Returns:
      new message identifier
    • updateMessage

      public void updateMessage(MessagePK messagePK, String title, String message, String userId, String status)
      Specified by:
      updateMessage in interface ForumService
    • updateMessageKeywords

      public void updateMessageKeywords(MessagePK messagePK, String keywords)
      Specified by:
      updateMessageKeywords in interface ForumService
    • deleteMessage

      public void deleteMessage(MessagePK messagePK)
      Remove the specified message and all the submessages.
      Specified by:
      deleteMessage in interface ForumService
      Parameters:
      messagePK - the unique identifier of the message
      Since:
      04 Octobre 2000
    • isModerator

      public boolean isModerator(String userId, ForumPK forumPK)
      Specified by:
      isModerator in interface ForumService
    • addModerator

      public void addModerator(ForumPK forumPK, String userId)
      Specified by:
      addModerator in interface ForumService
    • removeModerator

      public void removeModerator(ForumPK forumPK, String userId)
      Specified by:
      removeModerator in interface ForumService
    • removeAllModerators

      public void removeAllModerators(ForumPK forumPK)
      Specified by:
      removeAllModerators in interface ForumService
    • getModerators

      public List<Moderator> getModerators(int forumId)
      Specified by:
      getModerators in interface ForumService
    • moveMessage

      public void moveMessage(MessagePK messagePK, ForumPK forumPK)
      Specified by:
      moveMessage in interface ForumService
    • subscribeMessage

      public void subscribeMessage(MessagePK messagePK, String userId)
      Subscribe the given user to the given forum message.
      Specified by:
      subscribeMessage in interface ForumService
      Parameters:
      messagePK - the unique identifier of the message.
      userId - the unique identifier of the user to subscribe.
    • unsubscribeMessage

      public void unsubscribeMessage(MessagePK messagePK, String userId)
      Unsubscribe the given user to the given forum message.
      Specified by:
      unsubscribeMessage in interface ForumService
      Parameters:
      messagePK - the unique identifier of the message.
      userId - the unique identifier of the user to unsubscribe.
    • subscribeForum

      public void subscribeForum(ForumPK forumPK, String userId)
      Subscribe the given user to the given forum.
      Specified by:
      subscribeForum in interface ForumService
      Parameters:
      forumPK - the unique identifier of the forum.
      userId - the unique identifier of the user to subscribe.
    • unsubscribeForum

      public void unsubscribeForum(ForumPK forumPK, String userId)
      Unsubscribe the given user to the given forum.
      Specified by:
      unsubscribeForum in interface ForumService
      Parameters:
      forumPK - the unique identifier of the forum.
      userId - the unique identifier of the user to unsubscribe.
    • listAllSubscribers

      public org.silverpeas.core.subscription.util.SubscriptionSubscriberList listAllSubscribers(MessagePK messagePK)
      Gets the list of subscribers related to the given forum message.
      Specified by:
      listAllSubscribers in interface ForumService
      Parameters:
      messagePK - the unique identifier of the message.
      Returns:
      a list of subscribers.
    • listAllSubscribers

      public org.silverpeas.core.subscription.util.SubscriptionSubscriberList listAllSubscribers(ForumPK forumPK)
      Gets the list of subscribers related to the given forum.
      Specified by:
      listAllSubscribers in interface ForumService
      Parameters:
      forumPK - the unique identifier of the forum.
      Returns:
      a list of subscribers.
    • isSubscriber

      public boolean isSubscriber(MessagePK messagePK, String userId)
      Indicates if the given user has subscribed to the given forum message.
      Specified by:
      isSubscriber in interface ForumService
      Parameters:
      messagePK - the unique identifier of a message.
      userId - the unique identifier of the user.
      Returns:
      true if the given user has subscribed to the specified message. False otherwise.
    • isSubscriberByInheritance

      public boolean isSubscriberByInheritance(MessagePK messagePK, String userId)
      Indicates if the given user is subscribed by inheritance to the given forum message.
      Specified by:
      isSubscriberByInheritance in interface ForumService
      Parameters:
      messagePK - the unique identifier of a message.
      userId - the unique identifier of the user.
      Returns:
      true if the given user has subscribed to the specified message. False otherwise.
    • isSubscriber

      public boolean isSubscriber(ForumPK forumPK, String userId)
      Indicates if the given user has subscribed to the given forum.
      Specified by:
      isSubscriber in interface ForumService
      Parameters:
      forumPK - the unique identifier of the forum.
      userId - the unique identifier of the user.
      Returns:
      true if the given user has subscribed to the specified forum. False otherwise.
    • isSubscriberByInheritance

      public boolean isSubscriberByInheritance(ForumPK forumPK, String userId)
      Indicates if the given user is subscribed by inheritance to the given forum.
      Specified by:
      isSubscriberByInheritance in interface ForumService
      Parameters:
      forumPK - the unique identifier of the forum.
      userId - the unique identifier of the user.
      Returns:
      true if the given user has subscribed to the specified forum. False otherwise.
    • isSubscriber

      public boolean isSubscriber(String instanceId, String userId)
      Indicates if the given user has subscribed to the given component instance.
      Specified by:
      isSubscriber in interface ForumService
      Parameters:
      instanceId - the unique identifier of the component instance.
      userId - the unique identifier of the user.
      Returns:
      true if the given user has subscribed to the specified component instance. False otherwise.
    • createIndex

      public void createIndex(MessagePK messagePK)
      Specified by:
      createIndex in interface ForumService
    • createIndex

      public void createIndex(ForumPK forumPK)
      Specified by:
      createIndex in interface ForumService
    • openConnection

      protected Connection openConnection()
      Open connection
      Returns:
      the connection
    • getSilverObjectId

      public int getSilverObjectId(ForumPK forumPK)
      Specified by:
      getSilverObjectId in interface ForumService
    • createCategory

      public void createCategory(org.silverpeas.core.node.model.NodeDetail category)
      Specified by:
      createCategory in interface ForumService
    • updateCategory

      public void updateCategory(org.silverpeas.core.node.model.NodeDetail category)
      Specified by:
      updateCategory in interface ForumService
    • deleteCategory

      public void deleteCategory(String categoryId, String instanceId)
      Specified by:
      deleteCategory in interface ForumService
    • getCategory

      public org.silverpeas.core.node.model.NodeDetail getCategory(org.silverpeas.core.node.model.NodePK pk)
      Specified by:
      getCategory in interface ForumService
    • getAllCategories

      public Collection<org.silverpeas.core.node.model.NodeDetail> getAllCategories(String instanceId)
      Specified by:
      getAllCategories in interface ForumService
    • getForumTags

      public String getForumTags(ForumPK forumPK)
      Specified by:
      getForumTags in interface ForumService
    • getMessageTags

      public String getMessageTags(MessagePK messagePK)
      Specified by:
      getMessageTags in interface ForumService
    • getWysiwygContent

      protected String getWysiwygContent(String componentId, String messageId)
    • getSubscribeService

      protected org.silverpeas.core.subscription.SubscriptionService getSubscribeService()