You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by il...@apache.org on 2018/10/05 08:53:32 UTC

[2/2] syncope git commit: [SYNCOPE-1369] Improving FlowableTaskService as JavaDelegate

[SYNCOPE-1369] Improving FlowableTaskService as JavaDelegate


Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/9dd0b660
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/9dd0b660
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/9dd0b660

Branch: refs/heads/master
Commit: 9dd0b6603a305d2c3e3155aad6177057e4a62a1c
Parents: 394530c
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Fri Oct 5 10:52:37 2018 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Fri Oct 5 10:53:24 2018 +0200

----------------------------------------------------------------------
 .../flowable/impl/FlowableRuntimeUtils.java     | 14 +++---
 .../task/AbstractFlowableServiceTask.java       | 45 --------------------
 .../core/flowable/task/AutoActivate.java        | 15 +++----
 .../syncope/core/flowable/task/Create.java      | 17 +++-----
 .../syncope/core/flowable/task/Delete.java      | 10 ++---
 .../core/flowable/task/FlowableServiceTask.java | 43 +++++++++++++++++++
 .../core/flowable/task/GenerateToken.java       | 10 ++---
 .../syncope/core/flowable/task/Notify.java      | 14 +++---
 .../core/flowable/task/PasswordReset.java       | 20 ++++-----
 .../syncope/core/flowable/task/Reactivate.java  |  5 ++-
 .../syncope/core/flowable/task/Suspend.java     |  5 ++-
 .../syncope/core/flowable/task/Update.java      | 15 +++----
 .../src/main/resources/userWorkflow.bpmn20.xml  | 18 ++++----
 .../reference/flowable/AssignDirectorGroup.java | 18 ++++----
 .../reference/flowable/CreateARelationship.java | 21 +++++----
 .../resources/assignPrinterRequest.bpmn20.xml   |  2 +-
 .../resources/directorGroupRequest.bpmn20.xml   |  2 +-
 .../src/main/resources/userWorkflow.bpmn20.xml  | 26 +++++------
 18 files changed, 144 insertions(+), 156 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/9dd0b660/ext/flowable/flowable-bpmn/src/main/java/org/apache/syncope/core/flowable/impl/FlowableRuntimeUtils.java
