[jira] [Commented] (OFBIZ-9523) Improve groovy DSL : runService call makeValidContext

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

[jira] [Commented] (OFBIZ-9523) Improve groovy DSL : runService call makeValidContext

Nicolas Malin (Jira)

    [ https://issues.apache.org/jira/browse/OFBIZ-9523?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16107125#comment-16107125 ]

Nicolas Malin commented on OFBIZ-9523:
--------------------------------------

Hi Jacques,
It's right :)
If you apply this diff on the current RateService.groovy
{code}
Index: applications/accounting/groovyScripts/rate/RateServices.groovy
@@ -104,7 +104,7 @@
         }
     }
     if (parameters.rateAmount) {
-        result = run service: 'updateRateAmount', with: parameters
+        result = run service: 'updateRateAmount', with: context
         if (ServiceUtil.isError(result)) return result
     }
     return success()
@@ -119,7 +119,7 @@
         lookedUpValue.store()
 
         //expire related rate amount
-        result = run service: 'expireRateAmount', with: parameters
+        result = run service: 'expireRateAmount', with: context
         if (ServiceUtil.isError(result)) return result
     }
{code}
and run
{code}
./gradlew 'ofbiz --test component=accounting --test suitename=ratetests '
{code}
This works also.

I will update the wiki page with example


> Improve groovy DSL : runService call makeValidContext
> -----------------------------------------------------
>
>                 Key: OFBIZ-9523
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-9523
>             Project: OFBiz
>          Issue Type: Improvement
>          Components: framework
>    Affects Versions: Trunk
>            Reporter: Nicolas Malin
>            Assignee: Nicolas Malin
>             Fix For: Upcoming Release
>
>         Attachments: OFBIZ-9523.patch
>
>
> When you call run service with groovy, you need to be sure that all parametes are good for the service call.
> I propose to simplify this dsl with an automatic parameters check  so you can call directly like that
> {code}
> run service : createProduct, with: context
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)