roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agillil...@apache.org
Subject svn commit: r512378 - in /incubator/roller/trunk/apps/planet: src/java/org/apache/roller/planet/business/ src/java/org/apache/roller/planet/business/hibernate/ src/java/org/apache/roller/planet/pojos/ src/java/org/apache/roller/planet/tasks/ test/java/...
Date Tue, 27 Feb 2007 20:18:50 GMT
Author: agilliland
Date: Tue Feb 27 12:18:49 2007
New Revision: 512378

URL: http://svn.apache.org/viewvc?view=rev&rev=512378
Log:
Changing the behavior of the relationship between subscriptions and their entries to not use
Hibernate's "all-delete-orphan" functionality.  This includes a few changes ...

1. created a new deleteEntries(subscription) method in planet manager.

2. removed the subscription.purgeEntries() method.

3. replaced calls to subscription.purgeEntries() with calls to planetManager.deleteEntries(subscription).



Modified:
    incubator/roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/PlanetManager.java
    incubator/roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/hibernate/HibernatePlanetManagerImpl.java
    incubator/roller/trunk/apps/planet/src/java/org/apache/roller/planet/pojos/PlanetSubscriptionData.java
    incubator/roller/trunk/apps/planet/src/java/org/apache/roller/planet/tasks/TechnoratiRankingsTask.java
    incubator/roller/trunk/apps/planet/test/java/org/apache/roller/planet/business/PlanetManagerTest.java

Modified: incubator/roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/PlanetManager.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/PlanetManager.java?view=diff&rev=512378&r1=512377&r2=512378
==============================================================================
--- incubator/roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/PlanetManager.java
(original)
+++ incubator/roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/PlanetManager.java
Tue Feb 27 12:18:49 2007
@@ -171,6 +171,16 @@
     /** Delete entry. */
     public void deleteEntry(PlanetEntryData entry) throws RollerException;
     
+    
+    /**
+     * Delete all entries for a subscription.
+     *
+     * @param subscription The subscription to delete entries from.
+     * @throws RollerException If there is a problem doing the delete.
+     */
+    public void deleteEntries(PlanetSubscriptionData sub) throws RollerException;
+    
+    
     /** Clear any aggregations and update times that have been cached */
     public void clearCachedAggregations();
     

Modified: incubator/roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/hibernate/HibernatePlanetManagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/hibernate/HibernatePlanetManagerImpl.java?view=diff&rev=512378&r1=512377&r2=512378
==============================================================================
--- incubator/roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/hibernate/HibernatePlanetManagerImpl.java
(original)
+++ incubator/roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/hibernate/HibernatePlanetManagerImpl.java
Tue Feb 27 12:18:49 2007
@@ -102,6 +102,19 @@
         strategy.remove(entry);
     }
     
+    
+    public void deleteEntries(PlanetSubscriptionData sub) 
+        throws RollerException {
+        Iterator entries = sub.getEntries().iterator();
+        while(entries.hasNext()) {
+            strategy.remove(entries.next());
+        }
+        
+        // make sure and clear the other side of the assocation
+        sub.getEntries().clear();
+    }
+    
+    
     public void deletePlanet(PlanetData planet) 
         throws RollerException {
         strategy.remove(planet);
@@ -440,8 +453,8 @@
         FeedFetcherCache feedInfoCache =
                 new DiskFeedInfoCache(cacheDirName);
         
-        String proxyHost = PlanetRuntimeConfig.getProperty("site.proxyHost");
-        int proxyPort = PlanetRuntimeConfig.getIntProperty("site.proxyPort");
+        String proxyHost = PlanetRuntimeConfig.getProperty("site.proxyhost");
+        int proxyPort = PlanetRuntimeConfig.getIntProperty("site.proxyport");
         if (proxyHost != null && proxyPort > 0) {
             System.setProperty("proxySet", "true");
             System.setProperty("http.proxyHost", proxyHost);
@@ -472,7 +485,7 @@
             
             log.debug("   Entry count: " + count);
             if (count > 0) {
-                sub.purgeEntries();
+                this.deleteEntries(sub);
                 sub.addEntries(newEntries);
                 this.saveSubscription(sub);
                 this.strategy.flush();

Modified: incubator/roller/trunk/apps/planet/src/java/org/apache/roller/planet/pojos/PlanetSubscriptionData.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/apps/planet/src/java/org/apache/roller/planet/pojos/PlanetSubscriptionData.java?view=diff&rev=512378&r1=512377&r2=512378
==============================================================================
--- incubator/roller/trunk/apps/planet/src/java/org/apache/roller/planet/pojos/PlanetSubscriptionData.java
(original)
+++ incubator/roller/trunk/apps/planet/src/java/org/apache/roller/planet/pojos/PlanetSubscriptionData.java
Tue Feb 27 12:18:49 2007
@@ -218,7 +218,7 @@
     }
     
     /** 
-     * @hibernate.bag lazy="true" inverse="true" cascade="all-delete-orphan" 
+     * @hibernate.bag lazy="true" inverse="true" cascade="all" 
      * @hibernate.collection-key column="subscription_id"
      * @hibernate.collection-one-to-many class="org.apache.roller.planet.pojos.PlanetEntryData"
      */
@@ -248,8 +248,4 @@
         this.getEntries().addAll(newEntries);
     }
     
-    public void purgeEntries()
-    {
-        this.getEntries().clear();
-    }
 }

Modified: incubator/roller/trunk/apps/planet/src/java/org/apache/roller/planet/tasks/TechnoratiRankingsTask.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/apps/planet/src/java/org/apache/roller/planet/tasks/TechnoratiRankingsTask.java?view=diff&rev=512378&r1=512377&r2=512378
==============================================================================
--- incubator/roller/trunk/apps/planet/src/java/org/apache/roller/planet/tasks/TechnoratiRankingsTask.java
(original)
+++ incubator/roller/trunk/apps/planet/src/java/org/apache/roller/planet/tasks/TechnoratiRankingsTask.java
Tue Feb 27 12:18:49 2007
@@ -51,8 +51,8 @@
             PlanetManager planet = PlanetFactory.getPlanet().getPlanetManager();
             Technorati technorati = null;
             try {
-                String proxyHost = PlanetRuntimeConfig.getProperty("site.proxyHost");
-                int proxyPort = PlanetRuntimeConfig.getIntProperty("site.proxyPort");
+                String proxyHost = PlanetRuntimeConfig.getProperty("site.proxyhost");
+                int proxyPort = PlanetRuntimeConfig.getIntProperty("site.proxyport");
                 if (proxyHost != null && proxyPort != -1) {
                     technorati = new Technorati(proxyHost, proxyPort);
                 } else {

Modified: incubator/roller/trunk/apps/planet/test/java/org/apache/roller/planet/business/PlanetManagerTest.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/apps/planet/test/java/org/apache/roller/planet/business/PlanetManagerTest.java?view=diff&rev=512378&r1=512377&r2=512378
==============================================================================
--- incubator/roller/trunk/apps/planet/test/java/org/apache/roller/planet/business/PlanetManagerTest.java
(original)
+++ incubator/roller/trunk/apps/planet/test/java/org/apache/roller/planet/business/PlanetManagerTest.java
Tue Feb 27 12:18:49 2007
@@ -177,8 +177,7 @@
         {
             // purge entries
             PlanetSubscriptionData sub = planet.getSubscription("test_url");
-            sub.purgeEntries();
-            planet.saveSubscription(sub);
+            planet.deleteEntries(sub);
             TestUtils.endSession(true);
             
             // make sure they were removed



Mime
View raw message