[jboss-svn-commits] JBL Code SVN: r37939 - in labs/jbossforums/branches/forums130P27: forums/src/main/org/jboss/portlet/forums/feeds and 4 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Mon Mar 26 18:58:33 EDT 2012


Author: sviluppatorefico
Date: 2012-03-26 18:58:31 -0400 (Mon, 26 Mar 2012)
New Revision: 37939

Added:
   labs/jbossforums/branches/forums130P27/readme.txt
Modified:
   labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/feeds/FeedsServlet.java
   labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/BaseController.java
   labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/DownloadFilter.java
   labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/EmptyController.java
   labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/ForumUtil.java
   labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/PortalUtil.java
   labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/action/ActionController.java
   labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/action/AdminController.java
   labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/action/DeletePost.java
   labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/action/EditPost.java
   labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/action/ForumWatchController.java
   labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/action/ModeratorAction.java
   labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/action/NewTopic.java
   labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/action/PollController.java
   labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/action/PostAction.java
   labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/action/ReplyTopic.java
   labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/action/Search.java
   labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/action/SplitTopic.java
   labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/action/TopicWatchController.java
   labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/event/FloodControlListener.java
   labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/view/ViewAdminPanel.java
   labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/view/ViewCategory.java
   labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/view/ViewForum.java
   labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/view/ViewJumpbox.java
   labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/view/ViewMyForumsAllSubscribed.java
   labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/view/ViewMyForumsBase.java
   labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/view/ViewMyForumsEditAllForums.java
   labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/view/ViewMyForumsMain.java
   labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/view/ViewProfile.java
   labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/view/ViewSearch.java
   labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/view/ViewSummary.java
   labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/view/ViewTopic.java
Log:
This implementation allows the lookup of ejbs in jboss 5