----------------------------------------------------------------------
diff --git a/ext/flowable/flowable-bpmn/src/main/java/org/apache/syncope/core/flowable/impl/FlowableRuntimeUtils.java b/ext/flowable/flowable-bpmn/src/main/java/org/apache/syncope/core/flowable/impl/FlowableRuntimeUtils.java
index 8230ce1..e02f017 100644
--- a/ext/flowable/flowable-bpmn/src/main/java/org/apache/syncope/core/flowable/impl/FlowableRuntimeUtils.java
+++ b/ext/flowable/flowable-bpmn/src/main/java/org/apache/syncope/core/flowable/impl/FlowableRuntimeUtils.java
@@ -209,14 +209,12 @@ public final class FlowableRuntimeUtils {
     }
 
     public static void throwException(final FlowableException e, final String defaultMessage) {
-        if (e.getCause() != null) {
-            if (e.getCause().getCause() instanceof SyncopeClientException) {
-                throw (SyncopeClientException) e.getCause().getCause();
-            } else if (e.getCause().getCause() instanceof ParsingValidationException) {
-                throw (ParsingValidationException) e.getCause().getCause();
-            } else if (e.getCause().getCause() instanceof InvalidEntityException) {
-                throw (InvalidEntityException) e.getCause().getCause();
-            }
+        if (e.getCause() instanceof SyncopeClientException) {
+            throw (SyncopeClientException) e.getCause();
+        } else if (e.getCause() instanceof ParsingValidationException) {
+            throw (ParsingValidationException) e.getCause();
+        } else if (e.getCause() instanceof InvalidEntityException) {
+            throw (InvalidEntityException) e.getCause();
         }
 
         throw new WorkflowException(defaultMessage, e);

http://git-wip-us.apache.org/repos/asf/syncope/blob/9dd0b660/ext/flowable/flowable-bpmn/src/main/java/org/apache/syncope/core/flowable/task/AbstractFlowableServiceTask.java
----------------------------------------------------------------------
diff --git a/ext/flowable/flowable-bpmn/src/main/java/org/apache/syncope/core/flowable/task/AbstractFlowableServiceTask.java b/ext/flowable/flowable-bpmn/src/main/java/org/apache/syncope/core/flowable/task/AbstractFlowableServiceTask.java
deleted file mode 100644
index 692a161..0000000
--- a/ext/flowable/flowable-bpmn/src/main/java/org/apache/syncope/core/flowable/task/AbstractFlowableServiceTask.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.core.flowable.task;
-
-import org.flowable.engine.ProcessEngine;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-import org.springframework.transaction.annotation.Transactional;
-
-/**
- * Abstract base class for Flowable's service tasks in Syncope, with Spring support.
- */
-@Component
-public abstract class AbstractFlowableServiceTask {
-
-    protected static final Logger LOG = LoggerFactory.getLogger(AbstractFlowableServiceTask.class);
-
-    @Autowired
-    protected ProcessEngine engine;
-
-    @Transactional(rollbackFor = { Throwable.class })
-    public void execute(final String executionId) {
-        doExecute(executionId);
-    }
-
-    protected abstract void doExecute(final String executionId);
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/9dd0b660/ext/flowable/flowable-bpmn/src/main/java/org/apache/syncope/core/flowable/task/AutoActivate.java
----------------------------------------------------------------------
diff --git a/ext/flowable/flowable-bpmn/src/main/java/org/apache/syncope/core/flowable/task/AutoActivate.java b/ext/flowable/flowable-bpmn/src/main/java/org/apache/syncope/core/flowable/task/AutoActivate.java
index 3febfa0..3164e52 100644
--- a/ext/flowable/flowable-bpmn/src/main/java/org/apache/syncope/core/flowable/task/AutoActivate.java
+++ b/ext/flowable/flowable-bpmn/src/main/java/org/apache/syncope/core/flowable/task/AutoActivate.java
@@ -25,11 +25,12 @@ import org.apache.syncope.core.persistence.api.dao.UserDAO;
 import org.apache.syncope.core.persistence.api.entity.user.User;
 import org.apache.syncope.core.provisioning.api.data.UserDataBinder;
 import org.apache.syncope.core.flowable.impl.FlowableRuntimeUtils;
+import org.flowable.engine.delegate.DelegateExecution;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
 @Component
-public class AutoActivate extends AbstractFlowableServiceTask {
+public class AutoActivate extends FlowableServiceTask {
 
     @Autowired
     private UserDataBinder dataBinder;
@@ -38,11 +39,9 @@ public class AutoActivate extends AbstractFlowableServiceTask {
     private UserDAO userDAO;
 
     @Override
-    protected void doExecute(final String executionId) {
-        User user = engine.getRuntimeService().
-                getVariable(executionId, FlowableRuntimeUtils.USER, User.class);
-        UserTO userTO = engine.getRuntimeService().
-                getVariable(executionId, FlowableRuntimeUtils.USER_TO, UserTO.class);
+    protected void doExecute(final DelegateExecution execution) {
+        User user = execution.getVariable(FlowableRuntimeUtils.USER, User.class);
+        UserTO userTO = execution.getVariable(FlowableRuntimeUtils.USER_TO, UserTO.class);
         if (userTO != null && userTO.getKey() != null && user.getKey() != null) {
             user = userDAO.save(user);
 
@@ -52,9 +51,9 @@ public class AutoActivate extends AbstractFlowableServiceTask {
 
             dataBinder.update(user, userPatch);
 
-            engine.getRuntimeService().setVariable(executionId, FlowableRuntimeUtils.USER, user);
+            execution.setVariable(FlowableRuntimeUtils.USER, user);
         }
 
-        engine.getRuntimeService().setVariable(executionId, FlowableRuntimeUtils.PROPAGATE_ENABLE, Boolean.TRUE);
+        execution.setVariable(FlowableRuntimeUtils.PROPAGATE_ENABLE, Boolean.TRUE);
     }
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/9dd0b660/ext/flowable/flowable-bpmn/src/main/java/org/apache/syncope/core/flowable/task/Create.java
----------------------------------------------------------------------
diff --git a/ext/flowable/flowable-bpmn/src/main/java/org/apache/syncope/core/flowable/task/Create.java b/ext/flowable/flowable-bpmn/src/main/java/org/apache/syncope/core/flowable/task/Create.java
index 75bf0ac..f3bd848 100644
--- a/ext/flowable/flowable-bpmn/src/main/java/org/apache/syncope/core/flowable/task/Create.java
+++ b/ext/flowable/flowable-bpmn/src/main/java/org/apache/syncope/core/flowable/task/Create.java
@@ -23,11 +23,12 @@ import org.apache.syncope.core.persistence.api.entity.EntityFactory;
 import org.apache.syncope.core.persistence.api.entity.user.User;
 import org.apache.syncope.core.provisioning.api.data.UserDataBinder;
 import org.apache.syncope.core.flowable.impl.FlowableRuntimeUtils;
+import org.flowable.engine.delegate.DelegateExecution;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
 @Component
-public class Create extends AbstractFlowableServiceTask {
+public class Create extends FlowableServiceTask {
 
     @Autowired
     private UserDataBinder dataBinder;
@@ -36,20 +37,16 @@ public class Create extends AbstractFlowableServiceTask {
     private EntityFactory entityFactory;
 
     @Override
-    protected void doExecute(final String executionId) {
-        UserTO userTO = engine.getRuntimeService().
-                getVariable(executionId, FlowableRuntimeUtils.USER_TO, UserTO.class);
-        Boolean storePassword = engine.getRuntimeService().
-                getVariable(executionId, FlowableRuntimeUtils.STORE_PASSWORD, Boolean.class);
+    protected void doExecute(final DelegateExecution execution) {
+        UserTO userTO = execution.getVariable(FlowableRuntimeUtils.USER_TO, UserTO.class);
+        Boolean storePassword = execution.getVariable(FlowableRuntimeUtils.STORE_PASSWORD, Boolean.class);
 
         // create user
         User user = entityFactory.newEntity(User.class);
         dataBinder.create(user, userTO, storePassword == null ? true : storePassword);
 
         // report user as result
-        engine.getRuntimeService().
-                setVariable(executionId, FlowableRuntimeUtils.USER, user);
-        engine.getRuntimeService().
-                setVariable(executionId, FlowableRuntimeUtils.USER_TO, dataBinder.getUserTO(user, true));
+        execution.setVariable(FlowableRuntimeUtils.USER, user);
+        execution.setVariable(FlowableRuntimeUtils.USER_TO, dataBinder.getUserTO(user, true));
     }
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/9dd0b660/ext/flowable/flowable-bpmn/src/main/java/org/apache/syncope/core/flowable/task/Delete.java
----------------------------------------------------------------------
diff --git a/ext/flowable/flowable-bpmn/src/main/java/org/apache/syncope/core/flowable/task/Delete.java b/ext/flowable/flowable-bpmn/src/main/java/org/apache/syncope/core/flowable/task/Delete.java
index 7f3acf6..8d7bef7 100644
--- a/ext/flowable/flowable-bpmn/src/main/java/org/apache/syncope/core/flowable/task/Delete.java
+++ b/ext/flowable/flowable-bpmn/src/main/java/org/apache/syncope/core/flowable/task/Delete.java
@@ -20,15 +20,15 @@ package org.apache.syncope.core.flowable.task;
 
 import org.apache.syncope.core.persistence.api.entity.user.User;
 import org.apache.syncope.core.flowable.impl.FlowableRuntimeUtils;
+import org.flowable.engine.delegate.DelegateExecution;
 import org.springframework.stereotype.Component;
 
 @Component
-public class Delete extends AbstractFlowableServiceTask {
+public class Delete extends FlowableServiceTask {
 
     @Override
-    protected void doExecute(final String executionId) {
-        User user = engine.getRuntimeService().
-                getVariable(executionId, FlowableRuntimeUtils.USER, User.class);
+    protected void doExecute(final DelegateExecution execution) {
+        User user = execution.getVariable(FlowableRuntimeUtils.USER, User.class);
 
         // Do something with user...
         if (user != null) {
@@ -36,6 +36,6 @@ public class Delete extends AbstractFlowableServiceTask {
         }
 
         // remove user variable
-        engine.getRuntimeService().removeVariable(executionId, FlowableRuntimeUtils.USER);
+        execution.removeVariable(FlowableRuntimeUtils.USER);
     }
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/9dd0b660/ext/flowable/flowable-bpmn/src/main/java/org/apache/syncope/core/flowable/task/FlowableServiceTask.java
----------------------------------------------------------------------
diff --git a/ext/flowable/flowable-bpmn/src/main/java/org/apache/syncope/core/flowable/task/FlowableServiceTask.java b/ext/flowable/flowable-bpmn/src/main/java/org/apache/syncope/core/flowable/task/FlowableServiceTask.java
new file mode 100644
index 0000000..b83b2a1
--- /dev/null
+++ b/ext/flowable/flowable-bpmn/src/main/java/org/apache/syncope/core/flowable/task/FlowableServiceTask.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.core.flowable.task;
+
+import org.flowable.engine.delegate.DelegateExecution;
+import org.flowable.engine.delegate.JavaDelegate;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
+import org.springframework.transaction.annotation.Transactional;
+
+/**
+ * Abstract base class for Flowable's service tasks in Syncope, with Spring support.
+ */
+@Component
+public abstract class FlowableServiceTask implements JavaDelegate {
+
+    protected static final Logger LOG = LoggerFactory.getLogger(FlowableServiceTask.class);
+
+    @Transactional(rollbackFor = { Throwable.class })
+    @Override
+    public void execute(final DelegateExecution execution) {
+        doExecute(execution);
+    }
+
+    protected abstract void doExecute(final DelegateExecution execution);
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/9dd0b660/ext/flowable/flowable-bpmn/src/main/java/org/apache/syncope/core/flowable/task/GenerateToken.java
----------------------------------------------------------------------
diff --git a/ext/flowable/flowable-bpmn/src/main/java/org/apache/syncope/core/flowable/task/GenerateToken.java b/ext/flowable/flowable-bpmn/src/main/java/org/apache/syncope/core/flowable/task/GenerateToken.java
index aee2b73..2ecb0d5 100644
--- a/ext/flowable/flowable-bpmn/src/main/java/org/apache/syncope/core/flowable/task/GenerateToken.java
+++ b/ext/flowable/flowable-bpmn/src/main/java/org/apache/syncope/core/flowable/task/GenerateToken.java
@@ -21,24 +21,24 @@ package org.apache.syncope.core.flowable.task;
 import org.apache.syncope.core.persistence.api.dao.ConfDAO;
 import org.apache.syncope.core.persistence.api.entity.user.User;
 import org.apache.syncope.core.flowable.impl.FlowableRuntimeUtils;
+import org.flowable.engine.delegate.DelegateExecution;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
 @Component
-public class GenerateToken extends AbstractFlowableServiceTask {
+public class GenerateToken extends FlowableServiceTask {
 
     @Autowired
     private ConfDAO confDAO;
 
     @Override
-    protected void doExecute(final String executionId) {
-        User user = engine.getRuntimeService().
-                getVariable(executionId, FlowableRuntimeUtils.USER, User.class);
+    protected void doExecute(final DelegateExecution execution) {
+        User user = execution.getVariable(FlowableRuntimeUtils.USER, User.class);
 
         user.generateToken(
                 confDAO.find("token.length", 256L).intValue(),
                 confDAO.find("token.expireTime", 60L).intValue());
 
-        engine.getRuntimeService().setVariable(executionId, FlowableRuntimeUtils.USER, user);
+        execution.setVariable(FlowableRuntimeUtils.USER, user);
     }
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/9dd0b660/ext/flowable/flowable-bpmn/src/main/java/org/apache/syncope/core/flowable/task/Notify.java
----------------------------------------------------------------------
diff --git a/ext/flowable/flowable-bpmn/src/main/java/org/apache/syncope/core/flowable/task/Notify.java b/ext/flowable/flowable-bpmn/src/main/java/org/apache/syncope/core/flowable/task/Notify.java
index d64032f..14ee9c2 100644
--- a/ext/flowable/flowable-bpmn/src/main/java/org/apache/syncope/core/flowable/task/Notify.java
+++ b/ext/flowable/flowable-bpmn/src/main/java/org/apache/syncope/core/flowable/task/Notify.java
@@ -24,6 +24,7 @@ import org.apache.syncope.common.lib.types.AuditElements;
 import org.apache.syncope.core.persistence.api.entity.user.User;
 import org.apache.syncope.core.provisioning.api.notification.NotificationManager;
 import org.apache.syncope.core.flowable.impl.FlowableRuntimeUtils;
+import org.flowable.engine.delegate.DelegateExecution;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
@@ -33,19 +34,16 @@ import org.springframework.stereotype.Component;
  * An {@code event} workflow variable needs to be provided as well.
  */
 @Component
-public class Notify extends AbstractFlowableServiceTask {
+public class Notify extends FlowableServiceTask {
 
     @Autowired
     private NotificationManager notificationManager;
 
     @Override
-    protected void doExecute(final String executionId) {
-        User user = engine.getRuntimeService().
-                getVariable(executionId, FlowableRuntimeUtils.USER, User.class);
-        UserTO userTO = engine.getRuntimeService().
-                getVariable(executionId, FlowableRuntimeUtils.USER_TO, UserTO.class);
-        String event = engine.getRuntimeService().
-                getVariable(executionId, FlowableRuntimeUtils.EVENT, String.class);
+    protected void doExecute(final DelegateExecution execution) {
+        User user = execution.getVariable(FlowableRuntimeUtils.USER, User.class);
+        UserTO userTO = execution.getVariable(FlowableRuntimeUtils.USER_TO, UserTO.class);
+        String event = execution.getVariable(FlowableRuntimeUtils.EVENT, String.class);
 
         if (StringUtils.isNotBlank(event)) {
             notificationManager.createTasks(

http://git-wip-us.apache.org/repos/asf/syncope/blob/9dd0b660/ext/flowable/flowable-bpmn/src/main/java/org/apache/syncope/core/flowable/task/PasswordReset.java
----------------------------------------------------------------------
diff --git a/ext/flowable/flowable-bpmn/src/main/java/org/apache/syncope/core/flowable/task/PasswordReset.java b/ext/flowable/flowable-bpmn/src/main/java/org/apache/syncope/core/flowable/task/PasswordReset.java
index 1c36202..b1bb3a6 100644
--- a/ext/flowable/flowable-bpmn/src/main/java/org/apache/syncope/core/flowable/task/PasswordReset.java
+++ b/ext/flowable/flowable-bpmn/src/main/java/org/apache/syncope/core/flowable/task/PasswordReset.java
@@ -26,11 +26,12 @@ import org.apache.syncope.core.persistence.api.entity.user.User;
 import org.apache.syncope.core.provisioning.api.data.UserDataBinder;
 import org.apache.syncope.core.workflow.api.WorkflowException;
 import org.apache.syncope.core.flowable.impl.FlowableRuntimeUtils;
+import org.flowable.engine.delegate.DelegateExecution;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
 @Component
-public class PasswordReset extends AbstractFlowableServiceTask {
+public class PasswordReset extends FlowableServiceTask {
 
     @Autowired
     private UserDAO userDAO;
@@ -39,13 +40,10 @@ public class PasswordReset extends AbstractFlowableServiceTask {
     private UserDataBinder dataBinder;
 
     @Override
-    protected void doExecute(final String executionId) {
-        User user = engine.getRuntimeService().
-                getVariable(executionId, FlowableRuntimeUtils.USER, User.class);
-        String token = engine.getRuntimeService().
-                getVariable(executionId, FlowableRuntimeUtils.TOKEN, String.class);
-        String password = engine.getRuntimeService().
-                getVariable(executionId, FlowableRuntimeUtils.PASSWORD, String.class);
+    protected void doExecute(final DelegateExecution execution) {
+        User user = execution.getVariable(FlowableRuntimeUtils.USER, User.class);
+        String token = execution.getVariable(FlowableRuntimeUtils.TOKEN, String.class);
+        String password = execution.getVariable(FlowableRuntimeUtils.PASSWORD, String.class);
 
         if (!user.checkToken(token)) {
             throw new WorkflowException(new IllegalArgumentException("Wrong token: " + token + " for " + user));
@@ -63,8 +61,8 @@ public class PasswordReset extends AbstractFlowableServiceTask {
         PropagationByResource propByRes = dataBinder.update(user, userPatch);
 
         // report updated user and propagation by resource as result
-        engine.getRuntimeService().setVariable(executionId, FlowableRuntimeUtils.USER, user);
-        engine.getRuntimeService().setVariable(executionId, FlowableRuntimeUtils.USER_PATCH, userPatch);
-        engine.getRuntimeService().setVariable(executionId, FlowableRuntimeUtils.PROP_BY_RESOURCE, propByRes);
+        execution.setVariable(FlowableRuntimeUtils.USER, user);
+        execution.setVariable(FlowableRuntimeUtils.USER_PATCH, userPatch);
+        execution.setVariable(FlowableRuntimeUtils.PROP_BY_RESOURCE, propByRes);
     }
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/9dd0b660/ext/flowable/flowable-bpmn/src/main/java/org/apache/syncope/core/flowable/task/Reactivate.java
----------------------------------------------------------------------
diff --git a/ext/flowable/flowable-bpmn/src/main/java/org/apache/syncope/core/flowable/task/Reactivate.java b/ext/flowable/flowable-bpmn/src/main/java/org/apache/syncope/core/flowable/task/Reactivate.java
index d6b2c27..ab3799b 100644
--- a/ext/flowable/flowable-bpmn/src/main/java/org/apache/syncope/core/flowable/task/Reactivate.java
+++ b/ext/flowable/flowable-bpmn/src/main/java/org/apache/syncope/core/flowable/task/Reactivate.java
@@ -18,12 +18,13 @@
  */
 package org.apache.syncope.core.flowable.task;
 
+import org.flowable.engine.delegate.DelegateExecution;
 import org.springframework.stereotype.Component;
 
 @Component
-public class Reactivate extends AbstractFlowableServiceTask {
+public class Reactivate extends FlowableServiceTask {
 
     @Override
-    protected void doExecute(final String executionId) {
+    protected void doExecute(final DelegateExecution execution) {
     }
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/9dd0b660/ext/flowable/flowable-bpmn/src/main/java/org/apache/syncope/core/flowable/task/Suspend.java
----------------------------------------------------------------------
diff --git a/ext/flowable/flowable-bpmn/src/main/java/org/apache/syncope/core/flowable/task/Suspend.java b/ext/flowable/flowable-bpmn/src/main/java/org/apache/syncope/core/flowable/task/Suspend.java
index 8e9439b..0a6a85a 100644
--- a/ext/flowable/flowable-bpmn/src/main/java/org/apache/syncope/core/flowable/task/Suspend.java
+++ b/ext/flowable/flowable-bpmn/src/main/java/org/apache/syncope/core/flowable/task/Suspend.java
@@ -18,12 +18,13 @@
  */
 package org.apache.syncope.core.flowable.task;
 
+import org.flowable.engine.delegate.DelegateExecution;
 import org.springframework.stereotype.Component;
 
 @Component
-public class Suspend extends AbstractFlowableServiceTask {
+public class Suspend extends FlowableServiceTask {
 
     @Override
-    protected void doExecute(final String executionId) {
+    protected void doExecute(final DelegateExecution execution) {
     }
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/9dd0b660/ext/flowable/flowable-bpmn/src/main/java/org/apache/syncope/core/flowable/task/Update.java
----------------------------------------------------------------------
diff --git a/ext/flowable/flowable-bpmn/src/main/java/org/apache/syncope/core/flowable/task/Update.java b/ext/flowable/flowable-bpmn/src/main/java/org/apache/syncope/core/flowable/task/Update.java
index c7007ad..0c931e4 100644
--- a/ext/flowable/flowable-bpmn/src/main/java/org/apache/syncope/core/flowable/task/Update.java
+++ b/ext/flowable/flowable-bpmn/src/main/java/org/apache/syncope/core/flowable/task/Update.java
@@ -24,11 +24,12 @@ import org.apache.syncope.core.provisioning.api.PropagationByResource;
 import org.apache.syncope.core.persistence.api.entity.user.User;
 import org.apache.syncope.core.provisioning.api.data.UserDataBinder;
 import org.apache.syncope.core.flowable.impl.FlowableRuntimeUtils;
+import org.flowable.engine.delegate.DelegateExecution;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
 @Component
-public class Update extends AbstractFlowableServiceTask {
+public class Update extends FlowableServiceTask {
 
     @Autowired
     private UserDataBinder dataBinder;
@@ -37,22 +38,20 @@ public class Update extends AbstractFlowableServiceTask {
     private UserDAO userDAO;
 
     @Override
-    protected void doExecute(final String executionId) {
-        UserPatch userPatch = engine.getRuntimeService().
-                getVariable(executionId, FlowableRuntimeUtils.USER_PATCH, UserPatch.class);
+    protected void doExecute(final DelegateExecution execution) {
+        UserPatch userPatch = execution.getVariable(FlowableRuntimeUtils.USER_PATCH, UserPatch.class);
         if (userPatch == null || userPatch.isEmpty()) {
             LOG.warn("No actual update is to be performed: null patch");
         } else {
-            User user = engine.getRuntimeService().
-                    getVariable(executionId, FlowableRuntimeUtils.USER, User.class);
+            User user = execution.getVariable(FlowableRuntimeUtils.USER, User.class);
 
             user = userDAO.save(user);
 
             PropagationByResource propByRes = dataBinder.update(user, userPatch);
 
             // report updated user and propagation by resource as result
-            engine.getRuntimeService().setVariable(executionId, FlowableRuntimeUtils.USER, user);
-            engine.getRuntimeService().setVariable(executionId, FlowableRuntimeUtils.PROP_BY_RESOURCE, propByRes);
+            execution.setVariable(FlowableRuntimeUtils.USER, user);
+            execution.setVariable(FlowableRuntimeUtils.PROP_BY_RESOURCE, propByRes);
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/9dd0b660/ext/flowable/flowable-bpmn/src/main/resources/userWorkflow.bpmn20.xml
----------------------------------------------------------------------
diff --git a/ext/flowable/flowable-bpmn/src/main/resources/userWorkflow.bpmn20.xml b/ext/flowable/flowable-bpmn/src/main/resources/userWorkflow.bpmn20.xml
index 5a9f1bd..8325733 100644
--- a/ext/flowable/flowable-bpmn/src/main/resources/userWorkflow.bpmn20.xml
+++ b/ext/flowable/flowable-bpmn/src/main/resources/userWorkflow.bpmn20.xml
@@ -30,7 +30,7 @@ under the License.
   <process id="userWorkflow" name="User Workflow" isExecutable="true">
     <startEvent id="theStart"/>
     <sequenceFlow id="flow1" sourceRef="theStart" targetRef="create"/>
-    <serviceTask id="create" name="Create" flowable:expression="#{create.execute(execution.processInstanceId)}"/>
+    <serviceTask id="create" name="Create" flowable:delegateExpression="${create}"/>
     <sequenceFlow id="flow2" sourceRef="create" targetRef="activate"/>
     <scriptTask id="activate" name="Activate" scriptFormat="groovy" flowable:autoStoreVariables="false">
       <script><![CDATA[execution.setVariable("propagateEnable", Boolean.TRUE);]]></script>
@@ -54,9 +54,9 @@ under the License.
     <sequenceFlow id="active2ConfirmPasswordReset" sourceRef="activeGw" targetRef="checkToken4ConfirmPasswordReset">
       <conditionExpression xsi:type="tFormalExpression"><![CDATA[${task == 'confirmPasswordReset'}]]></conditionExpression>
     </sequenceFlow>
-    <serviceTask id="update" name="Update" flowable:expression="#{update.execute(execution.processInstanceId)}"/>
+    <serviceTask id="update" name="Update" flowable:delegateExpression="${update}"/>
     <sequenceFlow id="sid-EA22026A-25F0-4ED0-AB6E-9CE9CE74623C" sourceRef="update" targetRef="active"/>
-    <serviceTask id="suspend" name="Suspend" flowable:expression="#{suspend.execute(execution.processInstanceId)}"/>
+    <serviceTask id="suspend" name="Suspend" flowable:delegateExpression="${suspend}"/>
     <sequenceFlow id="flow10" sourceRef="suspend" targetRef="suspended"/>
     <userTask id="suspended" name="Suspended"/>
     <sequenceFlow id="flow11" sourceRef="suspended" targetRef="suspendedGw"/>
@@ -67,17 +67,17 @@ under the License.
     <sequenceFlow id="suspended2Delete" sourceRef="suspendedGw" targetRef="delete">
       <conditionExpression xsi:type="tFormalExpression"><![CDATA[${task == 'delete'}]]></conditionExpression>
     </sequenceFlow>
-    <serviceTask id="reactivate" name="Reactivate" flowable:expression="#{reactivate.execute(execution.processInstanceId)}"/>
+    <serviceTask id="reactivate" name="Reactivate" flowable:delegateExpression="${reactivate}"/>
     <sequenceFlow id="flow12" sourceRef="reactivate" targetRef="active"/>
-    <serviceTask id="generateToken4PasswordReset" name="Generate Token" flowable:expression="#{generateToken.execute(execution.processInstanceId)}"/>
+    <serviceTask id="generateToken4PasswordReset" name="Generate Token" flowable:delegateExpression="${generateToken}"/>
     <sequenceFlow id="sid-7F78CE07-A7A1-467F-BB4B-40FB234AEFF7" sourceRef="generateToken4PasswordReset" targetRef="notify4RequestPasswordReset"/>
-    <serviceTask id="notify4RequestPasswordReset" name="Notification" flowable:expression="#{notify.execute(execution.processInstanceId)}"/>
+    <serviceTask id="notify4RequestPasswordReset" name="Notification" flowable:delegateExpression="${notify}"/>
     <sequenceFlow id="sid-CF9ACA40-7750-47C3-A508-7250D24D4F1F" sourceRef="notify4RequestPasswordReset" targetRef="active"/>
-    <serviceTask id="checkToken4ConfirmPasswordReset" name="Check token, remove and update password" flowable:expression="#{passwordReset.execute(execution.processInstanceId)}"/>
+    <serviceTask id="checkToken4ConfirmPasswordReset" name="Check token, remove and update password" flowable:delegateExpression="${passwordReset}"/>
     <sequenceFlow id="sid-3E9FE01D-CC60-4A95-B356-CA0DC000FAD6" sourceRef="checkToken4ConfirmPasswordReset" targetRef="notify4ConfirmPasswordReset"/>
-    <serviceTask id="notify4ConfirmPasswordReset" name="Notification" flowable:expression="#{notify.execute(execution.processInstanceId)}"/>
+    <serviceTask id="notify4ConfirmPasswordReset" name="Notification" flowable:delegateExpression="${notify}"/>
     <sequenceFlow id="sid-A37806A7-6B7B-48A2-BB37-DAE640231144" sourceRef="notify4ConfirmPasswordReset" targetRef="active"/>
-    <serviceTask id="delete" name="Delete" flowable:expression="#{delete.execute(execution.processInstanceId)}"/>
+    <serviceTask id="delete" name="Delete" flowable:delegateExpression="${delete}"/>
     <sequenceFlow id="flow99" sourceRef="delete" targetRef="theEnd"/>
     <endEvent id="theEnd"/>
   </process>

http://git-wip-us.apache.org/repos/asf/syncope/blob/9dd0b660/fit/core-reference/src/main/java-all/org/apache/syncope/fit/core/reference/flowable/AssignDirectorGroup.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/main/java-all/org/apache/syncope/fit/core/reference/flowable/AssignDirectorGroup.java b/fit/core-reference/src/main/java-all/org/apache/syncope/fit/core/reference/flowable/AssignDirectorGroup.java
index 4db7ac2..07de2f3 100644
--- a/fit/core-reference/src/main/java-all/org/apache/syncope/fit/core/reference/flowable/AssignDirectorGroup.java
+++ b/fit/core-reference/src/main/java-all/org/apache/syncope/fit/core/reference/flowable/AssignDirectorGroup.java
@@ -21,16 +21,17 @@ package org.apache.syncope.fit.core.reference.flowable;
 import org.apache.syncope.common.lib.patch.MembershipPatch;
 import org.apache.syncope.common.lib.patch.UserPatch;
 import org.apache.syncope.core.flowable.impl.FlowableRuntimeUtils;
-import org.apache.syncope.core.flowable.task.AbstractFlowableServiceTask;
+import org.apache.syncope.core.flowable.task.FlowableServiceTask;
 import org.apache.syncope.core.persistence.api.dao.UserDAO;
 import org.apache.syncope.core.persistence.api.entity.user.User;
 import org.apache.syncope.core.provisioning.api.PropagationByResource;
 import org.apache.syncope.core.provisioning.api.data.UserDataBinder;
+import org.flowable.engine.delegate.DelegateExecution;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
 @Component
-public class AssignDirectorGroup extends AbstractFlowableServiceTask {
+public class AssignDirectorGroup extends FlowableServiceTask {
 
     @Autowired
     private UserDataBinder dataBinder;
@@ -39,12 +40,11 @@ public class AssignDirectorGroup extends AbstractFlowableServiceTask {
     private UserDAO userDAO;
 
     @Override
-    protected void doExecute(final String executionId) {
-        User user = engine.getRuntimeService().
-                getVariable(executionId, FlowableRuntimeUtils.USER, User.class);
+    protected void doExecute(final DelegateExecution execution) {
+        User user = execution.getVariable(FlowableRuntimeUtils.USER, User.class);
 
-        Boolean secondLevelApprove = engine.getRuntimeService().
-                getVariable(executionId, "secondLevelApprove", Boolean.class);
+        Boolean secondLevelApprove = execution.
+                getVariable("secondLevelApprove", Boolean.class);
         if (Boolean.TRUE.equals(secondLevelApprove)) {
             user = userDAO.save(user);
 
@@ -56,8 +56,8 @@ public class AssignDirectorGroup extends AbstractFlowableServiceTask {
             PropagationByResource propByRes = dataBinder.update(user, userPatch);
 
             // report updated user and propagation by resource as result
-            engine.getRuntimeService().setVariable(executionId, FlowableRuntimeUtils.USER, user);
-            engine.getRuntimeService().setVariable(executionId, FlowableRuntimeUtils.PROP_BY_RESOURCE, propByRes);
+            execution.setVariable(FlowableRuntimeUtils.USER, user);
+            execution.setVariable(FlowableRuntimeUtils.PROP_BY_RESOURCE, propByRes);
         } else {
             LOG.info("Second level was not approved, not assigning the director group to " + user.getUsername());
         }

http://git-wip-us.apache.org/repos/asf/syncope/blob/9dd0b660/fit/core-reference/src/main/java-all/org/apache/syncope/fit/core/reference/flowable/CreateARelationship.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/main/java-all/org/apache/syncope/fit/core/reference/flowable/CreateARelationship.java b/fit/core-reference/src/main/java-all/org/apache/syncope/fit/core/reference/flowable/CreateARelationship.java
index b0c5261..aa00fe4 100644
--- a/fit/core-reference/src/main/java-all/org/apache/syncope/fit/core/reference/flowable/CreateARelationship.java
+++ b/fit/core-reference/src/main/java-all/org/apache/syncope/fit/core/reference/flowable/CreateARelationship.java
@@ -22,16 +22,17 @@ import org.apache.syncope.common.lib.patch.RelationshipPatch;
 import org.apache.syncope.common.lib.patch.UserPatch;
 import org.apache.syncope.common.lib.to.RelationshipTO;
 import org.apache.syncope.core.flowable.impl.FlowableRuntimeUtils;
-import org.apache.syncope.core.flowable.task.AbstractFlowableServiceTask;
+import org.apache.syncope.core.flowable.task.FlowableServiceTask;
 import org.apache.syncope.core.persistence.api.dao.UserDAO;
 import org.apache.syncope.core.persistence.api.entity.user.User;
 import org.apache.syncope.core.provisioning.api.PropagationByResource;
 import org.apache.syncope.core.provisioning.api.data.UserDataBinder;
+import org.flowable.engine.delegate.DelegateExecution;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
 @Component
-public class CreateARelationship extends AbstractFlowableServiceTask {
+public class CreateARelationship extends FlowableServiceTask {
 
     @Autowired
     private UserDataBinder dataBinder;
@@ -40,17 +41,15 @@ public class CreateARelationship extends AbstractFlowableServiceTask {
     private UserDAO userDAO;
 
     @Override
-    protected void doExecute(final String executionId) {
-        User user = engine.getRuntimeService().
-                getVariable(executionId, FlowableRuntimeUtils.USER, User.class);
+    protected void doExecute(final DelegateExecution execution) {
+        User user = execution.
+                getVariable(FlowableRuntimeUtils.USER, User.class);
 
-        Boolean approve = engine.getRuntimeService().
-                getVariable(executionId, "approve", Boolean.class);
+        Boolean approve = execution.getVariable("approve", Boolean.class);
         if (Boolean.TRUE.equals(approve)) {
             user = userDAO.save(user);
 
-            String printer = engine.getRuntimeService().
-                    getVariable(executionId, "printer", String.class);
+            String printer = execution.getVariable("printer", String.class);
 
             UserPatch userPatch = new UserPatch();
             userPatch.setKey(user.getKey());
@@ -62,8 +61,8 @@ public class CreateARelationship extends AbstractFlowableServiceTask {
             PropagationByResource propByRes = dataBinder.update(user, userPatch);
 
             // report updated user and propagation by resource as result
-            engine.getRuntimeService().setVariable(executionId, FlowableRuntimeUtils.USER, user);
-            engine.getRuntimeService().setVariable(executionId, FlowableRuntimeUtils.PROP_BY_RESOURCE, propByRes);
+            execution.setVariable(FlowableRuntimeUtils.USER, user);
+            execution.setVariable(FlowableRuntimeUtils.PROP_BY_RESOURCE, propByRes);
         } else {
             LOG.info("Printer assignment to " + user.getUsername() + " was not approved");
         }

http://git-wip-us.apache.org/repos/asf/syncope/blob/9dd0b660/fit/core-reference/src/main/resources/assignPrinterRequest.bpmn20.xml
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/main/resources/assignPrinterRequest.bpmn20.xml b/fit/core-reference/src/main/resources/assignPrinterRequest.bpmn20.xml
index c9ecb9c..4b67f89 100644
--- a/fit/core-reference/src/main/resources/assignPrinterRequest.bpmn20.xml
+++ b/fit/core-reference/src/main/resources/assignPrinterRequest.bpmn20.xml
@@ -50,7 +50,7 @@ under the License.
       </extensionElements>
     </userTask>
     <sequenceFlow id="sid-D7047714-8E57-46B8-B6D4-4844DE330329" sourceRef="selectPrinter" targetRef="approvePrinter"/>
-    <serviceTask id="createARelationship" name="Create ARelationship" flowable:expression="#{createARelationship.execute(execution.processInstanceId)}"/>
+    <serviceTask id="createARelationship" name="Create ARelationship" flowable:delegateExpression="${createARelationship}"/>
     <sequenceFlow id="sid-33880AE7-35C6-4A39-8E5B-12D8BA53F042" sourceRef="approvePrinter" targetRef="createARelationship"/>
     <sequenceFlow id="sid-831E1896-EDF9-4F7D-AA42-E86CC1F8C5D3" sourceRef="createARelationship" targetRef="endevent1"/>
   </process>

http://git-wip-us.apache.org/repos/asf/syncope/blob/9dd0b660/fit/core-reference/src/main/resources/directorGroupRequest.bpmn20.xml
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/main/resources/directorGroupRequest.bpmn20.xml b/fit/core-reference/src/main/resources/directorGroupRequest.bpmn20.xml
index fd482b5..605d230 100644
--- a/fit/core-reference/src/main/resources/directorGroupRequest.bpmn20.xml
+++ b/fit/core-reference/src/main/resources/directorGroupRequest.bpmn20.xml
@@ -44,7 +44,7 @@ under the License.
         <flowable:formProperty id="rejectReason" name="Reason for rejecting" type="string" variable="rejectReason"/>
       </extensionElements>
     </userTask>
-    <serviceTask id="assignDirectorGroup" name="Assign director group" flowable:expression="#{assignDirectorGroup.execute(execution.processInstanceId)}"/>
+    <serviceTask id="assignDirectorGroup" name="Assign director group" flowable:delegateExpression="${assignDirectorGroup}"/>
     <exclusiveGateway id="sid-1E2454BD-FAE9-4A15-B169-D41843A39C15" default="sid-338A4B20-89E9-46B2-8AB3-36291455051B"/>
     <sequenceFlow id="sid-A7C20EB5-AAE6-4CF3-A151-F1A9FA9207A0" sourceRef="firstApproval" targetRef="sid-1E2454BD-FAE9-4A15-B169-D41843A39C15"/>
     <sequenceFlow id="sid-92E7D60C-09E7-465A-8115-C60ACD06E955" sourceRef="secondApproval" targetRef="assignDirectorGroup"/>

http://git-wip-us.apache.org/repos/asf/syncope/blob/9dd0b660/fit/core-reference/src/main/resources/userWorkflow.bpmn20.xml
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/main/resources/userWorkflow.bpmn20.xml b/fit/core-reference/src/main/resources/userWorkflow.bpmn20.xml
index 295dacf..79e4b39 100644
--- a/fit/core-reference/src/main/resources/userWorkflow.bpmn20.xml
+++ b/fit/core-reference/src/main/resources/userWorkflow.bpmn20.xml
@@ -30,7 +30,7 @@ under the License.
   <process id="userWorkflow" name="User Workflow" isExecutable="true">
     <startEvent id="theStart"/>
     <sequenceFlow id="flow1" sourceRef="theStart" targetRef="create"/>
-    <serviceTask id="create" name="Create" flowable:expression="#{create.execute(execution.processInstanceId)}"/>
+    <serviceTask id="create" name="Create" flowable:delegateExpression="${create}"/>
     <sequenceFlow id="flow2" sourceRef="create" targetRef="createGW"/>
     <exclusiveGateway id="createGW" default="create2Activate"/>
     <userTask id="createApproval" name="Create approval" flowable:candidateGroups="managingDirector" flowable:formKey="createApproval">
@@ -75,9 +75,9 @@ try {
     <sequenceFlow id="enableGW2Suspended" sourceRef="enableGW" targetRef="suspend">
       <conditionExpression xsi:type="tFormalExpression"><![CDATA[${!enabled}]]></conditionExpression>
     </sequenceFlow>
-    <serviceTask id="activate" name="Activate" flowable:expression="#{autoActivate.execute(execution.processInstanceId)}"/>
+    <serviceTask id="activate" name="Activate" flowable:delegateExpression="${autoActivate}"/>
     <sequenceFlow id="flow4" sourceRef="activate" targetRef="active"/>
-    <serviceTask id="generateToken" name="Generate token" flowable:expression="#{generateToken.execute(execution.processInstanceId)}"/>
+    <serviceTask id="generateToken" name="Generate token" flowable:delegateExpression="${generateToken}"/>
     <sequenceFlow id="flow5" sourceRef="generateToken" targetRef="created"/>
     <userTask id="created" name="Created"/>
     <sequenceFlow id="flow6" sourceRef="created" targetRef="optinGW"/>
@@ -164,9 +164,9 @@ try {
       ]]></script>
     </scriptTask>
     <sequenceFlow id="flow8ter" sourceRef="rejectUpdate" targetRef="active"/>
-    <serviceTask id="update" name="Update" flowable:expression="#{update.execute(execution.processInstanceId)}"/>
+    <serviceTask id="update" name="Update" flowable:delegateExpression="${update}"/>
     <sequenceFlow id="flow9" sourceRef="update" targetRef="active"/>
-    <serviceTask id="suspend" name="Suspend" flowable:expression="#{suspend.execute(execution.processInstanceId)}"/>
+    <serviceTask id="suspend" name="Suspend" flowable:delegateExpression="${suspend}"/>
     <sequenceFlow id="flow10" sourceRef="suspend" targetRef="suspended"/>
     <userTask id="suspended" name="Suspended"/>
     <sequenceFlow id="flow11" sourceRef="suspended" targetRef="suspendedGw"/>
@@ -177,7 +177,7 @@ try {
     <sequenceFlow id="suspended2Delete" sourceRef="suspendedGw" targetRef="delete">
       <conditionExpression xsi:type="tFormalExpression"><![CDATA[${task == 'delete'}]]></conditionExpression>
     </sequenceFlow>
-    <serviceTask id="reactivate" name="Reactivate" flowable:expression="#{reactivate.execute(execution.processInstanceId)}"/>
+    <serviceTask id="reactivate" name="Reactivate" flowable:delegateExpression="${reactivate}"/>
     <sequenceFlow id="flow12" sourceRef="reactivate" targetRef="active"/>
     <scriptTask id="reject" name="Reject" scriptFormat="groovy" flowable:autoStoreVariables="false">
       <script><![CDATA[
@@ -216,18 +216,18 @@ try {
       ]]></script>
     </scriptTask>
     <sequenceFlow id="flow14ter" sourceRef="rejectDelete" targetRef="active"/>
-    <serviceTask id="generateToken4PasswordReset" name="Generate token" flowable:expression="#{generateToken.execute(execution.processInstanceId)}"/>
+    <serviceTask id="generateToken4PasswordReset" name="Generate token" flowable:delegateExpression="${generateToken}"/>
     <sequenceFlow id="flow15" sourceRef="generateToken4PasswordReset" targetRef="notify4RequestPasswordReset"/>
-    <serviceTask id="notify4RequestPasswordReset" name="Notification" flowable:expression="#{notify.execute(execution.processInstanceId)}"/>
+    <serviceTask id="notify4RequestPasswordReset" name="Notification" flowable:delegateExpression="${notify}"/>
     <sequenceFlow id="flow16" sourceRef="notify4RequestPasswordReset" targetRef="active"/>
-    <serviceTask id="checkToken4ConfirmPasswordReset" name="Check token, remove and update password" flowable:expression="#{passwordReset.execute(execution.processInstanceId)}"/>
+    <serviceTask id="checkToken4ConfirmPasswordReset" name="Check token, remove and update password" flowable:delegateExpression="${passwordReset}"/>
     <sequenceFlow id="flow17" sourceRef="checkToken4ConfirmPasswordReset" targetRef="notify4ConfirmPasswordReset"/>
-    <serviceTask id="notify4ConfirmPasswordReset" name="Notification" flowable:expression="#{notify.execute(execution.processInstanceId)}"/>
+    <serviceTask id="notify4ConfirmPasswordReset" name="Notification" flowable:delegateExpression="${notify}"/>
     <sequenceFlow id="flow18" sourceRef="notify4ConfirmPasswordReset" targetRef="active"/>
-    <serviceTask id="delete" name="Delete" flowable:expression="#{delete.execute(execution.processInstanceId)}"/>
+    <serviceTask id="delete" name="Delete" flowable:delegateExpression="${delete}"/>
     <sequenceFlow id="flow99" sourceRef="delete" targetRef="theEnd"/>
     <endEvent id="theEnd"/>
-    <serviceTask id="updateWhilePendingCreateApproval" name="Update" flowable:expression="#{update.execute(execution.processInstanceId)}"/>
+    <serviceTask id="updateWhilePendingCreateApproval" name="Update" flowable:delegateExpression="${update}"/>
     <sequenceFlow id="sid-76B82B68-099D-4729-B8CF-D028386FE900" sourceRef="createApprovalGW" targetRef="createApproval"/>
     <sequenceFlow id="sid-B2EEC511-2924-4A95-B0B8-E35DA268DD58" sourceRef="createApprovalGW" targetRef="rejectedGw">
       <conditionExpression xsi:type="tFormalExpression"><![CDATA[${task == 'delete'}]]></conditionExpression>
@@ -246,7 +246,7 @@ try {
     <sequenceFlow id="createAsAnonymous2Approval" sourceRef="createGW" targetRef="createApproval">
       <conditionExpression xsi:type="tFormalExpression"><![CDATA[${wfExecutor == 'anonymous' || flowableUtils.isUserIngroup(userTO, 'groupForWorkflowApproval')}]]></conditionExpression>
     </sequenceFlow>
-    <serviceTask id="updateWhilePendingUpdateApproval" name="Update" flowable:expression="#{update.execute(execution.processInstanceId)}"/>
+    <serviceTask id="updateWhilePendingUpdateApproval" name="Update" flowable:delegateExpression="${update}"/>
     <exclusiveGateway id="sid-4C9C9117-26DB-4326-A12B-EEDA42EADF07" default="sid-12E29B94-C369-45C1-BCEF-C165AFDA525A"/>
     <sequenceFlow id="sid-930DADF1-C361-43DD-A240-582F21DEB9B6" sourceRef="createApproval" targetRef="sid-8CFA3152-19AA-4878-AD2C-96B63F6E98C7"/>
     <sequenceFlow id="sid-A2BDF803-688C-4A4D-9D33-6D859C029245" sourceRef="updateApproval" targetRef="sid-4C9C9117-26DB-4326-A12B-EEDA42EADF07"/>