Describe the bug
if there is a variable at parent level in bpmn and similar variable name is also there inside of a java class then it seems data index does not map the data correctly.
Sample Example to demonstrate the issue.
{
"cd": {
"createdDate": "2022-03-08T00:00:00Z",
"updatedDate": "2022-03-08T00:00:00Z",
"cntdec": "cntDec"
},
"createdDate": "2022-03-11T00:00:00Z",
"lc": {
"createdDate": "2022-03-09T00:00:00Z",
"updatedDate": "2022-03-09T00:00:00Z",
"lc": "lc"
},
"updatedDate": "2022-03-12T00:00:00Z",
"al": {
"createdDate": "2022-03-10T00:00:00Z",
"updatedDate": "2022-03-10T00:00:00Z",
"al": "al"
}
}
In the above payload we have createdDate inside of obejcts al/cd/lc variables as well as at parent level .
Though the data is persisted correctly but seems the mapping to push to data index overwrites the data.
We get the following output
{
"data": {
"Duplicate": [
{
"al": {
"al": "al",
"createdDate": "2022-03-10T00:00:00Z",
"updatedDate": "2022-03-10T00:00:00Z"
},
"cd": {
"cntdec": "cntDec",
"createdDate": "2022-03-08T00:00:00Z",
"updatedDate": "2022-03-08T00:00:00Z"
},
"createdDate": "2022-03-08T00:00:00Z",
"id": "06ee32c1-e353-481f-8260-a96c2f0bc3a8",
"lc": {
"createdDate": "2022-03-09T00:00:00Z",
"lc": "lc",
"updatedDate": "2022-03-09T00:00:00Z"
},
"updatedDate": "2022-03-08T00:00:00Z",
"metadata": {
"lastUpdate": "2023-01-30T05:50:15.6Z",
"processInstances": [
{
"id": "06ee32c1-e353-481f-8260-a96c2f0bc3a8",
"state": "ACTIVE",
"roles": null
}
]
}
}
]
}
}
You can see the top level createdDate and updatedDate are having value of "2022-03-08T00:00:00Z"
This is coming from the data we see in variable cd which as the same variable name within it.
Need to check the mapping logic for the data index.
![Screenshot 2023-01-30 at 11 30 17 AM](https://user-images.githubusercontent.com/1910577/215400364-9c3eeab5-5797-4ff0-bb21-bb1bf3c0095d.png)
![Screenshot 2023-01-30 at 11 40 06 AM](https://user-images.githubusercontent.com/1910577/215401876-83a90168-03b2-4e8c-8c49-af5b879c98ab.png)
As you can see the data from cntDec is incorrectly added on createdDate and updatedDate in DI . Need to figure where the mapping have issue for parent level objects.
p.s. Data in db is persisted correclty.
Expected behavior
{
"data": {
"Duplicate": [
{
"al": {
"al": "al",
"createdDate": "2022-03-10T00:00:00Z",
"updatedDate": "2022-03-10T00:00:00Z"
},
"cd": {
"cntdec": "cntDec",
"createdDate": "2022-03-08T00:00:00Z",
"updatedDate": "2022-03-08T00:00:00Z"
},
"createdDate": "2022-03-11T00:00:00Z",
"id": "06ee32c1-e353-481f-8260-a96c2f0bc3a8",
"lc": {
"createdDate": "2022-03-09T00:00:00Z",
"lc": "lc",
"updatedDate": "2022-03-09T00:00:00Z"
},
"updatedDate": "2022-03-12T00:00:00Z",
"metadata": {
"lastUpdate": "2023-01-30T05:50:15.6Z",
"processInstances": [
{
"id": "06ee32c1-e353-481f-8260-a96c2f0bc3a8",
"state": "ACTIVE",
"roles": null
}
]
}
}
]
}
}
Above should have been the output viz. createdDate = 11 Mar and updatedDate=12-mar as per payload.
Actual behavior
{
"data": {
"Duplicate": [
{
"al": {
"al": "al",
"createdDate": "2022-03-10T00:00:00Z",
"updatedDate": "2022-03-10T00:00:00Z"
},
"cd": {
"cntdec": "cntDec",
"createdDate": "2022-03-08T00:00:00Z",
"updatedDate": "2022-03-08T00:00:00Z"
},
"createdDate": "2022-03-08T00:00:00Z",
"id": "06ee32c1-e353-481f-8260-a96c2f0bc3a8",
"lc": {
"createdDate": "2022-03-09T00:00:00Z",
"lc": "lc",
"updatedDate": "2022-03-09T00:00:00Z"
},
"updatedDate": "2022-03-08T00:00:00Z",
"metadata": {
"lastUpdate": "2023-01-30T05:50:15.6Z",
"processInstances": [
{
"id": "06ee32c1-e353-481f-8260-a96c2f0bc3a8",
"state": "ACTIVE",
"roles": null
}
]
}
}
]
}
}
How to Reproduce?
use the attached bpmn2 file to test the error.
duplicate_variable_name.zip
Output of uname -a
or ver
Darwin Mac-mini.local 22.2.0 Darwin Kernel Version 22.2.0: Fri Nov 11 02:04:44 PST 2022; root:xnu-8792.61.2~4/RELEASE_ARM64_T8103 arm64
Output of java -version
openjdk version "19.0.1" 2022-10-18 OpenJDK Runtime Environment GraalVM CE 22.3.0 (build 19.0.1+10-jvmci-22.3-b08) OpenJDK 64-Bit Server VM GraalVM CE 22.3.0 (build 19.0.1+10-jvmci-22.3-b08, mixed mode, sharing)
GraalVM version (if different from Java)
No response
Kogito version or git rev (or at least Quarkus version if you are using Kogito via Quarkus platform BOM)
1.33.0.Final
Build tool (ie. output of mvnw --version
or gradlew --version
)
Apache Maven 3.8.6 (84538c9988a25aec085021c365c560670ad80f63) Maven home: /Users/debabratapatnaik/.m2/wrapper/dists/apache-maven-3.8.6-bin/67568434/apache-maven-3.8.6 Java version: 19.0.1, vendor: GraalVM Community, runtime: /Library/Java/JavaVirtualMachines/graalvm-ce-java19-22.3.0/Contents/Home Default locale: en_IN, platform encoding: UTF-8 OS name: "mac os x", version: "13.1", arch: "aarch64", family: "mac"
Additional information
fix the issue in di mapping itsonly result mapping issue.