dnet-applications/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/FilterName.java

48 lines
1.0 KiB
Java
Raw Normal View History

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-08-19 15:21:40 +02:00
import io.swagger.v3.oas.annotations.media.Schema;
2022-02-04 10:12:15 +01:00
@JsonAutoDetect
2022-08-19 15:21:40 +02:00
@Schema(name = "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,
typology,
2022-03-24 12:26:14 +01:00
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 typology:
2022-03-24 12:26:14 +01:00
case platform:
return FilterType.search;
2022-10-10 11:13:52 +02:00
case eoscDatasourceType:
return FilterType.multiSearch;
2022-03-24 12:26:14 +01:00
case country:
return FilterType.searchOrgs;
default:
throw new IllegalStateException("unmapped filter type for: " + filterName);
2022-02-04 10:12:15 +01:00
}
}
}