Return-Path: X-Original-To: apmail-syncope-commits-archive@www.apache.org Delivered-To: apmail-syncope-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 6723CFC51 for ; Wed, 5 Nov 2014 10:08:27 +0000 (UTC) Received: (qmail 43100 invoked by uid 500); 5 Nov 2014 10:08:27 -0000 Delivered-To: apmail-syncope-commits-archive@syncope.apache.org Received: (qmail 43073 invoked by uid 500); 5 Nov 2014 10:08:27 -0000 Mailing-List: contact commits-help@syncope.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@syncope.apache.org Delivered-To: mailing list commits@syncope.apache.org Received: (qmail 43064 invoked by uid 99); 5 Nov 2014 10:08:27 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 05 Nov 2014 10:08:27 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 07C3CA0A0B8; Wed, 5 Nov 2014 10:08:26 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: ilgrosso@apache.org To: commits@syncope.apache.org Date: Wed, 05 Nov 2014 10:08:31 -0000 Message-Id: In-Reply-To: <579cb12431e94831b52cc310acb718ec@git.apache.org> References: <579cb12431e94831b52cc310acb718ec@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [6/8] git commit: [SYNCOPE-600] Adding miss pre-condition for form availability after form submit [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ò Authored: Wed Nov 5 11:07:41 2014 +0100 Committer: Francesco Chicchiriccò 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 getPerformedTasks(final SyncopeUser user) { final Set result = new HashSet(); - 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>( new SimpleEntry(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());