[jboss-jira] [JBoss JIRA] Created: (JBFORUMS-245) implementation for multiple forums

Luca Stancapiano (JIRA) jira-events at lists.jboss.org
Sun Jun 24 17:14:52 EDT 2007


implementation for multiple forums
----------------------------------

                 Key: JBFORUMS-245
                 URL: http://jira.jboss.com/jira/browse/JBFORUMS-245
             Project: JBoss Forums
          Issue Type: Patch
          Components: Forum Model Layer, Forum Test Suite
    Affects Versions: 1.0.1 GA
         Environment: eclipse 3.2.2 , jboss as 4.0.5_cp_04, jboss portal taken from http://anonsvn.jboss.org/repos/portal/trunk since 9 jun 2007, jboss forums taken from http://anonsvn.labs.jboss.com/labs/jbossforums/branches/forums101P26 since 23 jun 2007
            Reporter: Luca Stancapiano
         Assigned To: Ryszard Kozmik
             Fix For: 1.0.1 GA


hi....I have a patch to use multiple forums into the portal.... updates are many because I added an argument in several method. The principal update is to add a jbp_forums_instances table that contains
the instance for the forum and a field jbp_id that represents the instance. You can to add a new forum directly by web adding a preference from portlet instances form of portal. The new forum is represented by a foruminstanceid preference. It is a number that identify a forum. If two instances of forum has the same foruminstanceid , then they are equals, while if those preferences are different , then the forums are different and they will get different categories, forums, topics ...etc etc.  I describe my update in steps:

STEP 1: DATABASE AND HIBERNATE
1 - added a table called jbp_forums_instances managed through hibernate through interface ForumInstance and class ForumInstanceImpl as for  the other tables in the forums
2 - added a field into jbp_forums_categories called jbp_forum_instance_id , that it tie in a one-to-many relation to jbp_forums_instances table and updated Category interface and CategoryImplClass
3 - updated src/resources/setup/setup.sql with the updates over mentioned
4 - updated src/resources/portal-forums-sar/conf/hibernate/setup.txt with the updates over mentioned
5 - updated src/resources/portal-forums-sar/conf/hibernate/hibernate.cfg.xml adding the creation of ForumInstance object into database

STEP 2 - PREFERENCES
1 - updated src/resources/portal-forums-war/WEB-INF/portlet.xml adding foruminstanceid preference to configure through web into portlet instances of portal

STEP 3 - METHODS
1 - updated findTopics, findTopicsHot, ,findTopicsByLatestPosts , findTopicsHottest, findTopicsMostViewed, findPosts, ,findCategories , findCategoriesFetchForums, findForums, createCategory, findLastPostsOfForums, findForumWatchByUser, findForumWatchedByUser, findTopicWatchedByUser, findTopicWatches and findForumWatches methods into  src/main/org/jboss/portlet/forums/ForumsModule.java and src/main/org/jboss/portlet/forums/impl/ForumsModuleImpl.java to use forumInstanceId argument
2 - created findForumInstanceById, createForumInstance, removeForumInstance into src/main/org/jboss/portlet/forums/ForumsModule.java and src/main/org/jboss/portlet/forums/impl/ForumsModuleImpl.java to manage ForumInstance objects

STEP 4 - TEST
1 - updated src/main/org/jboss/portlet/test/forums/CategoryModelTestCase.java to use new updates for methods
2 - updated src/main/org/jboss/portlet/test/forums/ForumModelTestCase.java to use new updates for methods
3 - updated src/main/org/jboss/portlet/test/forums/TopicModelTestCase.java to use new updates for methods
4 - updated src/main/org/jboss/portlet/test/forums/PostModelTestCase.java to use new updates for methods

SETP 5 - ACTIONS
1- added getPreferences method into src/main/org/jboss/portlet/forums/ui/FormUtil.java. This method is similar to getPreferences of PortalUtil class but it let to get the preferences also for an anonymous user:

          public static String getPreference(String preferenceKey)
    {
        String preference = null;

        Object o = FacesContext.getCurrentInstance().getExternalContext()
                .getRequest();
        if (o instanceof PortletRequest)
        {
            PortletRequest request = (PortletRequest) o;
            PortletPreferences pp = request.getPreferences();
            preference = pp.getValue(preferenceKey, "");
        }

        return preference;
    }

2 - updated all actions and views  that need to get foruminstanceid to query and insert forum objects. 

    Updated actions are: 

             addCategory, moveCategoryDown and moveCategoryUp methods of src/main/org/jboss/portlet/forums/ui/action/AdminController.java
    
     Updated views are:

            getCategories and getForums methods of src/main/org/jboss/portlet/forums/ui/view/ViewAdminPanel.java
            execute method of src/main/org/jboss/portlet/forums/ui/view/ViewCategory.java
            getCategories method of src/main/org/jboss/portlet/forums/ui/view/ViewJumpbox.java
            getWatchedTopics and getTopicWatches methods of src/main/org/jboss/portlet/forums/ui/view/ViewMyForumsAllSubscrived.java
           getForumsLastPosts, execute and getWatchedForums methods of src/main/org/jboss/portlet/forums/ui/view/ViewMyForumsEditAllForums.java
           getWatchedTopics, getForumsLastPosts and getWatchedForums methods of src/main/org/jboss/portlet/forums/ui/view/ViewMyForumsMain.java
           loadDefaultTopics method of src/main/org/jboss/portlet/forums/ui/view/ViewSummary.java

3 - all methods use a FORUM_INSTANCE_ID constant declared into src/main/org/jboss/portlet/forums/ui/Constants.java to call foruminstanceid preferemce
 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list