mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
ACE-2639. Adding Site and Tag based facets to the REST API.
These are handled as 'special cases' where the facetID (a QName) is stored without a namespace e.g. {}Site git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@85580 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -1,7 +1,8 @@
|
|||||||
|
<#macro stripEmptyNamespace qnameString>${qnameString?replace("{}", "")}</#macro>
|
||||||
<#macro facetJSON facet>
|
<#macro facetJSON facet>
|
||||||
<#escape x as jsonUtils.encodeJSONString(x)>
|
<#escape x as jsonUtils.encodeJSONString(x)>
|
||||||
"filterID" : "${facet.filterID}",
|
"filterID" : "${facet.filterID}",
|
||||||
"facetQName" : "${facet.facetQName}",
|
"facetQName" : "<@stripEmptyNamespace qnameString=facet.facetQName?string/>",
|
||||||
"displayName" : "${facet.displayName}",
|
"displayName" : "${facet.displayName}",
|
||||||
"displayControl" : "${facet.displayControl}",
|
"displayControl" : "${facet.displayControl}",
|
||||||
"maxFilters" : ${facet.maxFilters?c},
|
"maxFilters" : ${facet.maxFilters?c},
|
||||||
|
@@ -80,7 +80,7 @@ public class SolrFacetConfigAdminPost extends AbstractSolrFacetConfigAdminWebScr
|
|||||||
validateFilterID(filterID);
|
validateFilterID(filterID);
|
||||||
|
|
||||||
final String facetQNameStr = json.getString(PARAM_FACET_QNAME);
|
final String facetQNameStr = json.getString(PARAM_FACET_QNAME);
|
||||||
final QName facetQName = QName.resolveToQName(namespaceService, facetQNameStr);
|
final QName facetQName = QName.createQName(facetQNameStr, namespaceService);
|
||||||
final String displayName = json.getString(PARAM_DISPLAY_NAME);
|
final String displayName = json.getString(PARAM_DISPLAY_NAME);
|
||||||
final String displayControl = json.getString(PARAM_DISPLAY_CONTROL);
|
final String displayControl = json.getString(PARAM_DISPLAY_CONTROL);
|
||||||
final int maxFilters = json.getInt(PARAM_MAX_FILTERS);
|
final int maxFilters = json.getInt(PARAM_MAX_FILTERS);
|
||||||
|
@@ -137,7 +137,11 @@ public class SolrFacetConfigAdminPut extends AbstractSolrFacetConfigAdminWebScri
|
|||||||
final String filterID = json.getString(PARAM_FILTER_ID); // Must exist
|
final String filterID = json.getString(PARAM_FILTER_ID); // Must exist
|
||||||
|
|
||||||
final String facetQNameStr = getValue(String.class, json.opt(PARAM_FACET_QNAME), null);
|
final String facetQNameStr = getValue(String.class, json.opt(PARAM_FACET_QNAME), null);
|
||||||
final QName facetQName = (facetQNameStr == null) ? null : QName.resolveToQName(namespaceService, facetQNameStr);
|
|
||||||
|
// Note that in resolving the QName string here, we expect there to be some facet QNames which are not
|
||||||
|
// really QNames. These are SOLR/SearchService 'specials', examples being "SITE" or "TAG".
|
||||||
|
// These will be resolved here to a QName with no namespace.
|
||||||
|
final QName facetQName = (facetQNameStr == null) ? null : QName.createQName(facetQNameStr, namespaceService);
|
||||||
final String displayName = getValue(String.class, json.opt(PARAM_DISPLAY_NAME), null);
|
final String displayName = getValue(String.class, json.opt(PARAM_DISPLAY_NAME), null);
|
||||||
final String displayControl = getValue(String.class, json.opt(PARAM_DISPLAY_CONTROL), null);
|
final String displayControl = getValue(String.class, json.opt(PARAM_DISPLAY_CONTROL), null);
|
||||||
final int maxFilters = getValue(Integer.class, json.opt(PARAM_MAX_FILTERS), -1);
|
final int maxFilters = getValue(Integer.class, json.opt(PARAM_MAX_FILTERS), -1);
|
||||||
|
Reference in New Issue
Block a user