You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2012/12/25 05:26:42 UTC

svn commit: r1425716 - /ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/PrimaryKeyFinder.java

Author: jleroux
Date: Tue Dec 25 04:26:42 2012
New Revision: 1425716

URL: http://svn.apache.org/viewvc?rev=1425716&view=rev
Log:
Fix "Editing of product suppliers is not working for the Germany locale" https://issues.apache.org/jira/browse/OFBIZ-4769

Thanks to Christian, Paul, Deepak and Adrian

Modified:
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/PrimaryKeyFinder.java

Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/PrimaryKeyFinder.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/PrimaryKeyFinder.java?rev=1425716&r1=1425715&r2=1425716&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/PrimaryKeyFinder.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/PrimaryKeyFinder.java Tue Dec 25 04:26:42 2012
@@ -27,6 +27,7 @@ import javolution.util.FastMap;
 import org.ofbiz.base.util.Debug;
 import org.ofbiz.base.util.GeneralException;
 import org.ofbiz.base.util.UtilGenerics;
+import org.ofbiz.base.util.UtilMisc;
 import org.ofbiz.base.util.UtilValidate;
 import org.ofbiz.base.util.collections.FlexibleMapAccessor;
 import org.ofbiz.base.util.string.FlexibleStringExpander;
@@ -105,26 +106,22 @@ public class PrimaryKeyFinder extends Fi
             GenericValue tempVal = delegator.makeValue(modelEntity.getEntityName());
 
             // try a map called "parameters", try it first so values from here are overridden by values in the main context
-            Object parametersObj = context.get("parameters");
+            Map<String, Object> parametersObj = UtilMisc.toMap(UtilGenerics.checkMap(context.get("parameters")));
             if (parametersObj != null && parametersObj instanceof Map<?, ?>) {
-                tempVal.setAllFields(UtilGenerics.checkMap(parametersObj), true, null, Boolean.TRUE);
+                // need the timeZone and locale for conversion, so add here and remove after
+                parametersObj.put("locale", context.get("locale"));
+                parametersObj.put("timeZone", context.get("timeZone"));
+                modelEntity.convertFieldMapInPlace(parametersObj, delegator);
+                entityContext.remove("locale");
+                entityContext.remove("timeZone");
+                tempVal.setAllFields(parametersObj, true, null, Boolean.TRUE);
             }
 
             // just get the primary keys, and hopefully will get all of them, if not they must be manually filled in below in the field-maps
             tempVal.setAllFields(context, true, null, Boolean.TRUE);
-
             entityContext.putAll(tempVal);
         }
-        EntityFinderUtil.expandFieldMapToContext(fieldMap, context, entityContext);
-        //Debug.logInfo("PrimaryKeyFinder: entityContext=" + entityContext, module);
-        // then convert the types...
-        
-        // need the timeZone and locale for conversion, so add here and remove after
-        entityContext.put("locale", context.get("locale"));
-        entityContext.put("timeZone", context.get("timeZone"));
-        modelEntity.convertFieldMapInPlace(entityContext, delegator);
-        entityContext.remove("locale");
-        entityContext.remove("timeZone");
+        EntityFinderUtil.expandFieldMapToContext(fieldMap, context, entityContext);        
 
         // get the list of fieldsToSelect from selectFieldExpanderList
         Set<String> fieldsToSelect = EntityFinderUtil.makeFieldsToSelect(selectFieldExpanderList, context);