Modified: labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/feeds/FeedsServlet.java
===================================================================
--- labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/feeds/FeedsServlet.java	2012-03-26 19:59:51 UTC (rev 37938)
+++ labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/feeds/FeedsServlet.java	2012-03-26 22:58:31 UTC (rev 37939)
@@ -365,7 +365,7 @@
 	private ForumsModule getForumsModule() {
 		if (forumsModule == null) {
 			try {
-			   forumsModule = BaseController.getForumsModule();
+			   forumsModule = BaseController.getForumsModule(null);
 			} catch (Exception ex) {
 				log.error(ex);
 			}

Modified: labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/BaseController.java
===================================================================
--- labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/BaseController.java	2012-03-26 19:59:51 UTC (rev 37938)
+++ labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/BaseController.java	2012-03-26 22:58:31 UTC (rev 37939)
@@ -31,78 +31,80 @@
 
 /**
  * @author <a href="mailto:sohil.shah at jboss.com">Sohil Shah</a>
- *
+ * 
  */
-public abstract class BaseController implements Serializable,Constants
-{
-    private static ForumsModule singleton = null;  
-    
-    private String mainPageName = ""; //bean=level configuration supplied by the forums-config.xml
-    private Map links = null;
-    
-    /**
+public abstract class BaseController implements Serializable, Constants {
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = -4481043447596826941L;
+
+	private static ForumsModule singleton = null;
+
+	private String mainPageName = ""; // bean=level configuration supplied by
+										// the forums-config.xml
+	private Map links = null;
+
+	/**
+	 * 
+	 * @return
+	 */
+	public String getMainPageName() {
+		return this.mainPageName;
+	}
+
+	/**
+	 * 
+	 * @param mainPageName
+	 */
+	public void setMainPageName(String mainPageName) {
+		this.mainPageName = mainPageName;
+	}
+
+	/**
      * 
-     * @return
-     */
-    public String getMainPageName()
-    {
-        return this.mainPageName;
-    }
-    
-    /**
-     * 
-     * @param mainPageName
-     */
-    public void setMainPageName(String mainPageName)
-    {
-        this.mainPageName = mainPageName;
-    }
-    
-    /**
-     * 
      *
      */
-    public Map getLinks()
-    {
-        return this.links;
-    }
-    
-    /**
+	public Map getLinks() {
+		return this.links;
+	}
+
+	/**
      * 
      *
      */
-    public void setLinks(Map links)
-    {
-        this.links = links;
-    }
-    
-    
-    /**
-     * 
-     * @author sshah
-     *
-     */
-    public BaseController()
-    {
-    }         
-        
-    /**
-     * 
-     * @author sshah
-     *
-     */
-    public boolean isAnonymous()
-    {
-        return JSFUtil.isAnonymous();
-    }     
-    
-    //------utility method to grab the forums module------------------------------------------------------------------------------------------
-    public static ForumsModule getForumsModule() throws Exception
-    {
-        if(BaseController.singleton==null)
-        {
-            BaseController.singleton = (ForumsModule)new InitialContext().lookup("jboss-forums/ForumsModuleImpl/local");
-        }
-        return BaseController.singleton;
-    }
+	public void setLinks(Map links) {
+		this.links = links;
+	}
+
+	/**
+	 * 
+	 * @author sshah
+	 * 
+	 */
+	public BaseController() {
+	}
+
+	/**
+	 * 
+	 * @author sshah
+	 * 
+	 */
+	public boolean isAnonymous() {
+		return JSFUtil.isAnonymous();
+	}
+
+	// ------utility method to grab the forums
+	// module------------------------------------------------------------------------------------------
+	public static ForumsModule getForumsModule(ForumsModule forumsModule)
+			throws Exception {
+		if (forumsModule == null) {
+			if (BaseController.singleton == null) {
+				BaseController.singleton = (ForumsModule) new InitialContext()
+						.lookup("jboss-forums/ForumsModuleImpl/local");
+			}
+			return BaseController.singleton;
+		} else
+			return forumsModule;
+	}
 }

Modified: labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/DownloadFilter.java
===================================================================
--- labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/DownloadFilter.java	2012-03-26 19:59:51 UTC (rev 37938)
+++ labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/DownloadFilter.java	2012-03-26 22:58:31 UTC (rev 37939)
@@ -44,9 +44,14 @@
 /**
  * @author sohil shah
  */
-public class DownloadFilter implements Filter 
+public class DownloadFilter extends BaseController implements Filter 
 {
 	
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = -2389279265281007580L;
+
 	@EJB(name="jboss-forums/ForumsModuleImpl/local")
     private ForumsModule forumsModule;  
 	
@@ -77,8 +82,7 @@
 	        if ((request instanceof HttpServletRequest)
 	                && (response instanceof HttpServletResponse)) 
 	        {
-	            HttpServletResponse httpResponse = (HttpServletResponse) response;
-	            HttpServletRequest httpRequest = (HttpServletRequest)request;	            
+	            HttpServletResponse httpResponse = (HttpServletResponse) response;      
 	            UserTransaction transaction = null;
 	            try
 	            {
@@ -87,7 +91,7 @@
 	                
 	                //get this attachment data
 	                int attachmentId = Integer.parseInt(request.getParameter("id"));
-	                Attachment attachment = forumsModule.findFindAttachmentById(attachmentId);
+	                Attachment attachment = getForumsModule(forumsModule).findFindAttachmentById(attachmentId);
 	 	       	 	       
 		 	       //set the attachment headers
 		           httpResponse.setContentLength((int)attachment.getFile().getSize());

Modified: labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/EmptyController.java
===================================================================
--- labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/EmptyController.java	2012-03-26 19:59:51 UTC (rev 37938)
+++ labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/EmptyController.java	2012-03-26 22:58:31 UTC (rev 37939)
@@ -29,6 +29,11 @@
 public class EmptyController extends BaseController
 {
     /**
+	 * 
+	 */
+	private static final long serialVersionUID = -1354549818352820599L;
+
+	/**
      * 
      * @author sshah
      *

Modified: labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/ForumUtil.java
===================================================================
--- labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/ForumUtil.java	2012-03-26 19:59:51 UTC (rev 37938)
+++ labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/ForumUtil.java	2012-03-26 22:58:31 UTC (rev 37939)
@@ -29,8 +29,6 @@
 import javax.faces.context.ExternalContext;
 import javax.faces.context.FacesContext;
 import javax.portlet.ActionRequest;
-import javax.portlet.PortletPreferences;
-import javax.portlet.PortletRequest;
 
 import org.jboss.portal.core.modules.ModuleException;
 import org.jboss.portlet.forums.ForumsModule;

Modified: labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/PortalUtil.java
===================================================================
--- labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/PortalUtil.java	2012-03-26 19:59:51 UTC (rev 37938)
+++ labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/PortalUtil.java	2012-03-26 22:58:31 UTC (rev 37939)
@@ -562,7 +562,7 @@
 
                 try
                 {
-                	BaseController.getForumsModule().processNotifications(
+                	BaseController.getForumsModule(null).processNotifications(
                             postId, type, postUrl, replyUrl);
                 } catch (Exception e)
                 {
@@ -782,7 +782,7 @@
             User user = PortalUtil.getUser();
 
             Object userId = user.getId();
-            poster = BaseController.getForumsModule().findPosterByUserId(
+            poster = BaseController.getForumsModule(null).findPosterByUserId(
                     userId.toString());
 
             if (poster == null)
@@ -803,7 +803,7 @@
         UserModule userModule = null;
         User user = null;
         
-        String guestUserName = BaseController.getForumsModule().getGuestUserName();
+        String guestUserName = BaseController.getForumsModule(null).getGuestUserName();
         
         UserTransaction ut = null;
         try
@@ -830,7 +830,7 @@
         }
         
         Long userId = (Long) user.getId();
-        poster = BaseController.getForumsModule().findPosterByUserId(
+        poster = BaseController.getForumsModule(null).findPosterByUserId(
                 String.valueOf(userId));
         
         if (poster == null) {
@@ -1010,7 +1010,7 @@
                 return null;
             }
             
-            Watch watch = BaseController.getForumsModule().findForumWatchByUserAndForum( user , forum.getId().intValue() );
+            Watch watch = BaseController.getForumsModule(null).findForumWatchByUserAndForum( user , forum.getId().intValue() );
             
             if (watch!=null)
             {

Modified: labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/action/ActionController.java
===================================================================
--- labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/action/ActionController.java	2012-03-26 19:59:51 UTC (rev 37938)
+++ labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/action/ActionController.java	2012-03-26 22:58:31 UTC (rev 37939)
@@ -31,4 +31,9 @@
  */
 public class ActionController extends BaseController
 {
+
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = -2393101304245726801L;
 }

Modified: labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/action/AdminController.java
===================================================================
--- labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/action/AdminController.java	2012-03-26 19:59:51 UTC (rev 37938)
+++ labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/action/AdminController.java	2012-03-26 22:58:31 UTC (rev 37939)
@@ -50,6 +50,10 @@
 public class AdminController extends ActionController 
 {
 	
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = -1977660655542809904L;
 	@EJB(name="jboss-forums/ForumsModuleImpl/local")
     private ForumsModule forumsModule;  
     //user preference controller
@@ -246,7 +250,7 @@
 	        {
 	            Category category = null;
 	            try {
-	                category = forumsModule.findCategoryById(categoryId);
+	                category = getForumsModule(forumsModule).findCategoryById(categoryId);
 	            } catch (ModuleException e) {
 	                // Category was deleted
 	            }
@@ -268,7 +272,7 @@
 	        {
                     Forum forum = null;
                     try {
-                        forum = forumsModule.findForumById(forumId);
+                        forum = getForumsModule(forumsModule).findForumById(forumId);
                     } catch (ModuleException e) {
                         // Forum was deleted
                     }
@@ -333,9 +337,9 @@
 	        }
             
             //add this new category to the forum instance
-            ForumInstance forumInstance = forumsModule.findForumInstanceById(forumInstanceId);
+            ForumInstance forumInstance = getForumsModule(forumsModule).findForumInstanceById(forumInstanceId);
             
-            forumsModule.createCategory(this.categoryName, forumInstance);
+            getForumsModule(forumsModule).createCategory(this.categoryName, forumInstance);
             // Luca Stancapiano end
             
             String start = JSFUtil.getBundleMessage("ResourceJSF","Category_created_0");
@@ -376,7 +380,7 @@
             }
 	        
             //grab the category from the module and set the title
-            Category category = forumsModule.findCategoryById(categoryId);
+            Category category = getForumsModule(forumsModule).findCategoryById(categoryId);
             category.setTitle(this.categoryName);
             
             String start = JSFUtil.getBundleMessage("ResourceJSF","Category_updated_0");
@@ -419,19 +423,19 @@
             }
 	        
            //grab the category from the module and set the title
-            Category source = forumsModule.findCategoryById(categoryId);
+            Category source = getForumsModule(forumsModule).findCategoryById(categoryId);
             
             if (this.selectedCategory!=-1) {
                 
-                Category target = forumsModule.findCategoryById(this.selectedCategory);
+                Category target = getForumsModule(forumsModule).findCategoryById(this.selectedCategory);
     	        
                 //move all the forums from source category to the selected target category
-                forumsModule.addAllForums(source,target);
+                getForumsModule(forumsModule).addAllForums(source,target);
                 
             }
             
             //remove the source category
-            forumsModule.removeCategory(source);
+            getForumsModule(forumsModule).removeCategory(source);
            
             String start = JSFUtil.getBundleMessage("ResourceJSF","Category_deleted_0");
             String end = JSFUtil.getBundleMessage("ResourceJSF","Category_deleted_1");
@@ -466,8 +470,8 @@
         try
         {
             //add this new forum to the category
-            Category category = forumsModule.findCategoryById(this.selectedCategory);
-            forumsModule.createForum(category,this.forumName,this.forumDescription);
+            Category category = getForumsModule(forumsModule).findCategoryById(this.selectedCategory);
+            getForumsModule(forumsModule).createForum(category,this.forumName,this.forumDescription);
             
             String start = JSFUtil.getBundleMessage("ResourceJSF","Forum_created_0");
             String end = JSFUtil.getBundleMessage("ResourceJSF","Forum_created_1");
@@ -508,8 +512,8 @@
             }
 	        
             //grab the forum from the module and set the proper information
-            Forum forum = forumsModule.findForumById(forumId);
-            Category selectedCategory = forumsModule.findCategoryById(this.selectedCategory);
+            Forum forum = getForumsModule(forumsModule).findForumById(forumId);
+            Category selectedCategory = getForumsModule(forumsModule).findCategoryById(this.selectedCategory);
             forum.setCategory((CategoryImpl)selectedCategory);
             forum.setName(this.forumName);
             forum.setDescription(this.forumDescription);
@@ -556,8 +560,8 @@
 	    //move all the topics/posts of this forum to the specified target forum
             if(this.selectedForum!=-1)
             {
-                source = forumsModule.findForumByIdFetchTopics(forumId);
-                Forum target = forumsModule.findForumByIdFetchTopics(selectedForum);
+                source = getForumsModule(forumsModule).findForumByIdFetchTopics(forumId);
+                Forum target = getForumsModule(forumsModule).findForumByIdFetchTopics(selectedForum);
                 target.getTopics().addAll(source.getTopics());
                 target.setPostCount(target.getPostCount() + source.getPostCount());
                 target.setTopicCount(target.getTopicCount() + source.getTopicCount());
@@ -570,12 +574,12 @@
                 //clear the source out before delete
                 source.setTopics(new ArrayList());
             } else {
-                source = forumsModule.findForumById(forumId);
+                source = getForumsModule(forumsModule).findForumById(forumId);
             }
             
             
             //means delete all topic/posts on this forum            
-            forumsModule.removeForum(source);
+            getForumsModule(forumsModule).removeForum(source);
 	        
             String start = JSFUtil.getBundleMessage("ResourceJSF","Forum_deleted_0");
             String end = JSFUtil.getBundleMessage("ResourceJSF","Forum_deleted_1");
@@ -616,7 +620,7 @@
 	            categoryId = Integer.parseInt(cour);
 	        }
 	        	        
-	        Category category = forumsModule.findCategoryById(categoryId);
+	        Category category = getForumsModule(forumsModule).findCategoryById(categoryId);
 	        category.setOrder(category.getOrder() + AdminController.up);
 	        
 	         // Luca Stancapiano start
@@ -628,7 +632,7 @@
 	        	forumInstanceId = Integer.parseInt(cour);
 	        }
 	         
-	        Iterator categories = forumsModule.findCategories(forumInstanceId).iterator();
+	        Iterator categories = getForumsModule(forumsModule).findCategories(forumInstanceId).iterator();
 	         // Luca Stancapiano end
 	        
 	        for (int index = 10; categories.hasNext(); index += 10)
@@ -661,7 +665,7 @@
 	            categoryId = Integer.parseInt(cour);
 	        }
 	        	        
-	        Category category = forumsModule.findCategoryById(categoryId);
+	        Category category = getForumsModule(forumsModule).findCategoryById(categoryId);
 	        category.setOrder(category.getOrder() + AdminController.down);
 	        
 	        // Luca Stancapiano start
@@ -673,7 +677,7 @@
 	        	forumInstanceId = Integer.parseInt(cour);
 	        }
 	         
-	        Iterator categories = forumsModule.findCategories(forumInstanceId).iterator();
+	        Iterator categories = getForumsModule(forumsModule).findCategories(forumInstanceId).iterator();
 	        // Luca Stancapiano end
 	        
 	        for (int index = 10; categories.hasNext(); index += 10)
@@ -706,9 +710,9 @@
 	            forumId = Integer.parseInt(cour);
 	        }
 	        	     
-	        Forum forum = forumsModule.findForumById(forumId);
+	        Forum forum = getForumsModule(forumsModule).findForumById(forumId);
 	        forum.setOrder(forum.getOrder() + AdminController.up);
-	        Iterator forums = forumsModule.findForumsByCategoryId(forum.getCategory().getId()).iterator();
+	        Iterator forums = getForumsModule(forumsModule).findForumsByCategoryId(forum.getCategory().getId()).iterator();
 	        for (int index = 10; forums.hasNext(); index += 10)
 	        {
 	            forum = (ForumImpl)forums.next();
@@ -739,9 +743,9 @@
 	            forumId = Integer.parseInt(cour);
 	        }
 	        	     
-	        Forum forum = forumsModule.findForumById(forumId);
+	        Forum forum = getForumsModule(forumsModule).findForumById(forumId);
 	        forum.setOrder(forum.getOrder() + AdminController.down);
-	        Iterator forums = forumsModule.findForumsByCategoryId(forum.getCategory().getId()).iterator();
+	        Iterator forums = getForumsModule(forumsModule).findForumsByCategoryId(forum.getCategory().getId()).iterator();
 	        for (int index = 10; forums.hasNext(); index += 10)
 	        {
 	            forum = (ForumImpl)forums.next();
@@ -770,7 +774,7 @@
                 forumId = Integer.parseInt(cour);
             }
                      
-            Forum forum = forumsModule.findForumById(forumId);
+            Forum forum = getForumsModule(forumsModule).findForumById(forumId);
             forum.setStatus(Constants.FORUM_LOCKED);
             String message = JSFUtil.getBundleMessage("ResourceJSF","Forum_locked");
             JSFUtil.setMessage(Constants.FEEDBACK,message);
@@ -802,7 +806,7 @@
                 forumId = Integer.parseInt(cour);
             }
                      
