org.jboss.portlet.forums.impl
Class ForumsModuleImpl

java.lang.Object
  extended by javax.management.NotificationBroadcasterSupport
      extended by org.jboss.system.ServiceMBeanSupport
          extended by org.jboss.portal.server.util.Service
              extended by org.jboss.portlet.forums.AbstractModule
                  extended by org.jboss.portlet.forums.impl.ForumsModuleImpl
All Implemented Interfaces:
javax.management.MBeanRegistration, javax.management.NotificationBroadcaster, javax.management.NotificationEmitter, ForumsModule, org.jboss.system.Service, org.jboss.system.ServiceMBean

public class ForumsModuleImpl
extends AbstractModule
implements ForumsModule


Field Summary
 
Fields inherited from class org.jboss.portlet.forums.AbstractModule
JNDIName
 
Fields inherited from class org.jboss.system.ServiceMBeanSupport
server, SERVICE_CONTROLLER_SIG, serviceName
 
Fields inherited from interface org.jboss.system.ServiceMBean
CREATE_EVENT, CREATED, DESTROY_EVENT, DESTROYED, FAILED, REGISTERED, START_EVENT, STARTED, STARTING, states, STOP_EVENT, STOPPED, STOPPING, UNREGISTERED
 
Constructor Summary
ForumsModuleImpl()
           
 
Method Summary
 void addAllForums(Category source, Category target)
          DOCUMENT_ME
 Category createCategory(java.lang.String name)
          DOCUMENT_ME
 Forum createForum(Category category, java.lang.String name, java.lang.String description)
          DOCUMENT_ME
 void createForumWatch(Poster poster, Forum forum, int mode)
          DOCUMENT_ME
 Post createPost(Topic topic, Forum forum, Message message, java.util.Date creationDate, Poster poster)
          DOCUMENT_ME
 Poster createPoster(java.lang.Integer userId)
          DOCUMENT_ME
 Post createTopic(Forum forum, Message message, java.util.Date creationDate, Poster poster)
          DOCUMENT_ME
 void createTopicWatch(Poster poster, Topic topic)
           
 java.util.List findAnnouncements(Forum forum)
          DOCUMENT_ME
 java.util.List findCategories()
          DOCUMENT_ME
 Category findCategoryByID(java.lang.Integer id)
          DOCUMENT_ME
 Post findFirstPost(Topic topic)
          DOCUMENT_ME
 Forum findForumByID(java.lang.Integer id)
          DOCUMENT_ME
 java.util.List findForums()
          DOCUMENT_ME
 java.util.List findForumsByCategoryID(java.lang.Integer categoryId)
          DOCUMENT_ME
 ForumWatch findForumWatchByID(java.lang.Integer forumWatchId)
           
 java.util.List findForumWatchByUser(User user)
          DOCUMENT_ME
 Post findLastPost(Forum forum)
          DOCUMENT_ME
 Post findLastPost(Topic topic)
          DOCUMENT_ME
 java.util.Date findLastPostDateForUser(User user)
          DOCUMENT_ME
 Post findPostByID(java.lang.Integer id)
          DOCUMENT_ME
 Poster findPosterByUserID(java.lang.Integer userID)
          DOCUMENT_ME
 java.util.List findPostsByTopicIDAsc(java.lang.Integer topicId, int start, int limit)
          DOCUMENT_ME
 java.util.List findPostsByTopicIDDesc(java.lang.Integer topicId, int start, int limit)
          DOCUMENT_ME
 Topic findTopicByID(java.lang.Integer id)
          DOCUMENT_ME
 java.util.List findTopicsAsc(Forum forum, int type, int start, int perPage)
          DOCUMENT_ME
 java.util.List findTopicsBefore(Forum forum, int type, int start, int perPage, java.util.Date date)
          DOCUMENT_ME
 java.util.List findTopicsDesc(Forum forum, int type, int start, int perPage)
          DOCUMENT_ME
 TopicWatch findTopicWatchByID(java.lang.Integer topicWatchId)
           
protected  net.sf.hibernate.Session getSession()
          Return the hibernate session.
 void removeCategory(Category category)
          DOCUMENT_ME
 void removeForum(Forum forum)
          DOCUMENT_ME
 void removeForumWatch(ForumWatch watch)
          DOCUMENT_ME
 void removePost(Post post)
          DOCUMENT_ME
 void removeTopic(Topic topic)
          DOCUMENT_ME
 void removeTopicWatch(TopicWatch watch)
          DOCUMENT_ME
 
