[SYNCOPE-1251] Fix Update Activiti service task
authorMarco Di Sabatino Di Diodoro <marco.disabatino@tirasa.net>
Thu, 14 Dec 2017 13:06:50 +0000 (14:06 +0100)
committerMarco Di Sabatino Di Diodoro <marco.disabatino@tirasa.net>
Thu, 14 Dec 2017 13:08:23 +0000 (14:08 +0100)
client/console/src/main/java/org/apache/syncope/client/console/approvals/ApprovalDirectoryPanel.java
core/workflow-flowable/src/main/java/org/apache/syncope/core/workflow/flowable/task/Update.java

index 51f71eb..b694ee1 100644 (file)
@@ -214,7 +214,7 @@ public class ApprovalDirectoryPanel
                     previousUserTO = formTO.getUserTO();
                     formTO.getUserTO().setKey(formTO.getUserPatch().getKey());
                     formTO.getUserTO().setPassword(null);
-                    newUserTO = AnyOperations.patch(formTO.getUserTO(), formTO.getUserPatch()); 
+                    newUserTO = AnyOperations.patch(formTO.getUserTO(), formTO.getUserPatch());
                 }
 
                 AjaxWizard.EditItemActionEvent<UserTO> editItemActionEvent =
@@ -352,7 +352,10 @@ public class ApprovalDirectoryPanel
                     actual.setEntity(inner);
                 } else {
                     actual = userRestClient.update(getOriginalItem().getInnerObject().getETagValue(), patch);
-                    claimForm(restClient.getFormForUser(actual.getEntity().getKey()).getTaskId());
+                    WorkflowFormTO workFlowTO = restClient.getFormForUser(actual.getEntity().getKey());
+                    if (workFlowTO != null) {
+                        claimForm(workFlowTO.getTaskId());
+                    }
                 }
 
             }
index e9ed279..c619211 100644 (file)
@@ -63,6 +63,7 @@ public class Update extends AbstractFlowableServiceTask {
 
         // report updated user and propagation by resource as result
         engine.getRuntimeService().setVariable(executionId, FlowableUserWorkflowAdapter.USER, user);
+        engine.getRuntimeService().setVariable(executionId, FlowableUserWorkflowAdapter.USER_TO, updated);
         engine.getRuntimeService().setVariable(executionId, FlowableUserWorkflowAdapter.USER_PATCH, userPatch);
         engine.getRuntimeService().setVariable(executionId, FlowableUserWorkflowAdapter.PROP_BY_RESOURCE, propByRes);
     }