From 67ca9b17f6431bea52c316266faeff5ac7a4fa25 Mon Sep 17 00:00:00 2001 From: Enrique Gonzalez Martinez Date: Tue, 1 Oct 2024 08:36:17 +0200 Subject: [PATCH] fix --- ...serTaskKogitoWorkItemHandlerProcessListener.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/jbpm/jbpm-usertask/src/main/java/org/kie/kogito/jbpm/usertask/handler/UserTaskKogitoWorkItemHandlerProcessListener.java b/jbpm/jbpm-usertask/src/main/java/org/kie/kogito/jbpm/usertask/handler/UserTaskKogitoWorkItemHandlerProcessListener.java index b4cc54f91c7..3554997aeee 100644 --- a/jbpm/jbpm-usertask/src/main/java/org/kie/kogito/jbpm/usertask/handler/UserTaskKogitoWorkItemHandlerProcessListener.java +++ b/jbpm/jbpm-usertask/src/main/java/org/kie/kogito/jbpm/usertask/handler/UserTaskKogitoWorkItemHandlerProcessListener.java @@ -43,12 +43,6 @@ 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 processInstance = processes.processById(processId).instances().findById(processInstanceId).orElse(null); @@ -56,6 +50,13 @@ public void onUserTaskState(UserTaskStateEvent event) { ((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) {