syncope-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ilgro...@apache.org
Subject [6/8] git commit: [SYNCOPE-600] Adding miss pre-condition for form availability after form submit
Date Wed, 05 Nov 2014 10:08:31 GMT
[SYNCOPE-600] Adding miss pre-condition for form availability after form submit


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

Branch: refs/heads/master
Commit: 76b35a7870eee368d8b78e71d39bd9ecc2de5934
Parents: 377963e
Author: Francesco Chicchiriccò <ilgrosso@apache.org>
Authored: Wed Nov 5 11:07:41 2014 +0100
Committer: Francesco Chicchiriccò <ilgrosso@apache.org>
Committed: Wed Nov 5 11:07:41 2014 +0100

----------------------------------------------------------------------
 .../activiti/ActivitiUserWorkflowAdapter.java   | 32 +++++++++++---------
 1 file changed, 18 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/76b35a78/core/src/main/java/org/apache/syncope/core/workflow/user/activiti/ActivitiUserWorkflowAdapter.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/syncope/core/workflow/user/activiti/ActivitiUserWorkflowAdapter.java
b/core/src/main/java/org/apache/syncope/core/workflow/user/activiti/ActivitiUserWorkflowAdapter.java
index fdf35de..4f0d876 100644
--- a/core/src/main/java/org/apache/syncope/core/workflow/user/activiti/ActivitiUserWorkflowAdapter.java
+++ b/core/src/main/java/org/apache/syncope/core/workflow/user/activiti/ActivitiUserWorkflowAdapter.java
@@ -208,8 +208,9 @@ public class ActivitiUserWorkflowAdapter extends AbstractUserWorkflowAdapter
{
     private Set<String> getPerformedTasks(final SyncopeUser user) {
         final Set<String> result = new HashSet<String>();
 
-        for (HistoricActivityInstance task : historyService.createHistoricActivityInstanceQuery().executionId(user.
-                getWorkflowId()).list()) {
+        for (HistoricActivityInstance task
+                : historyService.createHistoricActivityInstanceQuery().executionId(user.getWorkflowId()).list())
{
+
             result.add(task.getActivityId());
         }
 
@@ -261,11 +262,11 @@ public class ActivitiUserWorkflowAdapter extends AbstractUserWorkflowAdapter
{
             throwException(e, "While starting " + WF_PROCESS_ID + " instance");
         }
 
-        SyncopeUser user = (SyncopeUser) runtimeService.getVariable(
-                processInstance.getProcessInstanceId(), SYNCOPE_USER);
+        SyncopeUser user =
+                runtimeService.getVariable(processInstance.getProcessInstanceId(), SYNCOPE_USER,
SyncopeUser.class);
 
-        Boolean updatedEnabled = (Boolean) runtimeService.getVariable(
-                processInstance.getProcessInstanceId(), ENABLED);
+        Boolean updatedEnabled =
+                runtimeService.getVariable(processInstance.getProcessInstanceId(), ENABLED,
Boolean.class);
         if (updatedEnabled != null) {
             user.setSuspended(!updatedEnabled);
         }
@@ -278,8 +279,8 @@ public class ActivitiUserWorkflowAdapter extends AbstractUserWorkflowAdapter
{
         updateStatus(user);
         user = userDAO.save(user);
 
-        Boolean propagateEnable = (Boolean) runtimeService.getVariable(
-                processInstance.getProcessInstanceId(), PROPAGATE_ENABLE);
+        Boolean propagateEnable =
+                runtimeService.getVariable(processInstance.getProcessInstanceId(), PROPAGATE_ENABLE,
Boolean.class);
         if (propagateEnable == null) {
             propagateEnable = enabled;
         }
@@ -353,12 +354,12 @@ public class ActivitiUserWorkflowAdapter extends AbstractUserWorkflowAdapter
{
         updateStatus(user);
         SyncopeUser updated = userDAO.save(user);
 
-        PropagationByResource propByRes = (PropagationByResource) runtimeService.getVariable(
-                user.getWorkflowId(), PROP_BY_RESOURCE);
+        PropagationByResource propByRes =
+                runtimeService.getVariable(user.getWorkflowId(), PROP_BY_RESOURCE, PropagationByResource.class);
 
         saveForFormSubmit(updated, userMod.getPassword(), propByRes);
 
-        Boolean propagateEnable = (Boolean) runtimeService.getVariable(user.getWorkflowId(),
PROPAGATE_ENABLE);
+        Boolean propagateEnable = runtimeService.getVariable(user.getWorkflowId(), PROPAGATE_ENABLE,
Boolean.class);
 
         return new WorkflowResult<Map.Entry<UserMod, Boolean>>(
                 new SimpleEntry<UserMod, Boolean>(userMod, propagateEnable), propByRes,
tasks);
@@ -826,16 +827,19 @@ public class ActivitiUserWorkflowAdapter extends AbstractUserWorkflowAdapter
{
 
         // see if there is any propagation to be done
         PropagationByResource propByRes =
-                (PropagationByResource) runtimeService.getVariable(user.getWorkflowId(),
PROP_BY_RESOURCE);
+                runtimeService.getVariable(user.getWorkflowId(), PROP_BY_RESOURCE, PropagationByResource.class);
 
         // fetch - if available - the encrypted password
         String clearPassword = null;
-        String encryptedPwd = (String) runtimeService.getVariable(user.getWorkflowId(), ENCRYPTED_PWD);
+        String encryptedPwd = runtimeService.getVariable(user.getWorkflowId(), ENCRYPTED_PWD,
String.class);
         if (StringUtils.isNotBlank(encryptedPwd)) {
             clearPassword = decrypt(encryptedPwd);
         }
 
-        UserMod userMod = (UserMod) runtimeService.getVariable(user.getWorkflowId(), USER_MOD);
+        // supports approval chains
+        saveForFormSubmit(user, clearPassword, propByRes);
+
+        UserMod userMod = runtimeService.getVariable(user.getWorkflowId(), USER_MOD, UserMod.class);
         if (userMod == null) {
             userMod = new UserMod();
             userMod.setId(updated.getId());


Mime
View raw message