[mini-lang] merge three maps with map-to-map

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[mini-lang] merge three maps with map-to-map

Malin Nicolas
Hi,
A little question about best practice with mini-lang. I want to merge
some maps on mini-lang like this :

       <call-service service-name="accReport-header"
in-map-name="headerMap">
         <result-to-field result-name="jrParameters" />
       </call-service>
       <map-to-map map="reportParameters" to-map="jrParameters"/>
       <map-to-map map="parameters" to-map="jrParameters"/>

This doesn't work because the map-to-map method doesn't accept to merge
an existing to-map and the <map-to-map map="parameters"
to-map="jrParameters"/> has been ignored

The page
https://cwiki.apache.org/confluence/display/OFBADMIN/Mini-language+Reference 
says :

          <map-to-map>  :  Copies a map to another map.

My ask : Would it be possible to copy a map into another existing map ?
if no, it is necessary to specify :

          <map-to-map>  :  Copies a map to another new map.

else the method map-to-map sould be updated like this :

Index: framework/minilang/src/org/ofbiz/minilang/method/envops/MapToMap.java
===================================================================
---
framework/minilang/src/org/ofbiz/minilang/method/envops/MapToMap.java
(révision 1437936)
+++
framework/minilang/src/org/ofbiz/minilang/method/envops/MapToMap.java
(copie de travail)
@@ -61,8 +61,8 @@
                  if (toMap == null) {
                      toMap = FastMap.newInstance();
                      toMapFma.put(methodContext.getEnvMap(), toMap);
-                    toMap.putAll(fromMap);
                  }
+               toMap.putAll(fromMap);
              } else {
                  methodContext.putAllEnv(fromMap);
              }

Your comments ?

--
Nicolas MALIN
Consultant
Tél : 06.17.66.40.06
Site projet : http://www.neogia.org/
-------
Société LibrenBerry
Tél : 02.48.02.56.12
Site : http://www.librenberry.net/

Reply | Threaded
Open this post in threaded view
|

Re: [mini-lang] merge three maps with map-to-map

Malin Nicolas
I open an issue https://issues.apache.org/jira/browse/OFBIZ-5152

Nicolas

Le 01/03/2013 11:19, Nicolas Malin a écrit :

> Index:
> framework/minilang/src/org/ofbiz/minilang/method/envops/MapToMap.java
> ===================================================================
> ---
> framework/minilang/src/org/ofbiz/minilang/method/envops/MapToMap.java
> (révision 1437936)
> +++
> framework/minilang/src/org/ofbiz/minilang/method/envops/MapToMap.java
> (copie de travail)
> @@ -61,8 +61,8 @@
>                  if (toMap == null) {
>                      toMap = FastMap.newInstance();
>                      toMapFma.put(methodContext.getEnvMap(), toMap);
> -                    toMap.putAll(fromMap);
>                  }
> +               toMap.putAll(fromMap);
>              } else {
>                  methodContext.putAllEnv(fromMap);
>              }


--
Nicolas MALIN
Consultant
Tél : 06.17.66.40.06
Site projet : http://www.neogia.org/
-------
Société LibrenBerry
Tél : 02.48.02.56.12
Site : http://www.librenberry.net/