Project

General

Profile

1
package eu.dnetlib.functionality.modular.ui.datasources.controllers;
2

    
3
import javax.servlet.http.HttpServletRequest;
4
import javax.servlet.http.HttpServletResponse;
5

    
6
import org.springframework.beans.factory.annotation.Autowired;
7
import org.springframework.beans.factory.annotation.Required;
8
import org.springframework.ui.ModelMap;
9

    
10
import com.google.gson.Gson;
11

    
12
import eu.dnetlib.functionality.modular.ui.ModuleEntryPoint;
13
import eu.dnetlib.functionality.modular.ui.datasources.controllers.util.DatasourceUIUtils;
14

    
15
public class DatasourceApisEntryPointController extends ModuleEntryPoint {
16

    
17
	@Autowired
18
	private DatasourceUIUtils dsUtils;
19

    
20
	private String compatibilityLevelsVocabulary;
21

    
22
	@Override
23
	protected void initialize(final ModelMap map, final HttpServletRequest request, final HttpServletResponse response) throws Exception {
24
		final Gson gson = new Gson();
25
		map.addAttribute("availableRepohiWfs", gson.toJson(dsUtils.listRepoHIWorkflows()));
26
		map.addAttribute("compatibilityLevels", gson.toJson(dsUtils.fetchVocabularyTerms(getCompatibilityLevelsVocabulary())));
27
		map.addAttribute("browseFields", gson.toJson(dsUtils.listBrowsableFields()));
28
	}
29

    
30
	public String getCompatibilityLevelsVocabulary() {
31
		return compatibilityLevelsVocabulary;
32
	}
33

    
34
	@Required
35
	public void setCompatibilityLevelsVocabulary(final String compatibilityLevelsVocabulary) {
36
		this.compatibilityLevelsVocabulary = compatibilityLevelsVocabulary;
37
	}
38

    
39
}
(3-3/5)