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.domain.RepositorySnippet;
6
import eu.dnetlib.repo.manager.service.exception.ResourceNotFoundException;
7
import eu.dnetlib.repo.manager.shared.*;
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.io.IOException;
14
import java.util.List;
15
import java.util.Map;
16

    
17

    
18
@RestController
19
@RequestMapping(value = "/repository")
20
@Api(description = "Repository API",  tags = {"repository"})
21
public interface RepositoryApi {
22

    
23
    @RequestMapping(value = "/getCountries", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
24
    @ResponseBody
25
    Country[] getCountries() ;
26

    
27
    @RequestMapping(value = "/getRepositoriesByCountry/{country}/{mode}", method = RequestMethod.GET,
28
            produces = MediaType.APPLICATION_JSON_VALUE)
29
    @ResponseBody
30
    List<RepositorySnippet> getRepositoriesByCountry(String country, String mode, Boolean managed) throws JSONException, IOException;
31

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

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

    
44

    
45
    @RequestMapping(value = "/getRepositoryAggregations/{id}", method = RequestMethod.GET,
46
            produces = MediaType.APPLICATION_JSON_VALUE)
47
    @ResponseBody
48
    List<AggregationDetails> getRepositoryAggregations(String id) throws JSONException;
49

    
50
    @RequestMapping(value = "/getRepositoryAggregationsByYear/{id}", method = RequestMethod.GET,
51
            produces = MediaType.APPLICATION_JSON_VALUE)
52
    @ResponseBody
53
    Map<String,List<AggregationDetails>> getRepositoryAggregationsByYear(String id) throws JSONException;
54

    
55

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

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

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

    
73

    
74
    @RequestMapping(value = "/deleteInterface/", method = RequestMethod.DELETE)
75
    void deleteRepositoryInterface(String id,String registeredBy);
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
                                               String registeredBy,
83
                                               RepositoryInterface iFace) throws JSONException,ResourceNotFoundException;
84

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

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

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

    
100
    @RequestMapping(value = "/updateRepository", method = RequestMethod.POST,
101
            consumes = MediaType.APPLICATION_JSON_VALUE)
102
    @ResponseBody
103
    Repository updateRepository(Repository repository) throws JSONException;
104
    
105
    @RequestMapping(value = "/getUrlsOfUserRepos/{user_email}/{page}/{size}/",method = RequestMethod.GET,
106
            produces = MediaType.APPLICATION_JSON_VALUE)
107
    @ResponseBody
108
    List<String> getUrlsOfUserRepos(String user_email,
109
                                    String page,
110
                                    String size) throws JSONException;
111

    
112
    @RequestMapping(value = "/getDatasourceVocabularies/{mode}",method = RequestMethod.GET,
113
            produces = MediaType.APPLICATION_JSON_VALUE)
114
    @ResponseBody
115
    List<String> getDatasourceVocabularies(String mode);
116

    
117
    @RequestMapping(value = "/getCompatibilityClasses/{mode}",method = RequestMethod.GET,
118
            produces = MediaType.APPLICATION_JSON_VALUE)
119
    @ResponseBody
120
    Map<String, String> getCompatibilityClasses(String mode);
121

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

    
127

    
128
    String getCountryName(String countryCode);
129

    
130
    @RequestMapping(value = "/getMetricsInfoForRepository/{repoId}",method = RequestMethod.GET,
131
            produces = MediaType.APPLICATION_JSON_VALUE)
132
    @ResponseBody
133
    MetricsInfo getMetricsInfoForRepository(String repoId) throws RepositoryServiceException;
134

    
135
    @RequestMapping(value = "/getListLatestUpdate/{mode}",method = RequestMethod.GET,
136
            produces = MediaType.APPLICATION_JSON_VALUE)
137
    @ResponseBody
138
    Map<String, String> getListLatestUpdate(String mode) throws RepositoryServiceException, JSONException;
139

    
140
    @RequestMapping(value = "/updateRepositoryInterface", method = RequestMethod.POST,
141
            consumes = MediaType.APPLICATION_JSON_VALUE)
142
    @ResponseBody
143
    RepositoryInterface updateRepositoryInterface(String repositoryId,String registeredBy,RepositoryInterface repositoryInterface) throws JSONException;
144

    
145

    
146

    
147
}
(10-10/19)