2022-02-04 10:12:15 +01:00
|
|
|
package eu.dnetlib.openaire.dsm.domain;
|
|
|
|
|
|
|
|
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
2022-03-24 12:26:14 +01:00
|
|
|
|
2022-02-04 10:12:15 +01:00
|
|
|
import io.swagger.annotations.ApiModel;
|
|
|
|
|
|
|
|
@JsonAutoDetect
|
|
|
|
@ApiModel(value = "Filter name", description = "List of the field names used to filter datasources")
|
2022-03-24 12:26:14 +01:00
|
|
|
public enum FilterName {
|
|
|
|
|
|
|
|
id,
|
|
|
|
managed,
|
|
|
|
collectedfrom, // exact match
|
|
|
|
officialname,
|
|
|
|
englishname,
|
|
|
|
websiteurl,
|
|
|
|
contactemail,
|
|
|
|
registeredby,
|
|
|
|
eoscDatasourceType,
|
|
|
|
platform, // like match
|
2022-02-04 10:12:15 +01:00
|
|
|
country; // exact match on related organization
|
|
|
|
|
2022-03-24 12:26:14 +01:00
|
|
|
public static FilterType type(final FilterName filterName) {
|
2022-02-04 10:12:15 +01:00
|
|
|
switch (filterName) {
|
2022-03-24 12:26:14 +01:00
|
|
|
case id:
|
|
|
|
case managed:
|
|
|
|
case collectedfrom:
|
|
|
|
return FilterType.exact;
|
|
|
|
case officialname:
|
|
|
|
case englishname:
|
|
|
|
case websiteurl:
|
|
|
|
case contactemail:
|
|
|
|
case registeredby:
|
|
|
|
case eoscDatasourceType:
|
|
|
|
case platform:
|
|
|
|
return FilterType.search;
|
|
|
|
case country:
|
|
|
|
return FilterType.searchOrgs;
|
|
|
|
default:
|
|
|
|
throw new IllegalStateException("unmapped filter type for: " + filterName);
|
2022-02-04 10:12:15 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|