Thanks so much Scott!! :-)

Kind Regards
Ashish Vijaywargiya
HotWax Systems - est. 1997

On Thu, Jan 14, 2016 at 2:28 PM, Scott Gray <[email protected]>
wrote:

> Yeah exactly Ashish, you can chain as many .add calls as you wish to add
> however many parameters are needed. The method will also accept a Map for
> situations where the inputs are coming from elsewhere.  We could also add
> another method to take from an existing map only those parameters that the
> service would accept.
>
> Regards
> Scott
> On 14 Jan 2016 17:19, "Ashish Vijaywargiya" <
> [email protected]> wrote:
>
> > +1.
> >
> > There is a limitation in UtilMisc.toMap() method where you can pass at
> max
> > 6 parameters. I think here you are proposing that we will be able to pass
> > any number parameters to the service or there will be limitation of max 6
> > parameters that can be passed?
> >
> > Thanks!
> >
> > --
> > Kind Regards
> > Ashish Vijaywargiya
> > HotWax Systems - est. 1997
> >
> > On Thu, Jan 14, 2016 at 4:37 AM, Scott Gray <
> [email protected]>
> > wrote:
> >
> > > Following a builder pattern a bit like EntityQuery:
> > >
> > > ServiceResult createProductResult = ServiceContext.create(dispatcher,
> > > userLogin)
> > >         .add("brandName", brandName)
> > >         .add("productName", productName)
> > >         .add("longDescription", description)
> > >         .add("internalName", internalName)
> > >         .add("introductionDate", UtilDateTime.nowTimestamp())
> > >         .add("productTypeId", "FINISHED_GOOD")
> > >         .newTransaction()
> > >         .runSync("createProduct");
> > > if (createProductResult.isError()) {
> > >     return ServiceUtil.returnError("Could not create Product: " +
> > > createProductResult.getErrorMessage());
> > > }
> > > productId = createProductResult.getString("productId");
> > >
> > >
> > > Calling a service from java always seems so cumbersome to me, maybe
> > > something like the above would make it a little bit nicer?
> > >
> > > Regards
> > > Scott
> > >
> >
>

Reply via email to