com.stratelia.webactiv.forums.forumsManager.ejb
Class ForumsBMEJB

java.lang.Object
  extended by com.stratelia.webactiv.forums.forumsManager.ejb.ForumsBMEJB
All Implemented Interfaces:
ForumsBM

public class ForumsBMEJB
extends Object
implements ForumsBM

Cette classe est le Business Manager qui gere les forums


Constructor Summary
ForumsBMEJB()
           
 
Method Summary
 void addModerator(ForumPK forumPK, String userId)
          Method declaration
 String createCategory(com.stratelia.webactiv.util.node.model.NodeDetail category)
           
 int createForum(ForumPK forumPK, String forumName, String forumDescription, String forumCreator, int forumParent, String categoryId, String keywords)
          Cree un nouveau forum dans la datasource
 void createIndex(ForumPK forumPK)
          Method declaration
 void createIndex(MessagePK messagePK)
          Method declaration
 int createMessage(MessagePK messagePK, String title, String authorId, Date creationDate, int forumId, int parentId, String content, String keywords, String status)
          Cree un nouveau message
 void deleteCategory(String categoryId, String instanceId)
           
 void deleteForum(ForumPK forumPK)
          Supprime un forum et tous ses sous-forums a partir de sa primary key
 void deleteMessage(MessagePK messagePK)
          Supprime un message et tous ses sous-messages a partir de sa primary key
 Collection<com.stratelia.webactiv.util.node.model.NodeDetail> getAllCategories(String instanceId)
           
 Collection<String> getAllMessageSons(MessagePK messagePK)
          Liste tous les sous-messages d'un message récursivement
 int getAuthorNbMessages(String userId, String status)
           
 com.stratelia.webactiv.util.node.model.NodeDetail getCategory(com.stratelia.webactiv.util.node.model.NodePK pk)
           
 Forum getForum(ForumPK forumPK)
           
 String getForumCreatorId(int forumId)
           
 ForumDetail getForumDetail(ForumPK forumPK)
           
 String getForumInstanceId(int forumId)
           
 String getForumName(int forumId)
           
 int getForumParentId(int forumId)
           
 Collection<Forum> getForumRootList(String instanceId)
          Gets all forums of an instanceId that have not parent forum.
 Collection<ForumDetail> getForums(Collection<ForumPK> forumPKs)
           
 List<Forum> getForums(ForumPK forumPK)
           
 List<Forum> getForumsByCategory(ForumPK forumPK, String categoryId)
           
 Collection<Forum> getForumsList(Collection<ForumPK> forumPKs)
           
 List<String> getForumSonsIds(ForumPK forumPK)
           
 String getForumTags(ForumPK forumPK)
           
 Message getLastMessage(ForumPK forumPK, int messageParentId, String status)
           
 Message getLastMessage(ForumPK forumPK, List<String> messageParentIds, String status)
           
 Message getLastMessage(ForumPK forumPK, String status)
          Retourne le dernier message d'un forum
 Collection getLastMessageRSS(String instanceId, int nbReturned)
           
 Collection<Message> getLastThreads(ForumPK forumPK, int count)
           
 Message getMessage(MessagePK messagePK)
           
 int getMessageParentId(int messageId)
           
 Collection<Message> getMessages(ForumPK forumPK)
           
 Collection<String> getMessageSons(MessagePK messagePK)
          Liste tous les sous-messages d'un message
 String getMessageTags(MessagePK messagePK)
           
 String getMessageTitle(int messageId)
           
 List<Moderator> getModerators(int forumId)
           
 int getNbMessages(int forumId, String type, String status)
           
 int getNbResponses(int forumId, int messageId, String status)
           
 Collection<Message> getNotAnsweredLastThreads(ForumPK forumPK, int count)
           
 int getSilverObjectId(ForumPK forumPK)
           
protected  com.silverpeas.subscribe.SubscriptionService getSubscribeBm()
          Gets instance of centralized subscription services.
 Collection<Message> getThreadsList(Collection<MessagePK> messagePKs)
           
