roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snoopd...@apache.org
Subject svn commit: r1062537 - /roller/trunk/weblogger-web/src/main/java/org/apache/roller/weblogger/ui/struts2/util/UIActionPrepareInterceptor.java
Date Sun, 23 Jan 2011 21:56:09 GMT
Author: snoopdave
Date: Sun Jan 23 21:56:09 2011
New Revision: 1062537

URL: http://svn.apache.org/viewvc?rev=1062537&view=rev
Log:
Fix for "Incorrectly directs to Main Menu after saving new entry"
   https://issues.apache.org/jira/browse/ROL-1901

Modified:
    roller/trunk/weblogger-web/src/main/java/org/apache/roller/weblogger/ui/struts2/util/UIActionPrepareInterceptor.java

Modified: roller/trunk/weblogger-web/src/main/java/org/apache/roller/weblogger/ui/struts2/util/UIActionPrepareInterceptor.java
URL: http://svn.apache.org/viewvc/roller/trunk/weblogger-web/src/main/java/org/apache/roller/weblogger/ui/struts2/util/UIActionPrepareInterceptor.java?rev=1062537&r1=1062536&r2=1062537&view=diff
==============================================================================
--- roller/trunk/weblogger-web/src/main/java/org/apache/roller/weblogger/ui/struts2/util/UIActionPrepareInterceptor.java
(original)
+++ roller/trunk/weblogger-web/src/main/java/org/apache/roller/weblogger/ui/struts2/util/UIActionPrepareInterceptor.java
Sun Jan 23 21:56:09 2011
@@ -23,6 +23,8 @@ import com.opensymphony.xwork2.ActionInv
 import com.opensymphony.xwork2.interceptor.AbstractInterceptor;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.roller.weblogger.ui.struts2.editor.EntryAdd;
+import org.apache.roller.weblogger.ui.struts2.editor.EntryEdit;
 
 
 /**
@@ -31,7 +33,7 @@ import org.apache.commons.logging.LogFac
 public class UIActionPrepareInterceptor extends AbstractInterceptor {
     
     private static Log log = LogFactory.getLog(UIActionPrepareInterceptor.class);
-    
+
     
     public String intercept(ActionInvocation invocation) throws Exception {
         
@@ -45,6 +47,18 @@ public class UIActionPrepareInterceptor 
             
             log.debug("action is UIActionPreparable, calling myPrepare() method");
             
+            // The EntryAdd->EntryEdit chain is the one place where we need 
+            // to pass a parameter along the chain, thus this somewhat ugly hack
+            if (invocation.getStack().getRoot().size() > 1) {
+                Object action0= invocation.getStack().getRoot().get(0);
+                Object action1 = invocation.getStack().getRoot().get(1);
+                if (action0 instanceof EntryEdit && action1 instanceof EntryAdd)
{
+                    EntryEdit editAction = (EntryEdit)action0;
+                    EntryAdd addAction = (EntryAdd)action1;
+                    editAction.getBean().setId(addAction.getBean().getId());
+                }
+            }            
+            
             UIActionPreparable theAction = (UIActionPreparable) action;
             theAction.myPrepare();
         }



Mime
View raw message