XML to Groovy conversions

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

XML to Groovy conversions

Suraj Khurana-2
Hello team,

Recently we are working on a major refactoring task of minilnag to groovy
conversion, which is commendable. I would like to add following points to
be taken into consideration while doing the exact changes in the service:

- Check and think of possible conversion to entity-auto.
- Handle service error responses, in xml usually we skip it. It would be
great if while conversion if any service is called, its error response
should be effectively handled. Like in a single line:

serviceResult = run service: "createCustomer", with: parameters
if (!ServiceUtil.isSuccess(serviceResult)) return
error(serviceResult.errorMessage)

- Avoid unnecessary declaration of variables and the same 'serviceResult'
map can be re-used in case of multiple service calls inside the same
service.

IMO, these are very small best practices that can directly be taken care of
while conversion, will improve code quality.

Please share your thoughts on this.

--
Best Regards,
Suraj Khurana
Senior Technical Consultant
Reply | Threaded
Open this post in threaded view
|

Re: XML to Groovy conversions

Jacques Le Roux
Administrator
Hi Suraj,

Thanks for your suggestions, I want to add an obvious one:

Please test your changes, at least manually or by adding JUnit tests.

OFBIZ-11986 is a good example of what needs to be done else after  :/

I was actually looking for a recent more complaining message on the same subject but I could not spot it. I guess I confused with your which is not
really complaining :)

Jacques

Le 16/05/2020 à 09:30, Suraj Khurana a écrit :

> Hello team,
>
> Recently we are working on a major refactoring task of minilnag to groovy
> conversion, which is commendable. I would like to add following points to
> be taken into consideration while doing the exact changes in the service:
>
> - Check and think of possible conversion to entity-auto.
> - Handle service error responses, in xml usually we skip it. It would be
> great if while conversion if any service is called, its error response
> should be effectively handled. Like in a single line:
>
> serviceResult = run service: "createCustomer", with: parameters
> if (!ServiceUtil.isSuccess(serviceResult)) return
> error(serviceResult.errorMessage)
>
> - Avoid unnecessary declaration of variables and the same 'serviceResult'
> map can be re-used in case of multiple service calls inside the same
> service.
>
> IMO, these are very small best practices that can directly be taken care of
> while conversion, will improve code quality.
>
> Please share your thoughts on this.
>
> --
> Best Regards,
> Suraj Khurana
> Senior Technical Consultant