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:
Neil McErlean
2014-09-24 08:34:11 +00:00
parent 28515dddc4
commit d93f56c5ca
3 changed files with 8 additions and 3 deletions

View File

@@ -1,7 +1,8 @@
<#macro stripEmptyNamespace qnameString>${qnameString?replace("{}", "")}</#macro>
<#macro facetJSON facet>
<#escape x as jsonUtils.encodeJSONString(x)>
"filterID" : "${facet.filterID}",
"facetQName" : "${facet.facetQName}",
"facetQName" : "<@stripEmptyNamespace qnameString=facet.facetQName?string/>",
"displayName" : "${facet.displayName}",
"displayControl" : "${facet.displayControl}",
"maxFilters" : ${facet.maxFilters?c},

View File

@@ -80,7 +80,7 @@ public class SolrFacetConfigAdminPost extends AbstractSolrFacetConfigAdminWebScr
validateFilterID(filterID);
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 displayControl = json.getString(PARAM_DISPLAY_CONTROL);
final int maxFilters = json.getInt(PARAM_MAX_FILTERS);

View File

@@ -137,7 +137,11 @@ public class SolrFacetConfigAdminPut extends AbstractSolrFacetConfigAdminWebScri
final String filterID = json.getString(PARAM_FILTER_ID); // Must exist
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 displayControl = getValue(String.class, json.opt(PARAM_DISPLAY_CONTROL), null);
final int maxFilters = getValue(Integer.class, json.opt(PARAM_MAX_FILTERS), -1);