This is an automated email from the ASF dual-hosted git repository.

pefernan pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-kie-kogito-apps.git


The following commit(s) were added to refs/heads/main by this push:
     new e1aacf854 [incubator-kie-issues-2012] Data-Index: Add 'cancelled' 
property to the NodeInstance output (#2238)
e1aacf854 is described below

commit e1aacf8547138db976a096454dc411dde0a35ac5
Author: Deepak Joseph <[email protected]>
AuthorDate: Thu Jul 10 01:34:32 2025 +0530

    [incubator-kie-issues-2012] Data-Index: Add 'cancelled' property to the 
NodeInstance output (#2238)
    
    * Cancelled property for NodeInstance
    
    * Fixes
    
    * test fix
    
    * added cancelledType for mongodb
    
    * Changed CancelledType to CancelType
    
    * fixed sql
    
    * removed exit date
    
    * changes
---
 .../src/main/resources/basic.schema.graphqls       |  8 +++++
 .../org/kie/kogito/index/service/GraphQLUtils.java |  6 ++--
 .../org/kie/kogito/index/model/CancelType.java     | 41 ++++++++++++++++++++++
 .../org/kie/kogito/index/model/NodeInstance.java   | 10 ++++++
 .../ProcessInstanceErrorDataEventMerger.java       |  9 ++++-
 .../kogito/index/jpa/model/NodeInstanceEntity.java | 13 +++++++
 .../jpa/storage/ProcessInstanceEntityStorage.java  | 30 ++++++++++++++--
 .../AbstractProcessInstanceEntityMapperIT.java     |  4 +++
 .../storage/AbstractProcessInstanceStorageIT.java  |  4 +--
 .../ansi/V1.45.1.3__add_cancelled_type_nodes.sql   | 20 +++++++++++
 .../index/mongodb/model/ProcessInstanceEntity.java | 11 ++++++
 .../mongodb/model/ProcessInstanceEntityMapper.java |  2 ++
 .../model/ProcessInstanceEntityMapperTest.java     |  4 +++
 .../V1.45.1.3__add_cancelled_type_nodes.sql        | 21 +++++++++++
 14 files changed, 174 insertions(+), 9 deletions(-)

diff --git 
a/data-index/data-index-graphql/src/main/resources/basic.schema.graphqls 
b/data-index/data-index-graphql/src/main/resources/basic.schema.graphqls
index 6df6e6700..b89d1b22e 100644
--- a/data-index/data-index-graphql/src/main/resources/basic.schema.graphqls
+++ b/data-index/data-index-graphql/src/main/resources/basic.schema.graphqls
@@ -159,6 +159,14 @@ type NodeInstance {
     slaDueDate: DateTime
     retrigger: Boolean
     errorMessage: String
+    cancelType: CancelType
+}
+
+enum CancelType {
+    ABORTED,
+    SKIPPED,
+    OBSOLETE,
+    ERROR
 }
 
 enum MilestoneStatus {
diff --git 
a/data-index/data-index-service/data-index-service-common/src/test/java/org/kie/kogito/index/service/GraphQLUtils.java
 
b/data-index/data-index-service/data-index-service-common/src/test/java/org/kie/kogito/index/service/GraphQLUtils.java
index e281bb669..2acd6a573 100644
--- 
a/data-index/data-index-service/data-index-service-common/src/test/java/org/kie/kogito/index/service/GraphQLUtils.java
+++ 
b/data-index/data-index-service/data-index-service-common/src/test/java/org/kie/kogito/index/service/GraphQLUtils.java
@@ -267,7 +267,7 @@ public class GraphQLUtils {
     }
 
     private static Stream<Field> getAllFieldsList(Class clazz) {
-        return 
FieldUtils.getAllFieldsList(clazz).stream().filter(getSoourcePredicate().or(getSoourcePredicate()));
+        return 
FieldUtils.getAllFieldsList(clazz).stream().filter(getSourcePredicate().or(getSourcePredicate()));
     }
 
     private static Function<Field, String> getFieldName() {
@@ -288,7 +288,7 @@ public class GraphQLUtils {
                 }
             }
 
-            if 
(field.getType().getName().startsWith("org.kie.kogito.index.model")) {
+            if 
(field.getType().getName().startsWith("org.kie.kogito.index.model") && 
!field.getType().isEnum()) {
                 return field.getName() + " { " + 
getAllFieldsList(field.getType()).map(f -> 
getFieldName().apply(f)).collect(joining(", ")) + " }";
             }
 
@@ -301,7 +301,7 @@ public class GraphQLUtils {
         return field -> !field.getName().equals("$jacocoData");
     }
 
-    private static Predicate<Field> getSoourcePredicate() {
+    private static Predicate<Field> getSourcePredicate() {
         return field -> 
!(field.getDeclaringClass().equals(ProcessDefinition.class) && 
(field.getName().equals("source") || field.getName().equals("nodes")));
     }
 }
diff --git 
a/data-index/data-index-storage/data-index-storage-api/src/main/java/org/kie/kogito/index/model/CancelType.java
 
b/data-index/data-index-storage/data-index-storage-api/src/main/java/org/kie/kogito/index/model/CancelType.java
new file mode 100644
index 000000000..4cfb9d14f
--- /dev/null
+++ 
b/data-index/data-index-storage/data-index-storage-api/src/main/java/org/kie/kogito/index/model/CancelType.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.kie.kogito.index.model;
+
+import static 
org.kie.kogito.event.process.ProcessInstanceNodeEventBody.EVENT_TYPE_ABORTED;
+import static 
org.kie.kogito.event.process.ProcessInstanceNodeEventBody.EVENT_TYPE_ERROR;
+import static 
org.kie.kogito.event.process.ProcessInstanceNodeEventBody.EVENT_TYPE_OBSOLETE;
+import static 
org.kie.kogito.event.process.ProcessInstanceNodeEventBody.EVENT_TYPE_SKIPPED;
+
+public enum CancelType {
+    ABORTED,
+    SKIPPED,
+    OBSOLETE,
+    ERROR;
+
+    public static CancelType fromEventType(Integer eventType) {
+        return switch (eventType) {
+            case EVENT_TYPE_ABORTED -> ABORTED;
+            case EVENT_TYPE_SKIPPED -> SKIPPED;
+            case EVENT_TYPE_OBSOLETE -> OBSOLETE;
+            case EVENT_TYPE_ERROR -> ERROR;
+            default -> throw new IllegalStateException("Unexpected eventType: 
" + eventType);
+        };
+    }
+}
diff --git 
a/data-index/data-index-storage/data-index-storage-api/src/main/java/org/kie/kogito/index/model/NodeInstance.java
 
b/data-index/data-index-storage/data-index-storage-api/src/main/java/org/kie/kogito/index/model/NodeInstance.java
index 96586f703..85b258573 100644
--- 
a/data-index/data-index-storage/data-index-storage-api/src/main/java/org/kie/kogito/index/model/NodeInstance.java
+++ 
b/data-index/data-index-storage/data-index-storage-api/src/main/java/org/kie/kogito/index/model/NodeInstance.java
@@ -44,6 +44,8 @@ public class NodeInstance {
 
     private String errorMessage;
 
+    private CancelType cancelType;
+
     public Boolean isRetrigger() {
         return retrigger;
     }
@@ -127,6 +129,14 @@ public class NodeInstance {
         this.slaDueDate = slaDueDate;
     }
 
+    public CancelType getCancelType() {
+        return cancelType;
+    }
+
+    public void setCancelType(CancelType cancelType) {
+        this.cancelType = cancelType;
+    }
+
     @Override
     public boolean equals(Object o) {
         if (this == o) {
diff --git 
a/data-index/data-index-storage/data-index-storage-common/src/main/java/org/kie/kogito/index/storage/merger/ProcessInstanceErrorDataEventMerger.java
 
b/data-index/data-index-storage/data-index-storage-common/src/main/java/org/kie/kogito/index/storage/merger/ProcessInstanceErrorDataEventMerger.java
index 021c9ebe5..93dc89add 100644
--- 
a/data-index/data-index-storage/data-index-storage-common/src/main/java/org/kie/kogito/index/storage/merger/ProcessInstanceErrorDataEventMerger.java
+++ 
b/data-index/data-index-storage/data-index-storage-common/src/main/java/org/kie/kogito/index/storage/merger/ProcessInstanceErrorDataEventMerger.java
@@ -22,6 +22,7 @@ import org.kie.kogito.event.process.ProcessInstanceDataEvent;
 import org.kie.kogito.event.process.ProcessInstanceErrorDataEvent;
 import org.kie.kogito.event.process.ProcessInstanceErrorEventBody;
 import org.kie.kogito.index.CommonUtils;
+import org.kie.kogito.index.model.CancelType;
 import org.kie.kogito.index.model.ProcessInstance;
 import org.kie.kogito.index.model.ProcessInstanceError;
 
@@ -42,7 +43,13 @@ public class ProcessInstanceErrorDataEventMerger extends 
ProcessInstanceEventMer
         pi.setError(error);
         pi.setState(CommonUtils.ERROR_STATE);
         if (pi.getNodes() != null) {
-            pi.getNodes().stream().filter(n -> 
n.getId().equals(error.getNodeInstanceId())).findAny().ifPresent(n -> 
n.setErrorMessage(data.getErrorMessage()));
+            pi.getNodes().stream()
+                    .filter(n -> n.getId().equals(error.getNodeInstanceId()))
+                    .findAny()
+                    .ifPresent(n -> {
+                        n.setErrorMessage(data.getErrorMessage());
+                        n.setCancelType(CancelType.ERROR);
+                    });
         }
         return pi;
     }
diff --git 
a/data-index/data-index-storage/data-index-storage-jpa-common/src/main/java/org/kie/kogito/index/jpa/model/NodeInstanceEntity.java
 
b/data-index/data-index-storage/data-index-storage-jpa-common/src/main/java/org/kie/kogito/index/jpa/model/NodeInstanceEntity.java
index ef3babab5..5ba538fb6 100644
--- 
a/data-index/data-index-storage/data-index-storage-jpa-common/src/main/java/org/kie/kogito/index/jpa/model/NodeInstanceEntity.java
+++ 
b/data-index/data-index-storage/data-index-storage-jpa-common/src/main/java/org/kie/kogito/index/jpa/model/NodeInstanceEntity.java
@@ -23,9 +23,12 @@ import java.util.Objects;
 
 import org.hibernate.annotations.OnDelete;
 import org.hibernate.annotations.OnDeleteAction;
+import org.kie.kogito.index.model.CancelType;
 
 import jakarta.persistence.CascadeType;
 import jakarta.persistence.Entity;
+import jakarta.persistence.EnumType;
+import jakarta.persistence.Enumerated;
 import jakarta.persistence.ForeignKey;
 import jakarta.persistence.Id;
 import jakarta.persistence.JoinColumn;
@@ -47,6 +50,8 @@ public class NodeInstanceEntity extends AbstractEntity {
     private String definitionId;
     private Boolean retrigger;
     private String errorMessage;
+    @Enumerated(EnumType.STRING)
+    private CancelType cancelType;
 
     @ManyToOne(cascade = CascadeType.ALL, optional = false)
     @OnDelete(action = OnDeleteAction.CASCADE)
@@ -134,6 +139,14 @@ public class NodeInstanceEntity extends AbstractEntity {
         this.slaDueDate = slaDueDate;
     }
 
+    public CancelType getCancelType() {
+        return cancelType;
+    }
+
+    public void setCancelType(final CancelType cancelType) {
+        this.cancelType = cancelType;
+    }
+
     public ProcessInstanceEntity getProcessInstance() {
         return processInstance;
     }
diff --git 
a/data-index/data-index-storage/data-index-storage-jpa-common/src/main/java/org/kie/kogito/index/jpa/storage/ProcessInstanceEntityStorage.java
 
b/data-index/data-index-storage/data-index-storage-jpa-common/src/main/java/org/kie/kogito/index/jpa/storage/ProcessInstanceEntityStorage.java
index 928900d48..3fd86f245 100644
--- 
a/data-index/data-index-storage/data-index-storage-jpa-common/src/main/java/org/kie/kogito/index/jpa/storage/ProcessInstanceEntityStorage.java
+++ 
b/data-index/data-index-storage/data-index-storage-jpa-common/src/main/java/org/kie/kogito/index/jpa/storage/ProcessInstanceEntityStorage.java
@@ -45,6 +45,7 @@ import org.kie.kogito.index.jpa.model.NodeInstanceEntity;
 import org.kie.kogito.index.jpa.model.ProcessInstanceEntity;
 import org.kie.kogito.index.jpa.model.ProcessInstanceErrorEntity;
 import org.kie.kogito.index.json.JsonUtils;
+import org.kie.kogito.index.model.CancelType;
 import org.kie.kogito.index.model.MilestoneStatus;
 import org.kie.kogito.index.model.ProcessInstance;
 import org.kie.kogito.index.storage.ProcessInstanceStorage;
@@ -56,8 +57,12 @@ import jakarta.inject.Inject;
 import jakarta.persistence.EntityManager;
 import jakarta.transaction.Transactional;
 
+import static 
org.kie.kogito.event.process.ProcessInstanceNodeEventBody.EVENT_TYPE_ABORTED;
 import static 
org.kie.kogito.event.process.ProcessInstanceNodeEventBody.EVENT_TYPE_ENTER;
+import static 
org.kie.kogito.event.process.ProcessInstanceNodeEventBody.EVENT_TYPE_ERROR;
 import static 
org.kie.kogito.event.process.ProcessInstanceNodeEventBody.EVENT_TYPE_EXIT;
+import static 
org.kie.kogito.event.process.ProcessInstanceNodeEventBody.EVENT_TYPE_OBSOLETE;
+import static 
org.kie.kogito.event.process.ProcessInstanceNodeEventBody.EVENT_TYPE_SKIPPED;
 import static org.kie.kogito.index.DateTimeUtils.toZonedDateTime;
 
 @ApplicationScoped
@@ -150,13 +155,25 @@ public class ProcessInstanceEntityStorage extends 
AbstractJPAStorageFetcher<Stri
         errorEntity.setNodeDefinitionId(error.getNodeDefinitionId());
         errorEntity.setNodeInstanceId(error.getNodeInstanceId());
         pi.setState(CommonUtils.ERROR_STATE);
-        pi.getNodes().stream().filter(n -> 
n.getId().equals(error.getNodeInstanceId())).findAny().ifPresent(n -> 
n.setErrorMessage(error.getErrorMessage()));
+        pi.getNodes().stream()
+                .filter(n -> n.getId().equals(error.getNodeInstanceId()))
+                .findAny()
+                .ifPresent(n -> {
+                    n.setErrorMessage(error.getErrorMessage());
+                    n.setCancelType(CancelType.ERROR);
+                });
     }
 
     private void indexNode(ProcessInstanceEntity pi, 
ProcessInstanceNodeEventBody data) {
-        pi.getNodes().stream().filter(n -> 
n.getId().equals(data.getNodeInstanceId())).findAny().ifPresentOrElse(n -> 
updateNode(n, data), () -> createNode(pi, data));
+        pi.getNodes().stream()
+                .filter(n -> n.getId().equals(data.getNodeInstanceId()))
+                .findAny()
+                .ifPresentOrElse(n -> updateNode(n, data), () -> 
createNode(pi, data));
         if ("MilestoneNode".equals(data.getNodeType())) {
-            pi.getMilestones().stream().filter(n -> 
n.getId().equals(data.getNodeInstanceId())).findAny().ifPresentOrElse(n -> 
updateMilestone(n, data), () -> createMilestone(pi, data));
+            pi.getMilestones().stream()
+                    .filter(n -> n.getId().equals(data.getNodeInstanceId()))
+                    .findAny()
+                    .ifPresentOrElse(n -> updateMilestone(n, data), () -> 
createMilestone(pi, data));
         }
     }
 
@@ -194,6 +211,12 @@ public class ProcessInstanceEntityStorage extends 
AbstractJPAStorageFetcher<Stri
         }
         ZonedDateTime eventDate = toZonedDateTime(body.getEventDate());
         switch (body.getEventType()) {
+            case EVENT_TYPE_ABORTED:
+            case EVENT_TYPE_SKIPPED:
+            case EVENT_TYPE_OBSOLETE:
+            case EVENT_TYPE_ERROR:
+                
nodeInstance.setCancelType(CancelType.fromEventType(body.getEventType()));
+                break;
             case EVENT_TYPE_ENTER:
                 nodeInstance.setEnter(eventDate);
                 break;
@@ -247,6 +270,7 @@ public class ProcessInstanceEntityStorage extends 
AbstractJPAStorageFetcher<Stri
         // SLA does nothing for now
     }
 
+    @Override
     public Set<StorageServiceCapability> capabilities() {
         return EnumSet.of(StorageServiceCapability.COUNT);
     }
diff --git 
a/data-index/data-index-storage/data-index-storage-jpa-common/src/test/java/org/kie/kogito/index/jpa/mapper/AbstractProcessInstanceEntityMapperIT.java
 
b/data-index/data-index-storage/data-index-storage-jpa-common/src/test/java/org/kie/kogito/index/jpa/mapper/AbstractProcessInstanceEntityMapperIT.java
index 1bb4b5a64..47a9e3675 100644
--- 
a/data-index/data-index-storage/data-index-storage-jpa-common/src/test/java/org/kie/kogito/index/jpa/mapper/AbstractProcessInstanceEntityMapperIT.java
+++ 
b/data-index/data-index-storage/data-index-storage-jpa-common/src/test/java/org/kie/kogito/index/jpa/mapper/AbstractProcessInstanceEntityMapperIT.java
@@ -28,6 +28,7 @@ import org.kie.kogito.index.jpa.model.MilestoneEntityId;
 import org.kie.kogito.index.jpa.model.NodeInstanceEntity;
 import org.kie.kogito.index.jpa.model.ProcessInstanceEntity;
 import org.kie.kogito.index.jpa.model.ProcessInstanceErrorEntity;
+import org.kie.kogito.index.model.CancelType;
 import org.kie.kogito.index.model.Milestone;
 import org.kie.kogito.index.model.NodeInstance;
 import org.kie.kogito.index.model.ProcessInstance;
@@ -55,6 +56,7 @@ public abstract class AbstractProcessInstanceEntityMapperIT {
     void setup() {
         String nodeInstanceId = "testNodeInstanceId";
         String nodeInstanceName = "testNodeInstanceName";
+        CancelType cancelType = CancelType.ERROR;
         String nodeInstanceNodeId = "testNodeInstanceNodeId";
         String nodeInstanceType = "testNodeInstanceType";
         String nodeInstanceDefinitionId = "testNodeInstanceDefinitionId";
@@ -91,6 +93,7 @@ public abstract class AbstractProcessInstanceEntityMapperIT {
         nodeInstance.setType(nodeInstanceType);
         nodeInstance.setNodeId(nodeInstanceNodeId);
         nodeInstance.setName(nodeInstanceName);
+        nodeInstance.setCancelType(cancelType);
 
         ProcessInstanceError processInstanceError = new ProcessInstanceError();
         processInstanceError.setMessage(processInstanceErrorMessage);
@@ -131,6 +134,7 @@ public abstract class AbstractProcessInstanceEntityMapperIT 
{
         nodeInstanceEntity.setNodeId(nodeInstanceNodeId);
         nodeInstanceEntity.setType(nodeInstanceType);
         nodeInstanceEntity.setProcessInstance(processInstanceEntity);
+        nodeInstanceEntity.setCancelType(cancelType);
 
         ProcessInstanceErrorEntity processInstanceErrorEntity = new 
ProcessInstanceErrorEntity();
         processInstanceErrorEntity.setMessage(processInstanceErrorMessage);
diff --git 
a/data-index/data-index-storage/data-index-storage-jpa-common/src/test/java/org/kie/kogito/index/jpa/storage/AbstractProcessInstanceStorageIT.java
 
b/data-index/data-index-storage/data-index-storage-jpa-common/src/test/java/org/kie/kogito/index/jpa/storage/AbstractProcessInstanceStorageIT.java
index 9b7d736b0..e5e4475c9 100644
--- 
a/data-index/data-index-storage/data-index-storage-jpa-common/src/test/java/org/kie/kogito/index/jpa/storage/AbstractProcessInstanceStorageIT.java
+++ 
b/data-index/data-index-storage/data-index-storage-jpa-common/src/test/java/org/kie/kogito/index/jpa/storage/AbstractProcessInstanceStorageIT.java
@@ -109,7 +109,7 @@ public abstract class AbstractProcessInstanceStorageIT {
                 .hasSize(1);
 
         Assertions.assertThat(processInstance.getNodes().get(0))
-                .hasNoNullFieldsOrPropertiesExcept("exit", "slaDueDate", 
"errorMessage", "retrigger")
+                .hasNoNullFieldsOrPropertiesExcept("exit", "slaDueDate", 
"errorMessage", "retrigger", "cancelType")
                 .hasFieldOrPropertyWithValue("name", "nodeName")
                 .hasFieldOrPropertyWithValue("type", "BoundaryEventNode")
                 .hasFieldOrPropertyWithValue("definitionId", nodeDefinitionId)
@@ -125,7 +125,7 @@ public abstract class AbstractProcessInstanceStorageIT {
                 .hasSize(1);
 
         Assertions.assertThat(processInstance.getNodes().get(0))
-                .hasNoNullFieldsOrPropertiesExcept("slaDueDate", 
"errorMessage", "retrigger")
+                .hasNoNullFieldsOrPropertiesExcept("slaDueDate", 
"errorMessage", "retrigger", "cancelType")
                 .hasFieldOrPropertyWithValue("name", "nodeName")
                 .hasFieldOrPropertyWithValue("type", "BoundaryEventNode")
                 .hasFieldOrPropertyWithValue("definitionId", nodeDefinitionId)
diff --git 
a/data-index/data-index-storage/data-index-storage-jpa/src/main/resources/kie-flyway/db/data-index/ansi/V1.45.1.3__add_cancelled_type_nodes.sql
 
b/data-index/data-index-storage/data-index-storage-jpa/src/main/resources/kie-flyway/db/data-index/ansi/V1.45.1.3__add_cancelled_type_nodes.sql
new file mode 100644
index 000000000..07ef79f6e
--- /dev/null
+++ 
b/data-index/data-index-storage/data-index-storage-jpa/src/main/resources/kie-flyway/db/data-index/ansi/V1.45.1.3__add_cancelled_type_nodes.sql
@@ -0,0 +1,20 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+ALTER TABLE IF EXISTS nodes ADD COLUMN IF NOT EXISTS cancel_type varchar (255);
diff --git 
a/data-index/data-index-storage/data-index-storage-mongodb/src/main/java/org/kie/kogito/index/mongodb/model/ProcessInstanceEntity.java
 
b/data-index/data-index-storage/data-index-storage-mongodb/src/main/java/org/kie/kogito/index/mongodb/model/ProcessInstanceEntity.java
index e8608e70e..dc00ab014 100644
--- 
a/data-index/data-index-storage/data-index-storage-mongodb/src/main/java/org/kie/kogito/index/mongodb/model/ProcessInstanceEntity.java
+++ 
b/data-index/data-index-storage/data-index-storage-mongodb/src/main/java/org/kie/kogito/index/mongodb/model/ProcessInstanceEntity.java
@@ -24,6 +24,7 @@ import java.util.Set;
 
 import org.bson.Document;
 import org.bson.codecs.pojo.annotations.BsonId;
+import org.kie.kogito.index.model.CancelType;
 
 public class ProcessInstanceEntity {
 
@@ -303,6 +304,8 @@ public class ProcessInstanceEntity {
 
         Long slaDueDate;
 
+        CancelType cancelType;
+
         private Boolean isRetrigger;
 
         private String errorMessage;
@@ -371,6 +374,14 @@ public class ProcessInstanceEntity {
             this.slaDueDate = slaDueDate;
         }
 
+        public CancelType getCancelType() {
+            return cancelType;
+        }
+
+        public void setCancelType(CancelType cancelType) {
+            this.cancelType = cancelType;
+        }
+
         @Override
         public boolean equals(Object o) {
             if (this == o) {
diff --git 
a/data-index/data-index-storage/data-index-storage-mongodb/src/main/java/org/kie/kogito/index/mongodb/model/ProcessInstanceEntityMapper.java
 
b/data-index/data-index-storage/data-index-storage-mongodb/src/main/java/org/kie/kogito/index/mongodb/model/ProcessInstanceEntityMapper.java
index 62909624c..46ca131a8 100644
--- 
a/data-index/data-index-storage/data-index-storage-mongodb/src/main/java/org/kie/kogito/index/mongodb/model/ProcessInstanceEntityMapper.java
+++ 
b/data-index/data-index-storage/data-index-storage-mongodb/src/main/java/org/kie/kogito/index/mongodb/model/ProcessInstanceEntityMapper.java
@@ -155,6 +155,7 @@ public class ProcessInstanceEntityMapper implements 
MongoEntityMapper<ProcessIns
         instance.setSlaDueDate(instantToZonedDateTime(entity.getSlaDueDate()));
         instance.setRetrigger(entity.isRetrigger());
         instance.setErrorMessage(entity.getErrorMessage());
+        instance.setCancelType(entity.getCancelType());
         return instance;
     }
 
@@ -174,6 +175,7 @@ public class ProcessInstanceEntityMapper implements 
MongoEntityMapper<ProcessIns
         entity.setSlaDueDate(zonedDateTimeToInstant(instance.getSlaDueDate()));
         entity.setRetrigger(instance.isRetrigger());
         entity.setErrorMessage(instance.getErrorMessage());
+        entity.setCancelType(instance.getCancelType());
         return entity;
     }
 
diff --git 
a/data-index/data-index-storage/data-index-storage-mongodb/src/test/java/org/kie/kogito/index/mongodb/model/ProcessInstanceEntityMapperTest.java
 
b/data-index/data-index-storage/data-index-storage-mongodb/src/test/java/org/kie/kogito/index/mongodb/model/ProcessInstanceEntityMapperTest.java
index a36ead9e5..ae58e6749 100644
--- 
a/data-index/data-index-storage/data-index-storage-mongodb/src/test/java/org/kie/kogito/index/mongodb/model/ProcessInstanceEntityMapperTest.java
+++ 
b/data-index/data-index-storage/data-index-storage-mongodb/src/test/java/org/kie/kogito/index/mongodb/model/ProcessInstanceEntityMapperTest.java
@@ -24,6 +24,7 @@ import java.util.Set;
 
 import org.junit.jupiter.api.BeforeAll;
 import org.junit.jupiter.api.Test;
+import org.kie.kogito.index.model.CancelType;
 import org.kie.kogito.index.model.Milestone;
 import org.kie.kogito.index.model.NodeInstance;
 import org.kie.kogito.index.model.ProcessInstance;
@@ -53,6 +54,7 @@ class ProcessInstanceEntityMapperTest {
         String nodeInstanceNodeId = "testNodeInstanceNodeId";
         String nodeInstanceType = "testNodeInstanceType";
         String nodeInstanceDefinitionId = "testNodeInstanceDefinitionId";
+        CancelType cancelType = CancelType.ABORTED;
 
         String processInstanceErrorMessage = "testProcessInstanceErrorMessage";
         String processInstanceErrorNodeDefinitionId = 
"testProcessInstanceErrorNodeDefinitionId";
@@ -86,6 +88,7 @@ class ProcessInstanceEntityMapperTest {
         nodeInstance.setType(nodeInstanceType);
         nodeInstance.setNodeId(nodeInstanceNodeId);
         nodeInstance.setName(nodeInstanceName);
+        nodeInstance.setCancelType(cancelType);
 
         ProcessInstanceError processInstanceError = new ProcessInstanceError();
         processInstanceError.setMessage(processInstanceErrorMessage);
@@ -126,6 +129,7 @@ class ProcessInstanceEntityMapperTest {
         nodeInstanceEntity.setName(nodeInstanceName);
         nodeInstanceEntity.setNodeId(nodeInstanceNodeId);
         nodeInstanceEntity.setType(nodeInstanceType);
+        nodeInstanceEntity.setCancelType(cancelType);
 
         ProcessInstanceEntity.ProcessInstanceErrorEntity 
processInstanceErrorEntity = new 
ProcessInstanceEntity.ProcessInstanceErrorEntity();
         processInstanceErrorEntity.setMessage(processInstanceErrorMessage);
diff --git 
a/data-index/data-index-storage/data-index-storage-postgresql/src/main/resources/kie-flyway/db/data-index/postgresql/V1.45.1.3__add_cancelled_type_nodes.sql
 
b/data-index/data-index-storage/data-index-storage-postgresql/src/main/resources/kie-flyway/db/data-index/postgresql/V1.45.1.3__add_cancelled_type_nodes.sql
new file mode 100644
index 000000000..51d17e5f7
--- /dev/null
+++ 
b/data-index/data-index-storage/data-index-storage-postgresql/src/main/resources/kie-flyway/db/data-index/postgresql/V1.45.1.3__add_cancelled_type_nodes.sql
@@ -0,0 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+
+ALTER TABLE IF EXISTS nodes ADD COLUMN IF NOT EXISTS cancel_type varchar (255);


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to