Project

General

Profile

1
package eu.dnetlib.openaire.exporter.model.datasource;
2

    
3
import com.fasterxml.jackson.annotation.JsonAutoDetect;
4
import io.swagger.annotations.ApiModel;
5

    
6
@JsonAutoDetect
7
@ApiModel(value = "Filter name", description = "List of the field names used to filter datasources")
8
public enum FilterName {
9
	id, managed, // exact match
10
	officialname, englishname, websiteurl, contactemail, registeredby, typology, platform, // like match
11
	country; // exact match on related organization
12

    
13
	public static FilterType type(FilterName filterName) {
14
		switch (filterName) {
15

    
16
		case id:
17
		case managed:
18
			return FilterType.exact;
19
		case officialname:
20
		case englishname:
21
		case websiteurl:
22
		case contactemail:
23
		case registeredby:
24
		case typology:
25
		case platform:
26
			return FilterType.search;
27
		case country:
28
			return FilterType.searchOrgs;
29
		default:
30
			throw new IllegalStateException();
31
		}
32
	}
33

    
34
}
(9-9/17)