protected  String getWysiwygContent(String componentId, String messageId)
           
 boolean isForumActive(int forumId)
           
 boolean isModerator(String userId, ForumPK forumPK)
          Method declaration
 boolean isNewMessage(String userId, ForumPK forumPK, int messageParentId, String status)
           
 boolean isNewMessageByForum(String userId, ForumPK forumPK, String status)
          Retourne vrai s'il y a des messages non lus sur ce forum depuis la dernière visite
 boolean isSubscriber(ForumPK forumPK, String userId)
          Indicates if the given user has subscribed to the given forum identifier.
 boolean isSubscriber(MessagePK messagePK, String userId)
          Indicates if the given user has subscribed to the given forum message identifier.
 boolean isSubscriber(String instanceId, String userId)
          Indicates if the given user has subscribed to the given component instance identifier.
 boolean isSubscriberByInheritance(ForumPK forumPK, String userId)
          Indicates if the given user is subscribed by inheritance to the given forum identifier.
 boolean isSubscriberByInheritance(MessagePK messagePK, String userId)
          Indicates if the given user is subscribed by inheritance to the given forum message identifier.
 com.silverpeas.subscribe.util.SubscriptionSubscriberList listAllSubscribers(ForumPK forumPK)
          Gets the list of subscribers related to the given forum primary key.
 com.silverpeas.subscribe.util.SubscriptionSubscriberList listAllSubscribers(MessagePK messagePK)
          Gets the list of subscribers related to the given forum message primary key.
 com.silverpeas.subscribe.util.SubscriptionSubscriberList listAllSubscribers(String instanceId)
          Gets the list of subscribers to the given component instance identifier.
 void lockForum(ForumPK forumPK, int level)
          Verrouille recursivement l'arborescence d'un forum en ecriture a partir de sa primary key
 void moveMessage(MessagePK messagePK, ForumPK forumPK)
          Method declaration
protected  Connection openConnection()
          Ouverture de la connection vers la source de donnees
 void removeAllModerators(ForumPK forumPK)
          Method declaration
 void removeModerator(ForumPK forumPK, String userId)
          Method declaration
 void setLastVisit(String userId, int messageId)
          enregistre la date de la dernière visite d'un utilisateur sur un forum
 void subscribeForum(ForumPK forumPK, String userId)
          Subscribe the given user to the given forum.
 void subscribeMessage(MessagePK messagePK, String userId)
          Subscribe the given user to the given forum message.
 int unlockForum(ForumPK forumPK, int level)
          Deverrouille recursivement un forum en ecriture a partir de sa primary key
 void unsubscribeForum(ForumPK forumPK, String userId)
          Unsubscribe the given user to the given forum.
 void unsubscribeMessage(MessagePK messagePK, String userId)
          Unsubscribe the given user to the given forum message.
 void updateCategory(com.stratelia.webactiv.util.node.model.NodeDetail category)
           
 void updateForum(ForumPK forumPK, String forumName, String forumDescription, int forumParent, String categoryId, String keywords)
          Met a jour les informations sur un forum dans la datasource
 void updateMessage(MessagePK messagePK, String title, String message, String userId, String status)
           
 void updateMessageKeywords(MessagePK messagePK, String keywords)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ForumsBMEJB

public ForumsBMEJB()
Method Detail

getForums

public Collection<ForumDetail> getForums(Collection<ForumPK> forumPKs)
Specified by:
getForums in interface ForumsBM

getForum

public Forum getForum(ForumPK forumPK)
Specified by:
getForum in interface ForumsBM

getForumRootList

public Collection<Forum> getForumRootList(String instanceId)
Gets all forums of an instanceId that have not parent forum.

Specified by:
getForumRootList in interface ForumsBM
Parameters:
instanceId -
Returns:

getForumsList

public Collection<Forum> getForumsList(Collection<ForumPK> forumPKs)
Specified by:
getForumsList in interface ForumsBM

getThreadsList

public Collection<Message> getThreadsList(Collection<MessagePK> messagePKs)
Specified by:
getThreadsList in interface ForumsBM

getForumName

public String getForumName(int forumId)
Specified by:
getForumName in interface ForumsBM

isForumActive

public boolean isForumActive(int forumId)
Specified by:
isForumActive in interface ForumsBM

getForumParentId

public int getForumParentId(int forumId)
Specified by:
getForumParentId in interface ForumsBM

getForumInstanceId

