roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snoopd...@apache.org
Subject svn commit: r519122 - in /incubator/roller/branches/roller_4.0_newbackend/apps/planet: src/java/org/apache/roller/planet/business/datamapper/ src/java/org/apache/roller/planet/business/jpa/ src/java/org/apache/roller/planet/ui/admin/struts2/ test/java/...
Date Fri, 16 Mar 2007 20:12:40 GMT
Author: snoopdave
Date: Fri Mar 16 13:12:38 2007
New Revision: 519122

URL: http://svn.apache.org/viewvc?view=rev&rev=519122
Log:
Ensure many-to-many relationships are maintained on both sides

Modified:
    incubator/roller/branches/roller_4.0_newbackend/apps/planet/src/java/org/apache/roller/planet/business/datamapper/DatamapperPlanetImpl.java
    incubator/roller/branches/roller_4.0_newbackend/apps/planet/src/java/org/apache/roller/planet/business/jpa/JPAPlanetManagerImpl.java
    incubator/roller/branches/roller_4.0_newbackend/apps/planet/src/java/org/apache/roller/planet/ui/admin/struts2/PlanetGroupForm.java
    incubator/roller/branches/roller_4.0_newbackend/apps/planet/src/java/org/apache/roller/planet/ui/admin/struts2/PlanetSubscriptionForm.java
    incubator/roller/branches/roller_4.0_newbackend/apps/planet/test/java/org/apache/roller/planet/business/EntryFunctionalTests.java
    incubator/roller/branches/roller_4.0_newbackend/apps/planet/test/java/org/apache/roller/planet/business/SubscriptionFunctionalTests.java

Modified: incubator/roller/branches/roller_4.0_newbackend/apps/planet/src/java/org/apache/roller/planet/business/datamapper/DatamapperPlanetImpl.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_4.0_newbackend/apps/planet/src/java/org/apache/roller/planet/business/datamapper/DatamapperPlanetImpl.java?view=diff&rev=519122&r1=519121&r2=519122
==============================================================================
--- incubator/roller/branches/roller_4.0_newbackend/apps/planet/src/java/org/apache/roller/planet/business/datamapper/DatamapperPlanetImpl.java
(original)
+++ incubator/roller/branches/roller_4.0_newbackend/apps/planet/src/java/org/apache/roller/planet/business/datamapper/DatamapperPlanetImpl.java
Fri Mar 16 13:12:38 2007
@@ -25,6 +25,7 @@
 import org.apache.roller.planet.business.PlanetManager;
 import org.apache.roller.business.datamapper.DatamapperPersistenceStrategy;
 import org.apache.roller.planet.business.PropertiesManager;