Methods inherited from class org.jboss.portlet.forums.AbstractModule
getJNDIName, setJNDIName, startService, stopService
 
Methods inherited from class org.jboss.portal.server.util.Service
create, destroy, getState, getStateString, start, stop
 
Methods inherited from class org.jboss.system.ServiceMBeanSupport
createService, destroyService, getLog, getName, getNextNotificationSequenceNumber, getObjectName, getServer, getServiceName, jbossInternalCreate, jbossInternalDescription, jbossInternalDestroy, jbossInternalLifecycle, jbossInternalStart, jbossInternalStop, postDeregister, postRegister, preDeregister, preRegister
 
Methods inherited from class javax.management.NotificationBroadcasterSupport
addNotificationListener, getNotificationInfo, handleNotification, removeNotificationListener, removeNotificationListener, sendNotification
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ForumsModuleImpl

public ForumsModuleImpl()
Method Detail

findForumByID

public Forum findForumByID(java.lang.Integer id)
                    throws ModuleException
DOCUMENT_ME

Specified by:
findForumByID in interface ForumsModule
Parameters:
id - DOCUMENT_ME
Returns:
DOCUMENT_ME
Throws:
ModuleException - DOCUMENT_ME
java.lang.IllegalArgumentException - DOCUMENT_ME

findCategoryByID

public Category findCategoryByID(java.lang.Integer id)
                          throws ModuleException
DOCUMENT_ME

Specified by:
findCategoryByID in interface ForumsModule
Parameters:
id - DOCUMENT_ME
Returns:
DOCUMENT_ME
Throws:
ModuleException - DOCUMENT_ME
java.lang.IllegalArgumentException - DOCUMENT_ME

findPosterByUserID

public Poster findPosterByUserID(java.lang.Integer userID)
                          throws ModuleException
DOCUMENT_ME

Specified by:
findPosterByUserID in interface ForumsModule
Parameters:
userName - DOCUMENT_ME
Returns:
DOCUMENT_ME
Throws:
ModuleException - DOCUMENT_ME
java.lang.IllegalArgumentException - DOCUMENT_ME

createPoster

public Poster createPoster(java.lang.Integer userId)
                    throws ModuleException
DOCUMENT_ME

Specified by:
createPoster in interface ForumsModule
Parameters:
userName - DOCUMENT_ME
Returns:
DOCUMENT_ME
Throws:
ModuleException - DOCUMENT_ME
java.lang.IllegalArgumentException - DOCUMENT_ME

findCategories

public java.util.List findCategories()
                              throws ModuleException
DOCUMENT_ME

Specified by:
findCategories in interface ForumsModule
Returns:
DOCUMENT_ME
Throws:
ModuleException - DOCUMENT_ME

findForums

public java.util.List findForums()
                          throws ModuleException
DOCUMENT_ME

Specified by:
findForums in interface ForumsModule
Returns:
DOCUMENT_ME
Throws:
ModuleException - DOCUMENT_ME

findForumsByCategoryID

public java.util.List findForumsByCategoryID(java.lang.Integer categoryId)
                                      throws ModuleException
DOCUMENT_ME

Specified by:
findForumsByCategoryID in interface ForumsModule
Parameters:
categoryId - DOCUMENT_ME
Returns:
DOCUMENT_ME
Throws:
ModuleException - DOCUMENT_ME

findAnnouncements

public java.util.List findAnnouncements(Forum forum)
                                 throws ModuleException
DOCUMENT_ME

Specified by:
findAnnouncements in interface ForumsModule
Parameters:
forum - DOCUMENT_ME
Returns:
DOCUMENT_ME
Throws:
ModuleException - DOCUMENT_ME

findTopicsAsc

public java.util.List findTopicsAsc(Forum forum,
                                    int type,
                                    int start,
                                    int perPage)
                             throws ModuleException
DOCUMENT_ME

Specified by:
findTopicsAsc in interface ForumsModule
Parameters:
forum - DOCUMENT_ME
type - DOCUMENT_ME
start - DOCUMENT_ME
perPage - DOCUMENT_ME
Returns:
DOCUMENT_ME
Throws:
ModuleException - DOCUMENT_ME

findTopicsDesc

public java.util.List findTopicsDesc(Forum forum,
                                     int type,
                                     int start,
                                     int perPage)
                              throws ModuleException
DOCUMENT_ME

