From de70eaf6cb9560fc3d5dd60ce7543fc8ed0d274b Mon Sep 17 00:00:00 2001 From: Alan Davis Date: Fri, 19 Sep 2014 08:34:12 +0000 Subject: [PATCH] Merged HEAD-BUG-FIX (5.0/Cloud) to HEAD (5.0/Cloud) 84671: Merged V4.2-BUG-FIX (4.2.4) to HEAD-BUG-FIX (5.0/Cloud) 84518: Merged V4.1-BUG-FIX (4.1.10) to V4.2-BUG-FIX (4.2.4) 84351: Merged DEV to V4.1-BUG-FIX (4.1.10) 79271 : MNT-11522 : Document modified date is being updated by Workflow - Fix bug. Change create a workflow package for the attached items and add them. Add Behavior Filter. 81662 : MNT-11522 : Document modified date is being updated by Workflow - Create Unit test. 83496 : MNT-11522 : Document modified date is being updated by Workflow - Change unit test. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@84685 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../bean/workflow/StartWorkflowWizard.java | 35 ++++++++++++++++--- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/source/java/org/alfresco/web/bean/workflow/StartWorkflowWizard.java b/source/java/org/alfresco/web/bean/workflow/StartWorkflowWizard.java index f79a2e43f7..8a647a1094 100644 --- a/source/java/org/alfresco/web/bean/workflow/StartWorkflowWizard.java +++ b/source/java/org/alfresco/web/bean/workflow/StartWorkflowWizard.java @@ -36,6 +36,7 @@ import javax.transaction.UserTransaction; import org.alfresco.model.ApplicationModel; import org.alfresco.model.ContentModel; +import org.alfresco.repo.policy.BehaviourFilter; import org.alfresco.repo.publishing.PublishingEventHelper; import org.alfresco.repo.workflow.WorkflowModel; import org.alfresco.repo.workflow.activiti.ActivitiConstants; @@ -90,6 +91,7 @@ public class StartWorkflowWizard extends BaseWizardBean transient private WorkflowService workflowService; transient private InvitationService invitationService; + transient private BehaviourFilter policyBehaviourFilter; protected Node startTaskNode; protected List resources; @@ -117,6 +119,20 @@ public class StartWorkflowWizard extends BaseWizardBean return this.unprotectedNodeService; } + public void setPolicyBehaviourFilter(BehaviourFilter policyBehaviourFilter) + { + this.policyBehaviourFilter = policyBehaviourFilter; + } + + protected BehaviourFilter getBehaviourFilter() + { + if(this.policyBehaviourFilter == null) + { + this.policyBehaviourFilter = (BehaviourFilter) FacesHelper.getManagedBean(FacesContext.getCurrentInstance(), "policyBehaviourFilter"); + } + return this.policyBehaviourFilter; + } + protected Map getWorkflows() { if (this.workflows == null) @@ -203,11 +219,20 @@ public class StartWorkflowWizard extends BaseWizardBean for (String addedItem : this.packageItemsToAdd) { - NodeRef addedNodeRef = new NodeRef(addedItem); - this.getUnprotectedNodeService().addChild(workflowPackage, addedNodeRef, - WorkflowModel.ASSOC_PACKAGE_CONTAINS, QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, - QName.createValidLocalName((String)this.getNodeService().getProperty( - addedNodeRef, ContentModel.PROP_NAME)))); + NodeRef addedNodeRef = new NodeRef(addedItem); + //MNT-11522. fix bug. add behavior filter for add items in workflow package. + try + { + this.getBehaviourFilter().disableBehaviour(addedNodeRef, ContentModel.ASPECT_AUDITABLE); + this.getUnprotectedNodeService().addChild(workflowPackage, addedNodeRef, + WorkflowModel.ASSOC_PACKAGE_CONTAINS, QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, + QName.createValidLocalName((String)this.getNodeService().getProperty( + addedNodeRef, ContentModel.PROP_NAME)))); + } + finally + { + this.getBehaviourFilter().enableBehaviour(addedNodeRef, ContentModel.ASPECT_AUDITABLE); + } } // setup the context for the workflow (this is the space the workflow was launched from)