You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by Paul Foxworthy <pa...@cohsoft.com.au> on 2011/10/03 02:48:44 UTC

Should ModelService.makeValid strip prefix from keys in parameter map?

Hi all,

Service definitions can specify a string-map-prefix for a parameter to a
service. The effect of string-map-prefix is that several parameters that
share a prefix  (e.g. param_1, param_2 etc) are combined into a single map
(e.g. params) before the service is invoked.

There are two places in the Ofbiz code that attempt to do this, but their
behaviour is inconsistent.  UtilHttp.makeParamMapWithPrefix combines the
parameters that share a prefix into a single map with keys that have the
prefix removed: typically keys will be of the form "1", "2", "3" etc. See
https://fisheye6.atlassian.com/browse/~br=trunk/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilHttp.java?r=1170525#to421 

ModelService.makeValid makeValid does *not* strip the prefix from keys.
makeValid calls a private method makePrefixMap . At
https://fisheye6.atlassian.com/browse/ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelService.java?hb=true#to922,
makePrefixMap puts the entire key (e.g. "param_1", "param_2" into the
combined map for parameters that share a prefix.

As a matter of good design I think the first approach is better. Now in the
long term I wonder if this work could be done in one place and not two. In
the short term, should makeValid be changed to strip the prefix from the key
in the same way as makeParamMapWithPrefix?

Cheers

Paul Foxworthy


--
View this message in context: http://ofbiz.135035.n4.nabble.com/Should-ModelService-makeValid-strip-prefix-from-keys-in-parameter-map-tp3866196p3866196.html
Sent from the OFBiz - Dev mailing list archive at Nabble.com.

Re: Should ModelService.makeValid strip prefix from keys in parameter map?

Posted by Jacques Le Roux <ja...@les7arts.com>.
Hi Paul,

I just stumbled upon this by chance. Nothing has been done since, right?

Jacques


Le 03/10/2011 02:48, Paul Foxworthy a écrit :
> Hi all,
>
> Service definitions can specify a string-map-prefix for a parameter to a
> service. The effect of string-map-prefix is that several parameters that
> share a prefix  (e.g. param_1, param_2 etc) are combined into a single map
> (e.g. params) before the service is invoked.
>
> There are two places in the Ofbiz code that attempt to do this, but their
> behaviour is inconsistent.  UtilHttp.makeParamMapWithPrefix combines the
> parameters that share a prefix into a single map with keys that have the
> prefix removed: typically keys will be of the form "1", "2", "3" etc. See
> https://fisheye6.atlassian.com/browse/~br=trunk/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilHttp.java?r=1170525#to421
>
> ModelService.makeValid makeValid does *not* strip the prefix from keys.
> makeValid calls a private method makePrefixMap . At
> https://fisheye6.atlassian.com/browse/ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelService.java?hb=true#to922,
> makePrefixMap puts the entire key (e.g. "param_1", "param_2" into the
> combined map for parameters that share a prefix.
>
> As a matter of good design I think the first approach is better. Now in the
> long term I wonder if this work could be done in one place and not two. In
> the short term, should makeValid be changed to strip the prefix from the key
> in the same way as makeParamMapWithPrefix?
>
> Cheers
>
> Paul Foxworthy
>
>
> --
> View this message in context: http://ofbiz.135035.n4.nabble.com/Should-ModelService-makeValid-strip-prefix-from-keys-in-parameter-map-tp3866196p3866196.html
> Sent from the OFBiz - Dev mailing list archive at Nabble.com.