Specified by:
findTopicsDesc in interface ForumsModule
Parameters:
forum - DOCUMENT_ME
type - DOCUMENT_ME
start - DOCUMENT_ME
perPage - DOCUMENT_ME
Returns:
DOCUMENT_ME
Throws:
ModuleException - DOCUMENT_ME

findTopicsBefore

public java.util.List findTopicsBefore(Forum forum,
                                       int type,
                                       int start,
                                       int perPage,
                                       java.util.Date date)
                                throws ModuleException
DOCUMENT_ME

Specified by:
findTopicsBefore in interface ForumsModule
Parameters:
forum - DOCUMENT_ME
type - DOCUMENT_ME
start - DOCUMENT_ME
perPage - DOCUMENT_ME
date - DOCUMENT_ME
Returns:
DOCUMENT_ME
Throws:
ModuleException - DOCUMENT_ME

createTopic

public Post createTopic(Forum forum,
                        Message message,
                        java.util.Date creationDate,
                        Poster poster)
                 throws ModuleException
DOCUMENT_ME

Specified by:
createTopic in interface ForumsModule
Parameters:
forum - DOCUMENT_ME
message - DOCUMENT_ME
creationDate - DOCUMENT_ME
poster - DOCUMENT_ME
Returns:
DOCUMENT_ME
Throws:
ModuleException - DOCUMENT_ME

createPost

public Post createPost(Topic topic,
                       Forum forum,
                       Message message,
                       java.util.Date creationDate,
                       Poster poster)
                throws ModuleException
DOCUMENT_ME

Specified by:
createPost in interface ForumsModule
Parameters:
topic - DOCUMENT_ME
forum - DOCUMENT_ME
message - DOCUMENT_ME
creationDate - DOCUMENT_ME
poster - DOCUMENT_ME
Returns:
DOCUMENT_ME
Throws:
ModuleException - DOCUMENT_ME

createCategory

public Category createCategory(java.lang.String name)
                        throws ModuleException
DOCUMENT_ME

Specified by:
createCategory in interface ForumsModule
Parameters:
name - DOCUMENT_ME
Returns:
DOCUMENT_ME
Throws:
ModuleException - DOCUMENT_ME

removeCategory

public void removeCategory(Category category)
                    throws ModuleException
DOCUMENT_ME

Specified by:
removeCategory in interface ForumsModule
Parameters:
category - DOCUMENT_ME
Throws:
ModuleException - DOCUMENT_ME

removeForum

public void removeForum(Forum forum)
                 throws ModuleException
DOCUMENT_ME

Specified by:
removeForum in interface ForumsModule
Parameters:
forum - DOCUMENT_ME
Throws:
ModuleException - DOCUMENT_ME

removePost

public void removePost(Post post)
                throws ModuleException
DOCUMENT_ME

Specified by:
removePost in interface ForumsModule
Parameters:
post - DOCUMENT_ME
Throws:
ModuleException - DOCUMENT_ME

removeTopic

public void removeTopic(Topic topic)
                 throws ModuleException
DOCUMENT_ME

Specified by:
removeTopic in interface ForumsModule
Parameters:
topic - DOCUMENT_ME
Throws:
ModuleException - DOCUMENT_ME

createForum

public Forum createForum(Category category,
                         java.lang.String name,
                         java.lang.String description)
                  throws ModuleException
DOCUMENT_ME

Specified by:
createForum in interface ForumsModule
Parameters:
category - DOCUMENT_ME
name - DOCUMENT_ME
description - DOCUMENT_ME
Returns:
DOCUMENT_ME
Throws:
ModuleException - DOCUMENT_ME

getSession

protected net.sf.hibernate.Session getSession()
Return the hibernate session. Testcase can overload this method to provide their own session.


findTopicByID

public Topic findTopicByID(java.lang.Integer id)
                    throws ModuleException
DOCUMENT_ME

Specified by:
findTopicByID in interface ForumsModule
Parameters:
id - DOCUMENT_ME
Returns:
DOCUMENT_ME
Throws:
ModuleException - DOCUMENT_ME
java.lang.IllegalArgumentException - DOCUMENT_ME

findPostByID

public Post findPostByID(java.lang.Integer id)
                  throws ModuleException
DOCUMENT_ME

Specified by:
findPostByID in interface ForumsModule
Parameters:
id - DOCUMENT_ME
Returns:
DOCUMENT_ME
Throws:
ModuleException - DOCUMENT_ME
java.lang.IllegalArgumentException - DOCUMENT_ME

addAllForums

