Skip to content

Commit

Permalink
fix user task events
Browse files Browse the repository at this point in the history
  • Loading branch information
elguardian committed Nov 21, 2023
1 parent d667366 commit 55104cd
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package org.kie.kogito.index.event.mapper;

import java.net.URI;
import java.util.List;

import javax.enterprise.context.ApplicationScoped;

Expand All @@ -44,6 +45,8 @@ public boolean accept(UserTaskInstanceDataEvent<?> event) {

@Override
public void merge(UserTaskInstance task, UserTaskInstanceDataEvent<?> data) {
List<String> finalState = List.of("Completed", "Aborted");

UserTaskInstanceStateDataEvent event = (UserTaskInstanceStateDataEvent) data;
LOGGER.debug("value before merging: {}", task);
task.setId(event.getData().getUserTaskInstanceId());
Expand All @@ -55,9 +58,9 @@ public void merge(UserTaskInstance task, UserTaskInstanceDataEvent<?> data) {
task.setDescription(event.getData().getUserTaskDescription());
task.setState(event.getData().getState());
task.setPriority(event.getData().getUserTaskPriority());
if (event.getData().getEventType() == null || "Ready".equals(event.getData().getEventType())) {
if (task.getStarted() == null) {
task.setStarted(toZonedDateTime(event.getData().getEventDate()));
} else if ("Completed".equals(event.getData().getEventType())) {
} else if (finalState.contains(event.getData().getEventType())) {
task.setCompleted(toZonedDateTime(event.getData().getEventDate()));
}

Expand Down

0 comments on commit 55104cd

Please sign in to comment.