6 Replies Latest reply on Mar 15, 2017 4:17 PM by diego-torres

    Retrieving Form Data with kie server rest api

    rodrigo.burdet

      Hello. Im working on a UI to work with BPM processes / tasks. To accomplish this, im using kie server REST API.

      The problem im facing is that i cant get the necessary form data to make my own form to start a new process.

      This happens because an api call to http://{server}/kie-server/services/rest/server/containers/{container}/forms/processes/{pId}?filter=true doesnt bring subforms information, neither dataHolder's values if the values are custom types.

       

      Is there a workaround to this problem using the kie rest api?

      Im using BPM 6.4 on EAP 6.4

       

      Best Regards

        • 1. Re: Retrieving Form Data with kie server rest api
          diego-torres

          Hello Rodrigo.

          Please look at this implementation:

          GitHub - diego-torres/subform-ticket: jBpm get sub-form demo.

          And let me know if your implementation is somehow different or if it works for you.

          • 2. Re: Retrieving Form Data with kie server rest api
            dmarrazzo

            Hello Rodrigo,

            are serializable your custom type?

            can you provide a reproducer?

            • 3. Re: Retrieving Form Data with kie server rest api
              rodrigo.burdet

              Your example works for me. But when i try to add another subform in the same parent form, your solution does not work.

               

              In your example i added a IssueList subform and the response i get:

              {

                "form": {

                  "dataHolder": [

                    {

                      "id": "issueList",

                      "inputId": "",

                      "name": "#E9E371",

                      "outId": "issueLIst",

                      "type": "dataModelerEntry",

                      "value": "org.acme.ticket_support.IssueList"

                    },

                    {

                      "id": "ticket",

                      "inputId": "",

                      "name": "#E9E371",

                      "outId": "ticket",

                      "type": "dataModelerEntry",

                      "value": "org.acme.ticket_support.Ticket"

                    }

                  ],

                  "displayMode": "default",

                  "field": [

                    {

                      "defaultSubform": "component-ticket.form",

                      "errorMessage": ",,,,,,,,",

                      "fieldClass": "java.lang.Object",

                      "fieldRequired": false,

                      "groupWithPrevious": false,

                      "id": 1575399852,

                      "inputBinding": "ticket",

                      "label": ",,,Subform2,ticket,,,,",

                      "name": "ticket",

                      "outputBinding": "ticket",

                      "position": 0,

                      "readonly": false,

                      "title": ",,,,,,,,",

                      "type": "Subform"

                    },

                    {

                      "addItemText": ",,,,,,,,",

                      "bag-type": "org.acme.ticket_support.Issue",

                      "cancelItemText": ",,,,,,,,",

                      "defaultSubform": "issue-subform.form",

                      "deleteItems": true,

                      "enableTableEnterData": false,

                      "errorMessage": ",,,,,,,,",

                      "expanded": false,

                      "fieldClass": "java.util.List",

                      "fieldRequired": false,

                      "hideCreateItem": false,

                      "id": 272361770,

                      "label": "SSClass,SSStyle,,,,issueList (issueList),,,,,",

                      "name": "issueList_issueList",

                      "newItemText": ",,,,,,,,",

                      "outputBinding": "issueLIst/issueList",

                      "position": 1,

                      "previewSubform": "issue-subform.form",

                      "readonly": false,

                      "tableSubform": "issue-subform.form",

                      "title": ",,,,,,,,",

                      "type": "MultipleSubform",

                      "updateItems": true,

                      "visualizeItems": true

                    }

                  ],

                  "id": 1417469681,

                  "name": "ticket-support.support-taskform.form",

                  "status": 0

                }

              }

               

              Which still hides subform information

              • 4. Re: Retrieving Form Data with kie server rest api
                rodrigo.burdet

                Dear Donato. No, my custom type is not serializable. But a curious fact is that having only one subform with non-serializable data works well. Adding another subform breaks the hole thing.

                 

                Regards

                • 5. Re: Retrieving Form Data with kie server rest api
                  rodrigo.burdet

                  Here is an implementation with 2 subforms that doesnt work

                   

                  GitHub - NickCis/subform-ticket: jBpm get sub-form demo.

                  • 6. Re: Retrieving Form Data with kie server rest api
                    diego-torres

                    I am observing this few things:

                    1. In the EAP log I found the following error logged by the kie-server:

                     

                     

                    2017-03-15 15:26:13,461 ERROR [stderr] (default task-57) java.lang.NullPointerException
                    2017-03-15 15:26:13,462 ERROR [stderr] (default task-57) at org.kie.server.services.jbpm.ui.form.InMemoryFormProvider.filterXML(InMemoryFormProvider.java:214)
                    2017-03-15 15:26:13,462 ERROR [stderr] (default task-57) at org.kie.server.services.jbpm.ui.form.InMemoryFormProvider.render(InMemoryFormProvider.java:87)...

                     

                    Is that something you can also see?

                     

                    2. I add fields "by origin", as the inbound/outbound linking is made automatically for me I don't have to further change that. I am observing that you are adding fields "by type" and then adding the properties to tie them to inbound/outbound variable mappings right?

                     

                    By the log it seems to be missing a reference to the "outboundBinding", but I will keep researching how that is getting missed because as far as I can see to this moment, all configurations are in place for inbound/outbound.