public void addAllForums(Category source,
                         Category target)
DOCUMENT_ME

Specified by:
addAllForums in interface ForumsModule
Parameters:
source - DOCUMENT_ME
target - DOCUMENT_ME

findPostsByTopicIDAsc

public java.util.List findPostsByTopicIDAsc(java.lang.Integer topicId,
                                            int start,
                                            int limit)
                                     throws ModuleException
DOCUMENT_ME

Specified by:
findPostsByTopicIDAsc in interface ForumsModule
Parameters:
topicId - DOCUMENT_ME
start - DOCUMENT_ME
limit - DOCUMENT_ME
Returns:
DOCUMENT_ME
Throws:
ModuleException - DOCUMENT_ME

findPostsByTopicIDDesc

public java.util.List findPostsByTopicIDDesc(java.lang.Integer topicId,
                                             int start,
                                             int limit)
                                      throws ModuleException
DOCUMENT_ME

Specified by:
findPostsByTopicIDDesc in interface ForumsModule
Parameters:
topicId - DOCUMENT_ME
start - DOCUMENT_ME
limit - DOCUMENT_ME
Returns:
DOCUMENT_ME
Throws:
ModuleException - DOCUMENT_ME

findLastPostDateForUser

public java.util.Date findLastPostDateForUser(User user)
                                       throws ModuleException
DOCUMENT_ME

Specified by:
findLastPostDateForUser in interface ForumsModule
Parameters:
user - DOCUMENT_ME
Returns:
DOCUMENT_ME
Throws:
ModuleException - DOCUMENT_ME

findLastPost

public Post findLastPost(Forum forum)
                  throws ModuleException
DOCUMENT_ME

Specified by:
findLastPost in interface ForumsModule
Parameters:
forum - DOCUMENT_ME
Returns:
DOCUMENT_ME
Throws:
ModuleException - DOCUMENT_ME

findFirstPost

public Post findFirstPost(Topic topic)
                   throws ModuleException
DOCUMENT_ME

Specified by:
findFirstPost in interface ForumsModule
Parameters:
topic - DOCUMENT_ME
Returns:
DOCUMENT_ME
Throws:
ModuleException - DOCUMENT_ME

findLastPost

public Post findLastPost(Topic topic)
                  throws ModuleException
DOCUMENT_ME

Specified by:
findLastPost in interface ForumsModule
Parameters:
topic - DOCUMENT_ME
Returns:
DOCUMENT_ME
Throws:
ModuleException - DOCUMENT_ME

findForumWatchByUser

public java.util.List findForumWatchByUser(User user)
                                    throws ModuleException
DOCUMENT_ME

Specified by:
findForumWatchByUser in interface ForumsModule
Parameters:
user - DOCUMENT_ME
Returns:
DOCUMENT_ME
Throws:
ModuleException - DOCUMENT_ME

createForumWatch

public void createForumWatch(Poster poster,
                             Forum forum,
                             int mode)
                      throws ModuleException
DOCUMENT_ME

Specified by:
createForumWatch in interface ForumsModule
Parameters:
user - DOCUMENT_ME
forum - DOCUMENT_ME
mode - DOCUMENT_ME
Throws:
ModuleException - DOCUMENT_ME

removeForumWatch

public void removeForumWatch(ForumWatch watch)
                      throws ModuleException
DOCUMENT_ME

Specified by:
removeForumWatch in interface ForumsModule
Parameters:
watch - DOCUMENT_ME
Throws:
ModuleException - DOCUMENT_ME

findForumWatchByID

public ForumWatch findForumWatchByID(java.lang.Integer forumWatchId)
                              throws ModuleException
Specified by:
findForumWatchByID in interface ForumsModule
Returns:
Throws:
ModuleException

createTopicWatch

public void createTopicWatch(Poster poster,
                             Topic topic)
                      throws ModuleException
Specified by:
createTopicWatch in interface ForumsModule
Throws:
ModuleException

removeTopicWatch

public void removeTopicWatch(TopicWatch watch)
                      throws ModuleException
DOCUMENT_ME

Specified by:
removeTopicWatch in interface ForumsModule
Parameters:
watch - DOCUMENT_ME
Throws:
ModuleException - DOCUMENT_ME

findTopicWatchByID

public TopicWatch findTopicWatchByID(java.lang.Integer topicWatchId)
                              throws ModuleException
Specified by:
findTopicWatchByID in interface ForumsModule
Returns:
Throws:
ModuleException