Author: jonesde
Date: Fri Nov  3 23:21:28 2006
New Revision: 471134

URL: http://svn.apache.org/viewvc?view=rev&rev=471134
Log:
Small changes to look at attributes before parameters to allow for overrides; 
now uses same pattern as elsewhere

Modified:
    
incubator/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/ServiceEventHandler.java
    
incubator/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/ServiceMultiEventHandler.java

Modified: 
incubator/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/ServiceEventHandler.java
URL: 
http://svn.apache.org/viewvc/incubator/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/ServiceEventHandler.java?view=diff&rev=471134&r1=471133&r2=471134
==============================================================================
--- 
incubator/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/ServiceEventHandler.java
 (original)
+++ 
incubator/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/ServiceEventHandler.java
 Fri Nov  3 23:21:28 2006
@@ -210,6 +210,14 @@
                 // first check the multi-part map
                 value = multiPartMap.get(name);
 
+                // next check attributes; do this before parameters so that 
attribute which can be changed by code can override parameters which can't
+                if (UtilValidate.isEmpty(value)) {
+                    Object tempVal = request.getAttribute(name);
+                    if (tempVal != null) {
+                        value = tempVal;
+                    }
+                }
+
                 // check the request parameters
                 if (UtilValidate.isEmpty(value)) {
                     // normal parameter data, which can either be a single 
value or an array of values
@@ -224,14 +232,6 @@
                     // make any composite parameter data (e.g., from a set of 
parameters {name_c_date, name_c_hour, name_c_minutes})
                     if (value == null) {
                         value = UtilHttp.makeParamValueFromComposite(request, 
name, locale);
-                    }
-                }
-
-                // next check attributes
-                if (UtilValidate.isEmpty(value)) {
-                    Object tempVal = request.getAttribute(name);
-                    if (tempVal != null) {
-                        value = tempVal;
                     }
                 }
 

Modified: 
incubator/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/ServiceMultiEventHandler.java
URL: 
http://svn.apache.org/viewvc/incubator/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/ServiceMultiEventHandler.java?view=diff&rev=471134&r1=471133&r2=471134
==============================================================================
--- 
incubator/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/ServiceMultiEventHandler.java
 (original)
+++ 
incubator/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/ServiceMultiEventHandler.java
 Fri Nov  3 23:21:28 2006
@@ -199,20 +199,22 @@
                         List paramList = 
UtilHttp.makeParamListWithSuffix(request, modelParam.stringListSuffix, null);
                         value = paramList;
                     } else {
+                        // check attributes; do this before parameters so that 
attribute which can be changed by code can override parameters which can't
+                        value = request.getAttribute(paramName + curSuffix);
+
                         // first check for request parameters
-                        String[] paramArr = 
request.getParameterValues(paramName + curSuffix);
-                        if (paramArr != null) {
-                            if (paramArr.length > 1) {
-                                value = Arrays.asList(paramArr);
-                            } else {
-                                value = paramArr[0];
+                        if (value == null) {
+                            String[] paramArr = 
request.getParameterValues(paramName + curSuffix);
+                            if (paramArr != null) {
+                                if (paramArr.length > 1) {
+                                    value = Arrays.asList(paramArr);
+                                } else {
+                                    value = paramArr[0];
+                                }
                             }
                         }
 
-                        // if the parameter wasn't passed and no other value 
found, don't pass on the null
-                        if (value == null) {
-                            value = request.getAttribute(paramName + 
curSuffix);
-                        }
+                        // if the parameter wasn't passed and no other value 
found, check the session
                         if (value == null) {
                             value = session.getAttribute(paramName + 
curSuffix);
                         }


Reply via email to