1
|
package eu.dnetlib.functionality.modular.ui.repositories.controllers;
|
2
|
|
3
|
import javax.annotation.Resource;
|
4
|
import javax.servlet.http.HttpServletRequest;
|
5
|
import javax.servlet.http.HttpServletResponse;
|
6
|
|
7
|
import com.google.gson.Gson;
|
8
|
import eu.dnetlib.enabling.locators.UniqueServiceLocator;
|
9
|
import eu.dnetlib.functionality.modular.ui.ModuleEntryPoint;
|
10
|
import eu.dnetlib.functionality.modular.ui.repositories.util.RepoUIUtils;
|
11
|
import org.springframework.beans.factory.annotation.Required;
|
12
|
import org.springframework.ui.ModelMap;
|
13
|
|
14
|
/**
|
15
|
* Created by michele on 12/01/16.
|
16
|
*/
|
17
|
public class AddRepoEntryPointController extends ModuleEntryPoint {
|
18
|
|
19
|
private String datasourceTypeVocabulary;
|
20
|
private String datasourceCountryVocabulary;
|
21
|
|
22
|
@Resource
|
23
|
private UniqueServiceLocator serviceLocator;
|
24
|
|
25
|
@Resource
|
26
|
private RepoUIUtils repoUIUtils;
|
27
|
|
28
|
@Override
|
29
|
protected void initialize(final ModelMap map, final HttpServletRequest request, final HttpServletResponse response) throws Exception {
|
30
|
final Gson gson = new Gson();
|
31
|
map.addAttribute("types", gson.toJson(repoUIUtils.fetchVocabularyTerms(datasourceTypeVocabulary)));
|
32
|
map.addAttribute("countries", gson.toJson(repoUIUtils.fetchVocabularyTerms(datasourceCountryVocabulary)));
|
33
|
}
|
34
|
|
35
|
public String getDatasourceTypeVocabulary() {
|
36
|
return datasourceTypeVocabulary;
|
37
|
}
|
38
|
|
39
|
@Required
|
40
|
public void setDatasourceTypeVocabulary(final String datasourceTypeVocabulary) {
|
41
|
this.datasourceTypeVocabulary = datasourceTypeVocabulary;
|
42
|
}
|
43
|
|
44
|
public String getDatasourceCountryVocabulary() {
|
45
|
return datasourceCountryVocabulary;
|
46
|
}
|
47
|
|
48
|
@Required
|
49
|
public void setDatasourceCountryVocabulary(final String datasourceCountryVocabulary) {
|
50
|
this.datasourceCountryVocabulary = datasourceCountryVocabulary;
|
51
|
}
|
52
|
|
53
|
}
|