Commit d5bb43eb authored by Maxym Borodenko's avatar Maxym Borodenko
Browse files

Filter accessions by GeoRegion. Added 2d filter (Region of Holding Institute)

parent c8a04238
......@@ -85,5 +85,8 @@ public interface FilterConstants {
public static final String PDCI = "pdci";
public static final String REGION_ORIGIN = "regionOrigin";
public static final String REGION_HOLD_INSTITUTE= "regionHoldInst";
}
......@@ -81,6 +81,8 @@ public class FilterHandler {
this.availableFilters.add(new BasicFilter(FilterConstants.CROPNAME, DataType.STRING));
this.availableFilters.add(new BasicFilter(FilterConstants.LISTS, DataType.STRING));
this.availableFilters.add(new BasicFilter(FilterConstants.REGION_ORIGIN, DataType.STRING));
this.availableFilters.add(new BasicFilter(FilterConstants.REGION_HOLD_INSTITUTE, DataType.STRING));
this.availableFilters.add(new I18nListFilter<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 AutocompleteFilter(FilterConstants.TAXONOMY_GENUS, "/explore/ac/" + FilterConstants.TAXONOMY_GENUS));
......@@ -89,7 +91,7 @@ public class FilterHandler {
this.availableFilters.add(new AutocompleteFilter(FilterConstants.TAXONOMY_SCINAME, "/explore/ac/" + FilterConstants.TAXONOMY_SCINAME));
this.availableFilters.add(new AutocompleteFilter(FilterConstants.ORGCTY_ISO3, "/explore/ac/" + FilterConstants.ORGCTY_ISO3));
this.availableFilters.add(new AutocompleteFilter(FilterConstants.INSTITUTE_COUNTRY_ISO3, "/explore/ac/" + FilterConstants.ORGCTY_ISO3));
this.availableFilters.add(new AutocompleteFilter(FilterConstants.INSTITUTE_COUNTRY_ISO3, "/explore/ac/" + FilterConstants.INSTITUTE_COUNTRY_ISO3));
this.availableFilters.add(new BasicFilter(FilterConstants.GEO_LATITUDE, DataType.NUMERIC));
this.availableFilters.add(new BasicFilter(FilterConstants.GEO_LONGITUDE, DataType.NUMERIC));
this.availableFilters.add(new BasicFilter(FilterConstants.GEO_ELEVATION, DataType.NUMERIC));
......
......@@ -236,19 +236,20 @@ public class GenesysFilterServiceImpl implements GenesysFilterService {
LOG.error("Error occurred during search", e);
}
if (termResult != null) {
for (final Country c : countries) {
String label = c.getCode3() + ", " + c.getName();
for (Term term : termResult.getTerms()) {
if (term.getTerm().equals(c.getCode3()) && term.getCount() > 0) {
label = label.concat(" (" + term.getCount() + ")");
completed.add(new LabelValue<String>(c.getCode3(), label));
break;
}
}
}
fillCountryCompleteListFromTerm(completed, termResult, countries);
} else if (FilterConstants.INSTITUTE_COUNTRY_ISO3.equalsIgnoreCase(filter)) {
final List<Country> countries = geoService.autocomplete(ac);
TermResult termResult = null;
try {
termResult = elasticService.termStatisticsAuto(filters, FilterConstants.INSTITUTE_COUNTRY_ISO3, 20000);
} catch (SearchException e) {
LOG.error("Error occurred during search", e);
}
} else if (FilterConstants.TAXONOMY_GENUS.equalsIgnoreCase(filter)) {
fillCountryCompleteListFromTerm(completed, termResult, countries);
}
else if (FilterConstants.TAXONOMY_GENUS.equalsIgnoreCase(filter)) {
final List<String> genera = taxonomyService.autocompleteGenus(ac, crop);
TermResult termResult = null;
try {
......@@ -257,18 +258,8 @@ public class GenesysFilterServiceImpl implements GenesysFilterService {
LOG.error("Error occurred during search", e);
}
if (termResult != null) {
for (final String value : genera) {
String label = value;
for (Term term : termResult.getTerms()) {
if (term.getTerm().equals(value) && term.getCount() > 0) {
label = label.concat(" (" + term.getCount() + ")");
completed.add(new LabelValue<String>(value, label));
break;
}
}
}
}
fillCompleteListFromTerm(completed, termResult, genera);
} else if (FilterConstants.TAXONOMY_SPECIES.equalsIgnoreCase(filter)) {
List<String> genus = new ArrayList<>();
......@@ -287,18 +278,8 @@ public class GenesysFilterServiceImpl implements GenesysFilterService {
LOG.error("Error occurred during search", e);
}
if (termResult != null) {
for (final String value : species) {
String label = value;
for (Term term : termResult.getTerms()) {
if (term.getTerm().equals(value) && term.getCount() > 0) {
label = label.concat(" (" + term.getCount() + ")");
completed.add(new LabelValue<String>(value, label));
break;
}
}
}
}
fillCompleteListFromTerm(completed, termResult, species);
} else if (FilterConstants.TAXONOMY_SUBTAXA.equalsIgnoreCase(filter)) {
List<String> genus = new ArrayList<>();
List<String> species = new ArrayList<>();
......@@ -324,18 +305,8 @@ public class GenesysFilterServiceImpl implements GenesysFilterService {
LOG.error("Error occurred during search", e);
}
if (termResult != null) {
for (final String value : subtaxa) {
String label = value;
for (Term term : termResult.getTerms()) {
if (term.getTerm().equals(value) && term.getCount() > 0) {
label = label.concat(" (" + term.getCount() + ")");
completed.add(new LabelValue<String>(value, label));
break;
}
}
}
}
fillCompleteListFromTerm(completed, termResult, subtaxa);
} else if (FilterConstants.TAXONOMY_SCINAME.equalsIgnoreCase(filter)) {
final List<String> taxa = taxonomyService.autocompleteTaxonomy(ac);
TermResult termResult = null;
......@@ -344,23 +315,41 @@ public class GenesysFilterServiceImpl implements GenesysFilterService {
} catch (SearchException e) {
LOG.error("Error occurred during search", e);
}
fillCompleteListFromTerm(completed, termResult, taxa);
} else {
throw new RuntimeException("No autocompleter for " + filter);
}
return completed;
}
private void fillCountryCompleteListFromTerm(final List<LabelValue<String>> completed, final TermResult termResult, final List<Country> countries) {
if (termResult != null) {
for (final Country c : countries) {
String label = c.getCode3() + ", " + c.getName();
for (Term term : termResult.getTerms()) {
if (term.getTerm().equals(c.getCode3()) && term.getCount() > 0) {
label = label.concat(" (" + term.getCount() + ")");
completed.add(new LabelValue<String>(c.getCode3(), label));
break;
}
}
}
}
}
if (termResult != null) {
for (final String taxonomy : taxa) {
String label = taxonomy;
for (Term term : termResult.getTerms()) {
if (term.getTerm().equals(taxonomy) && term.getCount() > 0) {
label = label.concat(" (" + term.getCount() + ")");
completed.add(new LabelValue<String>(taxonomy, label));
break;
}
private void fillCompleteListFromTerm(final List<LabelValue<String>> completed, final TermResult termResult, final List<String> list) {
if (termResult != null) {
for (final String val : list) {
String label = val;
for (Term term : termResult.getTerms()) {
if (term.getTerm().equals(val) && term.getCount() > 0) {
label = label.concat(" (" + term.getCount() + ")");
completed.add(new LabelValue<String>(val, label));
break;
}
}
}
} else {
throw new RuntimeException("No autocompleter for " + filter);
}
return completed;
}
public static class LabelValue<T> {
......
......@@ -196,7 +196,8 @@ public class ExplorerController extends BaseController implements InitializingBe
_logger.debug("Filtering by: " + jsonFilter);
AppliedFilters appliedFilters = mapper.readValue(jsonFilter, AppliedFilters.class);
conversionGeoRegionsFilterToOrgCountryFilter(appliedFilters);
final AppliedFilters storedTransformedFilters = conversionFiltersFromGeoRegions(appliedFilters);
appliedFilters = storedTransformedFilters;
Crop crop = null;
{
......@@ -211,12 +212,10 @@ public class ExplorerController extends BaseController implements InitializingBe
af.addFilterValue(new FilterHandler.LiteralValueFilter(crop.getShortName()));
}
}
model.addAttribute("crop", crop);
// JSP works with JsonObject
appliedFilters = mapper.readValue(jsonFilter, AppliedFilters.class);
final Map<?, ?> filters = mapper.readValue(appliedFilters.toString(), Map.class);
model.addAttribute("filters", filters);
selectedFilters = appliedFilters.getFilterNames();
final List<GenesysFilter> currentFilters = filterHandler.selectFilters(selectedFilters);
......@@ -228,8 +227,7 @@ public class ExplorerController extends BaseController implements InitializingBe
List<Integer> options = new ArrayList<>();
List<Integer> counts = new ArrayList<>();
AppliedFilters tempFilters = mapper.readValue(jsonFilter, AppliedFilters.class);
conversionGeoRegionsFilterToOrgCountryFilter(tempFilters);
AppliedFilters tempFilters = storedTransformedFilters;
final GenesysFilter finalFilter = filter;
tempFilters.removeIf(appliedFilter -> appliedFilter.getKey().equals(finalFilter.getKey()));
for (Term term : elasticService.termStatisticsAuto(tempFilters, filter.getKey(), 30).getTerms()) {
......@@ -245,8 +243,7 @@ public class ExplorerController extends BaseController implements InitializingBe
options = new ArrayList<>();
counts = new ArrayList<>();
tempFilters = mapper.readValue(jsonFilter, AppliedFilters.class);
conversionGeoRegionsFilterToOrgCountryFilter(tempFilters);
tempFilters = storedTransformedFilters;
final GenesysFilter finalFilter2 = filter;
tempFilters.removeIf(appliedFilter -> appliedFilter.getKey().equals(finalFilter2.getKey()));
for (Term term : elasticService.termStatisticsAuto(tempFilters, filter.getKey(), 30).getTerms()) {
......@@ -261,19 +258,21 @@ public class ExplorerController extends BaseController implements InitializingBe
if (_logger.isDebugEnabled()) {
_logger.debug(appliedFilters.toString());
}
model.addAttribute("jsonFilter", appliedFilters.toString());
transformFiltersIfNeed(appliedFilters);
final Page<AccessionDetails> accessions = filterService.listAccessionDetails(appliedFilters, new PageRequest(page - 1, results, new Sort("seqNo")));
if (_logger.isDebugEnabled()) {
_logger.debug("Got: " + accessions);
}
model.addAttribute("availableColumns", validDisplayColumns);
model.addAttribute("selectedColumns", cleanupDisplayColumns(columns, cookieColumns, response));
tempFilters = mapper.readValue(jsonFilter, AppliedFilters.class);
model.addAttribute("crop", crop);
model.addAttribute("filters", filters);
model.addAttribute("jsonFilter", tempFilters.toString());
model.addAttribute("availableColumns", validDisplayColumns);
model.addAttribute("selectedColumns", cleanupDisplayColumns(columns, cookieColumns, response));
model.addAttribute("crops", getCrops(appliedFilters));
model.addAttribute("pagedData", accessions);
model.addAttribute("appliedFilters", getAppliedFilters(tempFilters));
......@@ -291,8 +290,8 @@ public class ExplorerController extends BaseController implements InitializingBe
List<GeoRegion> resultList = new ArrayList<>();
for(GeoRegion geoRegion: geoRegionList) {
if(geoRegion.getParentRegion().getName().equals("World") || geoRegion.getParentRegion().getName().equals("Americas")) {
for (GeoRegion geoRegion: geoRegionList) {
if (geoRegion.getParentRegion().getName().equals("World") || geoRegion.getParentRegion().getName().equals("Americas")) {
geoRegion.setParentRegion(null);
resultList.add(geoRegion);
}
......@@ -301,10 +300,10 @@ public class ExplorerController extends BaseController implements InitializingBe
return resultList;
}
private AppliedFilters getAppliedFilters (AppliedFilters filters) {
private AppliedFilters getAppliedFilters (final AppliedFilters filters) {
AppliedFilters newAppliedFilters = new AppliedFilters();
for(AppliedFilter appliedFilter: filters) {
if(!appliedFilter.getValues().isEmpty()) {
for (AppliedFilter appliedFilter: filters) {
if (!appliedFilter.getValues().isEmpty()) {
newAppliedFilters.add(appliedFilter);
}
}
......@@ -318,7 +317,6 @@ public class ExplorerController extends BaseController implements InitializingBe
AppliedFilters appliedFilters = mapper.readValue(jsonFilter, AppliedFilters.class);
String[] selectedFilters = appliedFilters.getFilterNames();
final List<GenesysFilter> currentFilters = filterHandler.selectFilters(selectedFilters);
model.addAttribute("appliedFilters", appliedFilters);
model.addAttribute("currentFilters", currentFilters);
// JSP works with JsonObject
......@@ -330,9 +328,15 @@ public class ExplorerController extends BaseController implements InitializingBe
model.addAttribute("availableFilters", availableFilters);
AppliedFilters tempFilters = mapper.readValue(jsonFilter, AppliedFilters.class);
model.addAttribute("crops", getCrops(tempFilters));
// Composition overview
appliedFilters = transformFiltersIfNeed(appliedFilters);
model.addAttribute("crops", getCrops(appliedFilters));
appliedFilters = mapper.readValue(jsonFilter, AppliedFilters.class);
appliedFilters = transformFiltersIfNeed(appliedFilters);
model.addAttribute("appliedFilters", tempFilters);
model.addAttribute("accessionCount", elasticService.termStatisticsAuto(appliedFilters, FilterConstants.INSTCODE, 10).getTotalCount());
overviewInstitutes(model, appliedFilters);
overviewComposition(model, appliedFilters);
......@@ -340,6 +344,7 @@ public class ExplorerController extends BaseController implements InitializingBe
overviewHistoric(model, appliedFilters);
overviewManagement(model, appliedFilters);
overviewSources(model, appliedFilters);
model.addAttribute("geoRegions", getGeoRegions());
return "/accession/overview";
}
......@@ -370,13 +375,17 @@ public class ExplorerController extends BaseController implements InitializingBe
final Map<String, GenesysFilter> availableFilters = filterHandler.mapAvailableFilters();
AppliedFilters tempFilters = mapper.readValue(jsonFilter, AppliedFilters.class);
model.addAttribute("filters", filters);
model.addAttribute("availableFilters", availableFilters);
model.addAttribute("crops", getCrops(tempFilters));
model.addAttribute("additionalFilters", additionalFilters);
model.addAttribute("appliedFilters", getAppliedFilters(appliedFilters2));
model.addAttribute("currentFilters", currentFilters);
model.addAttribute("jsonFilter", appliedFilters.toString());
model.addAttribute("filters", filters);
model.addAttribute("additionalFilters", additionalFilters);
model.addAttribute("appliedFilters", getAppliedFilters(appliedFilters2));
model.addAttribute("geoRegions", getGeoRegions());
transformFiltersIfNeed(tempFilters);
model.addAttribute("crops", getCrops(tempFilters));
return "/accession/map";
}
......@@ -387,6 +396,8 @@ public class ExplorerController extends BaseController implements InitializingBe
throws IOException, SearchException {
AppliedFilters appliedFilters = mapper.readValue(jsonFilter, AppliedFilters.class);
transformFiltersIfNeed(appliedFilters);
Map<String, TermResult> pageData = new HashMap<>();
pageData.put("statsInstCode", elasticService.termStatisticsAuto(appliedFilters, FilterConstants.INSTCODE, 20));
......@@ -407,17 +418,6 @@ public class ExplorerController extends BaseController implements InitializingBe
return pageData;
}
@RequestMapping(value = "/explore/json", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
public Page<?> getFilteredJsonData(@RequestParam(value = "page", required = false, defaultValue = "1") int page,
@RequestParam(value = "filter", required = true, defaultValue = "{}") String jsonFilter,
@RequestParam(value = "results", required = true, defaultValue = "50") int results) throws IOException, SearchException {
AppliedFilters appliedFilters = mapper.readValue(jsonFilter, AppliedFilters.class);
conversionGeoRegionsFilterToOrgCountryFilter(appliedFilters);
return filterService.listAccessionDetails(appliedFilters, new PageRequest(page - 1, results, new Sort("seqNo")));
}
@RequestMapping(value = "/explore/listFilterSuggestions", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
public Map<String, GenesysFilter> getSuggestions(@RequestParam(value = "filter", required = true, defaultValue = "{}") String jsonFilter) throws IOException, SearchException {
......@@ -452,18 +452,90 @@ public class ExplorerController extends BaseController implements InitializingBe
return availableFilters;
}
private void conversionGeoRegionsFilterToOrgCountryFilter(final AppliedFilters appliedFilters) {
AppliedFilter geoRegionsFilter = appliedFilters.stream()
.filter(filter -> filter.getFilterName().equals("geoRegions")).findFirst().orElse(null);
@RequestMapping(value = "/explore/json", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
public Page<?> getFilteredJsonData(@RequestParam(value = "page", required = false, defaultValue = "1") int page,
@RequestParam(value = "filter", required = true, defaultValue = "{}") String jsonFilter,
@RequestParam(value = "results", required = true, defaultValue = "50") int results) throws IOException, SearchException {
AppliedFilters appliedFilters = mapper.readValue(jsonFilter, AppliedFilters.class);
transformFiltersIfNeed(appliedFilters);
return filterService.listAccessionDetails(appliedFilters, new PageRequest(page - 1, results, new Sort("seqNo")));
}
private AppliedFilters transformFiltersIfNeed(final AppliedFilters appliedFilters) {
AppliedFilter regionOriginFilter = appliedFilters.stream()
.filter(filter -> filter.getFilterName().equals("regionOrigin")).findFirst().orElse(null);
AppliedFilter regionHoldInstFilter = appliedFilters.stream()
.filter(filter -> filter.getFilterName().equals("regionHoldInst")).findFirst().orElse(null);
AppliedFilter countryOriginFilter = appliedFilters.stream()
.filter(filter -> filter.getFilterName().equals("orgCty.iso3")).findFirst().orElse(null);
AppliedFilter countryHoldInstFilter = appliedFilters.stream()
.filter(filter -> filter.getFilterName().equals("institute.country.iso3")).findFirst().orElse(null);
List<String> regionHoldInstValues = new ArrayList<>();
if (regionOriginFilter !=null && countryOriginFilter!=null && !countryOriginFilter.getValues().isEmpty()) {
regionHoldInstValues.addAll(getFilterValues(countryOriginFilter));
}
List<String> instituteCountryValues = new ArrayList<>();
if (regionHoldInstFilter !=null && countryHoldInstFilter!=null && !countryHoldInstFilter.getValues().isEmpty()) {
instituteCountryValues.addAll(getFilterValues(countryHoldInstFilter));
}
conversionFiltersFromGeoRegions(appliedFilters);
transformFilterListIfExistsRegionAndCountryInFilters(appliedFilters, regionOriginFilter, countryOriginFilter, regionHoldInstValues);
transformFilterListIfExistsRegionAndCountryInFilters(appliedFilters, regionHoldInstFilter, countryHoldInstFilter, instituteCountryValues);
return appliedFilters;
}
private void transformFilterListIfExistsRegionAndCountryInFilters(final AppliedFilters appliedFilters,
final AppliedFilter regionFilter,
final AppliedFilter countryFilter,
final List<String> regionValues) {
if (regionFilter != null && countryFilter != null && !regionValues.isEmpty()) {
AppliedFilter newCountryFilter = new AppliedFilter();
newCountryFilter.setFilterName(countryFilter.getFilterName());
for (String value : regionValues) {
newCountryFilter.addFilterValue(new FilterHandler.LiteralValueFilter(value));
}
appliedFilters.removeIf(appliedFilter1 -> appliedFilter1.getFilterName().equals(countryFilter.getFilterName()));
appliedFilters.add(newCountryFilter);
}
}
private AppliedFilters conversionFiltersFromGeoRegions(final AppliedFilters appliedFilters) {
AppliedFilter regionOriginFilter = appliedFilters.stream()
.filter(filter -> filter.getFilterName().equals("regionOrigin")).findFirst().orElse(null);
AppliedFilter regionHoldInstFilter = appliedFilters.stream()
.filter(filter -> filter.getFilterName().equals("regionHoldInst")).findFirst().orElse(null);
if (regionOriginFilter != null && !regionOriginFilter.getValues().isEmpty()) {
conversionGeoRegionsFilterToAnotherFilter(appliedFilters, regionOriginFilter, "orgCty.iso3");
}
if (regionHoldInstFilter != null && !regionHoldInstFilter.getValues().isEmpty()) {
conversionGeoRegionsFilterToAnotherFilter(appliedFilters, regionHoldInstFilter, "institute.country.iso3");
}
return appliedFilters;
}
private AppliedFilters conversionGeoRegionsFilterToAnotherFilter(final AppliedFilters appliedFilters,
final AppliedFilter oldFilter,
final String anotherFilterName) {
List<GeoRegion> geoRegionList = new ArrayList<>();
List<Country> countryList = new ArrayList<>();
Set<String> countryIsoList = new HashSet<>();
if (geoRegionsFilter != null && !geoRegionsFilter.getValues().isEmpty()) {
for (String isoCode: getFilterValues(geoRegionsFilter)) {
geoRegionList.add(geoRegionService.find(isoCode));
}
for (String isoCode: getFilterValues(oldFilter)) {
geoRegionList.add(geoRegionService.find(isoCode));
}
if (!geoRegionList.isEmpty()) {
......@@ -480,22 +552,22 @@ public class ExplorerController extends BaseController implements InitializingBe
if (!countryIsoList.isEmpty()) {
AppliedFilter orgCtyFilter = appliedFilters.stream()
.filter(filter -> filter.getFilterName().equals("orgCty.iso3"))
.findFirst().orElse(new AppliedFilter().setFilterName("orgCty.iso3"));
.filter(filter -> filter.getFilterName().equals(anotherFilterName))
.findFirst().orElse(new AppliedFilter().setFilterName(anotherFilterName));
if (!orgCtyFilter.getValues().isEmpty()) {
if (!orgCtyFilter.getValues().isEmpty())
countryIsoList.addAll(getFilterValues(orgCtyFilter));
}
for (String isoCode: countryIsoList) {
orgCtyFilter.addFilterValue(new FilterHandler.LiteralValueFilter(isoCode));
}
appliedFilters.removeIf(appliedFilter1 -> appliedFilter1.getFilterName().equals("geoRegions"));
appliedFilters.removeIf(appliedFilter1 -> appliedFilter1.getFilterName().equals(oldFilter.getFilterName()));
if(!appliedFilters.hasFilter("orgCty.iso3"))
if (!appliedFilters.hasFilter(anotherFilterName))
appliedFilters.add(orgCtyFilter);
}
return appliedFilters;
}
private Set<String> getFilterValues(final AppliedFilter appliedFilter) {
......@@ -533,7 +605,7 @@ public class ExplorerController extends BaseController implements InitializingBe
@ResponseBody
public String getTransformedFilters(@RequestParam(value = "filter", required = true, defaultValue = "{}") String jsonFilter) throws IOException, SearchException {
AppliedFilters appliedFilters = mapper.readValue(jsonFilter, AppliedFilters.class);
conversionGeoRegionsFilterToOrgCountryFilter(appliedFilters);
conversionFiltersFromGeoRegions(appliedFilters);
return appliedFilters.toString();
}
......@@ -634,7 +706,7 @@ public class ExplorerController extends BaseController implements InitializingBe
}
/**
*
*
* @param cookieColumns
* validated selected columns
* @param response
......@@ -791,7 +863,7 @@ public class ExplorerController extends BaseController implements InitializingBe
@RequestParam(value = "jsonFilter", required = false, defaultValue = "{}") String jsonFilter) throws IOException {
AppliedFilters appliedFilters = mapper.readValue(jsonFilter, AppliedFilters.class);
conversionGeoRegionsFilterToOrgCountryFilter(appliedFilters);
conversionFiltersFromGeoRegions(appliedFilters);
return filterService.autocomplete(filter, ac, appliedFilters);
}
......@@ -903,6 +975,8 @@ public class ExplorerController extends BaseController implements InitializingBe
public String getBoundingBox(@RequestParam(value = "filter", required = true) String jsonFilter) throws IOException {
AppliedFilters appliedFilters = mapper.readValue(jsonFilter, AppliedFilters.class);
transformFiltersIfNeed(appliedFilters);
return mappingService.getBoundingBox(appliedFilters);
}
......@@ -917,6 +991,7 @@ public class ExplorerController extends BaseController implements InitializingBe
try {
AppliedFilters appliedFilters = mapper.readValue(jsonFilter, AppliedFilters.class);
transformFiltersIfNeed(appliedFilters);
byte[] image = mappingService.getTile(appliedFilters, zoom, x, y);
image = changeColor(color, image);
......
......@@ -431,6 +431,7 @@ filter.alias=Accession name
filter.crops=Crop name
filter.cropName=Provided crop name
filter.regionOfOrigin=Region of Origin
filter.regionOfHoldingInstitute=Region of Holding Institute
filter.orgCty.iso3=Country of Origin
filter.institute.code=Holding Institute name
filter.institute.country.iso3=Country of holding institute
......
......@@ -24,7 +24,7 @@
<div class="">
<filters:filter-list availableFilters="${availableFilters}" filters="${filters}"
additionalFilters="${additionalFilters}" appliedFilters="${appliedFilters}"
crops="${crops}" crop="${crop}"/>
crops="${crops}" crop="${crop}" geoRegions="${geoRegions}"/>
<div class="col-lg-10 col-md-9 col-sm-9 col-xs-12 main-col-header">
<div class="nav-header clearfix">
......@@ -272,6 +272,13 @@
}
});
$("body").on("change", ".geo-switcher", function () {
if (jsonData[$(this).attr("i-key")] === undefined) {
BrowseUtil.enableFilter(this, jsonData);
}
GenesysFilter.filterSelectList($(this), jsonData);
});
$("body").on("click", ".filter-list", function () {
if (jsonData[$(this).attr("i-key")] === undefined) {
BrowseUtil.enableFilter(this, jsonData);
......
......@@ -29,8 +29,9 @@
<div class="">
<%-- filter list --%>
<filters:filter-list availableFilters="${availableFilters}" filters="${filters}"
appliedFilters="${appliedFilters}" crops="${crops}" crop="${crop}"/>
<filters:filter-list availableFilters="${availableFilters}" filters="${filters}"
additionalFilters="${additionalFilters}" appliedFilters="${appliedFilters}"
crops="${crops}" crop="${crop}" geoRegion