By the way, the ModelService class has a utility method that takes an existing 
Map and copies the valid service parameters to another Map:

http://api.ofbiz.org/org/ofbiz/service/ModelService.html#makeValid(java.util.Map,%20java.lang.String)

-Adrian

--- On Sat, 10/24/09, Ruth Hoffman <rhoff...@aesolves.com> wrote:

> From: Ruth Hoffman <rhoff...@aesolves.com>
> Subject: Re: OFBiz Java coding question
> To: dev@ofbiz.apache.org
> Date: Saturday, October 24, 2009, 12:47 PM
> Hi Scott:
> That makes sense. Thanks.
> Ruth
> 
> Scott Gray wrote:
> > My guess would be that they've done it for
> convenience.  The current service context has most of
> the parameters needed by a service that the code is planning
> on calling but some of the parameters that aren't required
> need to be removed before the service can be called.
> > An example:
> > Service1 has paramA, paramB and paramC
> > Service1 needs to call Service2
> > Service2 needs paramB and paramC
> > 
> > So in order for Service1 to call Service2 you can just
> copy the context map, remove paramA and then call the
> service.
> > 
> > Regards
> > Scott
> > 
> > HotWax Media
> > http://www.hotwaxmedia.com
> > 
> > On 25/10/2009, at 8:10 AM, Ruth Hoffman wrote:
> > 
> >> Hi List:
> >> I was wondering why, under certain conditions the
> developer used the "remove" method to get a value from the
> context instead of the "get" method. For example, why do
> this?
> >> 
> >>   String webSiteId = (String)
> serviceContext.remove("webSiteId");
> >> 
> >> Instead of this?
> >> 
> >>   String webSiteId = (String)
> serviceContext.get("webSiteId");
> >> 
> >> What should I be looking for when I'm trying to
> decide to use either "get" or "remove"?
> >> 
> >> TIA
> >> Ruth
> > 
> 



Reply via email to