mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
Merged HEAD-BUG-FIX (5.0/Cloud) to HEAD (5.0/Cloud)
80504: Merged WAT1 (5.0/Cloud) to HEAD-BUG-FIX (5.0/Cloud) 73946: ACE-1582: First cut of Solr faceted-search configuration. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@82802 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
<webscript>
|
||||
<shortname>Delete Faceted-Search Config</shortname>
|
||||
<description>
|
||||
<![CDATA[
|
||||
Delete faceted-search config, if configured
|
||||
|
||||
http://<host>:<port>/alfresco/api/solr/facet-config
|
||||
|
||||
Example response from this web script:
|
||||
|
||||
{
|
||||
"success" : true | false
|
||||
}
|
||||
|
||||
Notes:
|
||||
- user must be an Admin, member of Alfresco_Search_Administrators group or a Network Admin for given network/tenant
|
||||
]]>
|
||||
</description>
|
||||
<url>/api/solr/facet-config/{filterID}</url>
|
||||
<format default="json">argument</format>
|
||||
<authentication>user</authentication>
|
||||
<transaction>required</transaction>
|
||||
</webscript>
|
@@ -0,0 +1,5 @@
|
||||
<#escape x as jsonUtils.encodeJSONString(x)>
|
||||
{
|
||||
"success" : ${success?string}
|
||||
}
|
||||
</#escape>
|
@@ -0,0 +1,41 @@
|
||||
<webscript>
|
||||
<shortname>GET Faceted-Search Config</shortname>
|
||||
<description>
|
||||
<![CDATA[
|
||||
Get faceted-search config, if configured
|
||||
|
||||
http://<host>:<port>/alfresco/api/solr/facet-config
|
||||
|
||||
Example response from this web script:
|
||||
|
||||
{
|
||||
"facets": [
|
||||
{
|
||||
"filterID" : "filter_content_size",
|
||||
"facetQName" : "{http://www.alfresco.org/model/content/1.0}content.size",
|
||||
"displayName" : "faceted-search.facet-menu.facet.size",
|
||||
"maxFilters" : 5,
|
||||
"hitThreshold" : 1,
|
||||
"minFilterValueLength" : 5,
|
||||
"sortBy" : "ALPHABETICALLY",
|
||||
"scope" : "SCOPED_SITES",
|
||||
"scopedSites" : [
|
||||
"site3",
|
||||
"site2",
|
||||
"site1"
|
||||
],
|
||||
"index" : 5,
|
||||
"isEnabled" : true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Notes:
|
||||
- user must be an Admin, member of Alfresco_Search_Administrators group or a Network Admin for given network/tenant
|
||||
]]>
|
||||
</description>
|
||||
<url>/api/solr/facet-config</url>
|
||||
<format default="json">argument</format>
|
||||
<authentication>user</authentication>
|
||||
<transaction>required</transaction>
|
||||
</webscript>
|
@@ -0,0 +1,28 @@
|
||||
<#escape x as jsonUtils.encodeJSONString(x)>
|
||||
{
|
||||
"facets": [
|
||||
<#list filters?keys as facet>
|
||||
<#assign f=filters[facet]>
|
||||
{
|
||||
"filterID" : "${f.filterID}",
|
||||
"facetQName" : "${f.facetQName}",
|
||||
"displayName" : "${f.displayName}",
|
||||
"maxFilters" : ${f.maxFilters?c},
|
||||
"hitThreshold" : ${f.hitThreshold?c},
|
||||
"minFilterValueLength" : ${f.minFilterValueLength?c},
|
||||
"sortBy" : "${f.sortBy}",
|
||||
"scope" : "${f.scope}",
|
||||
"scopedSites" : [
|
||||
<#if f.scopedSites??>
|
||||
<#list f.scopedSites as site>
|
||||
"${site}"<#if site_has_next>,</#if>
|
||||
</#list>
|
||||
</#if>
|
||||
],
|
||||
"index" : ${f.index?c},
|
||||
"isEnabled" : ${f.enabled?c}
|
||||
}<#if facet_has_next>,</#if>
|
||||
</#list>
|
||||
]
|
||||
}
|
||||
</#escape>
|
@@ -0,0 +1,37 @@
|
||||
<webscript>
|
||||
<shortname>POST Faceted-Search Config</shortname>
|
||||
<description>
|
||||
<![CDATA[
|
||||
Post faceted-search config
|
||||
|
||||
http://<host>:<port>/alfresco/api/solr/facet-config
|
||||
|
||||
Example body to this web script:
|
||||
|
||||
{
|
||||
"filterID" : "filter_content_size",
|
||||
"facetQName" : "{http://www.alfresco.org/model/content/1.0}content.size",
|
||||
"displayName" : "faceted-search.facet-menu.facet.size",
|
||||
"maxFilters" : 5,
|
||||
"hitThreshold" : 1,
|
||||
"minFilterValueLength" : 5,
|
||||
"sortBy" : "ALPHABETICALLY",
|
||||
"scope" : "SCOPED_SITES",
|
||||
"scopedSites" : [
|
||||
"site3",
|
||||
"site2",
|
||||
"site1"
|
||||
],
|
||||
"index" : 6,
|
||||
"isEnabled" : true
|
||||
}
|
||||
|
||||
Notes:
|
||||
- user must be an Admin, member of Alfresco_Search_Administrators group or a Network Admin for given network/tenant
|
||||
]]>
|
||||
</description>
|
||||
<url>/api/solr/facet-config</url>
|
||||
<format default="json">argument</format>
|
||||
<authentication>user</authentication>
|
||||
<transaction>required</transaction>
|
||||
</webscript>
|
@@ -0,0 +1,37 @@
|
||||
<webscript>
|
||||
<shortname>PUT Faceted-Search Config</shortname>
|
||||
<description>
|
||||
<![CDATA[
|
||||
Put (update) faceted-search configt
|
||||
|
||||
http://<host>:<port>/alfresco/api/solr/facet-config
|
||||
|
||||
Example body to this web script:
|
||||
|
||||
{
|
||||
"filterID" : "filter_content_size",
|
||||
"facetQName" : "{http://www.alfresco.org/model/content/1.0}content.size",
|
||||
"displayName" : "faceted-search.facet-menu.facet.size",
|
||||
"maxFilters" : 5,
|
||||
"hitThreshold" : 1,
|
||||
"minFilterValueLength" : 5,
|
||||
"sortBy" : "ALPHABETICALLY",
|
||||
"scope" : "SCOPED_SITES",
|
||||
"scopedSites" : [
|
||||
"site3",
|
||||
"site2",
|
||||
"site1"
|
||||
],
|
||||
"index" : 6,
|
||||
"isEnabled" : true
|
||||
}
|
||||
|
||||
Notes:
|
||||
- user must be an Admin, member of Alfresco_Search_Administrators group or a Network Admin for given network/tenant
|
||||
]]>
|
||||
</description>
|
||||
<url>/api/solr/facet-config</url>
|
||||
<format default="json">argument</format>
|
||||
<authentication>user</authentication>
|
||||
<transaction>required</transaction>
|
||||
</webscript>
|
@@ -1819,6 +1819,31 @@
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<!-- Get/Post/Put/Delete Solr Facetnfig -->
|
||||
<bean id="baseSolrFacetConfigAdminWebscript" abstract="true" parent="webscript">
|
||||
<property name="facetService" ref="solrFacetService"/>
|
||||
</bean>
|
||||
<bean
|
||||
id="webscript.org.alfresco.repository.solr.facet.solr-facet-config-admin.get"
|
||||
class="org.alfresco.repo.web.scripts.solr.facet.SolrFacetConfigAdminGet"
|
||||
parent="baseSolrFacetConfigAdminWebscript">
|
||||
</bean>
|
||||
<bean
|
||||
id="webscript.org.alfresco.repository.solr.facet.solr-facet-config-admin.delete"
|
||||
class="org.alfresco.repo.web.scripts.solr.facet.SolrFacetConfigAdminDelete"
|
||||
parent="baseSolrFacetConfigAdminWebscript">
|
||||
</bean>
|
||||
<bean
|
||||
id="webscript.org.alfresco.repository.solr.facet.solr-facet-config-admin.post"
|
||||
class="org.alfresco.repo.web.scripts.solr.facet.SolrFacetConfigAdminPost"
|
||||
parent="baseSolrFacetConfigAdminWebscript">
|
||||
</bean>
|
||||
<bean
|
||||
id="webscript.org.alfresco.repository.solr.facet.solr-facet-config-admin.put"
|
||||
class="org.alfresco.repo.web.scripts.solr.facet.SolrFacetConfigAdminPut"
|
||||
parent="baseSolrFacetConfigAdminWebscript">
|
||||
</bean>
|
||||
|
||||
<!-- Share Content Download - post of an Activity before performing a Site download action -->
|
||||
<bean id="webscript.org.alfresco.slingshot.download.get" class="org.alfresco.slingshot.web.scripts.SlingshotContentGet" parent="webscript.org.alfresco.content.content.get">
|
||||
<property name="siteService" ref="SiteService" />
|
||||
|
@@ -0,0 +1,152 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2014 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package org.alfresco.repo.web.scripts.solr.facet;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.alfresco.repo.search.impl.solr.facet.SolrFacetProperties;
|
||||
import org.alfresco.repo.search.impl.solr.facet.SolrFacetService;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
import org.json.JSONTokener;
|
||||
import org.springframework.extensions.webscripts.Cache;
|
||||
import org.springframework.extensions.webscripts.DeclarativeWebScript;
|
||||
import org.springframework.extensions.webscripts.Status;
|
||||
import org.springframework.extensions.webscripts.WebScriptException;
|
||||
import org.springframework.extensions.webscripts.WebScriptRequest;
|
||||
|
||||
/**
|
||||
* This class is an abstract base class for the various web script controllers
|
||||
* in the SolrFacetService.
|
||||
*
|
||||
* @author Jamal Kaabi-Mofrad
|
||||
*/
|
||||
public abstract class AbstractSolrFacetConfigAdminWebScript extends DeclarativeWebScript
|
||||
{
|
||||
protected static final String PARAM_FILTER_ID = "filterID";
|
||||
protected static final String PARAM_FACET_QNAME = "facetQName";
|
||||
protected static final String PARAM_DISPLAY_NAME = "displayName";
|
||||
protected static final String PARAM_MAX_FILTERS = "maxFilters";
|
||||
protected static final String PARAM_HIT_THRESHOLD = "hitThreshold";
|
||||
protected static final String PARAM_MIN_FILTER_VALUE_LENGTH = "minFilterValueLength";
|
||||
protected static final String PARAM_SORT_BY = "sortBy";
|
||||
protected static final String PARAM_SCOPE = "scope";
|
||||
protected static final String PARAM_SCOPED_SITES = "scopedSites";
|
||||
protected static final String PARAM_INDEX = "index";
|
||||
protected static final String PARAM_IS_ENABLED = "isEnabled";
|
||||
|
||||
protected SolrFacetService facetService;
|
||||
|
||||
/**
|
||||
* @param facetService the facetService to set
|
||||
*/
|
||||
public void setFacetService(SolrFacetService facetService)
|
||||
{
|
||||
this.facetService = facetService;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Map<String, Object> executeImpl(final WebScriptRequest req, final Status status, final Cache cache)
|
||||
{
|
||||
validateCurrentUser();
|
||||
|
||||
return unprotectedExecuteImpl(req, status, cache);
|
||||
}
|
||||
|
||||
protected void validateCurrentUser()
|
||||
{
|
||||
String currentUser = AuthenticationUtil.getFullyAuthenticatedUser();
|
||||
// check the current user access rights
|
||||
if (!facetService.isSearchAdmin(currentUser))
|
||||
{
|
||||
throw new WebScriptException(HttpServletResponse.SC_FORBIDDEN, "Access denied.");
|
||||
}
|
||||
}
|
||||
|
||||
protected SolrFacetProperties parseRequestForFacetProperties(WebScriptRequest req)
|
||||
{
|
||||
JSONObject json = null;
|
||||
try
|
||||
{
|
||||
json = new JSONObject(new JSONTokener(req.getContent().getContent()));
|
||||
|
||||
final String filterID = json.getString(PARAM_FILTER_ID);
|
||||
final String facetQNameStr = json.getString(PARAM_FACET_QNAME);
|
||||
if (filterID == null || facetQNameStr == null)
|
||||
{
|
||||
String requiredProp = (filterID == null) ? "filterID" : "facetQName";
|
||||
throw new WebScriptException(Status.STATUS_BAD_REQUEST, requiredProp + " not provided.");
|
||||
}
|
||||
|
||||
final QName facetQName = QName.createQName(facetQNameStr);
|
||||
final String displayName = json.getString(PARAM_DISPLAY_NAME);
|
||||
final int maxFilters = json.getInt(PARAM_MAX_FILTERS);
|
||||
final int hitThreshold = json.getInt(PARAM_HIT_THRESHOLD);
|
||||
final int minFilterValueLength = json.getInt(PARAM_MIN_FILTER_VALUE_LENGTH);
|
||||
final String sortBy = json.getString(PARAM_SORT_BY);
|
||||
final String scope = json.getString(PARAM_SCOPE);
|
||||
final int index = json.getInt(PARAM_INDEX);
|
||||
final boolean isEnabled = json.getBoolean(PARAM_IS_ENABLED);
|
||||
JSONArray scopedSitesJsonArray = json.getJSONArray(PARAM_SCOPED_SITES);
|
||||
Set<String> scopedSites = null;
|
||||
if (scopedSitesJsonArray != null)
|
||||
{
|
||||
scopedSites = new HashSet<String>(scopedSitesJsonArray.length());
|
||||
for (int i = 0, length = scopedSitesJsonArray.length(); i < length; i++)
|
||||
{
|
||||
String site = scopedSitesJsonArray.getString(i);
|
||||
scopedSites.add(site);
|
||||
}
|
||||
}
|
||||
|
||||
SolrFacetProperties fp = new SolrFacetProperties.Builder()
|
||||
.filterID(filterID)
|
||||
.facetQName(facetQName)
|
||||
.displayName(displayName)
|
||||
.maxFilters(maxFilters)
|
||||
.hitThreshold(hitThreshold)
|
||||
.minFilterValueLength(minFilterValueLength)
|
||||
.sortBy(sortBy)
|
||||
.scope(scope)
|
||||
.index(index)
|
||||
.isEnabled(isEnabled)
|
||||
.scopedSites(scopedSites).build();
|
||||
return fp;
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Could not read content from req.", e);
|
||||
}
|
||||
catch (JSONException e)
|
||||
{
|
||||
throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Could not parse JSON from req.", e);
|
||||
}
|
||||
}
|
||||
|
||||
abstract protected Map<String, Object> unprotectedExecuteImpl(WebScriptRequest req, Status status, Cache cache);
|
||||
}
|
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2014 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package org.alfresco.repo.web.scripts.solr.facet;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.extensions.webscripts.Cache;
|
||||
import org.springframework.extensions.webscripts.Status;
|
||||
import org.springframework.extensions.webscripts.WebScriptException;
|
||||
import org.springframework.extensions.webscripts.WebScriptRequest;
|
||||
|
||||
/**
|
||||
* This class is the controller for the "solr-facet-config-admin.delete" web script.
|
||||
*
|
||||
* @author Jamal Kaabi-Mofrad
|
||||
*/
|
||||
public class SolrFacetConfigAdminDelete extends AbstractSolrFacetConfigAdminWebScript
|
||||
{
|
||||
private static final Log logger = LogFactory.getLog(SolrFacetConfigAdminDelete.class);
|
||||
|
||||
@Override
|
||||
protected Map<String, Object> unprotectedExecuteImpl(WebScriptRequest req, Status status, Cache cache)
|
||||
{
|
||||
// get the filterID parameter.
|
||||
Map<String, String> templateVars = req.getServiceMatch().getTemplateVars();
|
||||
String filterID = templateVars.get("filterID");
|
||||
|
||||
if (filterID == null)
|
||||
{
|
||||
throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Filter id not provided");
|
||||
}
|
||||
facetService.deleteFacet(filterID);
|
||||
|
||||
Map<String, Object> model = new HashMap<String, Object>(1);
|
||||
model.put("success", true);
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("Facet [" + filterID + "] has been deleted successfully");
|
||||
}
|
||||
|
||||
return model;
|
||||
}
|
||||
}
|
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2014 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package org.alfresco.repo.web.scripts.solr.facet;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.repo.search.impl.solr.facet.SolrFacetProperties;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.extensions.webscripts.Cache;
|
||||
import org.springframework.extensions.webscripts.Status;
|
||||
import org.springframework.extensions.webscripts.WebScriptRequest;
|
||||
|
||||
/**
|
||||
* This class is the controller for the "solr-facet-config-admin.get" web script.
|
||||
*
|
||||
* @author Jamal Kaabi-Mofrad
|
||||
*/
|
||||
public class SolrFacetConfigAdminGet extends AbstractSolrFacetConfigAdminWebScript
|
||||
{
|
||||
private static final Log logger = LogFactory.getLog(SolrFacetConfigAdminGet.class);
|
||||
|
||||
@Override
|
||||
protected Map<String, Object> unprotectedExecuteImpl(WebScriptRequest req, Status status, Cache cache)
|
||||
{
|
||||
Map<String, SolrFacetProperties> filters = facetService.getFacets();
|
||||
|
||||
Map<String, Object> model = new HashMap<String, Object>(1);
|
||||
|
||||
model.put("filters", filters);
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("Retrieved all available facets: " + filters);
|
||||
}
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2014 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package org.alfresco.repo.web.scripts.solr.facet;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.repo.search.impl.solr.facet.SolrFacetProperties;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.extensions.webscripts.Cache;
|
||||
import org.springframework.extensions.webscripts.Status;
|
||||
import org.springframework.extensions.webscripts.WebScriptException;
|
||||
import org.springframework.extensions.webscripts.WebScriptRequest;
|
||||
|
||||
/**
|
||||
* This class is the controller for the "solr-facet-config-admin.post" web scripts.
|
||||
*
|
||||
* @author Jamal Kaabi-Mofrad
|
||||
*/
|
||||
public class SolrFacetConfigAdminPost extends AbstractSolrFacetConfigAdminWebScript
|
||||
{
|
||||
private static final Log logger = LogFactory.getLog(SolrFacetConfigAdminPost.class);
|
||||
|
||||
@Override
|
||||
protected Map<String, Object> unprotectedExecuteImpl(WebScriptRequest req, Status status, Cache cache)
|
||||
{
|
||||
try
|
||||
{
|
||||
SolrFacetProperties fp = parseRequestForFacetProperties(req);
|
||||
facetService.createFacetNode(fp);
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("Created facet node: " + fp);
|
||||
}
|
||||
}
|
||||
catch (Throwable t)
|
||||
{
|
||||
throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Could not save the facet configuration.", t);
|
||||
}
|
||||
|
||||
Map<String, Object> model = new HashMap<String, Object>(1);
|
||||
return model;
|
||||
}
|
||||
}
|
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2014 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package org.alfresco.repo.web.scripts.solr.facet;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.repo.search.impl.solr.facet.SolrFacetProperties;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.extensions.webscripts.Cache;
|
||||
import org.springframework.extensions.webscripts.Status;
|
||||
import org.springframework.extensions.webscripts.WebScriptException;
|
||||
import org.springframework.extensions.webscripts.WebScriptRequest;
|
||||
|
||||
/**
|
||||
* This class is the controller for the "solr-facet-config-admin.put" web scripts.
|
||||
*
|
||||
* @author Jamal Kaabi-Mofrad
|
||||
*/
|
||||
public class SolrFacetConfigAdminPut extends AbstractSolrFacetConfigAdminWebScript
|
||||
{
|
||||
private static final Log logger = LogFactory.getLog(SolrFacetConfigAdminPost.class);
|
||||
|
||||
@Override
|
||||
protected Map<String, Object> unprotectedExecuteImpl(WebScriptRequest req, Status status, Cache cache)
|
||||
{
|
||||
try
|
||||
{
|
||||
SolrFacetProperties fp = parseRequestForFacetProperties(req);
|
||||
facetService.updateFacet(fp);
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("Updated facet node: " + fp);
|
||||
}
|
||||
|
||||
}
|
||||
catch (Throwable t)
|
||||
{
|
||||
throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Could not update the facet configuration.", t);
|
||||
}
|
||||
|
||||
Map<String, Object> model = new HashMap<String, Object>(1);
|
||||
return model;
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user