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
This commit is contained in:
Alan Davis
2014-09-19 08:34:12 +00:00
parent 988366280c
commit de70eaf6cb

View File

@@ -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<Node> 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<String, WorkflowDefinition> 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)