Forum Stats

  • 3,760,125 Users
  • 2,251,647 Discussions
  • 7,870,988 Comments

Discussions

An array as a summary attribute (payload) in human task, retrievable through BPM REST API

3916525
3916525 Member Posts: 3

I am on BPM 12c (12.2.1.3), using JDeveloper to develop my workflows.

I am trying to store an array of strings as an attribute in a payload on a human task. I want to then be able to use the BPM REST API to retrieve the payload contents, and retrieve the contents back as an array. Is this possible? So far it seems I can only get simple values back, such as string, boolean, integer etc.

This is the XSD I'm using:

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.example.org"            targetNamespace="http://www.example.org" elementFormDefault="qualified">  <xsd:element name="requestOneInput">    <xsd:complexType>      <xsd:sequence>        <xsd:element name="strAttr1" type="xsd:string"/>        <xsd:element name="boolAttr2" type="xsd:boolean"/>        <xsd:element name="dateAttr3" type="xsd:date"/>        <xsd:element name="element6" type="collectionOfArrayVals"/>      </xsd:sequence>    </xsd:complexType>  </xsd:element>  <xsd:complexType name="collectionOfArrayVals">    <xsd:sequence>      <xsd:element name="arrVal" maxOccurs="unbounded"/>    </xsd:sequence>  </xsd:complexType></xsd:schema>

In my human task, on the Data tab I have the following attributes specified for the data section:

requestOneInput [email protected]af true

testCollections [email protected]d7 true

In the Summary Attributes section I have the following XPath expressions to pull the array out of the payload data (these are only the ones related to the array):

test1 XPath /task:task/task:payload/task:testCollections/ns1:arrVal

test2 XPath /task:task/task:payload/task:testCollections

test3 XPath /task:task/task:payload/task:testCollections/text()

test4 XPath /task:task/task:payload/ns1:requestOneInput/ns1:element6

test5 XPath /task:task/task:payload/ns1:requestOneInput/ns1:element6/ns1:arrVal

test6 XPath /task:task/task:payload/ns1:requestOneInput/ns1:element6/text()

test7 XPath /task:task/task:payload/ns1:requestOneInput/ns1:element6/ns1:arrVal[1]

test8 XPath /task:task/task:payload/ns1:requestOneInput/ns1:element6/ns1:arrVal[2]

When I invoke the BPM REST API endpoint to get the payload (/bpm/api/3.0/tasks/{taskID}/summaryField) I am getting the following result:

{   "summaryFields":    [            {         "dataType": "java.lang.Integer",         "name": "PRIORITY",         "readOnly": "false",         "value": "3",         "displayName": "Priority",         "category": "Standard"      },            {         "dataType": "java.lang.String",         "name": "attr1",         "readOnly": "false",         "value": "zzz",         "displayName": "",         "category": "Payload"      },            {         "dataType": "java.lang.String",         "name": "attr2",         "readOnly": "false",         "value": "true",         "displayName": "",         "category": "Payload"      },            {         "dataType": "java.lang.String",         "name": "attr3",         "readOnly": "false",         "value": "1983-01-03",         "displayName": "",         "category": "Payload"      },            {         "dataType": "java.lang.String",         "name": "test1",         "readOnly": "true",         "value": "bbb",         "displayName": "",         "category": "Payload"      },            {         "dataType": "java.lang.String",         "name": "test2",         "readOnly": "true",         "value": "",         "displayName": "",         "category": "Payload"      },            {         "dataType": "java.lang.String",         "name": "test3",         "readOnly": "true",         "value": "",         "displayName": "",         "category": "Payload"      },            {         "dataType": "java.lang.String",         "name": "test4",         "readOnly": "true",         "value": "",         "displayName": "",         "category": "Payload"      },            {         "dataType": "java.lang.String",         "name": "test5",         "readOnly": "true",         "value": "bbb",         "displayName": "",         "category": "Payload"      },            {         "dataType": "java.lang.String",         "name": "test6",         "readOnly": "true",         "value": "",         "displayName": "",         "category": "Payload"      },            {         "dataType": "java.lang.String",         "name": "test7",         "readOnly": "true",         "value": "bbb",         "displayName": "",         "category": "Payload"      },            {         "dataType": "java.lang.String",         "name": "test8",         "readOnly": "true",         "value": "ccc",         "displayName": "",         "category": "Payload"      }   ],   "comment": null,   "priority": 0}

Ideally what I want it to receive the payload array element as an array, so I imagine something like this:

{"dataType": "java.lang.String[]","name": "whatIWant","readOnly": "true","value": ["val1","val2","val3"]"displayName": "","category": "Payload"  }
  1. Is it possible to get the value as an array when querying the payload?
  2. If the above isn't possible, is it possible to get the array as a flat string with a delimiter? e.g. "val1, val2, val3"
Tagged:

Answers

  • 3916525
    3916525 Member Posts: 3
    edited May 2, 2019 7:47PM

    I've figured out how to get a flat, delimited string containing the contents of the array. There is a custom Oracle extension function that allows this:

    test10XPathoraext:create-delimited-string(/task:task/task:payload/ns1:requestOneInput/ns1:element6/ns1:arrVal,"|")

    If anyone has a better suggestion that might keep it in the format of an array then I'm all ears.