public String getForumInstanceId(int forumId)
Specified by:
getForumInstanceId in interface ForumsBM

getForumCreatorId

public String getForumCreatorId(int forumId)

getForums

public List<Forum> getForums(ForumPK forumPK)
Specified by:
getForums in interface ForumsBM
Parameters:
forumPK -
Returns:

getForumDetail

public ForumDetail getForumDetail(ForumPK forumPK)
Specified by:
getForumDetail in interface ForumsBM
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 ForumsBM

getForumSonsIds

public List<String> getForumSonsIds(ForumPK forumPK)
Specified by:
getForumSonsIds in interface ForumsBM
Parameters:
forumPK -
Returns:

lockForum

public void lockForum(ForumPK forumPK,
                      int level)
Verrouille recursivement l'arborescence d'un forum en ecriture a partir de sa primary key

Specified by:
lockForum in interface ForumsBM
Parameters:
forumPK - la primary key du forum
level - le niveau de verrouillage

unlockForum

public int unlockForum(ForumPK forumPK,
                       int level)
Deverrouille recursivement un forum en ecriture a partir de sa primary key

Specified by:
unlockForum in interface ForumsBM
Parameters:
forumPK - la primary key du forum
level - le niveau de verrouillage
Returns:
int le code d'erreur

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 ForumsBM
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)
Cree un nouveau forum dans la datasource

Specified by:
createForum in interface ForumsBM
Parameters:
forumPK - la primary key
forumName - nom du forum
forumDescription - description du forum
forumCreator - l'id du createur du forum
forumParent - l'id du forum parent
categoryId - l'id de la categorie
keywords -
Returns:
String l'id du nouveau forum
Since:
02 Octobre 2000

updateForum

public void updateForum(ForumPK forumPK,
                        String forumName,
                        String forumDescription,
                        int forumParent,
                        String categoryId,
                        String keywords)
Met a jour les informations sur un forum dans la datasource

Specified by:
updateForum in interface ForumsBM
Parameters:
forumPK - la primary key du forum
forumName - nom du forum
forumDescription - description du forum
forumParent - l'id du forum parent
categoryId - l'id de la catégorie
keywords - the keywords associated to this forum.

getMessages

public Collection<Message> getMessages(ForumPK forumPK)
Specified by:
getMessages in interface ForumsBM

getNbMessages

public int getNbMessages(int forumId,
                         String type,
                         String status)
Specified by:
getNbMessages in interface ForumsBM

getAuthorNbMessages

public int getAuthorNbMessages(String userId,
                               String status)
Specified by:
getAuthorNbMessages in interface ForumsBM

getNbResponses

public int getNbResponses(int forumId,
                          int messageId,
                          String status)
Specified by:
getNbResponses in interface ForumsBM

getLastMessage

public Message getLastMessage(ForumPK forumPK,
                              String status)
Retourne le dernier message d'un forum

Specified by:
getLastMessage in interface ForumsBM
Parameters:
forumPK - la primary key du forum
status -
Returns:
the last message in a forum with the specified status.
Since:

getLastMessageRSS

public Collection getLastMessageRSS(String instanceId,
                                    int nbReturned)
Specified by:
getLastMessageRSS in interface ForumsBM

getLastMessage

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

getLastMessage

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

isNewMessageByForum

public boolean isNewMessageByForum(String userId,
                                   ForumPK forumPK,
                                   String status)
Retourne vrai s'il y a des messages non lus sur ce forum depuis la dernière visite

Specified by:
isNewMessageByForum in interface ForumsBM
Parameters:
userId - l'id de l'utilisateur
forumPK - l'id du forum
status - le status (validé, en attente, ...)
Returns:

isNewMessage

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

setLastVisit

public void setLastVisit(String userId,
                         int messageId)
enregistre la date de la dernière visite d'un utilisateur sur un forum

Specified by:
setLastVisit in interface ForumsBM
Parameters:
messageId - l'id du message
userId - l'id de l'utilisateur
Since:

getMessage

public Message getMessage(MessagePK messagePK)
Specified by:
getMessage in interface ForumsBM

getMessageTitle

public String getMessageTitle(int messageId)
Specified by:
getMessageTitle in interface ForumsBM

getMessageParentId

