roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snoopd...@apache.org
Subject svn commit: r703824 - in /roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger: business/jpa/JPAWeblogEntryManagerImpl.java ui/struts2/editor/EntryRemove.java
Date Sun, 12 Oct 2008 14:09:16 GMT
Author: snoopdave
Date: Sun Oct 12 07:09:16 2008
New Revision: 703824

URL: http://svn.apache.org/viewvc?rev=703824&view=rev
Log:
Fix for https://issues.apache.org/roller/browse/ROL-1706

Removing entry does not flush the cache.

Modified:
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/jpa/JPAWeblogEntryManagerImpl.java
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/EntryRemove.java

Modified: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/jpa/JPAWeblogEntryManagerImpl.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/jpa/JPAWeblogEntryManagerImpl.java?rev=703824&r1=703823&r2=703824&view=diff
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/jpa/JPAWeblogEntryManagerImpl.java
(original)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/jpa/JPAWeblogEntryManagerImpl.java
Sun Oct 12 07:09:16 2008
@@ -330,8 +330,9 @@
     /**
      * @inheritDoc
      */
-    public void removeWeblogEntry(WeblogEntry entry)
-    throws WebloggerException {
+    public void removeWeblogEntry(WeblogEntry entry) throws WebloggerException {
+        Weblog weblog = entry.getWebsite();
+        
         Query q = strategy.getNamedQuery("WeblogReferrer.getByWeblogEntry");
         q.setParameter(1, entry);
         List referers = q.getResultList();
@@ -357,7 +358,7 @@
         }
         
         // remove tags aggregates
-        if(entry.getTags() != null) {
+        if (entry.getTags() != null) {
             for(Iterator it = entry.getTags().iterator(); it.hasNext(); ) {
                 WeblogEntryTag tag = (WeblogEntryTag) it.next();
                 updateTagCount(tag.getName(), entry.getWebsite(), -1);
@@ -381,8 +382,8 @@
         this.strategy.remove(entry);
         
         // update weblog last modified date.  date updated by saveWebsite()
-        if(entry.isPublished()) {
-            roller.getWeblogManager().saveWeblog(entry.getWebsite());
+        if (entry.isPublished()) {
+            roller.getWeblogManager().saveWeblog(weblog);
         }
         
         // remove entry from cache mapping

Modified: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/EntryRemove.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/EntryRemove.java?rev=703824&r1=703823&r2=703824&view=diff
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/EntryRemove.java
(original)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/EntryRemove.java
Sun Oct 12 07:09:16 2008
@@ -76,9 +76,11 @@
             try {
                 // remove the entry from the search index
                 // TODO: can we do this in a better way?
+                String originalStatus = entry.getStatus();
                 entry.setStatus(WeblogEntry.DRAFT);
                 IndexManager manager = WebloggerFactory.getWeblogger().getIndexManager();
                 manager.addEntryReIndexOperation(entry);
+                entry.setStatus(originalStatus);
             } catch (WebloggerException ex) {
                 log.warn("Trouble triggering entry indexing", ex);
             }



Mime
View raw message