ofbiz-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jacques Le Roux (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (OFBIZ-9985) Convert BudgetServices.xml mini lang to groovy
Date Tue, 21 Nov 2017 14:05:00 GMT

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

Jacques Le Roux commented on OFBIZ-9985:
----------------------------------------

Hi Dennis,

No there is no problems with entity-auto as is, ie as it's used so far, in other words no
known bugs. The problem I crossed is something "special" (or new).

Using entity-auto, I wanted to mimic the current createBudget Minilang implementation which
also calls createBudgetStatus.  So I thought that by trigerring createBudgetStatus with a
SECA it would be OK.

Here is the patch:
{code}
Index: secas.xml
===================================================================
--- secas.xml	(revision 1815825)
+++ secas.xml	(working copy)
@@ -99,7 +99,13 @@
         <action service="sendOrderPayRetryNotification" mode="async" persist="true"/>
     </eca>

-    <!-- budget role ecas -->
+    <!-- Budget ecas -->
+    <eca service="createBudget" event="invoke">
+        <set field-name="budgetId" env-name="budgetId"/>
+        <set field-name="statusId" value="BG_CREATED"/>
+        <action service="createBudgetStatus" mode="sync" run-as-user="system"/>
+    </eca>
+
     <eca service="createBudgetRole" event="invoke">
         <action service="ensurePartyRole" mode="sync" run-as-user="system"/>
     </eca>
Index: services_budget.xml
===================================================================
--- services_budget.xml	(revision 1815825)
+++ services_budget.xml	(working copy)
@@ -25,8 +25,7 @@
     <version>1.0</version>

     <!-- Budget  -->
-    <service name="createBudget" default-entity-name="Budget" engine="simple"
-                location="component://accounting/minilang/budget/BudgetServices.xml" invoke="createBudget"
auth="true">
+    <service name="createBudget" default-entity-name="Budget" engine="entity-auto" invoke="create"
auth="true">
         <description>Create a Budget</description>
         <auto-attributes include="pk" mode="INOUT" optional="true"/>
         <auto-attributes include="nonpk" mode="IN" optional="true"/>
{code}

And here is the error
{code}
2017-11-21 15:00:47,649 |jsse-nio-8443-exec-1 |ServiceDispatcher             |E| Incoming
context (in runSync : createBudgetStatus) does not match expected requirements
org.apache.ofbiz.service.ServiceValidationException: Le param�tre requis suivant manque
: [createBudgetStatus.budgetId]
        at org.apache.ofbiz.service.ModelService.validate(ModelService.java:565) ~[ofbiz.jar:?]
        at org.apache.ofbiz.service.ServiceDispatcher.runSync(ServiceDispatcher.java:379)
[ofbiz.jar:?]
        at org.apache.ofbiz.service.ServiceDispatcher.runSync(ServiceDispatcher.java:229)
[ofbiz.jar:?]
        at org.apache.ofbiz.service.GenericDispatcherFactory$GenericDispatcher.runSync(GenericDispatcherFactory.java:88)
[ofbiz.jar:?]
 at org.apache.ofbiz.service.eca.ServiceEcaAction.runAction(ServiceEcaAction.java:128) [ofbiz.jar:?]
    at org.apache.ofbiz.service.eca.ServiceEcaRule.eval(ServiceEcaRule.java:160) [ofbiz.jar:?]
     at org.apache.ofbiz.service.eca.ServiceEcaUtil.evalRules(ServiceEcaUtil.java:195) [ofbiz.jar:?]
        at org.apache.ofbiz.service.ServiceDispatcher.runSync(ServiceDispatcher.java:387)
[ofbiz.jar:?]
        at org.apache.ofbiz.service.ServiceDispatcher.runSync(ServiceDispatcher.java:229)
[ofbiz.jar:?]
        at org.apache.ofbiz.service.GenericDispatcherFactory$GenericDispatcher.runSync(GenericDispatcherFactory.java:88)
[ofbiz.jar:?]
 at org.apache.ofbiz.webapp.event.CoreEvents.scheduleService(CoreEvents.java:316) [ofbiz.jar:?]
{code}

I did not check the relation between the entity-auto and SECA code yet, but at the moment
{{<auto-attributes include="pk" mode="INOUT" optional="true"/>}} does not pass a budgetId
in the SECA environement so the SECA fails.

BTW the service-eca.xsd seriously lacks documentation :/ I'll create a Jira for that...

> Convert BudgetServices.xml mini lang to groovy
> ----------------------------------------------
>
>                 Key: OFBIZ-9985
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-9985
>             Project: OFBiz
>          Issue Type: Sub-task
>          Components: accounting
>    Affects Versions: Trunk
>            Reporter: Leila Mekika
>            Assignee: Jacques Le Roux
>            Priority: Minor
>         Attachments: OFBIZ-9985.patch
>
>
> This is an attempt to migrate BudgetServices.xml to groovy file version.



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

Mime
View raw message