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 Summary
Constructors Constructor Description DefaultForumService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addModerator(ForumPK forumPK, String userId)
String
createCategory(org.silverpeas.core.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 datasourcevoid
createIndex(ForumPK forumPK)
void
createIndex(MessagePK messagePK)
Method declarationint
createMessage(MessagePK messagePK, String title, String authorId, Date creationDate, int forumId, int parentId, String content, String keywords, String status)
Create new forum messagevoid
deleteAll(String instanceId)
void
deleteCategory(String categoryId, String instanceId)
void
deleteForum(ForumPK forumPK)
Supprime un forum et tous ses sous-forums a partir de sa primary keyvoid
deleteMessage(MessagePK messagePK)
Supprime un message et tous ses sous-messages a partir de sa primary keyCollection<org.silverpeas.core.node.model.NodeDetail>
getAllCategories(String instanceId)
Collection<String>
getAllMessageSons(MessagePK messagePK)
Liste tous les sous-messages d'un message récursivementint
getAuthorNbMessages(String userId, String status)
org.silverpeas.core.node.model.NodeDetail
getCategory(org.silverpeas.core.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)
ForumPath
getForumPath(ForumPK forumPK)
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, String status)
Retourne le dernier message d'un forumMessage
getLastMessage(ForumPK forumPK, List<String> messageParentIds, String status)
Collection
getLastMessageRSS(String instanceId, int nbReturned)
Collection<Message>
getLastThreads(ForumPK forumPK, int count)
Message
getMessage(MessagePK messagePK)
int
getMessageParentId(int messageId)
MessagePath
getMessagePath(MessagePK messagePK)
Collection<Message>
getMessages(ForumPK forumPK)
Collection<String>
getMessageSons(MessagePK messagePK)
Liste tous les sous-messages d'un messageString
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 org.silverpeas.core.subscription.SubscriptionService
getSubscribeService()
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)
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 visiteboolean
isSubscriber(String instanceId, String userId)
Indicates if the given user has subscribed to the given component instance identifier.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
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.org.silverpeas.core.subscription.util.SubscriptionSubscriberList
listAllSubscribers(String instanceId)
Gets the list of subscribers to the given component instance identifier.org.silverpeas.core.subscription.util.SubscriptionSubscriberList
listAllSubscribers(ForumPK forumPK)
Gets the list of subscribers related to the given forum primary key.org.silverpeas.core.subscription.util.SubscriptionSubscriberList
listAllSubscribers(MessagePK messagePK)
Gets the list of subscribers related to the given forum message primary key.void
lockForum(ForumPK forumPK, int level)
Verrouille recursivement l'arborescence d'un forum en ecriture a partir de sa primary keyvoid
moveMessage(MessagePK messagePK, ForumPK forumPK)
protected Connection
openConnection()
Open connectionvoid
removeAllModerators(ForumPK forumPK)
void
removeModerator(ForumPK forumPK, String userId)
void
setLastVisit(String userId, int messageId)
enregistre la date de la dernière visite d'un utilisateur sur un forumvoid
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 keyvoid
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(org.silverpeas.core.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 datasourcevoid
updateMessage(MessagePK messagePK, String title, String message, String userId, String status)
void
updateMessageKeywords(MessagePK messagePK, String keywords)
-
-
-
Method Detail
-
getForums
public Collection<ForumDetail> getForums(Collection<ForumPK> forumPKs)
- Specified by:
getForums
in interfaceForumService
-
getForum
public Forum getForum(ForumPK forumPK)
- Specified by:
getForum
in interfaceForumService
-
getForumPath
public ForumPath getForumPath(ForumPK forumPK)
- Specified by:
getForumPath
in interfaceForumService
-
getForumRootList
public Collection<Forum> getForumRootList(String instanceId)
Gets all forums of an instanceId that have not parent forum.- Specified by:
getForumRootList
in interfaceForumService
- Parameters:
instanceId
-- Returns:
-
getForumsList
public Collection<Forum> getForumsList(Collection<ForumPK> forumPKs)
- Specified by:
getForumsList
in interfaceForumService
-
getThreadsList
public Collection<Message> getThreadsList(Collection<MessagePK> messagePKs)
- Specified by:
getThreadsList
in interfaceForumService
-
getForumName
public String getForumName(int forumId)
- Specified by:
getForumName
in interfaceForumService
-
deleteAll
public void deleteAll(String instanceId)
- Specified by:
deleteAll
in interfaceForumService
-
isForumActive
public boolean isForumActive(int forumId)
- Specified by:
isForumActive
in interfaceForumService
-
getForumParentId
public int getForumParentId(int forumId)
- Specified by:
getForumParentId
in interfaceForumService
-
getForumInstanceId
public String getForumInstanceId(int forumId)
- Specified by:
getForumInstanceId
in interfaceForumService
-
getForumCreatorId
public String getForumCreatorId(int forumId)
-
getForums
public List<Forum> getForums(ForumPK forumPK)
- Specified by:
getForums
in interfaceForumService
- Parameters:
forumPK
-- Returns:
-
getForumDetail
public ForumDetail getForumDetail(ForumPK forumPK)
- Specified by:
getForumDetail
in interfaceForumService
- 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 interfaceForumService
-
getForumSonsIds
public List<String> getForumSonsIds(ForumPK forumPK)
- Specified by:
getForumSonsIds
in interfaceForumService
- 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 interfaceForumService
- Parameters:
forumPK
- la primary key du forumlevel
- 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 interfaceForumService
- Parameters:
forumPK
- la primary key du forumlevel
- 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 interfaceForumService
- 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 interfaceForumService
- Parameters:
forumPK
- la primary keyforumName
- nom du forumforumDescription
- description du forumforumCreator
- l'id du createur du forumforumParent
- l'id du forum parentcategoryId
- l'id de la categoriekeywords
-- Returns:
- String l'id du nouveau forum
-
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 interfaceForumService
- Parameters:
forumPK
- la primary key du forumforumName
- nom du forumforumDescription
- description du forumforumParent
- l'id du forum parentcategoryId
- l'id de la catégoriekeywords
- the keywords associated to this forum.
-
getMessages
public Collection<Message> getMessages(ForumPK forumPK)
- Specified by:
getMessages
in interfaceForumService
-
getNbMessages
public int getNbMessages(int forumId, String type, String status)
- Specified by:
getNbMessages
in interfaceForumService
-
getAuthorNbMessages
public int getAuthorNbMessages(String userId, String status)
- Specified by:
getAuthorNbMessages
in interfaceForumService
-
getNbResponses
public int getNbResponses(int forumId, int messageId, String status)
- Specified by:
getNbResponses
in interfaceForumService
-
getLastMessage
public Message getLastMessage(ForumPK forumPK, String status)
Retourne le dernier message d'un forum- Specified by:
getLastMessage
in interfaceForumService
- Parameters:
forumPK
- la primary key du forumstatus
-- Returns:
- the last message in a forum with the specified status.
-
getLastMessageRSS
public Collection getLastMessageRSS(String instanceId, int nbReturned)
- Specified by:
getLastMessageRSS
in interfaceForumService
-
getLastMessage
public Message getLastMessage(ForumPK forumPK, int messageParentId, String status)
- Specified by:
getLastMessage
in interfaceForumService
-
getLastMessage
public Message getLastMessage(ForumPK forumPK, List<String> messageParentIds, String status)
- Specified by:
getLastMessage
in interfaceForumService
-
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 interfaceForumService
- Parameters:
userId
- l'id de l'utilisateurforumPK
- l'id du forumstatus
- le status (validé, en attente, ...)- Returns:
-
isNewMessage
public boolean isNewMessage(String userId, ForumPK forumPK, int messageParentId, String status)
- Specified by:
isNewMessage
in interfaceForumService
-
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 interfaceForumService
- Parameters:
messageId
- l'id du messageuserId
- l'id de l'utilisateur
-
getMessage
public Message getMessage(MessagePK messagePK)
- Specified by:
getMessage
in interfaceForumService
-
getMessagePath
public MessagePath getMessagePath(MessagePK messagePK)
- Specified by:
getMessagePath
in interfaceForumService
-
getMessageTitle
public String getMessageTitle(int messageId)
- Specified by:
getMessageTitle
in interfaceForumService
-
getMessageParentId
public int getMessageParentId(int messageId)
- Specified by:
getMessageParentId
in interfaceForumService
-
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 interfaceForumService
- Parameters:
messagePK
- message primary key identifiertitle
- message titleauthorId
- message author identifiercreationDate
- creation dateforumId
- forum identifierparentId
- parent message identifiercontent
- message contentkeywords
- the message keywordsstatus
- 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 interfaceForumService
-
updateMessageKeywords
public void updateMessageKeywords(MessagePK messagePK, String keywords)
- Specified by:
updateMessageKeywords
in interfaceForumService
-
deleteMessage
public void deleteMessage(MessagePK messagePK)
Supprime un message et tous ses sous-messages a partir de sa primary key- Specified by:
deleteMessage
in interfaceForumService
- Parameters:
messagePK
- la primary key du message- Since:
- 04 Octobre 2000
-
isModerator
public boolean isModerator(String userId, ForumPK forumPK)
- Specified by:
isModerator
in interfaceForumService
- Parameters:
userId
-forumPK
-- Returns:
-
addModerator
public void addModerator(ForumPK forumPK, String userId)
- Specified by:
addModerator
in interfaceForumService
- Parameters:
forumPK
-userId
-
-
removeModerator
public void removeModerator(ForumPK forumPK, String userId)
- Specified by:
removeModerator
in interfaceForumService
- Parameters:
forumPK
-userId
-
-
removeAllModerators
public void removeAllModerators(ForumPK forumPK)
- Specified by:
removeAllModerators
in interfaceForumService
- Parameters:
forumPK
-
-
getModerators
public List<Moderator> getModerators(int forumId)
- Specified by:
getModerators
in interfaceForumService
-
moveMessage
public void moveMessage(MessagePK messagePK, ForumPK forumPK)
- Specified by:
moveMessage
in interfaceForumService
- Parameters:
messagePK
-forumPK
-
-
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
-
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
-
subscribeMessage
public void subscribeMessage(MessagePK messagePK, String userId)
Subscribe the given user to the given forum message.- Specified by:
subscribeMessage
in interfaceForumService
- Parameters:
messagePK
-userId
-
-
unsubscribeMessage
public void unsubscribeMessage(MessagePK messagePK, String userId)
Unsubscribe the given user to the given forum message.- Specified by:
unsubscribeMessage
in interfaceForumService
- Parameters:
messagePK
-userId
-
-
subscribeForum
public void subscribeForum(ForumPK forumPK, String userId)
Subscribe the given user to the given forum.- Specified by:
subscribeForum
in interfaceForumService
- Parameters:
forumPK
-userId
-
-
unsubscribeForum
public void unsubscribeForum(ForumPK forumPK, String userId)
Unsubscribe the given user to the given forum.- Specified by:
unsubscribeForum
in interfaceForumService
- Parameters:
forumPK
-userId
-
-
listAllSubscribers
public org.silverpeas.core.subscription.util.SubscriptionSubscriberList listAllSubscribers(MessagePK messagePK)
Gets the list of subscribers related to the given forum message primary key.- Specified by:
listAllSubscribers
in interfaceForumService
- Parameters:
messagePK
-- Returns:
-
listAllSubscribers
public org.silverpeas.core.subscription.util.SubscriptionSubscriberList listAllSubscribers(ForumPK forumPK)
Gets the list of subscribers related to the given forum primary key.- Specified by:
listAllSubscribers
in interfaceForumService
- Parameters:
forumPK
-- Returns:
-
listAllSubscribers
public org.silverpeas.core.subscription.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 interfaceForumService
- 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 interfaceForumService
- 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 interfaceForumService
- 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 interfaceForumService
- 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 interfaceForumService
- 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 interfaceForumService
- Parameters:
instanceId
-userId
-- Returns:
-
createIndex
public void createIndex(MessagePK messagePK)
Method declaration- Specified by:
createIndex
in interfaceForumService
- Parameters:
messagePK
-
-
createIndex
public void createIndex(ForumPK forumPK)
- Specified by:
createIndex
in interfaceForumService
- Parameters:
forumPK
-
-
openConnection
protected Connection openConnection()
Open connection- Returns:
- the connection
-
getSilverObjectId
public int getSilverObjectId(ForumPK forumPK)
- Specified by:
getSilverObjectId
in interfaceForumService
-
createCategory
public String createCategory(org.silverpeas.core.node.model.NodeDetail category)
- Specified by:
createCategory
in interfaceForumService
-
updateCategory
public void updateCategory(org.silverpeas.core.node.model.NodeDetail category)
- Specified by:
updateCategory
in interfaceForumService
-
deleteCategory
public void deleteCategory(String categoryId, String instanceId)
- Specified by:
deleteCategory
in interfaceForumService
-
getCategory
public org.silverpeas.core.node.model.NodeDetail getCategory(org.silverpeas.core.node.model.NodePK pk)
- Specified by:
getCategory
in interfaceForumService
-
getAllCategories
public Collection<org.silverpeas.core.node.model.NodeDetail> getAllCategories(String instanceId)
- Specified by:
getAllCategories
in interfaceForumService
-
getLastThreads
public Collection<Message> getLastThreads(ForumPK forumPK, int count)
- Specified by:
getLastThreads
in interfaceForumService
-
getNotAnsweredLastThreads
public Collection<Message> getNotAnsweredLastThreads(ForumPK forumPK, int count)
- Specified by:
getNotAnsweredLastThreads
in interfaceForumService
-
getForumTags
public String getForumTags(ForumPK forumPK)
- Specified by:
getForumTags
in interfaceForumService
-
getMessageTags
public String getMessageTags(MessagePK messagePK)
- Specified by:
getMessageTags
in interfaceForumService
-
getSubscribeService
protected org.silverpeas.core.subscription.SubscriptionService getSubscribeService()
Gets instance of centralized subscription services.- Returns:
-
-