Uploaded image for project: 'Kogito'
  1. Kogito
  2. KOGITO-2499

Support for expressions in BPMN Tasks in/out variable assignments when invoking DMN

    XMLWordPrintable

Details

    • 0
    • 0% 0%
    • 2021 Week 25-27 (from Jun 21), 2021 Week 28-30 (from Jul 12)

    Description

      We should allow users to use expressions when sending input data from a Process to a DMN.

      I.e. The Buyer is an input variable to the DMN task. We need to pass the instance of Buyer, contained in the process variable gift:

       

      Variable Source: #{gift.getBuyer()}
      Type: org.example.model.Buyer
      Name: Buyer 
      

      Expected result: that the DMN will receive the buyer instance contained within the gift instance.

       

      If we follow the jBPM practice in this case for more intuitive usage, the expression #{myObject.getEncapsulated()} should work OOTB.

      A reproducer is below.

       


       

      Reproducer:

      $ git clone https://github.com/kmacedovarela/gift-shop-kogito
       
      -  start the project. 
      $ mvn clean compile quarkus:dev
       

      - Access http://localhost:8080/swagger-ui 
       
      - Confirm that DMN alone works by checking that values for "price" and "Membership" are not empty or zero.
      POST /define-price
       

       {
        "Buyer":{"Membership":"gold"},
        "Gift":{"ProductName":"console"}
      }

        
      - Confirm  BPMN + DMN, doesn't work.
      POST /order
       

      {
        "gift": {
          "available": true,
          "buyer": {
            "id": 0,
            "membership": "gold",
            "name": "string"
          },
          "buyerMembership": "string",
          "buyerName": "string",
          "id": 0,
          "price": 0,
          "productName": "console"
        }
      }  

       
       
      Error thrown: 

      Required dependency 'Buyer' not found on node 'Discount'

      2020-06-20 21:50:38,863 INFO [org.exa.ser.ProductStorageService] (executor-thread-96) Checking availability of console
      2020-06-20 21:50:38,874 ERROR [org.kie.dmn.cor.imp.DMNRuntimeImpl] (executor-thread-96) Required dependency 'Buyer' not found on node 'Discount'
      2020-06-20 21:50:38,881 ERROR [org.kie.dmn.cor.imp.DMNRuntimeImpl] (executor-thread-96) Unable to evaluate decision 'Price with Discount' as it depends on decision 'Discount'
      2020-06-20 21:50:38,883 ERROR [org.jbp.wor.ins.imp.WorkflowProcessInstanceImpl] (executor-thread-96) Unexpected error (id e3560d3e-2450-4e9f-bd75-3de33332c33f) while executing node Calculate price with discount in process instance bb4c1ec7-81e8-470a-830b-0f37f8c41435: org.jbpm.workflow.instance.WorkflowRuntimeException: [order:bb4c1ec7-81e8-470a-830b-0f37f8c41435 - Calculate price with discount:3] -- DMN result errors:: Message [id=0, level=ERROR, path=null, line=98, column=-1
       text=DMN: Required dependency 'Buyer' not found on node 'Discount' (DMN id: _92F21956-890A-4AC3-87E9-9B15FF0244D5, The referenced node was not found) ], Message [id=0, level=ERROR, path=null, line=147, column=-1
       text=DMN: Unable to evaluate decision 'Price with Discount' as it depends on decision 'Discount' (DMN id: _FEB03AAF-84ED-405D-A75A-F986DF58DACA, The referenced node was not found) ] 

      Attachments

        Activity

          People

            tdolphin-1 Tiago Dolphine
            kvarela@redhat.com Karina Varela (Inactive)
            Marian Macik Marian Macik
            Marian Macik Marian Macik
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: