Skip to content
Snippets Groups Projects
Commit 4f51f8e1 authored by Nicolas.Rod's avatar Nicolas.Rod Committed by Hugues.Cazeaux
Browse files

feat(Index): new endpoint to list facet requests by index

parent 806f7664
Branches
Tags
1 merge request!420feat(Index): new endpoint to list facet requests by index
......@@ -9,12 +9,12 @@
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of the
* License, or (at your option) any later version.
*
*
* This program 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 General Public License for more details.
*
*
* You should have received a copy of the GNU General Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/gpl-2.0.html>.
......@@ -23,6 +23,8 @@
package ch.unige.solidify;
import ch.unige.solidify.rest.ActionName;
public final class IndexUrlPath {
// ==========
......@@ -34,6 +36,8 @@ public final class IndexUrlPath {
public static final String INDEX_INDEX = INDEX + "/" + IndexConstants.INDEX;
public static final String INDEX_INDEX_FIELD_ALIAS = INDEX + "/" + IndexConstants.INDEX_FIELD_ALIASES;
public static final String INDEX_ACTION_LIST_FACET_REQUESTS = "/" + ActionName.LIST_FACET_REQUESTS + "/{indexName}";
private IndexUrlPath() {
throw new IllegalStateException(SolidifyConstants.TOOL_CLASS);
}
......
......@@ -9,12 +9,12 @@
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of the
* License, or (at your option) any later version.
*
*
* This program 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 General Public License for more details.
*
*
* You should have received a copy of the GNU General Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/gpl-2.0.html>.
......@@ -66,7 +66,7 @@ public class IndexFieldAliasService extends ResourceService<IndexFieldAlias> {
/**
* Return a list of IndexFieldAlias that are facets for the given index name Note: index name may be
* a list of multiple indices separated by a semi colon.
* a list of multiple indices separated by a semicolon.
*
* @param index Index name
* @return
......@@ -105,7 +105,7 @@ public class IndexFieldAliasService extends ResourceService<IndexFieldAlias> {
/**
* Return a list of facets for the given index name. Note: index name may be a list of multiple
* indices separated by a semi colon.
* indices separated by a semicolon.
*
* @param index Index name
* @return
......
......@@ -234,6 +234,8 @@ public abstract class IndexDataSearchController<T extends IndexMetadata> extends
/**
* Return the list of facets for the index
* <p>
* It can be overridden if the list of IndexFieldAlias is not stored locally (by using a REST request for instance).
*
* @param indexName
* @return
......
......@@ -9,12 +9,12 @@
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of the
* License, or (at your option) any later version.
*
*
* This program 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 General Public License for more details.
*
*
* You should have received a copy of the GNU General Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/gpl-2.0.html>.
......@@ -23,12 +23,15 @@
package ch.unige.solidify.controller.index;
import java.util.List;
import java.util.Map;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
......@@ -36,9 +39,11 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import ch.unige.solidify.IndexUrlPath;
import ch.unige.solidify.business.IndexFieldAliasService;
import ch.unige.solidify.controller.IndexController;
import ch.unige.solidify.controller.ResourceController;
import ch.unige.solidify.model.index.IndexFieldAlias;
import ch.unige.solidify.rest.FacetRequest;
import ch.unige.solidify.rest.RestCollection;
import ch.unige.solidify.security.AdminPermissions;
......@@ -78,4 +83,11 @@ public class IndexFieldAliasController extends ResourceController<IndexFieldAlia
return super.deleteList(ids);
}
@GetMapping({ IndexUrlPath.INDEX_ACTION_LIST_FACET_REQUESTS })
public ResponseEntity<RestCollection<FacetRequest>> facetsList(@PathVariable String indexName) {
List<FacetRequest> facetsList = ((IndexFieldAliasService) this.itemService).getFacetsListForIndex(indexName);
final RestCollection<FacetRequest> collection = new RestCollection<>(facetsList);
return new ResponseEntity<>(collection, HttpStatus.OK);
}
}
......@@ -9,12 +9,12 @@
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of the
* License, or (at your option) any later version.
*
*
* This program 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 General Public License for more details.
*
*
* You should have received a copy of the GNU General Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/gpl-2.0.html>.
......@@ -60,6 +60,7 @@ public class ActionName {
public static final String RESUME = "resume";
public static final String SAVE = "save";
public static final String SEARCH = "search";
public static final String LIST_FACET_REQUESTS = "list-facet-requests";
public static final String SELF = "self";
public static final String SIZE = "size";
public static final String SITEMAP = "sitemap.xml";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment