Nuxeo ECM Projects 5.4.3-SNAPSHOT

org.nuxeo.ecm.platform.forum.web
Class ThreadActionBean

java.lang.Object
  extended by org.nuxeo.ecm.platform.forum.web.ThreadActionBean
All Implemented Interfaces:
Serializable, ThreadAction

@Name(value="threadAction")
@Scope(value=CONVERSATION)
public class ThreadActionBean
extends Object
implements ThreadAction

This Action Listener represents a Thread inside a forum.

Author:
Brice Chaffangeon
See Also:
Serialized Form

Constructor Summary
ThreadActionBean()
           
 
Method Summary
 String addThread()
          Adds the thread inside the forum.
 ThreadAdapter getAdapter(DocumentModel thread)
           
 List<DocumentModel> getAllPosts(DocumentModel thread, String state)
          Gets all Posts in the Thread with the specified state.
 String getDescription()
          Gets the description of the Thread.
 DocumentModel getLastPostPublished(DocumentModel thread)
          Gets the latest post published in given thread.
 String getModerationAsString(DocumentModel thread)
          Return the label of the moderation state of the thread
 List<String> getModerators()
          Get all moderators on the thread.
 DocumentModel getParentPost(int post)
          Return the parent post of the specified index of the post in the getPostsAsThread() list.
 List<ThreadEntry> getPostsAsThread()
          Gets all available posts in the thread according the Post state and principal rights.
 List<DocumentModel> getPostsPending(DocumentModel thread)
          Gets pending posts in a thread.
 List<DocumentModel> getPostsPublished(DocumentModel thread)
          Gets published posts in a thread.
 String getSchema()
           
 List<String> getSelectedModerators()
           
 String getTitle()
          Gets the title of the Thread to be created.
 String getType()
           
 boolean isCurrentThreadModerated()
          Returns true if the thread is moderated, false otherwise.
 boolean isModerated()
          Returns true if the thread is moderated, false otherwise.
 boolean isParentPostPublished(int post)
          Return true if the parent post identified by it's number in the getPostsAsThread list is published.
 boolean isPrincipalGroupModerator()
          Returns true if the principal(s group is a moderator group
 boolean isPrincipalModerator()
          Returns true if the principal (logged user) is a moderator, else otherwise.
 boolean isThreadModerated(DocumentModel thread)
          Returns true if the given thread is moderated, false otherwise.
 void readState()
           
 void saveState()
           
 void setDescription(String description)
          Sets the description of the Thread.
 void setModerated(boolean moderated)
          Sets the moderation on a thread.
 void setSelectedModerators(List<String> selectedModerators)
           
 void setTitle(String title)
          Sets the title of the Thread.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ThreadActionBean

public ThreadActionBean()
Method Detail

addThread

public String addThread()
                 throws ClientException
Description copied from interface: ThreadAction
Adds the thread inside the forum.

Specified by:
addThread in interface ThreadAction
Throws:
ClientException - if the Thread can't be created

getModerators

public List<String> getModerators()
Description copied from interface: ThreadAction
Get all moderators on the thread.

Specified by:
getModerators in interface ThreadAction

isPrincipalModerator

public boolean isPrincipalModerator()
Description copied from interface: ThreadAction
Returns true if the principal (logged user) is a moderator, else otherwise.

Specified by:
isPrincipalModerator in interface ThreadAction

isPrincipalGroupModerator

public boolean isPrincipalGroupModerator()
Description copied from interface: ThreadAction
Returns true if the principal(s group is a moderator group

Specified by:
isPrincipalGroupModerator in interface ThreadAction

isCurrentThreadModerated

public boolean isCurrentThreadModerated()
                                 throws ClientException
Description copied from interface: ThreadAction
Returns true if the thread is moderated, false otherwise. Intends to be used by a Post.

Specified by:
isCurrentThreadModerated in interface ThreadAction
Throws:
ClientException

getPostsAsThread

@Factory(value="currentThreadPosts",
         scope=EVENT)
public List<ThreadEntry> getPostsAsThread()
                                   throws ClientException
Description copied from interface: ThreadAction
Gets all available posts in the thread according the Post state and principal rights. I.e., Post that are not published won't be visible for non-moderators.

Specified by:
getPostsAsThread in interface ThreadAction
Returns:
a list of ThreadEntry, directly usable for display with indentation
Throws:
ClientException

getAdapter

public ThreadAdapter getAdapter(DocumentModel thread)
Specified by:
getAdapter in interface ThreadAction

getAllPosts

public List<DocumentModel> getAllPosts(DocumentModel thread,
                                       String state)
                                throws ClientException
Description copied from interface: ThreadAction
Gets all Posts in the Thread with the specified state. Return all posts if state is null.

Specified by:
getAllPosts in interface ThreadAction
Throws:
ClientException

getPostsPublished

public List<DocumentModel> getPostsPublished(DocumentModel thread)
                                      throws ClientException
Description copied from interface: ThreadAction
Gets published posts in a thread.

Specified by:
getPostsPublished in interface ThreadAction
Throws:
ClientException

getPostsPending

public List<DocumentModel> getPostsPending(DocumentModel thread)
                                    throws ClientException
Description copied from interface: ThreadAction
Gets pending posts in a thread.

Specified by:
getPostsPending in interface ThreadAction
Throws:
ClientException

getDescription

public String getDescription()
Description copied from interface: ThreadAction
Gets the description of the Thread.

Specified by:
getDescription in interface ThreadAction

getTitle

public String getTitle()
Description copied from interface: ThreadAction
Gets the title of the Thread to be created.

Specified by:
getTitle in interface ThreadAction

setDescription

public void setDescription(String description)
Description copied from interface: ThreadAction
Sets the description of the Thread.

Specified by:
setDescription in interface ThreadAction

setTitle

public void setTitle(String title)
Description copied from interface: ThreadAction
Sets the title of the Thread.

Specified by:
setTitle in interface ThreadAction

getSchema

public String getSchema()

getType

public String getType()

saveState

public void saveState()

readState

public void readState()

isModerated

public boolean isModerated()
Description copied from interface: ThreadAction
Returns true if the thread is moderated, false otherwise. Just used at creation time.

Specified by:
isModerated in interface ThreadAction

setModerated

public void setModerated(boolean moderated)
Description copied from interface: ThreadAction
Sets the moderation on a thread.

Specified by:
setModerated in interface ThreadAction

getLastPostPublished

public DocumentModel getLastPostPublished(DocumentModel thread)
                                   throws ClientException
Description copied from interface: ThreadAction
Gets the latest post published in given thread.

Specified by:
getLastPostPublished in interface ThreadAction
Throws:
ClientException

getModerationAsString

public String getModerationAsString(DocumentModel thread)
                             throws ClientException
Description copied from interface: ThreadAction
Return the label of the moderation state of the thread

Specified by:
getModerationAsString in interface ThreadAction
Parameters:
thread - is the thread we want
Throws:
ClientException

isThreadModerated

public boolean isThreadModerated(DocumentModel thread)
                          throws ClientException
Description copied from interface: ThreadAction
Returns true if the given thread is moderated, false otherwise.

Specified by:
isThreadModerated in interface ThreadAction
Parameters:
thread - is the thread to test
Throws:
ClientException

getParentPost

public DocumentModel getParentPost(int post)
                            throws ClientException
Description copied from interface: ThreadAction
Return the parent post of the specified index of the post in the getPostsAsThread() list.

Specified by:
getParentPost in interface ThreadAction
Throws:
ClientException

isParentPostPublished

public boolean isParentPostPublished(int post)
                              throws ClientException
Description copied from interface: ThreadAction
Return true if the parent post identified by it's number in the getPostsAsThread list is published.

Specified by:
isParentPostPublished in interface ThreadAction
Throws:
ClientException

getSelectedModerators

public List<String> getSelectedModerators()

setSelectedModerators

public void setSelectedModerators(List<String> selectedModerators)

Nuxeo ECM Projects 5.4.3-SNAPSHOT

Copyright © 2011 Nuxeo SAS. All Rights Reserved.