public int getMessageParentId(int messageId)
Specified by:
getMessageParentId in interface ForumsBM

createMessage

public int createMessage(MessagePK messagePK,
                         String title,
                         String authorId,
                         Date creationDate,
                         int forumId,
                         int parentId,
                         String content,
                         String keywords,
                         String status)
Cree un nouveau message

Specified by:
createMessage in interface ForumsBM
Parameters:
messagePK - la primary key du message
title - titre du message
authorId - id de l'auteur du message
creationDate - date de creation
forumId - id du forum
parentId - id du message parent
content - texte du message
keywords - the message keywords
status - the message status
Returns:
l'id du nouveau

updateMessage

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

updateMessageKeywords

public void updateMessageKeywords(MessagePK messagePK,
                                  String keywords)
Specified by:
updateMessageKeywords in interface ForumsBM

deleteMessage

public void deleteMessage(MessagePK messagePK)
Supprime un message et tous ses sous-messages a partir de sa primary key

Specified by:
deleteMessage in interface ForumsBM
Parameters:
messagePK - la primary key du message
Since:
04 Octobre 2000

isModerator

public boolean isModerator(String userId,
                           ForumPK forumPK)
Method declaration

Specified by:
isModerator in interface ForumsBM
Parameters:
userId -
forumPK -
Returns:
See Also:

addModerator

public void addModerator(ForumPK forumPK,
                         String userId)
Method declaration

Specified by:
addModerator in interface ForumsBM
Parameters:
forumPK -
userId -
See Also:

removeModerator

public void removeModerator(ForumPK forumPK,
                            String userId)
Method declaration

Specified by:
removeModerator in interface ForumsBM
Parameters:
forumPK -
userId -
See Also:

removeAllModerators

public void removeAllModerators(ForumPK forumPK)
Method declaration

Specified by:
removeAllModerators in interface ForumsBM
Parameters:
forumPK -
See Also:

getModerators

public List<Moderator> getModerators(int forumId)
Specified by:
getModerators in interface ForumsBM

moveMessage

public void moveMessage(MessagePK messagePK,
                        ForumPK forumPK)
Method declaration

Specified by:
moveMessage in interface ForumsBM
Parameters:
messagePK -
forumPK -
See Also:

getMessageSons

public Collection<String> getMessageSons(MessagePK messagePK)
Liste tous les sous-messages d'un message

Parameters:
messagePK - la primary key du message pere
Returns:
Vector liste des ids fils
Since:
11 Octobre 2000

getAllMessageSons

public Collection<String> getAllMessageSons(MessagePK messagePK)
Liste tous les sous-messages d'un message récursivement

Parameters:
messagePK - la primary key du message pere
Returns:
Vector liste des ids fils
Since:
11 Octobre 2000

subscribeMessage

public void subscribeMessage(MessagePK messagePK,
                             String userId)
Subscribe the given user to the given forum message.

Specified by:
subscribeMessage in interface ForumsBM
Parameters:
messagePK -
userId -
See Also:

unsubscribeMessage

public void unsubscribeMessage(MessagePK messagePK,
                               String userId)
Unsubscribe the given user to the given forum message.

Specified by:
unsubscribeMessage in interface ForumsBM
Parameters:
messagePK -
userId -
See Also:

subscribeForum

public void subscribeForum(ForumPK forumPK,
                           String userId)
Subscribe the given user to the given forum.

Specified by:
subscribeForum in interface ForumsBM
Parameters:
forumPK -
userId -

unsubscribeForum

public void unsubscribeForum(ForumPK forumPK,
                             String userId)
Unsubscribe the given user to the given forum.

Specified by:
unsubscribeForum in interface ForumsBM
Parameters:
forumPK -
userId -

listAllSubscribers

public com.silverpeas.subscribe.util.SubscriptionSubscriberList listAllSubscribers(MessagePK messagePK)
Gets the list of subscribers related to the given forum message primary key.

Specified by:
listAllSubscribers in interface ForumsBM
Parameters:
messagePK -
Returns:
See Also:

listAllSubscribers

public com.silverpeas.subscribe.util.SubscriptionSubscriberList listAllSubscribers(ForumPK forumPK)
Gets the list of subscribers related to the given forum primary key.

