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

61049: Merged V4.2-BUG-FIX (4.2.2) to HEAD-BUG-FIX (Cloud/4.3)
      60931: Merged V4.1-BUG-FIX (4.1.8) to V4.2-BUG-FIX (4.2.2)
         60806: Merged BELARUS/V4.1-BUG_FIX-2013_11_27 (4.1.8) to V4.1-BUG-FIX (4.1.8)
            58341: MNT-8109: Moving a file over WebDAV changes the modification date although the file was not modified
               'system.preserve.modificationData' property has been added. The property controls if the logic of auditable aspect should be executed or not.
               - 'FileFolderServiceImplTest' has been fixed in accordance with changes in 'FileFolderServiceImpl';
               - 'FileFolderServicePropagationTest' has been added
            58456: MNT-8109: Moving a file over WebDAV changes the modification date although the file was not modified
               'system.preserve.modificationData' property has been added. The property controls if the logic of auditable aspect should be executed or not. Default value has been modified to 'false'. Tests were modified appropriately to respect the default value:
               - 'FileFolderServiceImplTest' has been reverted to the original state;
               - 'FileFolderServicePropagationTest' has been improved to avoid further modifications if the default value is changed;
               - 'FileFolderServicePropagationTest' has been added to 'ModelTestSuite';
               - Getter for the 'system.preserve.modificationData' property has been added to the 'FileFolderServiceImpl'


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@62381 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Alan Davis
2014-02-12 14:49:25 +00:00
parent c66a25e95d
commit 1c4d662866
5 changed files with 448 additions and 5 deletions

View File

@@ -41,6 +41,7 @@ import org.alfresco.query.PagingResults;
import org.alfresco.repo.copy.AbstractBaseCopyService;
import org.alfresco.repo.model.filefolder.HiddenAspect.Visibility;
import org.alfresco.repo.node.getchildren.GetChildrenCannedQuery;
import org.alfresco.repo.policy.BehaviourFilter;
import org.alfresco.repo.search.QueryParameterDefImpl;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.repo.security.permissions.PermissionCheckedCollection.PermissionCheckedCollectionMixin;
@@ -132,8 +133,11 @@ public class FileFolderServiceImpl extends AbstractBaseCopyService implements Fi
private SearchService searchService;
private ContentService contentService;
private MimetypeService mimetypeService;
private BehaviourFilter behaviourFilter;
private NamedObjectRegistry<CannedQueryFactory<NodeRef>> cannedQueryRegistry;
private boolean preserveModificationData = true;
// TODO: Replace this with a more formal means of identifying "system" folders (i.e. aspect or UUID)
private List<String> systemPaths;
@@ -206,8 +210,23 @@ public class FileFolderServiceImpl extends AbstractBaseCopyService implements Fi
{
this.defaultListMaxResults = defaultListMaxResults;
}
public void setBehaviourFilter(BehaviourFilter behaviourFilter)
{
this.behaviourFilter = behaviourFilter;
}
public void setPreserveModificationData(boolean preserveModificationData)
{
this.preserveModificationData = preserveModificationData;
}
public boolean isPreserveModificationData()
{
return preserveModificationData;
}
public void init()
{
}
@@ -1044,7 +1063,23 @@ public class FileFolderServiceImpl extends AbstractBaseCopyService implements Fi
if (isPrimaryParent)
{
// move the node so that the association moves as well
newAssocRef = nodeService.moveNode(sourceNodeRef, targetParentRef, assocTypeQname, qname);
boolean auditableBehaviorWasDisabled = preserveModificationData && behaviourFilter.isEnabled(ContentModel.ASPECT_AUDITABLE);
if (auditableBehaviorWasDisabled)
{
behaviourFilter.disableBehaviour(ContentModel.ASPECT_AUDITABLE);
}
try
{
newAssocRef = nodeService.moveNode(sourceNodeRef, targetParentRef, assocTypeQname, qname);
}
finally
{
if (auditableBehaviorWasDisabled)
{
behaviourFilter.enableBehaviour(ContentModel.ASPECT_AUDITABLE);
}
}
}
else
{