-            Forum forum = forumsModule.findForumById(forumId);
+            Forum forum = getForumsModule(forumsModule).findForumById(forumId);
             forum.setStatus(Constants.FORUM_UNLOCKED);
             String message = JSFUtil.getBundleMessage("ResourceJSF","Forum_unlocked");
             JSFUtil.setMessage(Constants.FEEDBACK,message);

Modified: labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/action/DeletePost.java
===================================================================
--- labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/action/DeletePost.java	2012-03-26 19:59:51 UTC (rev 37938)
+++ labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/action/DeletePost.java	2012-03-26 22:58:31 UTC (rev 37939)
@@ -101,7 +101,7 @@
         this.postId = postId;
         if (postId!=-1)
         {
-            post = (PostImpl)forumsModule.findPostById(postId);
+            post = (PostImpl)getForumsModule(forumsModule).findPostById(postId);
         }
     }
     
@@ -116,7 +116,7 @@
         {
 	        
 	        //setup the business objects/data of interest
-	        Post post = forumsModule.findPostById(postId);
+	        Post post = getForumsModule(forumsModule).findPostById(postId);
 	        TopicImpl topic = post.getTopic();
 	        ForumImpl forum = topic.getForum();
 	        
@@ -147,14 +147,14 @@
 	            // the watches
 	            // the poll
 	            // the links	            
-	        	forumsModule.removeTopic(post.getTopic());	 
+	        	getForumsModule(forumsModule).removeTopic(post.getTopic());	 
 	            
 	            //set the proper navigation state
 	            navState = Constants.TOPIC_DELETED;
 	         }
 	         else
 	         {
-	        	forumsModule.removePost(post);
+	        	 getForumsModule(forumsModule).removePost(post);
 	            topic.setReplies(topic.getReplies() - 1);
 	            forum.setPostCount(forum.getPostCount() - 1);	            
 	            if(isLastPost)

Modified: labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/action/EditPost.java
===================================================================
--- labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/action/EditPost.java	2012-03-26 19:59:51 UTC (rev 37938)
+++ labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/action/EditPost.java	2012-03-26 22:58:31 UTC (rev 37939)
@@ -97,7 +97,7 @@
 	            this.cleanup();
 	            
 	            //get the post from the module
-	            Post post = forumsModule.findPostById(postId);
+	            Post post = getForumsModule(forumsModule).findPostById(postId);
 	            TopicImpl topic = post.getTopic();
 	            
 	            //set the selected post's topic id
@@ -171,7 +171,7 @@
         try
         {	        	        
 	        //setup the business objects to be updated
-	        Post post = forumsModule.findPostById(this.postId);
+	        Post post = getForumsModule(forumsModule).findPostById(this.postId);
 	        TopicImpl topic = post.getTopic();
 	        	        
 	        //make sure this topic is not locked
@@ -226,7 +226,7 @@
                     poll.setLength(this.activeDuration);
                     poll.setOptions(localPollOptions);
                     validatePoll(poll);
-                    forumsModule.addPollToTopic(topic,poll);
+                    getForumsModule(forumsModule).addPollToTopic(topic,poll);
                 }
             }
             else
@@ -260,7 +260,7 @@
                     }
                     poll.setOptions(localPollOptions);
                                         