+import org.apache.roller.planet.business.datamapper.jpa.JPAPlanetManagerImpl;
 
 /**
  * A Datamapper specific implementation of the Roller business layer.
@@ -81,7 +82,7 @@
 
     protected PlanetManager createDatamapperPlanetManager(
             DatamapperPersistenceStrategy strategy) {
-        return new DatamapperPlanetManagerImpl(strategy);
+        return new JPAPlanetManagerImpl(strategy);
     }    
     
     /**

Modified: incubator/roller/branches/roller_4.0_newbackend/apps/planet/src/java/org/apache/roller/planet/business/jpa/JPAPlanetManagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_4.0_newbackend/apps/planet/src/java/org/apache/roller/planet/business/jpa/JPAPlanetManagerImpl.java?view=diff&rev=519122&r1=519121&r2=519122
==============================================================================
--- incubator/roller/branches/roller_4.0_newbackend/apps/planet/src/java/org/apache/roller/planet/business/jpa/JPAPlanetManagerImpl.java
(original)
+++ incubator/roller/branches/roller_4.0_newbackend/apps/planet/src/java/org/apache/roller/planet/business/jpa/JPAPlanetManagerImpl.java
Fri Mar 16 13:12:38 2007
@@ -289,17 +289,17 @@
             int size = 0;
             sb.append("SELECT e FROM PlanetEntryData e ");
             sb.append("JOIN e.subscription.groups g ");
-            params.add(size++, group);
-            sb.append("WHERE g = ?").append(size);
+            params.add(size++, group.getHandle());
+            sb.append("WHERE g.handle = ?").append(size);
             if (startDate != null) {
                 params.add(size++, startDate);
-                sb.append("AND e.pubTime > ?").append(size);
+                sb.append(" AND e.pubTime > ?").append(size);
             }
             if (endDate != null) {
                 params.add(size++, endDate);
-                sb.append("AND e.pubTime < :?").append(size);
+                sb.append(" AND e.pubTime < :?").append(size);
             }
-            sb.append("ORDER BY e.pubTime DESC");
+            sb.append(" ORDER BY e.pubTime DESC");
             
             Query query = strategy.getDynamicQuery(sb.toString());
             for (int i=0; i<params.size(); i++) {

Modified: incubator/roller/branches/roller_4.0_newbackend/apps/planet/src/java/org/apache/roller/planet/ui/admin/struts2/PlanetGroupForm.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_4.0_newbackend/apps/planet/src/java/org/apache/roller/planet/ui/admin/struts2/PlanetGroupForm.java?view=diff&rev=519122&r1=519121&r2=519122
==============================================================================
--- incubator/roller/branches/roller_4.0_newbackend/apps/planet/src/java/org/apache/roller/planet/ui/admin/struts2/PlanetGroupForm.java
(original)
+++ incubator/roller/branches/roller_4.0_newbackend/apps/planet/src/java/org/apache/roller/planet/ui/admin/struts2/PlanetGroupForm.java
Fri Mar 16 13:12:38 2007
@@ -115,6 +115,7 @@
                 } else {
                     PlanetGroupData group = getGroup();
                     group.getSubscriptions().remove(sub);
+                    sub.getGroups().remove(group);
                     pmgr.saveGroup(group);
                     PlanetFactory.getPlanet().flush();
                 }

Modified: incubator/roller/branches/roller_4.0_newbackend/apps/planet/src/java/org/apache/roller/planet/ui/admin/struts2/PlanetSubscriptionForm.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_4.0_newbackend/apps/planet/src/java/org/apache/roller/planet/ui/admin/struts2/PlanetSubscriptionForm.java?view=diff&rev=519122&r1=519121&r2=519122
==============================================================================
--- incubator/roller/branches/roller_4.0_newbackend/apps/planet/src/java/org/apache/roller/planet/ui/admin/struts2/PlanetSubscriptionForm.java
(original)
+++ incubator/roller/branches/roller_4.0_newbackend/apps/planet/src/java/org/apache/roller/planet/ui/admin/struts2/PlanetSubscriptionForm.java
Fri Mar 16 13:12:38 2007
@@ -96,6 +96,7 @@
                 
                 // add the sub to the group
                 group.getSubscriptions().add(this.subscription);
+                this.subscription.getGroups().add(group);
                 pMgr.saveGroup(group);
                 
             } else {

Modified: incubator/roller/branches/roller_4.0_newbackend/apps/planet/test/java/org/apache/roller/planet/business/EntryFunctionalTests.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_4.0_newbackend/apps/planet/test/java/org/apache/roller/planet/business/EntryFunctionalTests.java?view=diff&rev=519122&r1=519121&r2=519122
==============================================================================
--- incubator/roller/branches/roller_4.0_newbackend/apps/planet/test/java/org/apache/roller/planet/business/EntryFunctionalTests.java
(original)
+++ incubator/roller/branches/roller_4.0_newbackend/apps/planet/test/java/org/apache/roller/planet/business/EntryFunctionalTests.java
Fri Mar 16 13:12:38 2007
@@ -55,7 +55,11 @@
         
         // now associate both subscriptions with the test group
         testGroup1.getSubscriptions().add(testSub1);
+        testSub1.getGroups().add(testGroup1);
+        
         testGroup1.getSubscriptions().add(testSub2);
+        testSub2.getGroups().add(testGroup1);
+        
         PlanetFactory.getPlanet().getPlanetManager().saveGroup(testGroup1);
         PlanetFactory.getPlanet().flush();
         

Modified: incubator/roller/branches/roller_4.0_newbackend/apps/planet/test/java/org/apache/roller/planet/business/SubscriptionFunctionalTests.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_4.0_newbackend/apps/planet/test/java/org/apache/roller/planet/business/SubscriptionFunctionalTests.java?view=diff&rev=519122&r1=519121&r2=519122
==============================================================================
--- incubator/roller/branches/roller_4.0_newbackend/apps/planet/test/java/org/apache/roller/planet/business/SubscriptionFunctionalTests.java
(original)
+++ incubator/roller/branches/roller_4.0_newbackend/apps/planet/test/java/org/apache/roller/planet/business/SubscriptionFunctionalTests.java
Fri Mar 16 13:12:38 2007
@@ -88,18 +88,28 @@
         
         // add
         group.getSubscriptions().add(sub1);
+        sub1.getGroups().add(group);
+
         group.getSubscriptions().add(sub2);
+        sub2.getGroups().add(group);
+        
         planet.saveGroup(group);
         TestUtils.endSession(true);
         
         // verify
         group = null;
         group = planet.getGroupById(testGroup1.getId());
+        sub1 = planet.getSubscriptionById(testSub1.getId());
+        sub2 = planet.getSubscriptionById(testSub2.getId());
         assertEquals(2, group.getSubscriptions().size());
         
         // remove
         group.getSubscriptions().remove(sub1);
+        sub1.getGroups().remove(group);
+        
         group.getSubscriptions().remove(sub2);
+        sub2.getGroups().remove(group);
+
         planet.saveGroup(group);
         TestUtils.endSession(true);
         



Mime
View raw message