Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
elguardian committed Oct 1, 2024
1 parent ca84ee2 commit 67ca9b1
Showing 1 changed file with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,20 @@ public UserTaskKogitoWorkItemHandlerProcessListener(Processes processes) {
public void onUserTaskState(UserTaskStateEvent event) {
UserTaskState userTaskState = event.getNewStatus();

if (!userTaskState.isTerminate()) {
return;
}

LOG.info("onUserTaskState {} on termination trigger {}", event, userTaskState);

String processId = (String) event.getUserTaskInstance().getMetadata().get("ProcessId");
String processInstanceId = (String) event.getUserTaskInstance().getMetadata().get("ProcessInstanceId");
ProcessInstance<? extends Model> processInstance = processes.processById(processId).instances().findById(processInstanceId).orElse(null);
processInstance.updateWorkItem(event.getUserTaskInstance().getExternalReferenceId(), workItem -> {
((InternalKogitoWorkItem) workItem).setActualOwner(event.getUserTaskInstance().getActualOwner());
return workItem;
});

if (!userTaskState.isTerminate()) {
return;
}

LOG.info("onUserTaskState {} on termination trigger {}", event, userTaskState);

// we check first that the work item is not fished to convey the signal
Boolean notify = (Boolean) event.getUserTaskInstance().getMetadata().get(DefaultUserTaskLifeCycle.PARAMETER_NOTIFY);
if (notify != null && !notify) {
Expand Down

0 comments on commit 67ca9b1

Please sign in to comment.