-                    forumsModule.addPollToTopic(topic,poll);                    
+                    getForumsModule(forumsModule).addPollToTopic(topic,poll);                    
                 }
                 else
                 {

Modified: labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/action/ForumWatchController.java
===================================================================
--- labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/action/ForumWatchController.java	2012-03-26 19:59:51 UTC (rev 37938)
+++ labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/action/ForumWatchController.java	2012-03-26 22:58:31 UTC (rev 37939)
@@ -43,6 +43,11 @@
 public class ForumWatchController extends ActionController 
 {
 	
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 701065663010513552L;
+
 	@EJB(name="jboss-forums/ForumsModuleImpl/local")
     private ForumsModule forumsModule;  
 	
@@ -146,7 +151,7 @@
             {
                 try
                 {
-                    this.forum = (ForumImpl)forumsModule.findForumById(this.selectedForum);
+                    this.forum = (ForumImpl)getForumsModule(forumsModule).findForumById(this.selectedForum);
                 } catch (Exception e)
                 {
                     JSFUtil.handleException(e);
@@ -158,7 +163,7 @@
             {
                 try
                 {
-                    this.forum = (ForumImpl)forumsModule.findForumById(selectedForum);
+                    this.forum = (ForumImpl)getForumsModule(forumsModule).findForumById(selectedForum);
                 } catch (Exception e)
                 {
                     JSFUtil.handleException(e);
@@ -218,11 +223,11 @@
 	        }
 	        
 	        //get the forum that must be activated for watching
-	        Forum forum = forumsModule.findForumById(forumId);
+	        Forum forum = getForumsModule(forumsModule).findForumById(forumId);
 	        	        
 	        
 	        //activate the watch for the selected forum
-	        forumsModule.createWatch(PortalUtil.getPoster(),forum,this.watchMode);
+	        getForumsModule(forumsModule).createWatch(PortalUtil.getPoster(),forum,this.watchMode);
             navState="success";
         }
         catch(Exception e)
@@ -255,14 +260,14 @@
                 if (f!=null && f.trim().length()>0)
                 {
                    int forumId = Integer.parseInt(f);
-                   ForumWatch forumWatch = forumsModule.findForumWatchByUserAndForum(PortalUtil.getUser(), forumId);
+                   ForumWatch forumWatch = getForumsModule(forumsModule).findForumWatchByUserAndForum(PortalUtil.getUser(), forumId);
                    watchId = forumWatch!=null ? forumWatch.getId().intValue() : -1;
                 }
             }
             
             if (watchId!=-1)
             {
-            	forumsModule.removeWatch(forumsModule.findForumWatchById(watchId));
+            	getForumsModule(forumsModule).removeWatch(getForumsModule(forumsModule).findForumWatchById(watchId));
             }
         }
         catch(Exception e)
@@ -300,7 +305,7 @@
         
         try
         {
-            ForumWatch forumWatch = forumsModule.findForumWatchByUserAndForum(PortalUtil.getUser(),this.selectedForum);
+            ForumWatch forumWatch = getForumsModule(forumsModule).findForumWatchByUserAndForum(PortalUtil.getUser(),this.selectedForum);
             forumWatch.setMode(watchMode);
             navState="success";
         } catch (Exception e)
@@ -337,7 +342,7 @@
     {
         try
         {
-            ForumWatch watch = forumsModule.findForumWatchByUserAndForum(PortalUtil.getUser(), selectedForum);
+            ForumWatch watch = getForumsModule(forumsModule).findForumWatchByUserAndForum(PortalUtil.getUser(), selectedForum);
             return watch!=null;
         } catch (Exception e)
         {

Modified: labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/action/ModeratorAction.java
===================================================================
--- labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/action/ModeratorAction.java	2012-03-26 19:59:51 UTC (rev 37938)
+++ labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/action/ModeratorAction.java	2012-03-26 22:58:31 UTC (rev 37939)
@@ -56,6 +56,11 @@
 public class ModeratorAction extends BaseController
 {
 	
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 557502988546166382L;
+
 	@EJB(name="jboss-forums/ForumsModuleImpl/local")
     private ForumsModule forumsModule;    
 	
@@ -158,8 +163,8 @@
                 try {   
                     if (value)
                     {
-                        Topic topic = forumsModule.findTopicById(topicId);
-                        forumsModule.removeTopic(topic);
+                        Topic topic = getForumsModule(forumsModule).findTopicById(topicId);
+                        getForumsModule(forumsModule).removeTopic(topic);
                     }
                 } catch(Exception e)
                 {
@@ -192,7 +197,7 @@
         }
         Forum forumDest=null;
         try {
-            forumDest = forumsModule.findForumById(new Integer(forum_to_id));
+            forumDest = getForumsModule(forumsModule).findForumById(new Integer(forum_to_id));
         } catch (Exception e) 
         {
             setWarnBundleMessage("ERR_INTERNAL");
@@ -203,7 +208,7 @@
         try {
             
             // Refreshing forum from which topics are going to be moved
-            this.forum = (ForumImpl)forumsModule.findForumById(forum.getId());
+            this.forum = (ForumImpl)getForumsModule(forumsModule).findForumById(forum.getId());
             
             while (it.hasNext()) 
             {
@@ -213,7 +218,7 @@
                 {
                     Topic topic = null;
                     try {   
-                        topic = forumsModule.findTopicById(topicId);
+                        topic = getForumsModule(forumsModule).findTopicById(topicId);
                     } catch(Exception e)
                     {
                         setWarnBundleMessage("ERR_INTERNAL");
@@ -257,7 +262,7 @@
                     try {   
                         if (value)
                         {
-                            Topic topic = forumsModule.findTopicById(topicId);
+                            Topic topic = getForumsModule(forumsModule).findTopicById(topicId);
                             topic.setStatus(Constants.TOPIC_LOCKED);
                         }
                     } catch(Exception e)
@@ -301,7 +306,7 @@
                     try {   
                         if (value)
                         {
-                            Topic topic = forumsModule.findTopicById(topicId);
+                            Topic topic = getForumsModule(forumsModule).findTopicById(topicId);
                             topic.setStatus(Constants.TOPIC_UNLOCKED);
                         }
                     } catch(Exception e)
@@ -404,7 +409,7 @@
              {
                  try
                  {
-                     list.add(forumsModule.findTopicById(topicId));
+                     list.add(getForumsModule(forumsModule).findTopicById(topicId));
                  }
                  catch (Exception e)
                  {
@@ -458,7 +463,7 @@
         checkboxes=new HashMap();
 
         // ForumsModule is stored as a final variable so that anonymous class could use it.
-        final ForumsModule fm = forumsModule;
+        final ForumsModule fm = getForumsModule(forumsModule);
 
         //grab the data to be displayed for this page
         if(forumId!=-1)

Modified: labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/action/NewTopic.java
===================================================================
--- labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/action/NewTopic.java	2012-03-26 19:59:51 UTC (rev 37938)
+++ labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/action/NewTopic.java	2012-03-26 22:58:31 UTC (rev 37939)
@@ -51,6 +51,10 @@
 public class NewTopic extends PostAction
 {     
 	
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = -4942677404675560696L;
 	@EJB(name="jboss-forums/ForumsModuleImpl/local")
     private ForumsModule forumsModule;  
 	
@@ -121,7 +125,7 @@
            message.setSubject(this.subject);
            
            //setup the forum and the corresponding poster
-           Forum forum = forumsModule.findForumById(this.forumId);
+           Forum forum = getForumsModule(forumsModule).findForumById(this.forumId);
            PosterImpl poster = (PosterImpl)PortalUtil.getPoster();
            
            //setup the poll related information
@@ -145,7 +149,7 @@
                                  
            //actually create the topic in this forum
            //use this method when poll and attachments are actually integrated
-           Post post = forumsModule.createTopic(
+           Post post = getForumsModule(forumsModule).createTopic(
 	           forum,
 	           message,
 	           new Date(),

Modified: labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/action/PollController.java
===================================================================
--- labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/action/PollController.java	2012-03-26 19:59:51 UTC (rev 37938)
+++ labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/action/PollController.java	2012-03-26 22:58:31 UTC (rev 37939)
@@ -43,6 +43,10 @@
 public class PollController extends ActionController 
 {
 	
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 5114581627888779169L;
 	@EJB(name="jboss-forums/ForumsModuleImpl/local")
     private ForumsModule forumsModule;  
     
@@ -73,7 +77,7 @@
 	                return null;
 	            }
 	            	            
-	            Topic topic = forumsModule.findTopicById(topicId);
+	            Topic topic = getForumsModule(forumsModule).findTopicById(topicId);
 	            PollImpl poll = topic.getPoll();
 	            PollOptionImpl selectedOption = (PollOptionImpl)poll.getOptions().get(voteIndex);
 	            PosterImpl poster = (PosterImpl)PortalUtil.getPoster();

Modified: labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/action/PostAction.java
===================================================================
--- labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/action/PostAction.java	2012-03-26 19:59:51 UTC (rev 37938)
+++ labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/action/PostAction.java	2012-03-26 22:58:31 UTC (rev 37939)
@@ -56,6 +56,11 @@
 public abstract class PostAction extends ActionController
 {
 	
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 295137515236191246L;
+
 	@EJB(name="jboss-forums/ForumsModuleImpl/local")
     private ForumsModule forumsModule;  
 	
@@ -695,7 +700,7 @@
     {
         PostImpl post = null;
         
-        post = (PostImpl)forumsModule.findPostById(new Integer(JSFUtil.getRequestParameter(Constants.p_postId)));
+        post = (PostImpl)getForumsModule(forumsModule).findPostById(new Integer(JSFUtil.getRequestParameter(Constants.p_postId)));
         
         return post;
     }

Modified: labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/action/ReplyTopic.java
===================================================================
--- labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/action/ReplyTopic.java	2012-03-26 19:59:51 UTC (rev 37938)
+++ labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/action/ReplyTopic.java	2012-03-26 22:58:31 UTC (rev 37939)
@@ -47,6 +47,11 @@
 public class ReplyTopic extends PostAction
 {
 	
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 6918238036659797067L;
+
 	@EJB(name="jboss-forums/ForumsModuleImpl/local")
     private ForumsModule forumsModule;  
     
@@ -98,13 +103,13 @@
             
             if (topicId==-1 && postId!=-1) {
                 // If topicId was not given and postId is available we get topicId from Post
-                Post post = forumsModule.findPostById((postId));
+                Post post = getForumsModule(forumsModule).findPostById((postId));
                 if (post!=null) {
                     topic = post.getTopic();
                     topicId = topic.getId().intValue();
                 }
             } else {
-                topic = forumsModule.findTopicById(topicId);
+                topic = getForumsModule(forumsModule).findTopicById(topicId);
             }
             
             if (forumId==-1 && topic!=null) {
@@ -150,7 +155,7 @@
 	        }
 	        
 	        //setup the quote information	        
-	        Post post = forumsModule.findPostById(postId);
+	        Post post = getForumsModule(forumsModule).findPostById(postId);
 	        PosterImpl poster = (PosterImpl)PortalUtil.getPoster();
 	        this.message = "["+Constants.QUOTE+"="+poster.getUser().getUserName()+"]"+post.getMessage().getText()+"[/"+Constants.QUOTE+"]";
         }
@@ -201,8 +206,8 @@
            message.setSubject(this.subject);
            
            //setup the forum and the corresponding poster
-           Forum forum = forumsModule.findForumById(this.forumId);
-           Topic topic = forumsModule.findTopicById(topicId);
+           Forum forum = getForumsModule(forumsModule).findForumById(this.forumId);
+           Topic topic = getForumsModule(forumsModule).findTopicById(topicId);
            PosterImpl poster = (PosterImpl)PortalUtil.getPoster();
            
            //make sure this topic is not locked
@@ -213,7 +218,7 @@
            }
            
            //actually post a reply to this topic in the forum
-           Post post = forumsModule.createPost(topic,
+           Post post = getForumsModule(forumsModule).createPost(topic,
 	           forum,
 	           message,
 	           new Date(),

Modified: labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/action/Search.java
===================================================================
--- labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/action/Search.java	2012-03-26 19:59:51 UTC (rev 37938)
+++ labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/action/Search.java	2012-03-26 22:58:31 UTC (rev 37939)
@@ -108,7 +108,7 @@
 	        	forumInstanceId = Integer.parseInt(cour);
 	        }
 	        
-            List<CategoryImpl> c = forumsModule.findCategories(forumInstanceId);
+            List<CategoryImpl> c = getForumsModule(forumsModule).findCategories(forumInstanceId);
             
             if (c != null) {
                 for (CategoryImpl category : c) {
@@ -140,7 +140,7 @@
 	        	forumInstanceId = Integer.parseInt(cour);
 	        }
 	        
-            List<ForumImpl> f = forumsModule.findForums(forumInstanceId);
+            List<ForumImpl> f = getForumsModule(forumsModule).findForums(forumInstanceId);
             
             if (f != null) {
                 for (ForumImpl forum : f) {

Modified: labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/action/SplitTopic.java
===================================================================
--- labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/action/SplitTopic.java	2012-03-26 19:59:51 UTC (rev 37938)
+++ labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/action/SplitTopic.java	2012-03-26 22:58:31 UTC (rev 37939)
@@ -51,6 +51,11 @@
  */
 public class SplitTopic extends BaseController {
 	
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = -1573920430742051428L;
+
 	@EJB(name="jboss-forums/ForumsModuleImpl/local")
     private ForumsModule forumsModule;    
 	
@@ -151,10 +156,10 @@
         
         try {
             
-            Forum destForum = forumsModule.findForumById(new Integer(toForumId));
+            Forum destForum = getForumsModule(forumsModule).findForumById(new Integer(toForumId));
             
             // Creating new topic in destination forum.
-            Topic newTopic = forumsModule.createTopic(destForum,
+            Topic newTopic = getForumsModule(forumsModule).createTopic(destForum,
                                     PortalUtil.getUser().getId().toString(),
                                     newTopicTitle, topic.getType());
                                     
@@ -262,10 +267,10 @@
         }
         try {
             
-            Forum destForum = forumsModule.findForumById(new Integer(toForumId));
+            Forum destForum = getForumsModule(forumsModule).findForumById(new Integer(toForumId));
             
             // Creating new topic in selected destination forum.
-            Topic newTopic = forumsModule.createTopic(destForum,
+            Topic newTopic = getForumsModule(forumsModule).createTopic(destForum,
                                     PortalUtil.getUser().getId().toString(),
                                     newTopicTitle, topic.getType());
                                     
@@ -273,7 +278,7 @@
             selectIt = checkboxes.keySet().iterator();
             Post movedPost=null;
             while (selectIt.hasNext()) {
-                movedPost = forumsModule.findPostById((Integer)selectIt.next());
+                movedPost = getForumsModule(forumsModule).findPostById((Integer)selectIt.next());
                 newTopic.addPost((PostImpl)movedPost);
             }
             
@@ -335,7 +340,7 @@
 
         //process the topic information
         if (topicId != -1) {
-            this.topic = (TopicImpl)forumsModule.findTopicById(topicId);
+            this.topic = (TopicImpl)getForumsModule(forumsModule).findTopicById(topicId);
         }
         if (checkboxes==null || checkboxes.size()!=topic.getPosts().size()) {
             checkboxes = new HashMap();

Modified: labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/action/TopicWatchController.java
===================================================================
--- labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/action/TopicWatchController.java	2012-03-26 19:59:51 UTC (rev 37938)
+++ labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/action/TopicWatchController.java	2012-03-26 22:58:31 UTC (rev 37939)
@@ -44,6 +44,11 @@
 public class TopicWatchController extends ActionController 
 {
 	
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 1444693287363025185L;
+
 	@EJB(name="jboss-forums/ForumsModuleImpl/local")
     private ForumsModule forumsModule;  
     
@@ -148,7 +153,7 @@
         {
             try
             {
-                this.topic = (TopicImpl)forumsModule.findTopicById(this.topicId);
+                this.topic = (TopicImpl)getForumsModule(forumsModule).findTopicById(this.topicId);
             } catch (Exception e)
             {
                 JSFUtil.handleException(e);
@@ -204,11 +209,11 @@
             }
             
             //get the topic that must be activated for watching
-            Topic topic = forumsModule.findTopicById(topicId);
+            Topic topic = getForumsModule(forumsModule).findTopicById(topicId);
                         
             
             //activate the watch for the selected topic
-            forumsModule.createWatch(PortalUtil.getPoster(),topic,this.watchType);
+            getForumsModule(forumsModule).createWatch(PortalUtil.getPoster(),topic,this.watchType);
             navState="success";
         }
         catch(Exception e)
@@ -230,9 +235,9 @@
         try
         {
             
-            TopicWatch watch = forumsModule.findTopicWatchByUserAndTopic(PortalUtil.getUser(),topicId);
+            TopicWatch watch = getForumsModule(forumsModule).findTopicWatchByUserAndTopic(PortalUtil.getUser(),topicId);
         
-            forumsModule.removeWatch(watch);
+            getForumsModule(forumsModule).removeWatch(watch);
             
         } catch (Exception e)
         {
@@ -255,7 +260,7 @@
         
         try
         {
-            TopicWatch topicWatch = forumsModule.findTopicWatchByUserAndTopic(PortalUtil.getUser(),this.topicId);
+            TopicWatch topicWatch = getForumsModule(forumsModule).findTopicWatchByUserAndTopic(PortalUtil.getUser(),this.topicId);
             topicWatch.setMode(watchType);
             navState="success";
         } catch (Exception e)
@@ -281,7 +286,7 @@
         try
         {
          
-            topicWatch = forumsModule.findTopicWatchByUserAndTopic(PortalUtil.getUser(),this.topicId);
+            topicWatch = getForumsModule(forumsModule).findTopicWatchByUserAndTopic(PortalUtil.getUser(),this.topicId);
             
         } catch (Exception e)
         {

Modified: labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/event/FloodControlListener.java
===================================================================
--- labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/event/FloodControlListener.java	2012-03-26 19:59:51 UTC (rev 37938)
+++ labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/event/FloodControlListener.java	2012-03-26 22:58:31 UTC (rev 37939)
@@ -41,7 +41,7 @@
         
         try 
         {
-            floodInterval = BaseController.getForumsModule().getFloodInterval();
+            floodInterval = BaseController.getForumsModule(null).getFloodInterval();
         } catch (Exception e) {
             e.printStackTrace();
         }
@@ -56,7 +56,7 @@
             User user = PortalUtil.getUser();
             
             if (user != null) {
-                Date lastPost = BaseController.getForumsModule().findLastPostDateForUser(user);
+                Date lastPost = BaseController.getForumsModule(null).findLastPostDateForUser(user);
             
                 if (lastPost != null)
                 {

Modified: labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/view/ViewAdminPanel.java
===================================================================
--- labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/view/ViewAdminPanel.java	2012-03-26 19:59:51 UTC (rev 37938)
+++ labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/view/ViewAdminPanel.java	2012-03-26 22:58:31 UTC (rev 37939)
@@ -39,6 +39,11 @@
 public class ViewAdminPanel extends BaseController
 {
 	
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 2921359509888139037L;
+
 	@EJB(name="jboss-forums/ForumsModuleImpl/local")
     private ForumsModule forumsModule;  
 	
@@ -96,7 +101,7 @@
     	        	forumInstanceId = Integer.parseInt(cour);
     	        }
                 
-                categories = forumsModule.findCategoriesFetchForums(forumInstanceId);    
+                categories = getForumsModule(forumsModule).findCategoriesFetchForums(forumInstanceId);    
                 // Luca Stancapiano end
                 
                 return categories;
@@ -129,7 +134,7 @@
     	        	forumInstanceId = Integer.parseInt(cour);
     	        }
                 
-                forums = forumsModule.findForums(forumInstanceId);  
+                forums = getForumsModule(forumsModule).findForums(forumInstanceId);  
                 // Luca Stancapiano end
                 
                 return forums;

Modified: labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/view/ViewCategory.java
===================================================================
--- labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/view/ViewCategory.java	2012-03-26 19:59:51 UTC (rev 37938)
+++ labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/view/ViewCategory.java	2012-03-26 22:58:31 UTC (rev 37939)
@@ -55,6 +55,10 @@
 public class ViewCategory extends BaseController
 { 
 	
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 5349549910762005145L;
 	@EJB(name="jboss-forums/ForumsModuleImpl/local")
     private ForumsModule forumsModule;  
     //user preference controller
@@ -117,7 +121,7 @@
     }
     
     public ForumsModule getModule () throws Exception {
-        return forumsModule;
+        return getForumsModule(forumsModule);
     }
     
             
@@ -244,7 +248,7 @@
 	        forumInstanceId = Integer.parseInt(cou);
 	     }
          
-         this.forumLastPosts = forumsModule.findLastPostsOfForums(forumInstanceId);
+         this.forumLastPosts = getForumsModule(forumsModule).findLastPostsOfForums(forumInstanceId);
          // Luca Stancapiano end
          
          //setup category related data to be displayed
@@ -252,7 +256,7 @@
          {    
              //process a default level category
         	 // Luca Stancapiano
-             Collection cour = forumsModule.findCategoriesFetchForums(forumInstanceId);
+             Collection cour = getForumsModule(forumsModule).findCategoriesFetchForums(forumInstanceId);
              if(cour!=null)
              {
                  Iterator iterator = cour.iterator();
@@ -266,7 +270,7 @@
          else
          {
              //process the specifed category 
-             CategoryImpl currentCategory = (CategoryImpl)forumsModule.findCategoryByIdFetchForums(categoryId);
+             CategoryImpl currentCategory = (CategoryImpl)getForumsModule(forumsModule).findCategoryByIdFetchForums(categoryId);
              if(currentCategory!=null)
              {
                  this.processCategory(currentCategory);

Modified: labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/view/ViewForum.java
===================================================================
--- labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/view/ViewForum.java	2012-03-26 19:59:51 UTC (rev 37938)
+++ labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/view/ViewForum.java	2012-03-26 22:58:31 UTC (rev 37939)
@@ -55,6 +55,11 @@
 public class ViewForum extends BaseController
 {   
 	
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = -1193917741044670669L;
+
 	@EJB(name="jboss-forums/ForumsModuleImpl/local")
     private ForumsModule forumsModule;  
 	
@@ -110,7 +115,7 @@
          }
          announcements = new ArrayList(); 
          try {
-             announcements = forumsModule.findTopicsDesc(forum,
+             announcements = getForumsModule(forumsModule).findTopicsDesc(forum,
                      Constants.POST_ANNOUNCE,
                      0,
                      Integer.MAX_VALUE);
@@ -135,7 +140,7 @@
          }
          boolean present = false;
          try {
-             announcements= forumsModule.findTopicsDesc(forum,
+             announcements= getForumsModule(forumsModule).findTopicsDesc(forum,
                      Constants.POST_ANNOUNCE,
                      0,
                      Integer.MAX_VALUE);
@@ -163,7 +168,7 @@
          stickyThreads = new ArrayList();
          try {
              //ForumsModule fm = this.getForumsModule();
-             stickyThreads = forumsModule.findTopicsDesc(forum,
+             stickyThreads = getForumsModule(forumsModule).findTopicsDesc(forum,
                              Constants.POST_STICKY,
                              0,
                              Integer.MAX_VALUE);
@@ -191,7 +196,7 @@
          }
          boolean present = false;
          try {
-             stickyThreads = forumsModule.findTopicsDesc(forum,
+             stickyThreads = getForumsModule(forumsModule).findTopicsDesc(forum,
                              Constants.POST_STICKY,
                              0,
                              Integer.MAX_VALUE);
@@ -294,7 +299,7 @@
          }
          
          // ForumsModule is stored as a final variable so that anonymous class could use it.
-         final ForumsModule fm = forumsModule;
+         final ForumsModule fm = getForumsModule(forumsModule);
          
          //grab the data to be displayed for this page
          if(forumId!=-1)

Modified: labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/view/ViewJumpbox.java
===================================================================
--- labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/view/ViewJumpbox.java	2012-03-26 19:59:51 UTC (rev 37938)
+++ labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/view/ViewJumpbox.java	2012-03-26 22:58:31 UTC (rev 37939)
@@ -38,6 +38,10 @@
 public class ViewJumpbox extends BaseController
 {
 	
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 2141380006506609949L;
 	@EJB(name="jboss-forums/ForumsModuleImpl/local")
     private ForumsModule forumsModule;  
     //user preference controller
@@ -88,7 +92,7 @@
     	        	forumInstanceId = Integer.parseInt(cour);
     	        }
                 
-                categories = forumsModule.findCategoriesFetchForums(forumInstanceId);
+                categories = getForumsModule(forumsModule).findCategoriesFetchForums(forumInstanceId);
                 // Luca Stancapiano end
                 
                 return categories;

Modified: labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/view/ViewMyForumsAllSubscribed.java
===================================================================
--- labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/view/ViewMyForumsAllSubscribed.java	2012-03-26 19:59:51 UTC (rev 37938)
+++ labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/view/ViewMyForumsAllSubscribed.java	2012-03-26 22:58:31 UTC (rev 37939)
@@ -38,6 +38,10 @@
 public class ViewMyForumsAllSubscribed extends ViewMyForumsBase
 {
 	
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = -722807880085740058L;
 	@EJB(name="jboss-forums/ForumsModuleImpl/local")
     private ForumsModule forumsModule;  
     //user preference controller
@@ -59,7 +63,7 @@
             }
             if (topicId != -1)
             {
-                watch = forumsModule.findTopicWatchByUserAndTopic(PortalUtil.getUser(),topicId);
+                watch = getForumsModule(forumsModule).findTopicWatchByUserAndTopic(PortalUtil.getUser(),topicId);
             }
         } catch (Exception e)
         {
@@ -134,7 +138,7 @@
     	        {
     	        	forumInstanceId = Integer.parseInt(cour);
     	        }
-                watchedTopics = forumsModule.findTopicWatchedByUser(PortalUtil.getUser(), forumInstanceId);
+                watchedTopics = getForumsModule(forumsModule).findTopicWatchedByUser(PortalUtil.getUser(), forumInstanceId);
                 // Luca Stancapiano end
                 
             } catch (Exception e)
@@ -162,7 +166,7 @@
     	        {
     	        	forumInstanceId = Integer.parseInt(cour);
     	        }
-                topicWatches = forumsModule.findTopicWatches(PortalUtil.getUser(), forumInstanceId);
+                topicWatches = getForumsModule(forumsModule).findTopicWatches(PortalUtil.getUser(), forumInstanceId);
                 // Luca Stancapiano end
                 
             } catch (Exception e)
@@ -181,9 +185,9 @@
         this.watchedTopics = watchedTopics;
     }
     
-    protected ForumsModule getMyForumsModule()
+    protected ForumsModule getMyForumsModule() throws Exception
     {
-        return forumsModule;
+        return getForumsModule(forumsModule);
     }
     
     // -------- Business logic ----------------------------------------------------------------------------------------------------------------

Modified: labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/view/ViewMyForumsBase.java
===================================================================
--- labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/view/ViewMyForumsBase.java	2012-03-26 19:59:51 UTC (rev 37938)
+++ labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/view/ViewMyForumsBase.java	2012-03-26 22:58:31 UTC (rev 37939)
@@ -179,6 +179,6 @@
         
     }
     
-    protected abstract ForumsModule getMyForumsModule();
+    protected abstract ForumsModule getMyForumsModule() throws Exception;
 
 }

Modified: labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/view/ViewMyForumsEditAllForums.java
===================================================================
--- labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/view/ViewMyForumsEditAllForums.java	2012-03-26 19:59:51 UTC (rev 37938)
+++ labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/view/ViewMyForumsEditAllForums.java	2012-03-26 22:58:31 UTC (rev 37939)
@@ -34,14 +34,19 @@
 import org.jboss.portlet.forums.impl.ForumImpl;
 import org.jboss.portlet.forums.impl.PostImpl;
 import org.jboss.portlet.forums.model.Watch;
+import org.jboss.portlet.forums.ui.BaseController;
 import org.jboss.portlet.forums.ui.Constants;
 import org.jboss.portlet.forums.ui.JSFUtil;
 import org.jboss.portlet.forums.ui.PortalUtil;
 import org.jboss.portlet.forums.ui.ThemeHelper;
 import org.jboss.portlet.forums.ui.action.PreferenceController;
 
-public class ViewMyForumsEditAllForums
+public class ViewMyForumsEditAllForums extends BaseController
 {
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = -7833189733125983452L;
 	@EJB(name="jboss-forums/ForumsModuleImpl/local")
     private ForumsModule forumsModule; 
     //user preference controller
@@ -130,7 +135,7 @@
     	        	forumInstanceId = Integer.parseInt(cour);
     	        }
                 
-                forumsLastPosts = forumsModule.findLastPostsOfForums(forumInstanceId);
+                forumsLastPosts = getForumsModule(forumsModule).findLastPostsOfForums(forumInstanceId);
                 // Luca Stancapiano end
                 
             } catch (Exception e)
@@ -182,7 +187,7 @@
     	        {
     	        	forumInstanceId = Integer.parseInt(cour);
     	        }
-                watchedForums = forumsModule.findForumWatchedByUser(PortalUtil.getUser(), forumInstanceId);
+                watchedForums = getForumsModule(forumsModule).findForumWatchedByUser(PortalUtil.getUser(), forumInstanceId);
                 // Luca Stancapiano end
                 
             } catch (Exception e)
@@ -278,7 +283,7 @@
 	        {
 	        	forumInstanceId = Integer.parseInt(cour);
 	        }
-            this.forumWatches = forumsModule.findForumWatches(PortalUtil.getUser(), forumInstanceId);
+            this.forumWatches = getForumsModule(forumsModule).findForumWatches(PortalUtil.getUser(), forumInstanceId);
             // Luca Stancapiano end
             
         } catch (Exception e)
@@ -324,7 +329,7 @@
             }
             if (forumId != -1)
             {
-                watch = forumsModule.findForumWatchByUserAndForum(PortalUtil.getUser(),forumId);
+                watch = getForumsModule(forumsModule).findForumWatchByUserAndForum(PortalUtil.getUser(),forumId);
             }
         } catch (Exception e)
         {

Modified: labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/view/ViewMyForumsMain.java
===================================================================
--- labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/view/ViewMyForumsMain.java	2012-03-26 19:59:51 UTC (rev 37938)
+++ labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/view/ViewMyForumsMain.java	2012-03-26 22:58:31 UTC (rev 37939)
@@ -41,6 +41,10 @@
 
 public class ViewMyForumsMain extends ViewMyForumsBase
 {
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = -6587070080682393388L;
 	@EJB(name="jboss-forums/ForumsModuleImpl/local")
     private ForumsModule forumsModule;  
     //user preference controller
@@ -92,7 +96,7 @@
     	        {
     	        	forumInstanceId = Integer.parseInt(cour);
     	        }
-                watchedTopics = forumsModule.
+                watchedTopics = getForumsModule(forumsModule).
                 findTopicWatchedByUser(PortalUtil.getUser(),lastLoginDate, forumInstanceId);
                 // Luca Stancapiano end
                 
@@ -129,7 +133,7 @@
     	        {
     	        	forumInstanceId = Integer.parseInt(cour);
     	        }
-                watchedForums = forumsModule.findForumWatchedByUser(PortalUtil.getUser(), forumInstanceId);
+                watchedForums = getForumsModule(forumsModule).findForumWatchedByUser(PortalUtil.getUser(), forumInstanceId);
                 // Luca Stancapiano end
                 
             } catch (Exception e)
@@ -190,7 +194,7 @@
     	        	forumInstanceId = Integer.parseInt(cour);
     	        }
                 
-                forumsLastPosts = forumsModule.findLastPostsOfForums(forumInstanceId);
+                forumsLastPosts = getForumsModule(forumsModule).findLastPostsOfForums(forumInstanceId);
                 // Luca Stancapiano end
                 
             } catch (Exception e)
@@ -273,9 +277,9 @@
         }
     }
     
-    protected ForumsModule getMyForumsModule()
+    protected ForumsModule getMyForumsModule() throws Exception
     {
-        return forumsModule;
+        return getForumsModule(forumsModule);
     }
     
 }

Modified: labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/view/ViewProfile.java
===================================================================
--- labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/view/ViewProfile.java	2012-03-26 19:59:51 UTC (rev 37938)
+++ labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/view/ViewProfile.java	2012-03-26 22:58:31 UTC (rev 37939)
@@ -37,6 +37,11 @@
  */
 public class ViewProfile extends BaseController
 {
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 2028734088051699739L;
+
 	@EJB(name="jboss-forums/ForumsModuleImpl/local")
     private ForumsModule forumsModule;  
 
@@ -80,7 +85,7 @@
       String userId = ForumUtil.getParameter(Constants.p_userId);
       if(userId!=null && !userId.trim().equals(""))
       {
-          this.poster = (PosterImpl)forumsModule.findPosterByUserId(userId);
+          this.poster = (PosterImpl)getForumsModule(forumsModule).findPosterByUserId(userId);
       }  
     }
 

Modified: labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/view/ViewSearch.java
===================================================================
--- labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/view/ViewSearch.java	2012-03-26 19:59:51 UTC (rev 37938)
+++ labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/view/ViewSearch.java	2012-03-26 22:58:31 UTC (rev 37939)
@@ -28,6 +28,7 @@
 import java.util.Map;
 
 import javax.ejb.EJB;
+import javax.naming.InitialContext;
 
 import org.jboss.portlet.forums.ForumsModule;
 import org.jboss.portlet.forums.impl.PostImpl;
@@ -44,188 +45,189 @@
 import org.jboss.portlet.forums.ui.action.Search;
 
 public class ViewSearch extends BaseController {
-	
-	@EJB(name="jboss-forums/ForumsModuleImpl/local")
-    private ForumsModule forumsModule;  
-	@EJB(name="jboss-forums/ForumsSearchModuleImpl/local")
-    private ForumsSearchModule forumsSearchModule;  
 
-    private static final long serialVersionUID = 1L;
-    
-    /**
-     * user preference related data
-     */
-    private PreferenceController userPreferences = null;
-    
-    private List<PostImpl> posts;
-    
-    private List<TopicImpl> topics;
-    
-    private Map topicLastPosts = null;
-    
-    private Search search;
-    
-    private PageNavigator pageNavigator = null;
-    
-	public List<PostImpl> getPosts()
-	{
-        return posts;
-    }
-	
-	public List<TopicImpl> getTopics() 
-	{
-	    return topics;
+	@EJB(name = "jboss-forums/ForumsModuleImpl/local")
+	private ForumsModule forumsModule;
+	@EJB(name = "jboss-forums/ForumsSearchModuleImpl/local")
+	private ForumsSearchModule forumsSearchModule;
+
+	private static final long serialVersionUID = 1L;
+
+	/**
+	 * user preference related data
+	 */
+	private PreferenceController userPreferences = null;
+
+	private List<PostImpl> posts;
+
+	private List<TopicImpl> topics;
+
+	private Map topicLastPosts = null;
+
+	private Search search;
+
+	private PageNavigator pageNavigator = null;
+
+	public List<PostImpl> getPosts() {
+		return posts;
 	}
 
-    public Map getTopicLastPosts() 
-    {
-        if(this.topicLastPosts==null)
-        {
-            this.topicLastPosts = new HashMap();
-        }
-        return this.topicLastPosts;
-    }
-	
-    public Search getSearch()
-    {
-        return search;
-    }
+	public List<TopicImpl> getTopics() {
+		return topics;
+	}
 
-    public void setSearch(Search search)
-    {
-        this.search = search;
-    }
-    
-    public PageNavigator getPageNavigator()
-    {
-        return this.pageNavigator;
-    }
-    
-    //------------user preferences-------------------------------------------------------------------------------------------------------------
-    /**
-     * @return Returns the userPreferences.
-     */
-    public PreferenceController getUserPreferences() 
-    {
-        return userPreferences;
-    }
-    /**
-     * @param userPreferences The userPreferences to set.
-     */
-    public void setUserPreferences(PreferenceController userPreferences) 
-    {
-        this.userPreferences = userPreferences;    
-    }      
-    //-------------------------------------------------------------------------------------------------------------------------------------                
+	public Map getTopicLastPosts() {
+		if (this.topicLastPosts == null) {
+			this.topicLastPosts = new HashMap();
+		}
+		return this.topicLastPosts;
+	}
 
-    public boolean isInitialized()
-    {
-       boolean initialized = false;
-       try
-       { 
-           this.execute();
-           initialized = true;
-       }
-       catch(Exception e)
-       {
-           JSFUtil.handleException(e);
-       }
-       return initialized;
-    }
+	public Search getSearch() {
+		return search;
+	}
 
-    public boolean isDisplayAsTopics()
-    {
-        String displayAs = search.getSearchCriteria().getDisplayAs();
-        
-        if (displayAs.equals(DisplayAs.TOPICS.name())) {
-            return true;
-        }
-        
-        return false;
-    }
-    
-    @SuppressWarnings("unchecked")
-    private void execute() throws Exception
-    {
-        
-        String page = ForumUtil.getParameter(Constants.p_page);
-        
-        int currentPage = 0;
-        if (page != null && page.trim().length() > 0) {
-            //setup the page data
-            currentPage = Integer.parseInt(page);
-        }
-        
-        SearchCriteria criteria = search.getSearchCriteria();
-        
-        if (criteria != null) {
-            
-            criteria.setPageSize(Integer.valueOf(this.userPreferences.getPreference(Constants.POSTS_TOPIC_KEY)));
-            criteria.setPageNumber(currentPage);
+	public void setSearch(Search search) {
+		this.search = search;
+	}
 
-            if (criteria.getDisplayAs().equals(DisplayAs.POSTS.name())) {
-                
-                ResultPage<PostImpl> resultPage = forumsSearchModule.findPosts(criteria);
-            
-                posts = resultPage.getPage();
+	public PageNavigator getPageNavigator() {
+		return this.pageNavigator;
+	}
 
-                if (posts != null && posts.isEmpty())
-                    posts = null;
-                
-                this.pageNavigator =
-                    new PageNavigator(resultPage.getResultSize(),
-                                      criteria.getPageSize(),
-                                      currentPage) {
-        
-                        protected Collection<PostImpl> initializePage() {
-                            
-                            int beginIndex = this.getBeginIndex();
-                            int totalEntries = this.getNumberOfEntries();
-                                
-                            //reset the page navigation if the start cursor is outside the range (both forward and backward)
-                            if (beginIndex >= totalEntries || beginIndex < 0)
-                            {
-                                this.setCurrentPage(0); //go to the first page
-                                beginIndex = this.getBeginIndex();
-                            }
-                                
-                            return getPosts();
-                        }
-                    };
-            } else {
-                
-                ResultPage<TopicImpl> resultPage = forumsSearchModule.findTopics(criteria);
-                
-                topics = resultPage.getPage();
-                
-                if (topics != null && topics.isEmpty()) {
-                    topics = null;
-                } else {
-                    topicLastPosts = forumsModule.findLastPostsOfTopics(topics);
-                }
-                
-                this.pageNavigator =
-                    new PageNavigator(resultPage.getResultSize(),
-                                      criteria.getPageSize(),
-                                      currentPage) {
-        
-                        protected Collection<TopicImpl> initializePage() {
-                            
-                            int beginIndex = this.getBeginIndex();
-                            int totalEntries = this.getNumberOfEntries();
-                                
-                            //reset the page navigation if the start cursor is outside the range (both forward and backward)
-                            if (beginIndex >= totalEntries || beginIndex < 0)
-                            {
-                                this.setCurrentPage(0); //go to the first page
-                                beginIndex = this.getBeginIndex();
-                            }
-                                
-                            return getTopics();
-                        }
-                    };
-            }
-        }
-    }
-	
+	// ------------user
+	// preferences-------------------------------------------------------------------------------------------------------------
+	/**
+	 * @return Returns the userPreferences.
+	 */
+	public PreferenceController getUserPreferences() {
+		return userPreferences;
+	}
+
+	/**
+	 * @param userPreferences
+	 *            The userPreferences to set.
+	 */
+	public void setUserPreferences(PreferenceController userPreferences) {
+		this.userPreferences = userPreferences;
+	}
+
+	// -------------------------------------------------------------------------------------------------------------------------------------
+
+	public boolean isInitialized() {
+		boolean initialized = false;
+		try {
+			this.execute();
+			initialized = true;
+		} catch (Exception e) {
+			JSFUtil.handleException(e);
+		}
+		return initialized;
+	}
+
+	public boolean isDisplayAsTopics() {
+		String displayAs = search.getSearchCriteria().getDisplayAs();
+
+		if (displayAs.equals(DisplayAs.TOPICS.name())) {
+			return true;
+		}
+
+		return false;
+	}
+
+	@SuppressWarnings("unchecked")
+	private void execute() throws Exception {
+
+		String page = ForumUtil.getParameter(Constants.p_page);
+
+		int currentPage = 0;
+		if (page != null && page.trim().length() > 0) {
+			// setup the page data
+			currentPage = Integer.parseInt(page);
+		}
+
+		SearchCriteria criteria = search.getSearchCriteria();
+
+		if (criteria != null) {
+
+			criteria.setPageSize(Integer.valueOf(this.userPreferences
+					.getPreference(Constants.POSTS_TOPIC_KEY)));
+			criteria.setPageNumber(currentPage);
+
+			if (criteria.getDisplayAs().equals(DisplayAs.POSTS.name())) {
+
+				ResultPage<PostImpl> resultPage = getForumsSearchModule(forumsSearchModule)
+						.findPosts(criteria);
+
+				posts = resultPage.getPage();
+
+				if (posts != null && posts.isEmpty())
+					posts = null;
+
+				this.pageNavigator = new PageNavigator(
+						resultPage.getResultSize(), criteria.getPageSize(),
+						currentPage) {
+
+					protected Collection<PostImpl> initializePage() {
+
+						int beginIndex = this.getBeginIndex();
+						int totalEntries = this.getNumberOfEntries();
+
+						// reset the page navigation if the start cursor is
+						// outside the range (both forward and backward)
+						if (beginIndex >= totalEntries || beginIndex < 0) {
+							this.setCurrentPage(0); // go to the first page
+							beginIndex = this.getBeginIndex();
+						}
+
+						return getPosts();
+					}
+				};
+			} else {
+
+				ResultPage<TopicImpl> resultPage = getForumsSearchModule(forumsSearchModule)
+						.findTopics(criteria);
+
+				topics = resultPage.getPage();
+
+				if (topics != null && topics.isEmpty()) {
+					topics = null;
+				} else {
+					topicLastPosts = getForumsModule(forumsModule)
+							.findLastPostsOfTopics(topics);
+				}
+
+				this.pageNavigator = new PageNavigator(
+						resultPage.getResultSize(), criteria.getPageSize(),
+						currentPage) {
+
+					protected Collection<TopicImpl> initializePage() {
+
+						int beginIndex = this.getBeginIndex();
+						int totalEntries = this.getNumberOfEntries();
+
+						// reset the page navigation if the start cursor is
+						// outside the range (both forward and backward)
+						if (beginIndex >= totalEntries || beginIndex < 0) {
+							this.setCurrentPage(0); // go to the first page
+							beginIndex = this.getBeginIndex();
+						}
+
+						return getTopics();
+					}
+				};
+			}
+		}
+	}
+
+	private ForumsSearchModule getForumsSearchModule(
+			ForumsSearchModule forumsSearchModule) throws Exception {
+		if (forumsSearchModule == null) {
+			forumsSearchModule = (ForumsSearchModule) new InitialContext()
+					.lookup("jboss-forums/ForumsSearchModuleImpl/local");
+			return forumsSearchModule;
+		} else
+			return forumsSearchModule;
+	}
+
 }

Modified: labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/view/ViewSummary.java
===================================================================
--- labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/view/ViewSummary.java	2012-03-26 19:59:51 UTC (rev 37938)
+++ labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/view/ViewSummary.java	2012-03-26 22:58:31 UTC (rev 37939)
@@ -44,6 +44,10 @@
  */
 public class ViewSummary extends BaseController
 { 
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 6950361977869824L;
 	@EJB(name="jboss-forums/ForumsModuleImpl/local")
     private ForumsModule forumsModule;  
     //user preference controller
@@ -179,8 +183,8 @@
         	forumInstanceId = Integer.parseInt(cour);
         }
         
-        if (forumsModule.findForumInstanceById(forumInstanceId) == null) 
-        	forumsModule.createForumInstance(forumInstanceId, "by_manual_preferences");
+        if (getForumsModule(forumsModule).findForumInstanceById(forumInstanceId) == null) 
+        	getForumsModule(forumsModule).createForumInstance(forumInstanceId, "by_manual_preferences");
         
         // Luca Stancapiano end
         
@@ -191,16 +195,16 @@
         	  to take only categories of a specific forum instance 
            */
            case Constants.BLOCK_TOPICS_MODE_HOT_TOPICS:              
-              this.topics = forumsModule.findTopicsHot(summaryTopicReplies,summaryTopicLimit,forumInstanceId);
+              this.topics = getForumsModule(forumsModule).findTopicsHot(summaryTopicReplies,summaryTopicLimit,forumInstanceId);
               break;
            case Constants.BLOCK_TOPICS_MODE_HOTTEST_TOPICS:              
-        	  this.topics = forumsModule.findTopicsHottest(time,summaryTopicLimit,forumInstanceId);
+        	  this.topics = getForumsModule(forumsModule).findTopicsHottest(time,summaryTopicLimit,forumInstanceId);
         	  break;
            case Constants.BLOCK_TOPICS_MODE_LATEST_POSTS:
-        	  this.topics = forumsModule.findTopicsByLatestPosts(summaryTopicLimit,forumInstanceId);
+        	  this.topics = getForumsModule(forumsModule).findTopicsByLatestPosts(summaryTopicLimit,forumInstanceId);
         	  break;
            case Constants.BLOCK_TOPICS_MODE_MOST_VIEWED:              
-        	  this.topics = forumsModule.findTopicsMostViewed(time,summaryTopicLimit,forumInstanceId);
+        	  this.topics = getForumsModule(forumsModule).findTopicsMostViewed(time,summaryTopicLimit,forumInstanceId);
         	  break;              
            // Luca Stancapiano end
         }

Modified: labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/view/ViewTopic.java
===================================================================
--- labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/view/ViewTopic.java	2012-03-26 19:59:51 UTC (rev 37938)
+++ labs/jbossforums/branches/forums130P27/forums/src/main/org/jboss/portlet/forums/ui/view/ViewTopic.java	2012-03-26 22:58:31 UTC (rev 37939)
@@ -48,6 +48,10 @@
  */
 public class ViewTopic extends BaseController
 {
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 5205743830388129653L;
 	@EJB(name="jboss-forums/ForumsModuleImpl/local")
     private ForumsModule forumsModule;  
     /**
@@ -226,14 +230,14 @@
         
         if (p != null && p.trim().length() > 0) {
             postId = new Integer(p);
-            Post post = forumsModule.findPostById(postId);
+            Post post = getForumsModule(forumsModule).findPostById(postId);
             topicId = post.getTopic().getId().intValue();
             this.topic = post.getTopic();
             List postIds = null;
             if (postOrder.compareToIgnoreCase("ascending")==0) {
-                postIds = forumsModule.findPostIdsAsc(this.topic,0,Integer.MAX_VALUE);
+                postIds = getForumsModule(forumsModule).findPostIdsAsc(this.topic,0,Integer.MAX_VALUE);
             } else {
-                postIds = forumsModule.findPostIdsDesc(this.topic,0,Integer.MAX_VALUE);
+                postIds = getForumsModule(forumsModule).findPostIdsDesc(this.topic,0,Integer.MAX_VALUE);
             }
             int counter = 0;
             Iterator it = postIds.iterator();
@@ -248,7 +252,7 @@
         }
 
         // ForumsModule is stored as a final variable so that anonymous class could use it.
-        final ForumsModule fm = forumsModule;
+        final ForumsModule fm = getForumsModule(forumsModule);
 
         //process the topic information
         if (topicId != -1) {

Added: labs/jbossforums/branches/forums130P27/readme.txt
===================================================================
--- labs/jbossforums/branches/forums130P27/readme.txt	                        (rev 0)
+++ labs/jbossforums/branches/forums130P27/readme.txt	2012-03-26 22:58:31 UTC (rev 37939)
@@ -0,0 +1,4 @@
+Forums need picketlink as identity manager. To install it follow the steps:
+
+1- take thirdparty/picketlink/lib/*.jar and put in the lib directory of the application server. 
+In jboss 5/6 you are forced to put it in /server/$conf/lib
\ No newline at end of file


Property changes on: labs/jbossforums/branches/forums130P27/readme.txt
___________________________________________________________________
Added: svn:mime-type
   + text/plain



More information about the jboss-svn-commits mailing list