fjtirado commented on code in PR #1941:
URL: 
https://github.com/apache/incubator-kie-kogito-apps/pull/1941#discussion_r1453417407


##########
data-index/data-index-common/src/main/java/org/kie/kogito/index/service/IndexingService.java:
##########
@@ -66,76 +72,57 @@ public class IndexingService {
     @Inject
     DataIndexStorageService manager;
 
-    @Inject
-    Instance<ProcessInstanceEventMerger> processInstanceMergers;
-
-    @Inject
-    Instance<UserTaskInstanceEventMerger> userTaskInstanceMergers;
-
-    @Inject
-    ProcessDefinitionEventMerger processDefinitionEventMerger;
-
     //retry in case of rare but possible race condition during the insert for 
the first registry
     @Retry(maxRetries = 3, delay = 300, jitter = 100, retryOn = 
ConcurrentModificationException.class)
     public void indexProcessInstanceEvent(ProcessInstanceDataEvent<?> event) {
-        handleProcessInstanceEvent(event);
-    }
-
-    private ProcessInstance 
handleProcessInstanceEvent(ProcessInstanceDataEvent<?> event) {
-        Optional<ProcessInstance> found = 
Optional.ofNullable(manager.getProcessInstancesCache().get(event.getKogitoProcessInstanceId()));
-        ProcessInstance pi;
-        if (found.isEmpty()) {
-            pi = new ProcessInstance();
-            pi.setId(event.getKogitoProcessInstanceId());
-            pi.setProcessId(event.getKogitoProcessId());
-            pi.setMilestones(new ArrayList<>());
-            pi.setNodes(new ArrayList<>());
-        } else {
-            pi = found.get();
-
+        ProcessInstanceStorage storage = manager.getProcessInstanceStorage();

Review Comment:
   I think the logic to select the type of event belongs to the model layer.
   If a new event type is added, we enforce every storage layer is able to cope 
with it



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to