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.shared.Aggregations;
6
import eu.dnetlib.repo.manager.shared.Country;
7
import eu.dnetlib.repo.manager.shared.Timezone;
8
import io.swagger.annotations.Api;
9
import org.json.JSONException;
10
import org.springframework.http.MediaType;
11
import org.springframework.web.bind.annotation.*;
12

    
13
import java.util.List;
14
import java.util.Map;
15

    
16

    
17
@RestController
18
@RequestMapping(value = "/repository")
19
@Api(description = "Repository API",  tags = {"repository"})
20
public interface RepositoryApi {
21
    
22
    @RequestMapping(value = "/testAggregations", method = RequestMethod.GET,
23
            produces = MediaType.APPLICATION_JSON_VALUE)
24
    @ResponseBody
25
    List<String> 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}/{mode}", method = RequestMethod.GET,
32
            produces = MediaType.APPLICATION_JSON_VALUE)
33
    @ResponseBody
34
    List<Repository> getRepositoriesByCountry(String country,String mode) throws JSONException;
35

    
36
    @RequestMapping(value = "/getRepositoriesOfUser/{userEmail}/{page}/{size}",method = RequestMethod.GET,
37
            produces = MediaType.APPLICATION_JSON_VALUE)
38
    @ResponseBody
39
    List<Repository> getRepositoriesOfUser(String userEmail,
40
                                           String page,
41
                                           String size) throws JSONException;
42

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

    
48

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

    
54

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

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

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

    
72

    
73
    @RequestMapping(value = "/deleteInterface", method = RequestMethod.DELETE)
74
    @ResponseBody
75
    void deleteRepositoryInterface(String id);
76

    
77
    @RequestMapping(value = "/addInterface", method = RequestMethod.POST,
78
            consumes = MediaType.APPLICATION_JSON_VALUE)
79
    @ResponseBody
80
    RepositoryInterface addRepositoryInterface(String datatype,
81
                                               String repoId,
82
                                               RepositoryInterface iFace) throws JSONException;
83

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

    
89
    @RequestMapping(value = "/getTypologies", method = RequestMethod.GET,
90
            produces = MediaType.APPLICATION_JSON_VALUE)
91
    @ResponseBody
92
    List<String> getTypologies();
93

    
94
    @RequestMapping(value = "/getTimezones", method = RequestMethod.GET,
95
            produces = MediaType.APPLICATION_JSON_VALUE)
96
    @ResponseBody
97
    List<Timezone> getTimezones();
98

    
99
    @RequestMapping(value = "/updateManagedStatus", method = RequestMethod.POST,
100
            produces = MediaType.APPLICATION_JSON_VALUE)
101
    @ResponseBody
102
    String updateManagedStatus(String id, String managed);
103

    
104
    @RequestMapping(value = "/updateEnglishName", method = RequestMethod.POST,
105
            produces = MediaType.APPLICATION_JSON_VALUE)
106
    @ResponseBody
107
    String updateEnglishName(String id, String englishName);
108

    
109
    @RequestMapping(value = "/updateLatitude", method = RequestMethod.POST,
110
            produces = MediaType.APPLICATION_JSON_VALUE)
111
    @ResponseBody
112
    String updateLatitude(String id, String latitude);
113

    
114
    @RequestMapping(value = "/updateLongitude", method = RequestMethod.POST,
115
            produces = MediaType.APPLICATION_JSON_VALUE)
116
    @ResponseBody
117
    String updateLongitude(String id, String longitude);
118

    
119
    @RequestMapping(value = "/updateOfficialName", method = RequestMethod.POST,
120
            produces = MediaType.APPLICATION_JSON_VALUE)
121
    @ResponseBody
122
    String updateOfficialName(String id, String officialName);
123

    
124
    @RequestMapping(value = "/updateTimezone", method = RequestMethod.POST,
125
            produces = MediaType.APPLICATION_JSON_VALUE)
126
    @ResponseBody
127
    String updateTimezone(String id, String timezone);
128

    
129
    @RequestMapping(value = "/updateTypology", method = RequestMethod.POST,
130
            produces = MediaType.APPLICATION_JSON_VALUE)
131
    @ResponseBody
132
    String updateTypology(String id, String typology);
133

    
134
    @RequestMapping(value = "/updateLogoUrl", method = RequestMethod.POST,
135
            produces = MediaType.APPLICATION_JSON_VALUE)
136
    @ResponseBody
137
    String updateLogoUrl(String id, String logoUrl);
138

    
139
    @RequestMapping(value = "/updatePlatform", method = RequestMethod.POST,
140
            produces = MediaType.APPLICATION_JSON_VALUE)
141
    @ResponseBody
142
    String updatePlatform(String id, String platform);
143

    
144

    
145
    @RequestMapping(value = "/getUrlsOfUserRepos/{user_email}/{page}/{size}/",method = RequestMethod.GET,
146
            produces = MediaType.APPLICATION_JSON_VALUE)
147
    @ResponseBody
148
    List<String> getUrlsOfUserRepos(String user_email,
149
                                    String page,
150
                                    String size) throws JSONException;
151

    
152
    @RequestMapping(value = "/getDatasourceVocabularies/{mode}",method = RequestMethod.GET,
153
            produces = MediaType.APPLICATION_JSON_VALUE)
154
    @ResponseBody
155
    List<String> getDatasourceVocabularies(String mode);
156

    
157
    @RequestMapping(value = "/getCompatibilityClasses/{mode}",method = RequestMethod.GET,
158
            produces = MediaType.APPLICATION_JSON_VALUE)
159
    @ResponseBody
160
    Map<String, String> getCompatibilityClasses(String mode);
161

    
162
    @RequestMapping(value = "/getDatasourceClasses/{mode}",method = RequestMethod.GET,
163
            produces = MediaType.APPLICATION_JSON_VALUE)
164
    @ResponseBody
165
    Map<String, String> getDatasourceClasses(String mode);
166

    
167

    
168
    String getCountryName(String countryCode);
169
}
(7-7/10)