syncope-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ilgro...@apache.org
Subject [2/3] git commit: Profitinh of recent Activiti API enhancements
Date Wed, 05 Nov 2014 10:32:35 GMT
Profitinh of recent Activiti API enhancements


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

Branch: refs/heads/master
Commit: 84587034cfcab2f8f978ae893de577bb51462dd1
Parents: 76b35a7
Author: Francesco Chicchiriccò <ilgrosso@apache.org>
Authored: Wed Nov 5 11:32:13 2014 +0100
Committer: Francesco Chicchiriccò <ilgrosso@apache.org>
Committed: Wed Nov 5 11:32:13 2014 +0100

----------------------------------------------------------------------
 .../syncope/core/workflow/user/activiti/task/Create.java     | 6 +++---
 .../syncope/core/workflow/user/activiti/task/Delete.java     | 2 +-
 .../core/workflow/user/activiti/task/GenerateToken.java      | 2 +-
 .../syncope/core/workflow/user/activiti/task/Notify.java     | 8 +++-----
 .../core/workflow/user/activiti/task/PasswordReset.java      | 8 +++-----
 .../syncope/core/workflow/user/activiti/task/Update.java     | 4 ++--
 6 files changed, 13 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/84587034/core/src/main/java/org/apache/syncope/core/workflow/user/activiti/task/Create.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/syncope/core/workflow/user/activiti/task/Create.java
