[jboss-svn-commits] JBL Code SVN: r28973 - in labs/jbosslabs/labs-3.0-build/integration/cs-nfm/trunk/src/main: resources and 1 other directory.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Tue Aug 18 09:01:17 EDT 2009


Author: lkrzyzanek
Date: 2009-08-18 09:01:16 -0400 (Tue, 18 Aug 2009)
New Revision: 28973

Modified:
   labs/jbosslabs/labs-3.0-build/integration/cs-nfm/trunk/src/main/java/org/jboss/labs/clearspace/plugin/nfm/DbNukesForumsManager.java
   labs/jbosslabs/labs-3.0-build/integration/cs-nfm/trunk/src/main/resources/communities.properties
   labs/jbosslabs/labs-3.0-build/integration/cs-nfm/trunk/src/main/resources/spring.xml
Log:
Added handling of sub-sub-community creation.

Modified: labs/jbosslabs/labs-3.0-build/integration/cs-nfm/trunk/src/main/java/org/jboss/labs/clearspace/plugin/nfm/DbNukesForumsManager.java
===================================================================
--- labs/jbosslabs/labs-3.0-build/integration/cs-nfm/trunk/src/main/java/org/jboss/labs/clearspace/plugin/nfm/DbNukesForumsManager.java	2009-08-18 12:34:58 UTC (rev 28972)
+++ labs/jbosslabs/labs-3.0-build/integration/cs-nfm/trunk/src/main/java/org/jboss/labs/clearspace/plugin/nfm/DbNukesForumsManager.java	2009-08-18 13:01:16 UTC (rev 28973)
@@ -820,31 +820,52 @@
     }
     Set<CommunityDefBean> communities = loadCommunityLayout(layoutDef);
     for (CommunityDefBean communityDef : communities) {
-      log.info("Create community: " + communityDef.getName());
-      Community projectCommunity = communityManager.createCommunity(
-          communityDef.getName(), communityDef.getDisplayName(), communityDef
-              .getDescription());
-      // add project - forums mappings
-      for (Long forumID : communityDef.getForumIDs()) {
-        nukesForumsMappingDAO.saveForumMapping(forumID, projectCommunity
-            .getID());
-      }
+      Community projectCommunity = createCommunity(null, communityDef);
 
       for (CommunityDefBean communitySubDef : communityDef
           .getSubCommunityDefBeans()) {
-        Community subCommunity = communityManager.createCommunity(
-            projectCommunity, communitySubDef.getName(), communitySubDef
-                .getDisplayName(), communitySubDef.getDescription());
+        Community subCommunity = createCommunity(projectCommunity,
+            communitySubDef);
 
-        // add subproject - forums mappings
-        for (Long forumID : communitySubDef.getForumIDs()) {
-          nukesForumsMappingDAO.saveForumMapping(forumID, subCommunity.getID());
+        for (CommunityDefBean communitySubSubDef : communitySubDef
+            .getSubCommunityDefBeans()) {
+          createCommunity(subCommunity, communitySubSubDef);
+
         }
       }
     }
     flushCache(NukesForumsManager.CacheName.FORUM);
   }
+  
+  /**
+   * Create community based on community definition
+   * 
+   * @param parentCommunity
+   *          parent community or null
+   * @param communityDef
+   * @return created CS community
+   */
+  private Community createCommunity(Community parentCommunity,
+      CommunityDefBean communityDef) {
+    log.info("Create community: " + communityDef.getName());
 
+    Community community;
+    if (parentCommunity == null) {
+      community = communityManager.createCommunity(communityDef.getName(),
+          communityDef.getDisplayName(), communityDef.getDescription());
+    } else {
+      community = communityManager.createCommunity(parentCommunity,
+          communityDef.getName(), communityDef.getDisplayName(), communityDef
+              .getDescription());
+    }
+
+    // add subproject - forums mappings
+    for (Long forumID : communityDef.getForumIDs()) {
+      nukesForumsMappingDAO.saveForumMapping(forumID, community.getID());
+    }
+    return community;
+  }
+
   protected Set<CommunityDefBean> loadCommunityLayout(Properties layoutDef) {
     Set<CommunityDefBean> communities = new LinkedHashSet<CommunityDefBean>();
     final String rootPrefix = "community.";

Modified: labs/jbosslabs/labs-3.0-build/integration/cs-nfm/trunk/src/main/resources/communities.properties
===================================================================
--- labs/jbosslabs/labs-3.0-build/integration/cs-nfm/trunk/src/main/resources/communities.properties	2009-08-18 12:34:58 UTC (rev 28972)
+++ labs/jbosslabs/labs-3.0-build/integration/cs-nfm/trunk/src/main/resources/communities.properties	2009-08-18 13:01:16 UTC (rev 28973)
@@ -4,7 +4,8 @@
 # community.x.desc=  Description
 # community.x.forumIDs= ID's of Nukes forums that will be migrated to this communities i.e. 1,2,3,4
 
-# community.x.y Is sub community
+# community.x.y   Is sub community
+# community.x.y.z Is sub sub community
 
 community.1.name=JBoss AS
 community.1.dname=jboss-as
@@ -14,7 +15,12 @@
 community.1.1.dname=dev
 community.1.1.desc=
 community.1.1.forumIDs=
+community.1.1.1.name=Design of the JBoss EJB Container
+community.1.1.1.dname=ejbcontainer
+community.1.1.1.desc=
+community.1.1.1.forumIDs=166
 
+
 community.2.name=Portal
 community.2.dname=portal
 community.2.desc=

Modified: labs/jbosslabs/labs-3.0-build/integration/cs-nfm/trunk/src/main/resources/spring.xml
===================================================================
--- labs/jbosslabs/labs-3.0-build/integration/cs-nfm/trunk/src/main/resources/spring.xml	2009-08-18 12:34:58 UTC (rev 28972)
+++ labs/jbosslabs/labs-3.0-build/integration/cs-nfm/trunk/src/main/resources/spring.xml	2009-08-18 13:01:16 UTC (rev 28973)
@@ -50,7 +50,6 @@
   <bean id="nukesUserManager"
     class="org.jboss.labs.clearspace.plugin.nfm.DbNukesUserManager">
     <property name="userManager" ref="userManagerImpl" />
-    <property name="userDetailsService" ref="jiveUserDetailsService" />
     <property name="profileManager" ref="profileManagerImpl" />
     <property name="profileFieldManager" ref="profileFieldManagerImpl" />
     <property name="nukesForumsDAO" ref="nukesForumsDAO" />



More information about the jboss-svn-commits mailing list