1
|
package eu.dnetlib.functionality.modular.ui.repositories.controllers;
|
2
|
|
3
|
import javax.servlet.http.HttpServletRequest;
|
4
|
import javax.servlet.http.HttpServletResponse;
|
5
|
|
6
|
import com.google.gson.Gson;
|
7
|
import eu.dnetlib.enabling.locators.UniqueServiceLocator;
|
8
|
import eu.dnetlib.functionality.modular.ui.ModuleEntryPoint;
|
9
|
import eu.dnetlib.functionality.modular.ui.repositories.util.RepoUIUtils;
|
10
|
import eu.dnetlib.rmi.datasource.DatasourceManagerService;
|
11
|
import org.springframework.beans.factory.annotation.Autowired;
|
12
|
import org.springframework.beans.factory.annotation.Required;
|
13
|
import org.springframework.ui.ModelMap;
|
14
|
|
15
|
public class RepoApisEntryPointController extends ModuleEntryPoint {
|
16
|
|
17
|
@Autowired
|
18
|
private UniqueServiceLocator serviceLocator;
|
19
|
|
20
|
@Autowired
|
21
|
private RepoUIUtils repoUIUtils;
|
22
|
|
23
|
private String compatibilityLevelsVocabulary;
|
24
|
|
25
|
@Override
|
26
|
protected void initialize(final ModelMap map, final HttpServletRequest request, final HttpServletResponse response) throws Exception {
|
27
|
final Gson gson = new Gson();
|
28
|
map.addAttribute("compatibilityLevels", gson.toJson(this.repoUIUtils.fetchVocabularyTerms(getCompatibilityLevelsVocabulary())));
|
29
|
map.addAttribute("browseFields", gson.toJson(this.serviceLocator.getService(DatasourceManagerService.class).listBrowsableFields()));
|
30
|
}
|
31
|
|
32
|
public String getCompatibilityLevelsVocabulary() {
|
33
|
return this.compatibilityLevelsVocabulary;
|
34
|
}
|
35
|
|
36
|
@Required
|
37
|
public void setCompatibilityLevelsVocabulary(final String compatibilityLevelsVocabulary) {
|
38
|
this.compatibilityLevelsVocabulary = compatibilityLevelsVocabulary;
|
39
|
}
|
40
|
|
41
|
}
|