Specified by:
listAllSubscribers in interface ForumsBM
Parameters:
forumPK -
Returns:

listAllSubscribers

public com.silverpeas.subscribe.util.SubscriptionSubscriberList listAllSubscribers(String instanceId)
Gets the list of subscribers to the given component instance identifier. This kind of subscribers come from WEB-Service subscriptions (/services/subscribe/{instanceId})

Specified by:
listAllSubscribers in interface ForumsBM
Parameters:
instanceId -
Returns:

isSubscriber

public boolean isSubscriber(MessagePK messagePK,
                            String userId)
Indicates if the given user has subscribed to the given forum message identifier.

Specified by:
isSubscriber in interface ForumsBM
Parameters:
messagePK -
userId -
Returns:

isSubscriberByInheritance

public boolean isSubscriberByInheritance(MessagePK messagePK,
                                         String userId)
Indicates if the given user is subscribed by inheritance to the given forum message identifier.

Specified by:
isSubscriberByInheritance in interface ForumsBM
Parameters:
messagePK -
userId -
Returns:

isSubscriber

public boolean isSubscriber(ForumPK forumPK,
                            String userId)
Indicates if the given user has subscribed to the given forum identifier.

Specified by:
isSubscriber in interface ForumsBM
Parameters:
forumPK -
userId -
Returns:

isSubscriberByInheritance

public boolean isSubscriberByInheritance(ForumPK forumPK,
                                         String userId)
Indicates if the given user is subscribed by inheritance to the given forum identifier.

Specified by:
isSubscriberByInheritance in interface ForumsBM
Parameters:
forumPK -
userId -
Returns:

isSubscriber

public boolean isSubscriber(String instanceId,
                            String userId)
Indicates if the given user has subscribed to the given component instance identifier.

Specified by:
isSubscriber in interface ForumsBM
Parameters:
instanceId -
userId -
Returns:

createIndex

public void createIndex(MessagePK messagePK)
Method declaration

Specified by:
createIndex in interface ForumsBM
Parameters:
messagePK -
See Also:

createIndex

public void createIndex(ForumPK forumPK)
Method declaration

Specified by:
createIndex in interface ForumsBM
Parameters:
forumPK -
See Also:

openConnection

protected Connection openConnection()
Ouverture de la connection vers la source de donnees

Returns:
Connection la connection

getSilverObjectId

public int getSilverObjectId(ForumPK forumPK)
Specified by:
getSilverObjectId in interface ForumsBM

createCategory

public String createCategory(com.stratelia.webactiv.util.node.model.NodeDetail category)
Specified by:
createCategory in interface ForumsBM

updateCategory

public void updateCategory(com.stratelia.webactiv.util.node.model.NodeDetail category)
Specified by:
updateCategory in interface ForumsBM

deleteCategory

public void deleteCategory(String categoryId,
                           String instanceId)
Specified by:
deleteCategory in interface ForumsBM

getCategory

public com.stratelia.webactiv.util.node.model.NodeDetail getCategory(com.stratelia.webactiv.util.node.model.NodePK pk)
Specified by:
getCategory in interface ForumsBM

getAllCategories

public Collection<com.stratelia.webactiv.util.node.model.NodeDetail> getAllCategories(String instanceId)
Specified by:
getAllCategories in interface ForumsBM

getLastThreads

public Collection<Message> getLastThreads(ForumPK forumPK,
                                          int count)
Specified by:
getLastThreads in interface ForumsBM

getNotAnsweredLastThreads

public Collection<Message> getNotAnsweredLastThreads(ForumPK forumPK,
                                                     int count)
Specified by:
getNotAnsweredLastThreads in interface ForumsBM

getForumTags

public String getForumTags(ForumPK forumPK)
Specified by:
getForumTags in interface ForumsBM

getMessageTags

public String getMessageTags(MessagePK messagePK)
Specified by:
getMessageTags in interface ForumsBM

getWysiwygContent

protected String getWysiwygContent(String componentId,
                                   String messageId)

getSubscribeBm

protected com.silverpeas.subscribe.SubscriptionService getSubscribeBm()
Gets instance of centralized subscription services.

Returns:


Copyright © 2016 Silverpeas. All Rights Reserved.