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