mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged V2.2 to HEAD
7740: Fix to display better error messages for errors when restricting WCM File Picker to configured search 7993: Added missing explicit AVM index. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@8449 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -1833,6 +1833,8 @@ error_association=Failed to find association definition for association \"{0}\".
|
|||||||
error_charset_null=Null characterset value
|
error_charset_null=Null characterset value
|
||||||
error_negative_quota=Quota cannot be negative: {0}
|
error_negative_quota=Quota cannot be negative: {0}
|
||||||
error_search_not_exist=Search does not exist with name: {0}
|
error_search_not_exist=Search does not exist with name: {0}
|
||||||
|
error_search_not_exist=Search does not exist with name: \"{0}\"
|
||||||
|
error_retrieving_search_results=Error getting results for search \"{0}\" - \"{1}\"
|
||||||
|
|
||||||
# Confirmations
|
# Confirmations
|
||||||
return_to_application=Return to application
|
return_to_application=Return to application
|
||||||
|
@@ -45,6 +45,7 @@ import org.alfresco.model.WCMModel;
|
|||||||
import org.alfresco.repo.avm.AVMNodeConverter;
|
import org.alfresco.repo.avm.AVMNodeConverter;
|
||||||
import org.alfresco.repo.content.MimetypeMap;
|
import org.alfresco.repo.content.MimetypeMap;
|
||||||
import org.alfresco.repo.domain.PropertyValue;
|
import org.alfresco.repo.domain.PropertyValue;
|
||||||
|
import org.alfresco.repo.search.SearcherException;
|
||||||
import org.alfresco.repo.security.permissions.AccessDeniedException;
|
import org.alfresco.repo.security.permissions.AccessDeniedException;
|
||||||
import org.alfresco.service.cmr.avm.AVMNodeDescriptor;
|
import org.alfresco.service.cmr.avm.AVMNodeDescriptor;
|
||||||
import org.alfresco.service.cmr.avm.AVMService;
|
import org.alfresco.service.cmr.avm.AVMService;
|
||||||
@@ -62,14 +63,12 @@ import org.alfresco.service.cmr.search.SearchService;
|
|||||||
import org.alfresco.service.namespace.NamespaceService;
|
import org.alfresco.service.namespace.NamespaceService;
|
||||||
import org.alfresco.service.namespace.QName;
|
import org.alfresco.service.namespace.QName;
|
||||||
import org.alfresco.service.namespace.RegexQNamePattern;
|
import org.alfresco.service.namespace.RegexQNamePattern;
|
||||||
import org.alfresco.util.ISO9075;
|
|
||||||
import org.alfresco.util.Pair;
|
import org.alfresco.util.Pair;
|
||||||
import org.alfresco.web.app.Application;
|
import org.alfresco.web.app.Application;
|
||||||
import org.alfresco.web.app.servlet.ajax.InvokeCommand;
|
import org.alfresco.web.app.servlet.ajax.InvokeCommand;
|
||||||
import org.alfresco.web.bean.FileUploadBean;
|
import org.alfresco.web.bean.FileUploadBean;
|
||||||
import org.alfresco.web.bean.repository.Node;
|
import org.alfresco.web.bean.repository.Node;
|
||||||
import org.alfresco.web.bean.repository.Repository;
|
import org.alfresco.web.bean.repository.Repository;
|
||||||
import org.alfresco.web.bean.repository.User;
|
|
||||||
import org.alfresco.web.forms.XMLUtil;
|
import org.alfresco.web.forms.XMLUtil;
|
||||||
import org.alfresco.web.ui.common.Utils;
|
import org.alfresco.web.ui.common.Utils;
|
||||||
import org.apache.commons.fileupload.FileItem;
|
import org.apache.commons.fileupload.FileItem;
|
||||||
@@ -443,10 +442,9 @@ public class FilePickerBean implements Serializable
|
|||||||
|
|
||||||
filePickerDataElement.setAttribute("error", MessageFormat.format(
|
filePickerDataElement.setAttribute("error", MessageFormat.format(
|
||||||
Application.getMessage(facesContext, "error_not_found"),
|
Application.getMessage(facesContext, "error_not_found"),
|
||||||
currentPath.substring(currentPath.lastIndexOf("/") + 1,
|
"'" + currentPath.substring(currentPath.lastIndexOf("/") + 1, currentPath.length()) + "'",
|
||||||
currentPath.length()),
|
(currentPath.lastIndexOf("/") == 0 ? "/" : currentPath.substring(
|
||||||
(currentPath.lastIndexOf("/") == 0 ? "/" : currentPath
|
0, currentPath.lastIndexOf("/")))));
|
||||||
.substring(0, currentPath.lastIndexOf("/")))));
|
|
||||||
|
|
||||||
// If folder restriction has been set, since the derived
|
// If folder restriction has been set, since the derived
|
||||||
// current path is invalid just set it to null
|
// current path is invalid just set it to null
|
||||||
@@ -519,8 +517,19 @@ public class FilePickerBean implements Serializable
|
|||||||
// add content nodes from search results as child elements of
|
// add content nodes from search results as child elements of
|
||||||
// the file picker data element.
|
// the file picker data element.
|
||||||
{
|
{
|
||||||
addSearchResultNodes(filePickerDataDoc, filePickerDataElement,
|
try
|
||||||
configuredSearchNodeRef, selectableTypes, facesContext);
|
{
|
||||||
|
addSearchResultNodes(filePickerDataDoc, filePickerDataElement,
|
||||||
|
configuredSearchNodeRef, selectableTypes, facesContext);
|
||||||
|
}
|
||||||
|
// if searcher exception thrown whilst getting search results,
|
||||||
|
// then add error message as attribute to file-picker-data element
|
||||||
|
catch (SearcherException e)
|
||||||
|
{
|
||||||
|
filePickerDataElement.setAttribute("error", MessageFormat.format(
|
||||||
|
Application.getMessage(facesContext, "error_retrieving_search_results"),
|
||||||
|
configSearchName, e.getMessage()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -790,6 +799,13 @@ public class FilePickerBean implements Serializable
|
|||||||
// run configured search to get content nodes returned in search result
|
// run configured search to get content nodes returned in search result
|
||||||
List<AVMNodeDescriptor> searchResultNodes = runConfiguredSearch(configuredSearchNodeRef);
|
List<AVMNodeDescriptor> searchResultNodes = runConfiguredSearch(configuredSearchNodeRef);
|
||||||
|
|
||||||
|
// if there are no search results (i.e. null) throw exception
|
||||||
|
if (searchResultNodes == null)
|
||||||
|
{
|
||||||
|
throw new SearcherException("No results returned by search query.\n"
|
||||||
|
+ "Search node reference: " + configuredSearchNodeRef);
|
||||||
|
}
|
||||||
|
|
||||||
for (AVMNodeDescriptor node : searchResultNodes)
|
for (AVMNodeDescriptor node : searchResultNodes)
|
||||||
{
|
{
|
||||||
// create child element representing AVM node and add to file picker
|
// create child element representing AVM node and add to file picker
|
||||||
|
Reference in New Issue
Block a user