roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agillil...@apache.org
Subject svn commit: r394237 - /incubator/roller/branches/roller-newbackend/src/org/roller/business/hibernate/HibernatePlanetManagerImpl.java
Date Sat, 15 Apr 2006 00:58:57 GMT
Author: agilliland
Date: Fri Apr 14 17:58:54 2006
New Revision: 394237

URL: http://svn.apache.org/viewcvs?rev=394237&view=rev
Log:
cleaned up refreshEntries() method to get it working with new backend.


Modified:
    incubator/roller/branches/roller-newbackend/src/org/roller/business/hibernate/HibernatePlanetManagerImpl.java

Modified: incubator/roller/branches/roller-newbackend/src/org/roller/business/hibernate/HibernatePlanetManagerImpl.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller-newbackend/src/org/roller/business/hibernate/HibernatePlanetManagerImpl.java?rev=394237&r1=394236&r2=394237&view=diff
==============================================================================
--- incubator/roller/branches/roller-newbackend/src/org/roller/business/hibernate/HibernatePlanetManagerImpl.java
(original)
+++ incubator/roller/branches/roller-newbackend/src/org/roller/business/hibernate/HibernatePlanetManagerImpl.java
Fri Apr 14 17:58:54 2006
@@ -450,12 +450,17 @@
         // Loop through all subscriptions in the system
         Iterator subs = getAllSubscriptions();
         while (subs.hasNext()) {
+            
             long subStartTime = System.currentTimeMillis();
             
+            PlanetSubscriptionData sub = (PlanetSubscriptionData)subs.next();
+            
+            // reattach sub.  sub gets detached as we iterate
+            sub = this.getSubscriptionById(sub.getId());
+            
             // Fetch latest entries for each subscription
             Set newEntries = null;
             int count = 0;
-            PlanetSubscriptionData sub = (PlanetSubscriptionData)subs.next();
             if (!StringUtils.isEmpty(localURL) && sub.getFeedUrl().startsWith(localURL))
{
                 newEntries = getNewEntriesLocal(sub, feedFetcher, feedInfoCache);
             } else {
@@ -466,13 +471,9 @@
             // TODO: wrap this in a transaction
             log.debug("   Entry count: " + count);
             if (count > 0) {
-                Iterator entryIter = sub.getEntries().iterator();
-                while (entryIter.hasNext()) {
-                    deleteEntry((PlanetEntryData)entryIter.next());
-                }
                 sub.purgeEntries();
                 sub.addEntries(newEntries);
-                if (roller != null) roller.commit();
+                this.saveSubscription(sub);
             }
             long subEndTime = System.currentTimeMillis();
             log.info("   " + count + " - "
@@ -634,7 +635,7 @@
         }
         if (feed.getPublishedDate() != null) {
             sub.setLastUpdated(feed.getPublishedDate());
-            saveSubscription(sub);
+            // saving sub here causes detachment issues, so we save it later
         }
         
         // Kludge for Feeds without entry dates: most recent entry is given
@@ -663,7 +664,6 @@
                 if (entry.getPermalink() == null) {
                     log.warn("No permalink, rejecting entry from "+feedUrl);
                 } else {
-                    saveEntry(entry);
                     newEntries.add(entry);
                 }
                 cal.add(Calendar.DATE, -1);



Mime
View raw message