Merged 5.1.N (5.1.2) to 5.2.N (5.2.1)

128192 amorarasu: Merged 5.0.N (5.0.4) to 5.1.N (5.1.2)
      128165 amorarasu: Merged V4.2-BUG-FIX (4.2.7) to 5.0.N (5.0.4)
         128151 rneamtu: MNT-15855 : Restoring a site or a folder with a locked for offline edit file does not work
            - restored associations between working copy and original node after a parent node is deleted
            - added unit test for case


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@128216 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Alan Davis
2016-06-21 11:06:09 +00:00
parent 8faec771c6
commit ecadec2d73
5 changed files with 296 additions and 35 deletions

View File

@@ -1,14 +1,14 @@
/*
* #%L
* Alfresco Repository
* %%
* Copyright (C) 2005 - 2016 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* #%L
* Alfresco Repository
* %%
* Copyright (C) 2005 - 2016 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@@ -2777,6 +2777,8 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl implements Extens
StoreRef oldStoreRef = oldNodeToMoveRef.getStoreRef();
StoreRef newStoreRef = parentNodeRef.getStoreRef();
List<ChildAssociationRef> nodesToRestoreAssociationsFor = new ArrayList<ChildAssociationRef>();
// Get the primary parent association
Pair<Long, ChildAssociationRef> oldParentAssocPair = nodeDAO.getPrimaryParentAssoc(nodeToMoveId);
if (oldParentAssocPair == null)
@@ -2881,8 +2883,21 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl implements Extens
// Fire node policies. This ensures that each node in the hierarchy gets a notification fired.
invokeOnDeleteNode(oldChildAssoc, childNodeTypeQName, childNodeAspectQNames, true);
invokeOnCreateNode(newChildAssoc);
// collect working copy nodes that need to be updated; we need all nodes
// to be already moved when create association between nodes
if (hasAspect(newChildAssoc.getChildRef(), ContentModel.ASPECT_ARCHIVE_LOCKABLE))
{
nodesToRestoreAssociationsFor.add(newChildAssoc);
}
}
// invoke onRestoreNode for working copy nodes in order to restore original lock
for (ChildAssociationRef childAssoc : nodesToRestoreAssociationsFor)
{
invokeOnRestoreNode(childAssoc);
}
return newParentAssocRef;
}
else