Project

General

Profile

1
package eu.dnetlib.repo.manager.service.controllers;
2

    
3
import eu.dnetlib.domain.data.Repository;
4
import eu.dnetlib.domain.data.RepositoryInterface;
5
import eu.dnetlib.repo.manager.service.shared.Aggregations;
6
import eu.dnetlib.repo.manager.service.shared.Country;
7
import org.json.JSONException;
8
import org.springframework.http.MediaType;
9
import org.springframework.web.bind.annotation.RequestMapping;
10
import org.springframework.web.bind.annotation.RequestMethod;
11
import org.springframework.web.bind.annotation.ResponseBody;
12
import org.springframework.web.bind.annotation.RestController;
13
import java.util.List;
14
import java.util.Map;
15
import java.util.Set;
16

    
17
@RestController
18
@RequestMapping(value = "/repository")
19
public interface RepositoryApi {
20

    
21

    
22
    @RequestMapping(value = "/testAggregations", method = RequestMethod.GET,
23
            produces = MediaType.APPLICATION_JSON_VALUE)
24
    @ResponseBody
25
    Aggregations testAggregations() throws JSONException;
26

    
27
    @RequestMapping(value = "/getCountries", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
28
    @ResponseBody
29
    Country[] getCountries() ;
30

    
31
    @RequestMapping(value = "/getRepositoriesByCountry/{country}", method = RequestMethod.GET,
32
            produces = MediaType.APPLICATION_JSON_VALUE)
33
    @ResponseBody
34
    Set<String> getRepositoriesByCountry(String country) throws JSONException;
35

    
36
    @RequestMapping(value = "/getRepositoriesOfUser/{userEmail}/{page}/{size}")
37
    @ResponseBody
38
    List<Repository> getRepositoriesOfUser( String userEmail,
39
                                        String page,
40
                                        String size) throws JSONException;
41

    
42
    @RequestMapping(value = "/getRepositoryById/{id}", method = RequestMethod.GET,
43
            produces = MediaType.APPLICATION_JSON_VALUE)
44
    @ResponseBody
45
    Repository getRepositoryById(String id) throws JSONException;
46

    
47

    
48
    @RequestMapping(value = "/getRepositoryAggregations/{id}", method = RequestMethod.GET,
49
            produces = MediaType.APPLICATION_JSON_VALUE)
50
    @ResponseBody
51
    Aggregations getRepositoryAggregations(String id) throws JSONException;
52

    
53

    
54
    @RequestMapping(value = "/getRepositoriesByName/{name}/{page}/{size}/", method = RequestMethod.GET,
55
            produces = MediaType.APPLICATION_JSON_VALUE)
56
    @ResponseBody
57
    List<Repository> getRepositoriesByName(String name,
58
                                          String page,
59
                                          String size) throws JSONException;
60

    
61
    @RequestMapping(value = "/getRepositoryInterface/{id}", method = RequestMethod.GET,
62
            produces = MediaType.APPLICATION_JSON_VALUE)
63
    @ResponseBody
64
    RepositoryInterface getRepositoyInterface(String id) throws JSONException;
65

    
66
    @RequestMapping(value = "/addRepository", method = RequestMethod.POST,
67
            consumes = MediaType.APPLICATION_JSON_VALUE)
68
    @ResponseBody
69
    String addRepository(Repository repository) throws JSONException;
70

    
71
    @RequestMapping(value = "/addInterface", method = RequestMethod.POST,
72
            consumes = MediaType.APPLICATION_JSON_VALUE)
73
    @ResponseBody
74
    String addRepositoryInterface(RepositoryInterface repositoryInterface) throws JSONException;
75

    
76
    @RequestMapping(value = "/getDnetCountries", method = RequestMethod.GET,
77
            produces = MediaType.APPLICATION_JSON_VALUE)
78
    @ResponseBody
79
    List<String> getDnetCountries();
80

    
81
    @RequestMapping(value = "/getTypologies", method = RequestMethod.GET,
82
            produces = MediaType.APPLICATION_JSON_VALUE)
83
    @ResponseBody
84
    List<String> getTypologies();
85

    
86
    @RequestMapping(value = "/getTimezones", method = RequestMethod.GET,
87
            produces = MediaType.APPLICATION_JSON_VALUE)
88
    @ResponseBody
89
    List<String> getTimezones();
90

    
91
    @RequestMapping(value = "/updateManagedStatus", method = RequestMethod.POST,
92
            produces = MediaType.APPLICATION_JSON_VALUE)
93
    @ResponseBody
94
    String updateManagedStatus(String id,String managed);
95

    
96
    @RequestMapping(value = "/updateEnglishName", method = RequestMethod.POST,
97
            produces = MediaType.APPLICATION_JSON_VALUE)
98
    @ResponseBody
99
    String updateEnglishName(String id,String englishName);
100

    
101
    @RequestMapping(value = "/updateLatitude", method = RequestMethod.POST,
102
            produces = MediaType.APPLICATION_JSON_VALUE)
103
    @ResponseBody
104
    String updateLatitude(String id,String latitude);
105

    
106
    @RequestMapping(value = "/updateLongitude", method = RequestMethod.POST,
107
            produces = MediaType.APPLICATION_JSON_VALUE)
108
    @ResponseBody
109
    String updateLongitude(String id,String longitude);
110

    
111
    @RequestMapping(value = "/updateOfficialName", method = RequestMethod.POST,
112
            produces = MediaType.APPLICATION_JSON_VALUE)
113
    @ResponseBody
114
    String updateOfficialName(String id,String officialName);
115

    
116
    @RequestMapping(value = "/getUrlsOfUserRepos/{email}/{page}/{size}/",method = RequestMethod.GET,
117
            produces = MediaType.APPLICATION_JSON_VALUE)
118
    @ResponseBody
119
    String getUrlsOfUserRepos(String user_email,
120
                              String page,
121
                              String size) throws JSONException;
122

    
123
    @RequestMapping(value = "/getDatasourceVocabularies/{mode}",method = RequestMethod.GET,
124
            produces = MediaType.APPLICATION_JSON_VALUE)
125
    @ResponseBody
126
    List<String> getDatasourceVocabularies(String mode);
127

    
128

    
129

    
130

    
131

    
132

    
133

    
134
}
(5-5/8)