diff --git a/source/java/org/alfresco/repo/copy/CopyServiceImpl.java b/source/java/org/alfresco/repo/copy/CopyServiceImpl.java index 91270e6731..80c1c4348d 100644 --- a/source/java/org/alfresco/repo/copy/CopyServiceImpl.java +++ b/source/java/org/alfresco/repo/copy/CopyServiceImpl.java @@ -548,8 +548,14 @@ public class CopyServiceImpl implements CopyService ChildAssociationDefinition childAssocDef = (ChildAssociationDefinition) assocDef; if (dropName && !childAssocDef.getDuplicateChildNamesAllowed()) { - // duplicate children are not allowed. - targetNodeProperties.remove(ContentModel.PROP_NAME); + // ALF-13949: A behaviour callback (e.g. WorkingCopyAspect) may already have generated a new name, so + // preserve the new name if it has changed + String newName = (String) targetNodeProperties.get(ContentModel.PROP_NAME); + if (newName != null && newName.equals(nodeService.getProperty(sourceNodeRef, ContentModel.PROP_NAME))) + { + // duplicate children are not allowed. + targetNodeProperties.remove(ContentModel.PROP_NAME); + } } } diff --git a/source/java/org/alfresco/repo/model/filefolder/FileFolderServiceImpl.java b/source/java/org/alfresco/repo/model/filefolder/FileFolderServiceImpl.java index f47ca76c4e..beef653df3 100644 --- a/source/java/org/alfresco/repo/model/filefolder/FileFolderServiceImpl.java +++ b/source/java/org/alfresco/repo/model/filefolder/FileFolderServiceImpl.java @@ -1139,7 +1139,10 @@ public class FileFolderServiceImpl implements FileFolderService // Only update the name if it has changed String currentName = (String)nodeService.getProperty(targetNodeRef, ContentModel.PROP_NAME); - if (currentName.equals(newName) == false) + + // ALF-13949: WorkingCopyAspect intentionally generates new names for all copies of working copies (which no + // longer have the working copy aspect) so leave these alone after copy + if (!currentName.equals(newName) && !nodeService.hasAspect(sourceNodeRef, ContentModel.ASPECT_WORKING_COPY)) { try { diff --git a/source/java/org/alfresco/repo/security/authority/AuthorityDAOImpl.java b/source/java/org/alfresco/repo/security/authority/AuthorityDAOImpl.java index 342af25dc7..db3f9483c9 100644 --- a/source/java/org/alfresco/repo/security/authority/AuthorityDAOImpl.java +++ b/source/java/org/alfresco/repo/security/authority/AuthorityDAOImpl.java @@ -797,7 +797,7 @@ public class AuthorityDAOImpl implements AuthorityDAO, NodeServicePolicies.Befor { listAuthorities(null, name, authorities, true, true); } - if(!TransactionalResourceHelper.getSet(DELETING_AUTHORITY_SET_RESOURCE).contains(name)) + if(AlfrescoTransactionSupport.getTransactionId() != null && !TransactionalResourceHelper.getSet(DELETING_AUTHORITY_SET_RESOURCE).contains(name)) { userAuthorityCache.put(name, Collections.unmodifiableSet(authorities)); } diff --git a/source/java/org/alfresco/repo/security/person/PersonServiceImpl.java b/source/java/org/alfresco/repo/security/person/PersonServiceImpl.java index 9ec216ee2a..4133b4bd82 100644 --- a/source/java/org/alfresco/repo/security/person/PersonServiceImpl.java +++ b/source/java/org/alfresco/repo/security/person/PersonServiceImpl.java @@ -1715,7 +1715,7 @@ public class PersonServiceImpl extends TransactionListenerAdapter implements Per private void putToCache(String userName, Set refs) { String key = userName.toLowerCase(); - if(!TransactionalResourceHelper.getSet(DELETING_PERSON_SET_RESOURCE).contains(key)) + if(AlfrescoTransactionSupport.getTransactionId() != null && TransactionalResourceHelper.getSet(DELETING_PERSON_SET_RESOURCE).contains(key)) { this.personCache.put(key, refs); }