Merged HEAD-BUG-FIX (5.1/Cloud) to HEAD (5.1/Cloud)

90779: Merged V4.2-BUG-FIX (4.2.5) to HEAD-BUG-FIX (5.0/Cloud)
      90654: Merged DEV to V4.2-BUG-FIX (4.2.4)
         88809: MNT-12502: Updating parent node (folder) fails using CMIS, if any of contained children is locked
            Check if HiddenAspect and IndexControlAspect exist on folder items before actually remove aspects.
            Apply cascade of the (un-)hide to children even if a child is locked. Add unit test for case.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@94717 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Alan Davis
2015-01-31 11:01:39 +00:00
parent 46244028c5
commit 549257843e
3 changed files with 100 additions and 6 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2005-2012 Alfresco Software Limited.
* Copyright (C) 2005-2014 Alfresco Software Limited.
*
* This file is part of Alfresco
*
@@ -33,6 +33,7 @@ import org.alfresco.api.AlfrescoPublicApi;
import org.alfresco.model.ContentModel;
import org.alfresco.query.PagingRequest;
import org.alfresco.query.PagingResults;
import org.alfresco.repo.policy.BehaviourFilter;
import org.alfresco.repo.policy.PolicyComponent;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.service.cmr.model.FileFolderService;
@@ -129,11 +130,17 @@ public class HiddenAspect
private FileFolderService fileFolderService;
private SearchService searchService;
private PolicyComponent policyComponent;
private BehaviourFilter behaviourFilter;
public HiddenAspect()
{
}
public void setBehaviourFilter(BehaviourFilter behaviourFilter)
{
this.behaviourFilter = behaviourFilter;
}
public void setPolicyComponent(PolicyComponent policyComponent)
{
this.policyComponent = policyComponent;
@@ -409,7 +416,15 @@ public class HiddenAspect
// already has the hidden aspect applied (it may have been applied for a different pattern).
for(FileInfo file : files)
{
applyHidden(file, filter);
behaviourFilter.disableBehaviour(file.getNodeRef(), ContentModel.ASPECT_LOCKABLE);
try
{
applyHidden(file, filter);
}
finally
{
behaviourFilter.enableBehaviour(file.getNodeRef(), ContentModel.ASPECT_LOCKABLE);
}
}
}
}
@@ -445,7 +460,15 @@ public class HiddenAspect
// already has the hidden aspect applied (it may have been applied for a different pattern).
for(FileInfo file : files)
{
applyHidden(file, filter);
behaviourFilter.disableBehaviour(file.getNodeRef(), ContentModel.ASPECT_LOCKABLE);
try
{
applyHidden(file, filter);
}
finally
{
behaviourFilter.enableBehaviour(file.getNodeRef(), ContentModel.ASPECT_LOCKABLE);
}
}
}
}
@@ -466,8 +489,22 @@ public class HiddenAspect
// remove hidden aspect only if it doesn't match a hidden pattern
if(isHidden(name) == null)
{
removeHiddenAspect(file.getNodeRef());
removeIndexControlAspect(file.getNodeRef());
behaviourFilter.disableBehaviour(file.getNodeRef(), ContentModel.ASPECT_LOCKABLE);
try
{
if (hasHiddenAspect(file.getNodeRef()))
{
removeHiddenAspect(file.getNodeRef());
}
if (hasIndexControlAspect(file.getNodeRef()))
{
removeIndexControlAspect(file.getNodeRef());
}
}
finally
{
behaviourFilter.enableBehaviour(file.getNodeRef(), ContentModel.ASPECT_LOCKABLE);
}
if(file.isFolder())
{