Uploaded image for project: 'OFBiz'
  1. OFBiz
  2. OFBIZ-10024

INOUT entity-auto engine parameter not seen in SECA



    • Bug
    • Status: Closed
    • Major
    • Resolution: Not A Problem
    • None
    • None
    • None
    • None


      At the bottom of OFBIZ-9985 I mentionned an issue I crossed when using an INOUT parameter with entity-auto engine and triggering an SECA.

      Here it is:

      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:

      Index: secas.xml
      --- secas.xml	(revision 1815825)
      +++ secas.xml	(working copy)
      @@ -99,7 +99,13 @@
               <action service="sendOrderPayRetryNotification" mode="async" persist="true"/>
      -    <!-- 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"/>
      Index: services_budget.xml
      --- services_budget.xml	(revision 1815825)
      +++ services_budget.xml	(working copy)
      @@ -25,8 +25,7 @@
           <!-- 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"/>

      And here is the error

      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:?]

      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 have created OFBIZ-9994 for that


        Issue Links



              jleroux Jacques Le Roux
              jleroux Jacques Le Roux
              0 Vote for this issue
              2 Start watching this issue