mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged HEAD-BUG-FIX (5.0/Cloud) to HEAD (5.0/Cloud)
79314: Merged V4.2-BUG-FIX (4.2.4) to HEAD-BUG-FIX (5.0/Cloud) 79222: MNT-12063: Merged V4.2.1 (4.2.1) to V4.2-BUG-FIX (4.2.2) 79141: MNT-12079 : CLONE - IMAP client failing to retrieve all folders - Ignore mount point if it is not exists or user has no permissions to retrieve path git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@82704 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -1210,7 +1210,7 @@ public class ImapServiceImpl implements ImapService, OnRestoreNodePolicy, OnCrea
|
||||
{
|
||||
try
|
||||
{
|
||||
return config.getFolderPath(namespaceService, nodeService, searchService, fileFolderService);
|
||||
return config.getFolderPathOrNull(namespaceService, nodeService, searchService, fileFolderService);
|
||||
}
|
||||
catch (AccessDeniedException e)
|
||||
{
|
||||
|
@@ -104,20 +104,49 @@ public class RepositoryFolderConfigBean extends RepositoryPathConfigBean
|
||||
* <p>
|
||||
* Authentication and transactions are the client's responsibility.
|
||||
*
|
||||
* @return Returns an existing folder reference or null
|
||||
* @return Returns an existing folder reference
|
||||
* @throws AlfrescoRuntimeException if path cannot be resolved or found node is not a folder
|
||||
*/
|
||||
public NodeRef getFolderPath(
|
||||
NamespaceService namespaceService,
|
||||
NodeService nodeService,
|
||||
SearchService searchService,
|
||||
FileFolderService fileFolderService)
|
||||
{
|
||||
return getFolderPathImpl(namespaceService, nodeService, searchService, fileFolderService, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to find the folder path referenced by this bean.
|
||||
* The {@link #getPath() path} to the start of the {@link #getFolderNames() folder path}
|
||||
* must exist.
|
||||
* <p>
|
||||
* Authentication and transactions are the client's responsibility.
|
||||
*
|
||||
* @return Returns an existing folder reference or null
|
||||
*/
|
||||
public NodeRef getFolderPathOrNull(
|
||||
NamespaceService namespaceService,
|
||||
NodeService nodeService,
|
||||
SearchService searchService,
|
||||
FileFolderService fileFolderService)
|
||||
{
|
||||
return getFolderPathImpl(namespaceService, nodeService, searchService, fileFolderService, false);
|
||||
}
|
||||
|
||||
private NodeRef getFolderPathImpl(
|
||||
NamespaceService namespaceService,
|
||||
NodeService nodeService,
|
||||
SearchService searchService,
|
||||
FileFolderService fileFolderService,
|
||||
boolean throwException)
|
||||
{
|
||||
NodeRef pathStartNodeRef = super.resolveNodePath(namespaceService, nodeService, searchService);
|
||||
if (pathStartNodeRef == null)
|
||||
{
|
||||
throw new AlfrescoRuntimeException(
|
||||
return getNullOrThrowAlfrescoRuntimeExcpetion(
|
||||
"Folder path resolution requires an existing base path. \n" +
|
||||
" Base path: " + getRootPath());
|
||||
" Base path: " + getRootPath(), throwException);
|
||||
}
|
||||
// Just choose the root path if the folder path is empty
|
||||
if (folderPath.length() == 0)
|
||||
@@ -129,7 +158,7 @@ public class RepositoryFolderConfigBean extends RepositoryPathConfigBean
|
||||
List<NodeRef> nodeRefs = searchService.selectNodes(pathStartNodeRef, folderPath, null, namespaceService, true);
|
||||
if (nodeRefs.size() == 0)
|
||||
{
|
||||
throw new AlfrescoRuntimeException("Folder not found: " + this);
|
||||
return getNullOrThrowAlfrescoRuntimeExcpetion("Folder not found: " + this, throwException);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -137,7 +166,7 @@ public class RepositoryFolderConfigBean extends RepositoryPathConfigBean
|
||||
FileInfo folderInfo = fileFolderService.getFileInfo(nodeRef);
|
||||
if (!folderInfo.isFolder())
|
||||
{
|
||||
throw new AlfrescoRuntimeException("Not a folder: " + this);
|
||||
return getNullOrThrowAlfrescoRuntimeExcpetion("Not a folder: " + this, throwException);
|
||||
}
|
||||
return nodeRef;
|
||||
}
|
||||
@@ -145,6 +174,15 @@ public class RepositoryFolderConfigBean extends RepositoryPathConfigBean
|
||||
// Done
|
||||
}
|
||||
|
||||
private NodeRef getNullOrThrowAlfrescoRuntimeExcpetion(String exceptionMessage, boolean throwException)
|
||||
{
|
||||
if (throwException)
|
||||
{
|
||||
throw new AlfrescoRuntimeException(exceptionMessage);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to find or create the folder path referenced by this bean.
|
||||
* The {@link #getPath() path} to the start of the {@link #getFolderNames() folder path}
|
||||
|
Reference in New Issue
Block a user