AppliedFiltersConverter.java
package org.genesys.server.service.filter;
import org.genesys.server.service.FilterConstants;
public class AppliedFiltersConverter {
private static final String ACCEFILT_SGSV = "sgsv";
/**
* This method maps the old filter "keys" (like "institute.country.iso3") to
* appropriate properties of the entity as indexed.
*
* @param afTerm
* @return
*/
public static String convertTerm(String afTerm) {
switch (afTerm) {
// These are renamed
case FilterConstants.CROPS:
return "crop.shortName";
case FilterConstants.INSTITUTE_COUNTRY_ISO2:
return "institute.country.code2";
case FilterConstants.INSTITUTE_COUNTRY_ISO3:
return "institute.country.code3";
case FilterConstants.REGION_HOLD_INSTITUTE:
return "institute.country.region.isoCode";
case FilterConstants.ORGCTY_ISO3:
return "countryOfOrigin.code3";
case FilterConstants.REGION_ORIGIN:
return "countryOfOrigin.region.isoCode";
case FilterConstants.TAXONOMY_SCINAME:
return "taxonomy.taxonName";
case FilterConstants.IN_SGSV:
return ACCEFILT_SGSV;
case FilterConstants.ART15:
return "inTrust";
// These are the same
case FilterConstants.ACCENUMB:
case FilterConstants.AVAILABLE:
case FilterConstants.CROPNAME:
case FilterConstants.DOI:
case FilterConstants.DONORCODE:
case FilterConstants.DUPLSITE:
case FilterConstants.HISTORIC:
case FilterConstants.ID:
case FilterConstants.INSTCODE:
case FilterConstants.MLSSTATUS:
case FilterConstants.SAMPSTAT:
case FilterConstants.STORAGE:
case FilterConstants.SEQUENTIAL_NUMBER:
case FilterConstants.SGSV:
case FilterConstants.UUID:
case FilterConstants.GEO_ELEVATION:
case FilterConstants.GEO_LATITUDE:
case FilterConstants.GEO_LONGITUDE:
case FilterConstants.COLLMISSID:
case FilterConstants.LAST_MODIFIED_DATE:
case FilterConstants.TAXONOMY_GENUS:
case FilterConstants.TAXONOMY_SPECIES:
case FilterConstants.TAXONOMY_GENUSSPECIES:
case FilterConstants.TAXONOMY_SUBTAXA:
return afTerm;
default:
throw new RuntimeException("Unhandled conversion for term " + afTerm);
}
}
}