From 5dfd4e413ed3619253e0f986a4f6d8303d3acadd Mon Sep 17 00:00:00 2001 From: Gavin Cornwell Date: Mon, 14 Apr 2008 09:33:41 +0000 Subject: [PATCH] Merged 2.2 to HEAD git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@8751 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../repo/avm/wf/AVMSubmitPackageHandler.java | 30 ++++++++++--------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/source/java/org/alfresco/repo/avm/wf/AVMSubmitPackageHandler.java b/source/java/org/alfresco/repo/avm/wf/AVMSubmitPackageHandler.java index 8739c9a1c8..4faf3d5a3e 100644 --- a/source/java/org/alfresco/repo/avm/wf/AVMSubmitPackageHandler.java +++ b/source/java/org/alfresco/repo/avm/wf/AVMSubmitPackageHandler.java @@ -130,7 +130,8 @@ public class AVMSubmitPackageHandler extends JBPMSpringActionHandler implements AlfrescoTransactionSupport.bindResource("staging_diffs", stagingDiffs); - // Workflow does this as system as the staging area has restricted access + // Workflow does this as system as the staging area has restricted access and reviewers + // may not have permission to flatten the store the workflow was submitted from AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork() { @@ -139,22 +140,23 @@ public class AVMSubmitPackageHandler extends JBPMSpringActionHandler implements fAVMSyncService.update(stagingDiffs, null, false, false, true, true, tag, description); AVMDAOs.Instance().fAVMNodeDAO.flush(); fAVMSyncService.flatten(pkgPath.getSecond(), targetPath); + + // flatten source folder where changes were submitted from + if (from != null && from.length() > 0) + { + // first, submit changes back to sandbox forcing addition of edits in workflow (and submission + // flag removal). second, flatten sandbox, removing modified items that have been submitted + // TODO: Without locking on the sandbox, it's possible that a change to a "submitted" item + // may get lost when the item is finally approved + final List sandboxDiffs = fAVMSyncService.compare(pkgPath.getFirst(), pkgPath.getSecond(), -1, from, null); + fAVMSyncService.update(sandboxDiffs, null, true, true, false, false, tag, description); + AVMDAOs.Instance().fAVMNodeDAO.flush(); + fAVMSyncService.flatten(from, targetPath); + } + return null; } }, AuthenticationUtil.getSystemUserName()); - - // flatten source folder where changes were submitted from - if (from != null && from.length() > 0) - { - // first, submit changes back to sandbox forcing addition of edits in workflow (and submission - // flag removal). second, flatten sandbox, removing modified items that have been submitted - // TODO: Without locking on the sandbox, it's possible that a change to a "submitted" item - // may get lost when the item is finally approved - final List sandboxDiffs = fAVMSyncService.compare(pkgPath.getFirst(), pkgPath.getSecond(), -1, from, null); - fAVMSyncService.update(sandboxDiffs, null, true, true, false, false, tag, description); - AVMDAOs.Instance().fAVMNodeDAO.flush(); - fAVMSyncService.flatten(from, targetPath); - } } /**