mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merge DEV/V3.4-BUG-FIX to HEAD (28799-28800,28864,28875,28879,28916,28941,28956,28970,28993)
28993: HomeFolderProviderSynchronizer: Provider used for LDAP to continue to use username as home folder name directly under .../app:company_home/app:user_homes Property spaces.user_homes.regex.pattern now set to "" rather than "^(..)" which would have given a single level hash structure. 28970: Merge DEV/ALAN/HOME_FOLDER to DEV/V3.4-BUG-FIX 28947: - Introduction of version 2 HomeFolderProvider2 and re-factor of version 1 so that the code used to create the folders is now in the HomeFolderManager. - Re-factor homeFolderProviderSynchronizer to handle HomeFolderProvider2. - Addition of AbstractHomeFolderProvider.V2Adaptor to allow external providers that extend AbstractHomeFolderPathProvider to be handled by homeFolderProviderSynchronizer. 28860: Minor change to class comment and removed unused imports 28858: ALF-4727 Hashed home folder provider added and used by default for LDAP sync users - based on Romain Guinot work. ALF-7797 HomeFolderProviderSynchronizer added to move existing users (normally those added by LDAP sync) into location preferred by home folder provider. - HomeFolderProviderSynchronizer bug fixes - tenant accounts supported for first time - addition of a phase to create parent folders before moving home folder to avoid a race condition - check for conditions that would result in FileExistExceptions as we don't want a the transaction to be discarded as this results in retries. - HomeFolderProviderSynchronizerTest integration test including tenant services - HomeFolderManager now sets the HOME_FOLDER_PROVIDER if it uses a default when HOME_FOLDER_PROVIDER is not set. - AbstractHomeFolderProvider clears cache when path reset as it will be invalid. - UIDBasedHomeFolderProvider.createNewParent creates its own mutable List as the one passed in may not be mutable. 28580: Save code changes - added comments to do with LDAP syn overriding the HFP value and related to this added a global property to keep empty parent folders. 28347: HomeFolderProviderSynchronizer - issue to do with new run of sync having created a user via UI that has a home folder as one of the parent folders. - issue to do with catching exception when creating temporary folder - transaction is gone - give up if error in any phase 28298: Addition of HomeFolderPathProvider (based on Romain's work) and addition of HomeFolderProviderSynchronizer. 28956: Merged DEV to V3.4-BUG-FIX ALF-9428: Multitenancy users not preserved after upgrade from 3.2.2.7 to 3.4.2 - Provide correct RunAs context in FixUserQNamesPatch batching. 28941: ALF-9361 : CLONE -sync Flat IMAP client with Alfresco is slow and inaccurate 28916: ALF-9421 The AlfrescoJavaScript action now includes company home in the JavaScript scope. 28879: Fixed ALF-9296: Alfresco Dashboard: Impossible to approve/reject task from My Tasks dashlet on My Alfresco 28875: Fixed ALF-6329: SPANISH - Share, translation on Transfer Target configuration 28864: Message: ALF-9430: RuntimeExec waitForCompletion logic is obscure - Only a single flag 'isCompleted' - Set flag in try-finally - Added notify() However, the wait() code doesn't, in practice, get called because the waitForCompletion is synchronized with the run() and is called a while after the reading thread is triggered. So the logic is less obscure and safer for the finally. 28800: File for rev 28799: ALF-9240 28799: Merged DEV to V3.4-BUG-FIX 28797: ALF-9240: Issue with adding an aspect with large multivalued list Added unit test to stress, but could not reproduce git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@28995 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -100,6 +100,8 @@ import org.springframework.extensions.surf.util.AbstractLifecycleBean;
|
||||
import org.springframework.extensions.surf.util.I18NUtil;
|
||||
import org.springframework.util.FileCopyUtils;
|
||||
|
||||
import com.icegreen.greenmail.imap.ImapConstants;
|
||||
|
||||
/**
|
||||
* @author Dmitry Vaserin
|
||||
* @author Arseny Kovalchuk
|
||||
@@ -216,6 +218,11 @@ public class ImapServiceImpl implements ImapService, OnCreateChildAssociationPol
|
||||
this.foldersCache = foldersCache;
|
||||
}
|
||||
|
||||
public SimpleCache<Serializable, Object> getFoldersCache()
|
||||
{
|
||||
return foldersCache;
|
||||
}
|
||||
|
||||
public FileFolderService getFileFolderService()
|
||||
{
|
||||
return fileFolderService;
|
||||
@@ -792,11 +799,13 @@ public class ImapServiceImpl implements ImapService, OnCreateChildAssociationPol
|
||||
/**
|
||||
* Check whether resultFolder is stale
|
||||
*/
|
||||
/*
|
||||
if(resultFolder.isStale())
|
||||
{
|
||||
logger.debug("folder is stale");
|
||||
resultFolder = null;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
if (resultFolder == null)
|
||||
@@ -841,7 +850,7 @@ public class ImapServiceImpl implements ImapService, OnCreateChildAssociationPol
|
||||
|
||||
NodeRef targetNode = fileFolderService.searchSimple(nodeRef, folderNames[i]);
|
||||
|
||||
if (targetNode == null)
|
||||
if (i == 0 && targetNode == null)
|
||||
{
|
||||
resultFolder = new AlfrescoImapFolder(user.getQualifiedMailboxName(), serviceRegistry);
|
||||
if (logger.isDebugEnabled())
|
||||
@@ -1294,6 +1303,20 @@ public class ImapServiceImpl implements ImapService, OnCreateChildAssociationPol
|
||||
|
||||
logger.debug("listMailboxes returning size:" + result.size());
|
||||
|
||||
StringBuilder prefix = new StringBuilder(128);
|
||||
prefix.append(ImapConstants.USER_NAMESPACE)
|
||||
.append(AlfrescoImapConst.HIERARCHY_DELIMITER)
|
||||
.append(user.getQualifiedMailboxName())
|
||||
.append(AlfrescoImapConst.HIERARCHY_DELIMITER);
|
||||
int prefixLength = prefix.length();
|
||||
|
||||
for(AlfrescoImapFolder folder : result)
|
||||
{
|
||||
String cacheKey = folder.getFullName().substring(prefixLength + 1, folder.getFullName().length() - 1);
|
||||
logger.debug("[listMailboxes] Adding the cache entry : " + cacheKey);
|
||||
foldersCache.put(cacheKey, folder);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
}
|
||||
@@ -2150,6 +2173,38 @@ public class ImapServiceImpl implements ImapService, OnCreateChildAssociationPol
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void beforeDeleteNode(NodeRef nodeRef)
|
||||
{
|
||||
|
||||
NodeRef parentNodeRef = nodeService.getPrimaryParent(nodeRef).getParentRef();
|
||||
if (ContentModel.TYPE_FOLDER.equals(nodeService.getType(nodeRef)))
|
||||
{
|
||||
// If a node is a folder, we need to remove its' cache with its' children cache as well
|
||||
invalidateFolderCacheByNodeRef(nodeRef, true);
|
||||
}
|
||||
else if (ContentModel.TYPE_CONTENT.equals(nodeService.getType(nodeRef)))
|
||||
{
|
||||
// If a node is a content, it is simpler to remove its' parent cache
|
||||
// to avoid of deal with folder messages cache
|
||||
invalidateFolderCacheByNodeRef(parentNodeRef, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
// Add a listener once, when a lots of messsages were created/moved into the folder
|
||||
if (AlfrescoTransactionSupport.getResource(UIDVALIDITY_LISTENER_ALREADY_BOUND) == null)
|
||||
{
|
||||
AlfrescoTransactionSupport.bindListener(new UidValidityTransactionListener(parentNodeRef, nodeService));
|
||||
AlfrescoTransactionSupport.bindResource(UIDVALIDITY_LISTENER_ALREADY_BOUND, true);
|
||||
}
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("[beforeDeleteNode] Node " + nodeRef + " going to be removed. UIDVALIDITY will be changed for " + parentNodeRef);
|
||||
}
|
||||
}
|
||||
|
||||
private class UidValidityTransactionListener extends TransactionListenerAdapter
|
||||
{
|
||||
|
||||
@@ -2202,7 +2257,7 @@ public class ImapServiceImpl implements ImapService, OnCreateChildAssociationPol
|
||||
}
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("UIDVALIDITY was modified");
|
||||
logger.debug("UIDVALIDITY was modified for " + folderNodeRef);
|
||||
}
|
||||
return modifDate;
|
||||
}
|
||||
@@ -2212,6 +2267,69 @@ public class ImapServiceImpl implements ImapService, OnCreateChildAssociationPol
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void invalidateFolderCacheByNodeRef(NodeRef folderNodeRef, boolean invalidateChildren)
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
if (invalidateChildren)
|
||||
{
|
||||
logger.debug("[invalidateFolderCacheByNodeRef] Invalidate cache entries for " + folderNodeRef);
|
||||
}
|
||||
else
|
||||
{
|
||||
logger.debug("[invalidateFolderCacheByNodeRef] Invalidate cache entries for " + folderNodeRef + " and children");
|
||||
}
|
||||
}
|
||||
|
||||
if (invalidateChildren)
|
||||
{
|
||||
SimpleCache<Serializable, Object> foldersCache = getFoldersCache();
|
||||
List<Serializable> toRemove = new LinkedList<Serializable>();
|
||||
for(Serializable name : foldersCache.getKeys())
|
||||
{
|
||||
AlfrescoImapFolder folder = (AlfrescoImapFolder) foldersCache.get(name);
|
||||
if (folderNodeRef.equals(folder.getFolderInfo().getNodeRef()))
|
||||
{
|
||||
toRemove.add(name);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (toRemove.size() > 0)
|
||||
{
|
||||
String rootName = (String) toRemove.get(0);
|
||||
for(Serializable name : foldersCache.getKeys())
|
||||
{
|
||||
if (((String) name).startsWith(rootName))
|
||||
{
|
||||
toRemove.add(name);
|
||||
}
|
||||
}
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("Caches to invalidate: " + toRemove.toString());
|
||||
}
|
||||
for(Serializable name : toRemove)
|
||||
{
|
||||
foldersCache.remove(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SimpleCache<Serializable, Object> foldersCache = getFoldersCache();
|
||||
for(Serializable name : foldersCache.getKeys())
|
||||
{
|
||||
AlfrescoImapFolder folder = (AlfrescoImapFolder) foldersCache.get(name);
|
||||
if (folderNodeRef.equals(folder.getFolderInfo().getNodeRef()))
|
||||
{
|
||||
foldersCache.remove(name);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if provided nodeRef is in Sites/.../documentlibrary
|
||||
*/
|
||||
|
Reference in New Issue
Block a user