b/core/src/main/java/org/apache/syncope/core/workflow/user/activiti/task/Create.java
index 37dc284..e9e0ad4 100644
--- a/core/src/main/java/org/apache/syncope/core/workflow/user/activiti/task/Create.java
+++ b/core/src/main/java/org/apache/syncope/core/workflow/user/activiti/task/Create.java
@@ -33,9 +33,9 @@ public class Create extends AbstractActivitiServiceTask {
 
     @Override
     protected void doExecute(final String executionId) {
-        UserTO userTO = (UserTO) runtimeService.getVariable(executionId, ActivitiUserWorkflowAdapter.USER_TO);
-        Boolean storePassword = (Boolean) runtimeService.getVariable(executionId,
-                ActivitiUserWorkflowAdapter.STORE_PASSWORD);
+        UserTO userTO = runtimeService.getVariable(executionId, ActivitiUserWorkflowAdapter.USER_TO,
UserTO.class);
+        Boolean storePassword =
+                runtimeService.getVariable(executionId, ActivitiUserWorkflowAdapter.STORE_PASSWORD,
Boolean.class);
         // create and set workflow id
         SyncopeUser user = new SyncopeUser();
         dataBinder.create(user, userTO, storePassword == null ? true : storePassword);

http://git-wip-us.apache.org/repos/asf/syncope/blob/84587034/core/src/main/java/org/apache/syncope/core/workflow/user/activiti/task/Delete.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/syncope/core/workflow/user/activiti/task/Delete.java
b/core/src/main/java/org/apache/syncope/core/workflow/user/activiti/task/Delete.java
index e635c4e..5a5cb34 100644
--- a/core/src/main/java/org/apache/syncope/core/workflow/user/activiti/task/Delete.java
+++ b/core/src/main/java/org/apache/syncope/core/workflow/user/activiti/task/Delete.java
@@ -28,7 +28,7 @@ public class Delete extends AbstractActivitiServiceTask {
     @Override
     protected void doExecute(final String executionId) {
         SyncopeUser user =
-                (SyncopeUser) runtimeService.getVariable(executionId, ActivitiUserWorkflowAdapter.SYNCOPE_USER);
+                runtimeService.getVariable(executionId, ActivitiUserWorkflowAdapter.SYNCOPE_USER,
SyncopeUser.class);
 
         // Do something with SyncopeUser...
         if (user != null) {

http://git-wip-us.apache.org/repos/asf/syncope/blob/84587034/core/src/main/java/org/apache/syncope/core/workflow/user/activiti/task/GenerateToken.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/syncope/core/workflow/user/activiti/task/GenerateToken.java
b/core/src/main/java/org/apache/syncope/core/workflow/user/activiti/task/GenerateToken.java
index cfc345a..48876cf 100644
--- a/core/src/main/java/org/apache/syncope/core/workflow/user/activiti/task/GenerateToken.java
+++ b/core/src/main/java/org/apache/syncope/core/workflow/user/activiti/task/GenerateToken.java
@@ -33,7 +33,7 @@ public class GenerateToken extends AbstractActivitiServiceTask {
     @Override
     protected void doExecute(final String executionId) {
         SyncopeUser user =
-                (SyncopeUser) runtimeService.getVariable(executionId, ActivitiUserWorkflowAdapter.SYNCOPE_USER);
+                runtimeService.getVariable(executionId, ActivitiUserWorkflowAdapter.SYNCOPE_USER,
SyncopeUser.class);
 
         user.generateToken(
                 confDAO.find("token.length", "256").getValues().get(0).getLongValue().intValue(),

http://git-wip-us.apache.org/repos/asf/syncope/blob/84587034/core/src/main/java/org/apache/syncope/core/workflow/user/activiti/task/Notify.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/syncope/core/workflow/user/activiti/task/Notify.java
b/core/src/main/java/org/apache/syncope/core/workflow/user/activiti/task/Notify.java
index d6a388a..8209852 100644
--- a/core/src/main/java/org/apache/syncope/core/workflow/user/activiti/task/Notify.java
+++ b/core/src/main/java/org/apache/syncope/core/workflow/user/activiti/task/Notify.java
@@ -41,11 +41,9 @@ public class Notify extends AbstractActivitiServiceTask {
     @Override
     protected void doExecute(final String executionId) {
         SyncopeUser user =
-                (SyncopeUser) runtimeService.getVariable(executionId, ActivitiUserWorkflowAdapter.SYNCOPE_USER);
-        UserTO userTO =
-                (UserTO) runtimeService.getVariable(executionId, ActivitiUserWorkflowAdapter.USER_TO);
-        String event =
-                (String) runtimeService.getVariable(executionId, ActivitiUserWorkflowAdapter.EVENT);
+                runtimeService.getVariable(executionId, ActivitiUserWorkflowAdapter.SYNCOPE_USER,
SyncopeUser.class);
+        UserTO userTO = runtimeService.getVariable(executionId, ActivitiUserWorkflowAdapter.USER_TO,
UserTO.class);
+        String event = runtimeService.getVariable(executionId, ActivitiUserWorkflowAdapter.EVENT,
String.class);
 
         if (StringUtils.isNotBlank(event)) {
             notificationManager.createTasks(

http://git-wip-us.apache.org/repos/asf/syncope/blob/84587034/core/src/main/java/org/apache/syncope/core/workflow/user/activiti/task/PasswordReset.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/syncope/core/workflow/user/activiti/task/PasswordReset.java
b/core/src/main/java/org/apache/syncope/core/workflow/user/activiti/task/PasswordReset.java
index 4b34666..e9d59a3 100644
--- a/core/src/main/java/org/apache/syncope/core/workflow/user/activiti/task/PasswordReset.java
+++ b/core/src/main/java/org/apache/syncope/core/workflow/user/activiti/task/PasswordReset.java
@@ -29,11 +29,9 @@ public class PasswordReset extends AbstractActivitiServiceTask {
     @Override
     protected void doExecute(final String executionId) {
         SyncopeUser user =
-                (SyncopeUser) runtimeService.getVariable(executionId, ActivitiUserWorkflowAdapter.SYNCOPE_USER);
-        String token =
-                (String) runtimeService.getVariable(executionId, ActivitiUserWorkflowAdapter.TOKEN);
-        String password =
-                (String) runtimeService.getVariable(executionId, ActivitiUserWorkflowAdapter.PASSWORD);
+                runtimeService.getVariable(executionId, ActivitiUserWorkflowAdapter.SYNCOPE_USER,
SyncopeUser.class);
+        String token = runtimeService.getVariable(executionId, ActivitiUserWorkflowAdapter.TOKEN,
String.class);
+        String password = runtimeService.getVariable(executionId, ActivitiUserWorkflowAdapter.PASSWORD,
String.class);
 
         if (!user.checkToken(token)) {
             throw new WorkflowException(new IllegalArgumentException("Wrong token: " + token
+ " for " + user));

http://git-wip-us.apache.org/repos/asf/syncope/blob/84587034/core/src/main/java/org/apache/syncope/core/workflow/user/activiti/task/Update.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/syncope/core/workflow/user/activiti/task/Update.java
b/core/src/main/java/org/apache/syncope/core/workflow/user/activiti/task/Update.java
index fe53068..dda6f30 100644
--- a/core/src/main/java/org/apache/syncope/core/workflow/user/activiti/task/Update.java
+++ b/core/src/main/java/org/apache/syncope/core/workflow/user/activiti/task/Update.java
@@ -36,9 +36,9 @@ public class Update extends AbstractActivitiServiceTask {
     @Override
     protected void doExecute(final String executionId) {
         SyncopeUser user =
-                (SyncopeUser) runtimeService.getVariable(executionId, ActivitiUserWorkflowAdapter.SYNCOPE_USER);
+                runtimeService.getVariable(executionId, ActivitiUserWorkflowAdapter.SYNCOPE_USER,
SyncopeUser.class);
         UserMod userMod =
-                (UserMod) runtimeService.getVariable(executionId, ActivitiUserWorkflowAdapter.USER_MOD);
+                runtimeService.getVariable(executionId, ActivitiUserWorkflowAdapter.USER_MOD,
UserMod.class);
 
         // update password internally only if required
         UserMod actualMod = SerializationUtils.clone(userMod);


Mime
View raw message