Commit 39e5d379 authored by Matija Obreza's avatar Matija Obreza

Moved filter keys to FilterConstants

parent 40febb8c
/**
* Copyright 2014 Global Crop Diversity Trust
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**/
package org.genesys2.server.service;
public interface FilterConstants {
public static final String CROPS = "crops";
public static final String SAMPSTAT = "sampStat";
public static final String STORAGE = "storage";
public static final String COLLMISSID = "coll.collMissId";
public static final String AVAILABLE = "available";
public static final String ART15 = "art15";
public static final String MLSSTATUS = "mlsStatus";
public static final String SGSV = "sgsv";
public static final String ALIAS = "alias";
public static final String ACCENUMB = "acceNumb";
public static final String INSTCODE = "institute.code";
public static final String ORGANIZATION = "organization";
public static final String GEO_ELEVATION = "geo.elevation";
public static final String GEO_LONGITUDE = "geo.longitude";
public static final String GEO_LATITUDE = "geo.latitude";
public static final String ORGCTY_ISO3 = "orgCty.iso3";
public static final String TAXONOMY_SCINAME = "taxonomy.sciName";
public static final String TAXONOMY_SPECIES = "taxonomy.species";
public static final String TAXONOMY_GENUS = "taxonomy.genus";
}
......@@ -27,6 +27,7 @@ import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.genesys2.server.model.genesys.Method;
import org.genesys2.server.service.FilterConstants;
import org.genesys2.server.service.MappingService.CoordUtil;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort.Order;
......@@ -89,35 +90,37 @@ public class DirectMysqlQuery {
}
protected DirectMysqlQuery join(ObjectNode jsonTree) {
if (hasFilter(jsonTree, "crops") || hasFilter(jsonTree, "taxonomy.genus") || hasFilter(jsonTree, "taxonomy.species") || hasFilter(jsonTree, "taxonomy.sciName")) {
if (hasFilter(jsonTree, FilterConstants.CROPS) || hasFilter(jsonTree, FilterConstants.TAXONOMY_GENUS)
|| hasFilter(jsonTree, FilterConstants.TAXONOMY_SPECIES) || hasFilter(jsonTree, FilterConstants.TAXONOMY_SCINAME)) {
innerJoin("taxonomy2", "t", "t.id=a.taxonomyId2");
if (hasFilter(jsonTree, "crops")) {
if (hasFilter(jsonTree, FilterConstants.CROPS)) {
innerJoin("croptaxonomy", "ct", "ct.taxonomyId=t.id");
innerJoin("crop", null, "crop.id=ct.cropId");
}
}
if (hasFilter(jsonTree, "organization")) {
if (hasFilter(jsonTree, FilterConstants.ORGANIZATION)) {
innerJoin("faoinstitute", "fao", "fao.id=a.instituteId");
innerJoin("organizationinstitute", "oi", "oi.instituteId=fao.id");
innerJoin("organization", "org", "org.id=oi.organizationId");
}
if (hasFilter(jsonTree, "geo.latitude") || hasFilter(jsonTree, "geo.longitude") || hasFilter(jsonTree, "geo.elevation")) {
if (hasFilter(jsonTree, FilterConstants.GEO_LATITUDE) || hasFilter(jsonTree, FilterConstants.GEO_LONGITUDE)
|| hasFilter(jsonTree, FilterConstants.GEO_ELEVATION)) {
innerJoin("accessiongeo", "geo", "geo.accessionId=a.id");
}
if (hasFilter(jsonTree, "alias")) {
if (hasFilter(jsonTree, FilterConstants.ALIAS)) {
innerJoin("accessionalias", "accename", "accename.accessionId=a.id");
}
if (hasFilter(jsonTree, "coll.collMissId")) {
if (hasFilter(jsonTree, FilterConstants.COLLMISSID)) {
innerJoin("accessioncollect", "col", "col.accessionId=a.id");
}
if (hasFilter(jsonTree, "storage")) {
if (hasFilter(jsonTree, FilterConstants.STORAGE)) {
innerJoin("accessionstorage", "storage", "storage.accessionId=a.id");
}
return this;
}
......@@ -130,25 +133,25 @@ public class DirectMysqlQuery {
createQuery(whereBuffer, "a.id", jsonTree.get("id"), params);
createQuery(whereBuffer, "a.taxGenus", jsonTree.get("genusId"), params);
createQuery(whereBuffer, "a.taxSpecies", jsonTree.get("speciesId"), params);
createQuery(whereBuffer, "a.acceNumb", jsonTree.get("acceNumb"), params);
createQuery(whereBuffer, "a.orgCty", jsonTree.get("orgCty.iso3"), params);
createQuery(whereBuffer, "a.instCode", jsonTree.get("institute.code"), params);
createQuery(whereBuffer, "a.inSGSV", jsonTree.get("svalbard"), params);
createQuery(whereBuffer, "a.mlsStat", jsonTree.get("mlsStatus"), params);
createQuery(whereBuffer, "a.inTrust", jsonTree.get("art15"), params);
createQuery(whereBuffer, "a.sampStat", jsonTree.get("sampStat"), params);
createQuery(whereBuffer, "a.available", jsonTree.get("available"), params);
createQuery(whereBuffer, "org.slug", jsonTree.get("organization"), params);
createQuery(whereBuffer, "t.genus", jsonTree.get("taxonomy.genus"), params);
createQuery(whereBuffer, "t.species", jsonTree.get("taxonomy.species"), params);
createQuery(whereBuffer, "t.taxonName", jsonTree.get("taxonomy.sciName"), params);
createQuery(whereBuffer, "geo.longitude", jsonTree.get("geo.longitude"), params);
createQuery(whereBuffer, "geo.latitude", jsonTree.get("geo.latitude"), params);
createQuery(whereBuffer, "geo.elevation", jsonTree.get("geo.elevation"), params);
createQuery(whereBuffer, "crop.shortName", jsonTree.get("crops"), params);
createQuery(whereBuffer, "accename.name", jsonTree.get("alias"), params);
createQuery(whereBuffer, "col.collMissId", jsonTree.get("coll.collMissId"), params);
createQuery(whereBuffer, "storage.storage", jsonTree.get("storage"), params);
createQuery(whereBuffer, "a.acceNumb", jsonTree.get(FilterConstants.ACCENUMB), params);
createQuery(whereBuffer, "a.orgCty", jsonTree.get(FilterConstants.ORGCTY_ISO3), params);
createQuery(whereBuffer, "a.instCode", jsonTree.get(FilterConstants.INSTCODE), params);
createQuery(whereBuffer, "a.inSGSV", jsonTree.get(FilterConstants.SGSV), params);
createQuery(whereBuffer, "a.mlsStat", jsonTree.get(FilterConstants.MLSSTATUS), params);
createQuery(whereBuffer, "a.inTrust", jsonTree.get(FilterConstants.ART15), params);
createQuery(whereBuffer, "a.sampStat", jsonTree.get(FilterConstants.SAMPSTAT), params);
createQuery(whereBuffer, "a.available", jsonTree.get(FilterConstants.AVAILABLE), params);
createQuery(whereBuffer, "org.slug", jsonTree.get(FilterConstants.ORGANIZATION), params);
createQuery(whereBuffer, "t.genus", jsonTree.get(FilterConstants.TAXONOMY_GENUS), params);
createQuery(whereBuffer, "t.species", jsonTree.get(FilterConstants.TAXONOMY_SPECIES), params);
createQuery(whereBuffer, "t.taxonName", jsonTree.get(FilterConstants.TAXONOMY_SCINAME), params);
createQuery(whereBuffer, "geo.longitude", jsonTree.get(FilterConstants.GEO_LONGITUDE), params);
createQuery(whereBuffer, "geo.latitude", jsonTree.get(FilterConstants.GEO_LATITUDE), params);
createQuery(whereBuffer, "geo.elevation", jsonTree.get(FilterConstants.GEO_ELEVATION), params);
createQuery(whereBuffer, "crop.shortName", jsonTree.get(FilterConstants.CROPS), params);
createQuery(whereBuffer, "accename.name", jsonTree.get(FilterConstants.ALIAS), params);
createQuery(whereBuffer, "col.collMissId", jsonTree.get(FilterConstants.COLLMISSID), params);
createQuery(whereBuffer, "storage.storage", jsonTree.get(FilterConstants.STORAGE), params);
for (final Iterator<String> it = jsonTree.fieldNames(); it.hasNext();) {
final String fieldName = it.next();
......
......@@ -44,6 +44,7 @@ import org.genesys2.server.persistence.domain.AccessionRepository;
import org.genesys2.server.persistence.domain.MethodRepository;
import org.genesys2.server.persistence.domain.TraitValueRepository;
import org.genesys2.server.service.CropService;
import org.genesys2.server.service.FilterConstants;
import org.genesys2.server.service.GenesysFilterService;
import org.genesys2.server.service.GenesysFilterService.GenesysFilter.DataType;
import org.genesys2.server.service.GenesysFilterService.GenesysFilter.FilterType;
......@@ -72,6 +73,8 @@ import com.fasterxml.jackson.databind.node.ObjectNode;
@Transactional(readOnly = true)
public class GenesysFilterServiceImpl implements GenesysFilterService {
private static final Log LOG = LogFactory.getLog(GenesysFilterServiceImpl.class);
private final ArrayList<GenesysFilter> availableFilters;
......@@ -113,28 +116,28 @@ public class GenesysFilterServiceImpl implements GenesysFilterService {
public GenesysFilterServiceImpl() {
this.availableFilters = new ArrayList<GenesysFilter>();
this.availableFilters.add(new GenesysFilterImpl("crops", DataType.STRING));
this.availableFilters.add(new GenesysI18nListFilterImpl<Integer>("sampStat", DataType.NUMERIC).build("accession.sampleStatus", new Integer[] { 100,
this.availableFilters.add(new GenesysFilterImpl(FilterConstants.CROPS, DataType.STRING));
this.availableFilters.add(new GenesysI18nListFilterImpl<Integer>(FilterConstants.SAMPSTAT, DataType.NUMERIC).build("accession.sampleStatus", new Integer[] { 100,
110, 120, 130, 200, 300, 400, 410, 411, 412, 413, 414, 415, 416, 420, 421, 422, 423, 500, 600, 999 }));
this.availableFilters.add(new GenesysAutocompleteFilterImpl("taxonomy.genus", "/explore/ac/genus"));
this.availableFilters.add(new GenesysAutocompleteFilterImpl("taxonomy.species", "/explore/ac/species"));
this.availableFilters.add(new GenesysAutocompleteFilterImpl("taxonomy.sciName", "/explore/ac/taxonomy"));
this.availableFilters.add(new GenesysAutocompleteFilterImpl("orgCty.iso3", "/explore/ac/country"));
this.availableFilters.add(new GenesysFilterImpl("geo.latitude", DataType.NUMERIC));
this.availableFilters.add(new GenesysFilterImpl("geo.longitude", DataType.NUMERIC));
this.availableFilters.add(new GenesysFilterImpl("geo.elevation", DataType.NUMERIC));
this.availableFilters.add(new GenesysFilterImpl("organization", DataType.STRING));
this.availableFilters.add(new GenesysAutocompleteFilterImpl("institute.code", "/explore/ac/instCode"));
this.availableFilters.add(new GenesysFilterImpl("acceNumb", DataType.STRING, FilterType.RANGE));
this.availableFilters.add(new GenesysFilterImpl("alias", DataType.STRING, FilterType.RANGE));
this.availableFilters.add(new GenesysFilterImpl("sgsv", DataType.BOOLEAN));
this.availableFilters.add(new GenesysFilterImpl("mlsStatus", DataType.BOOLEAN));
this.availableFilters.add(new GenesysFilterImpl("art15", DataType.BOOLEAN));
this.availableFilters.add(new GenesysFilterImpl("available", DataType.BOOLEAN));
this.availableFilters.add(new GenesysFilterImpl("coll.collMissId", DataType.STRING));
this.availableFilters.add(new GenesysI18nListFilterImpl<Integer>("storage", DataType.NUMERIC).build("accession.storage", new Integer[] { 10, 11, 12,
this.availableFilters.add(new GenesysAutocompleteFilterImpl(FilterConstants.TAXONOMY_GENUS, "/explore/ac/genus"));
this.availableFilters.add(new GenesysAutocompleteFilterImpl(FilterConstants.TAXONOMY_SPECIES, "/explore/ac/species"));
this.availableFilters.add(new GenesysAutocompleteFilterImpl(FilterConstants.TAXONOMY_SCINAME, "/explore/ac/taxonomy"));
this.availableFilters.add(new GenesysAutocompleteFilterImpl(FilterConstants.ORGCTY_ISO3, "/explore/ac/country"));
this.availableFilters.add(new GenesysFilterImpl(FilterConstants.GEO_LATITUDE, DataType.NUMERIC));
this.availableFilters.add(new GenesysFilterImpl(FilterConstants.GEO_LONGITUDE, DataType.NUMERIC));
this.availableFilters.add(new GenesysFilterImpl(FilterConstants.GEO_ELEVATION, DataType.NUMERIC));
this.availableFilters.add(new GenesysFilterImpl(FilterConstants.ORGANIZATION, DataType.STRING));
this.availableFilters.add(new GenesysAutocompleteFilterImpl(FilterConstants.INSTCODE, "/explore/ac/instCode"));
this.availableFilters.add(new GenesysFilterImpl(FilterConstants.ACCENUMB, DataType.STRING, FilterType.RANGE));
this.availableFilters.add(new GenesysFilterImpl(FilterConstants.ALIAS, DataType.STRING, FilterType.RANGE));
this.availableFilters.add(new GenesysFilterImpl(FilterConstants.SGSV, DataType.BOOLEAN));
this.availableFilters.add(new GenesysFilterImpl(FilterConstants.MLSSTATUS, DataType.BOOLEAN));
this.availableFilters.add(new GenesysFilterImpl(FilterConstants.ART15, DataType.BOOLEAN));
this.availableFilters.add(new GenesysFilterImpl(FilterConstants.AVAILABLE, DataType.BOOLEAN));
this.availableFilters.add(new GenesysFilterImpl(FilterConstants.COLLMISSID, DataType.STRING));
this.availableFilters.add(new GenesysI18nListFilterImpl<Integer>(FilterConstants.STORAGE, DataType.NUMERIC).build("accession.storage", new Integer[] { 10, 11, 12,
13, 20, 30, 40, 50, 99 }));
}
......@@ -249,7 +252,7 @@ public class GenesysFilterServiceImpl implements GenesysFilterService {
}
String shortName = null;
try {
shortName = jsonTree.get("crops").get(0).asText();
shortName = jsonTree.get(FilterConstants.CROPS).get(0).asText();
} catch (NullPointerException e) {
LOG.info("Crop not selected");
}
......@@ -275,7 +278,7 @@ public class GenesysFilterServiceImpl implements GenesysFilterService {
} else if ("species".equalsIgnoreCase(filter)) {
List<String> genus= new ArrayList<>();
ArrayNode arrayRoot = (ArrayNode) jsonTree.get("taxonomy.genus");
ArrayNode arrayRoot = (ArrayNode) jsonTree.get(FilterConstants.TAXONOMY_GENUS);
if (arrayRoot!=null){
Iterator<JsonNode> elements = arrayRoot.elements();
JsonNode element;
......
......@@ -22,6 +22,7 @@ import org.genesys2.server.model.genesys.Accession;
import org.genesys2.server.model.genesys.Taxonomy2;
import org.genesys2.server.model.impl.FaoInstitute;
import org.genesys2.server.service.CropService;
import org.genesys2.server.service.FilterConstants;
import org.genesys2.server.service.GenesysService;
import org.genesys2.server.service.InstituteService;
import org.genesys2.server.service.TaxonomyService;
......@@ -139,7 +140,7 @@ public class AccessionController extends BaseController {
throw new ResourceNotFoundException("No taxonomy with genus=" + genus);
}
model.addAttribute("filter", "{\"taxonomy.genus\":[\"" + taxonomy.getGenus() + "\"]}");
model.addAttribute("filter", "{\"" + FilterConstants.TAXONOMY_GENUS + "\":[\"" + taxonomy.getGenus() + "\"]}");
model.addAttribute("page", page);
return "redirect:/explore";
......@@ -165,7 +166,8 @@ public class AccessionController extends BaseController {
throw new ResourceNotFoundException("No taxonomy with genus=" + genus);
}
model.addAttribute("filter", "{\"taxonomy.genus\":[\"" + taxonomy.getGenus() + "\"], \"taxonomy.species\":[\"" + taxonomy.getSpecies() + "\"]}");
model.addAttribute("filter", "{\"" + FilterConstants.TAXONOMY_GENUS + "\":[\"" + taxonomy.getGenus() + "\"], \"" + FilterConstants.TAXONOMY_SPECIES
+ "\":[\"" + taxonomy.getSpecies() + "\"]}");
model.addAttribute("page", page);
return "redirect:/explore";
......
......@@ -21,6 +21,7 @@ import java.util.List;
import org.genesys2.server.model.impl.Country;
import org.genesys2.server.model.impl.FaoInstitute;
import org.genesys2.server.service.ContentService;
import org.genesys2.server.service.FilterConstants;
import org.genesys2.server.service.GenesysService;
import org.genesys2.server.service.GeoService;
import org.genesys2.server.service.InstituteService;
......@@ -88,8 +89,7 @@ public class CountryController extends BaseController {
view(model, countryStr);
@SuppressWarnings("unchecked")
final
List<FaoInstitute> institutes = (List<FaoInstitute>) model.get("faoInstitutes");
final List<FaoInstitute> institutes = (List<FaoInstitute>) model.get("faoInstitutes");
model.addAttribute("jsonInstitutes", geoService.toJson(institutes).toString());
......@@ -126,7 +126,7 @@ public class CountryController extends BaseController {
throw new ResourceNotFoundException();
}
model.addAttribute("filter", "{\"orgCty.iso3\":[\"" + country.getCode3() + "\"]}");
model.addAttribute("filter", "{\"" + FilterConstants.ORGCTY_ISO3 + "\":[\"" + country.getCode3() + "\"]}");
return "redirect:/explore";
}
......
......@@ -19,6 +19,7 @@ package org.genesys2.server.servlet.controller;
import org.genesys2.server.model.impl.Crop;
import org.genesys2.server.model.impl.CropTaxonomy;
import org.genesys2.server.service.CropService;
import org.genesys2.server.service.FilterConstants;
import org.genesys2.server.service.GenesysFilterService;
import org.genesys2.server.service.GenesysService;
import org.genesys2.server.service.TraitService;
......@@ -95,7 +96,7 @@ public class CropController extends BaseController {
throw new ResourceNotFoundException();
}
model.addAttribute("filter", "{\"crops\":[\"" + crop.getShortName() + "\"]}");
model.addAttribute("filter", "{\"" + FilterConstants.CROPS + "\":[\"" + crop.getShortName() + "\"]}");
return "redirect:/explore";
}
......
......@@ -38,6 +38,7 @@ import org.genesys2.server.model.impl.Crop;
import org.genesys2.server.service.CropService;
import org.genesys2.server.service.GenesysFilterService;
import org.genesys2.server.service.GenesysFilterService.GenesysFilter;
import org.genesys2.server.service.FilterConstants;
import org.genesys2.server.service.GenesysService;
import org.genesys2.server.service.InstituteService;
import org.genesys2.server.service.MappingService;
......@@ -113,7 +114,7 @@ public class ExplorerController extends BaseController {
throw new ResourceNotFoundException("No crop " + shortName);
}
model.addAttribute("filter", "{\"crops\":[\"" + crop.getShortName() + "\"]}");
model.addAttribute("filter", "{\"" + FilterConstants.CROPS + "\":[\"" + crop.getShortName() + "\"]}");
model.addAttribute("page", page);
return "redirect:/explore";
}
......
......@@ -24,6 +24,7 @@ import java.util.Locale;
import org.genesys2.server.model.impl.FaoInstitute;
import org.genesys2.server.model.impl.Organization;
import org.genesys2.server.service.ContentService;
import org.genesys2.server.service.FilterConstants;
import org.genesys2.server.service.GenesysService;
import org.genesys2.server.service.GeoService;
import org.genesys2.server.service.OrganizationService;
......@@ -108,7 +109,7 @@ public class OrganizationController extends BaseController {
/**
* View map of member institutes
*
*
* @param model
* @param slug
* @return
......@@ -118,8 +119,7 @@ public class OrganizationController extends BaseController {
view(model, slug);
@SuppressWarnings("unchecked")
final
List<FaoInstitute> members = (List<FaoInstitute>) model.get("members");
final List<FaoInstitute> members = (List<FaoInstitute>) model.get("members");
model.addAttribute("jsonInstitutes", geoService.toJson(members).toString());
......@@ -154,7 +154,7 @@ public class OrganizationController extends BaseController {
throw new ResourceNotFoundException();
}
model.addAttribute("filter", "{\"organization\":[\"" + organization.getSlug() + "\"]}");
model.addAttribute("filter", "{\"" + FilterConstants.ORGANIZATION + "\":[\"" + organization.getSlug() + "\"]}");
model.addAttribute("page", page);
return "redirect:/explore";
}
......
......@@ -27,6 +27,7 @@ import javax.servlet.http.HttpServletResponse;
import org.genesys2.server.model.genesys.Taxonomy2;
import org.genesys2.server.model.impl.FaoInstitute;
import org.genesys2.server.service.ContentService;
import org.genesys2.server.service.FilterConstants;
import org.genesys2.server.service.GenesysService;
import org.genesys2.server.service.GeoService;
import org.genesys2.server.service.InstituteService;
......@@ -117,25 +118,25 @@ public class WiewsController extends BaseController {
return "/wiews/details";
}
@RequestMapping(value = "/{wiewsCode}/stat-genus",produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
public List<Object[]> getGenusStats(@PathVariable(value = "wiewsCode") String wiewsCode){
final FaoInstitute faoInstitute = instituteService.getInstitute(wiewsCode);
if (faoInstitute == null) {
throw new ResourceNotFoundException();
}
return genesysService.statisticsGenusByInstitute(faoInstitute, new PageRequest(0, 10)).getContent();
}
@RequestMapping(value = "/{wiewsCode}/stat-species",produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
public List<Object[]> getSpeciesStats(@PathVariable(value = "wiewsCode") String wiewsCode){
final FaoInstitute faoInstitute = instituteService.getInstitute(wiewsCode);
if (faoInstitute == null) {
throw new ResourceNotFoundException();
}
return genesysService.statisticsSpeciesByInstitute(faoInstitute, new PageRequest(0, 20)).getContent();
}
@RequestMapping(value = "/{wiewsCode}/stat-genus", produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
public List<Object[]> getGenusStats(@PathVariable(value = "wiewsCode") String wiewsCode) {
final FaoInstitute faoInstitute = instituteService.getInstitute(wiewsCode);
if (faoInstitute == null) {
throw new ResourceNotFoundException();
}
return genesysService.statisticsGenusByInstitute(faoInstitute, new PageRequest(0, 10)).getContent();
}
@RequestMapping(value = "/{wiewsCode}/stat-species", produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
public List<Object[]> getSpeciesStats(@PathVariable(value = "wiewsCode") String wiewsCode) {
final FaoInstitute faoInstitute = instituteService.getInstitute(wiewsCode);
if (faoInstitute == null) {
throw new ResourceNotFoundException();
}
return genesysService.statisticsSpeciesByInstitute(faoInstitute, new PageRequest(0, 20)).getContent();
}
@RequestMapping("/{wiewsCode}/datasets")
public String viewDatasets(ModelMap model, @PathVariable(value = "wiewsCode") String wiewsCode, @RequestParam(value = "page", defaultValue = "1") int page) {
......@@ -158,9 +159,8 @@ public class WiewsController extends BaseController {
@RequestMapping("/{wiewsCode}/update")
public String update(ModelMap model, @PathVariable(value = "wiewsCode") String wiewsCode, @RequestParam("blurp") String blurp,
@RequestParam("gaTracker") String gaTracker, @RequestParam("mailto") String mailto,
@RequestParam("uniqueAcceNumbs") boolean uniqueAcceNumbs,
@RequestParam (value = "allowMaterialRequests",required = false,defaultValue = "false") boolean allowMaterialRequests) {
@RequestParam("gaTracker") String gaTracker, @RequestParam("mailto") String mailto, @RequestParam("uniqueAcceNumbs") boolean uniqueAcceNumbs,
@RequestParam(value = "allowMaterialRequests", required = false, defaultValue = "false") boolean allowMaterialRequests) {
_logger.debug("Updating institite " + wiewsCode);
final FaoInstitute faoInstitute = instituteService.getInstitute(wiewsCode);
if (faoInstitute == null) {
......@@ -187,7 +187,7 @@ public class WiewsController extends BaseController {
throw new ResourceNotFoundException();
}
model.addAttribute("filter", "{\"institute.code\":[\"" + faoInstitute.getCode() + "\"]}");
model.addAttribute("filter", "{\"" + FilterConstants.INSTCODE + "\":[\"" + faoInstitute.getCode() + "\"]}");
model.addAttribute("page", page);
return "redirect:/explore";
}
......@@ -208,7 +208,8 @@ public class WiewsController extends BaseController {
}
_logger.debug("Got " + taxonomy2);
model.addAttribute("filter", "{\"institute.code\":[\"" + faoInstitute.getCode() + "\"],\"taxonomy.genus\":[\"" + taxonomy2.getGenus() + "\"]}");
model.addAttribute("filter", "{\"" + FilterConstants.INSTCODE + "\":[\"" + faoInstitute.getCode() + "\"],\"" + FilterConstants.TAXONOMY_GENUS
+ "\":[\"" + taxonomy2.getGenus() + "\"]}");
model.addAttribute("page", page);
return "redirect:/explore";
}
......@@ -229,8 +230,8 @@ public class WiewsController extends BaseController {
}
_logger.debug("Got " + taxonomy2);
model.addAttribute("filter", "{\"institute.code\":[\"" + faoInstitute.getCode() + "\"],\"taxonomy.genus\":[\"" + taxonomy2.getGenus() + "\"],\"taxonomy.species\":[\""
+ taxonomy2.getSpecies() + "\"]}");
model.addAttribute("filter", "{\"" + FilterConstants.INSTCODE + "\":[\"" + faoInstitute.getCode() + "\"],\"" + FilterConstants.TAXONOMY_GENUS
+ "\":[\"" + taxonomy2.getGenus() + "\"],\"" + FilterConstants.TAXONOMY_SPECIES + "\":[\"" + taxonomy2.getSpecies() + "\"]}");
model.addAttribute("page", page);
return "redirect:/explore";
}
......@@ -245,7 +246,7 @@ public class WiewsController extends BaseController {
// Create JSON filter
final ObjectNode jsonTree = mapper.createObjectNode();
final ArrayNode arr = jsonTree.putArray("institute.code");
final ArrayNode arr = jsonTree.putArray(FilterConstants.INSTCODE);
arr.add(faoInstitute.getCode());
// Write Darwin Core Archive to the stream.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment