Revision 50686
Added by Panagiotis Kanakakis about 6 years ago
modules/uoa-repository-manager-service/trunk/src/main/java/eu/dnetlib/repo/manager/service/controllers/ValidatorApi.java | ||
---|---|---|
45 | 45 |
|
46 | 46 |
@RequestMapping(value = "/getStoredJobsNew" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE) |
47 | 47 |
@ResponseBody |
48 |
List<StoredJob> getStoredJobsNew(String user, String jobType, Integer offset, Integer limit, String dateFrom, |
|
49 |
String dateTo, String validationStatus) throws ValidatorServiceException; |
|
48 |
List<StoredJob> getStoredJobsNew(String user, |
|
49 |
String jobType, |
|
50 |
String offset, |
|
51 |
String limit, |
|
52 |
String dateFrom, |
|
53 |
String dateTo, |
|
54 |
String validationStatus) throws ValidatorServiceException; |
|
50 | 55 |
|
51 | 56 |
|
52 | 57 |
@RequestMapping(value = "/getStoredJobsTotalNumberNew" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE) |
modules/uoa-repository-manager-service/trunk/src/main/java/eu/dnetlib/repo/manager/service/controllers/BrokerApiImpl.java | ||
---|---|---|
7 | 7 |
import eu.dnetlib.repo.manager.shared.Term; |
8 | 8 |
import eu.dnetlib.repo.manager.shared.Tuple; |
9 | 9 |
import eu.dnetlib.repo.manager.shared.broker.*; |
10 |
import io.swagger.annotations.ApiParam; |
|
10 | 11 |
import org.json.JSONException; |
11 | 12 |
import org.json.JSONObject; |
12 | 13 |
import org.springframework.beans.factory.annotation.Autowired; |
... | ... | |
21 | 22 |
import org.springframework.util.LinkedMultiValueMap; |
22 | 23 |
import org.springframework.util.MultiValueMap; |
23 | 24 |
import org.springframework.web.bind.annotation.PathVariable; |
25 |
import org.springframework.web.bind.annotation.RequestParam; |
|
24 | 26 |
import org.springframework.web.client.RestClientException; |
25 | 27 |
import org.springframework.web.client.RestTemplate; |
26 | 28 |
import org.springframework.web.util.UriComponents; |
... | ... | |
83 | 85 |
|
84 | 86 |
|
85 | 87 |
@Override |
86 |
public DatasourcesBroker getDatasourcesOfUser(String params) throws JSONException { |
|
87 |
JSONObject json_params = new JSONObject(params); |
|
88 |
public DatasourcesBroker getDatasourcesOfUser(@RequestParam("user") @ApiParam(value = "User email", required = true) String user, |
|
89 |
@RequestParam("includeShared") |
|
90 |
@ApiParam(value = "Include shared datasources", required = true) String includeShared, |
|
91 |
@RequestParam("includeByOthers") @ApiParam(value = "Include datasources of other", required = true) String includeByOthers) throws JSONException { |
|
92 |
|
|
88 | 93 |
DatasourcesBroker ret = new DatasourcesBroker(); |
89 |
|
|
90 |
String userEmail = json_params.getString("userEmail"); |
|
91 |
boolean includeShared = Boolean.parseBoolean( json_params.getString("includeShared") ); |
|
92 |
boolean includeByOthers = Boolean.parseBoolean( json_params.getString("includeByOthers") ); |
|
93 |
|
|
94 | 94 |
try { |
95 |
ret.setDatasourcesOfUser(getDatasourcesOfUserType(getRepositoriesOfUser(userEmail)));
|
|
96 |
if (includeShared) {
|
|
95 |
ret.setDatasourcesOfUser(getDatasourcesOfUserType(getRepositoriesOfUser(user))); |
|
96 |
if (Boolean.parseBoolean(includeShared)) {
|
|
97 | 97 |
//TODO whatever nikonas was saying |
98 | 98 |
List<String> sharedDatasourceIds = new ArrayList<String>(); |
99 | 99 |
ret.setSharedDatasources(getDatasourcesOfUserType(getRepositoriesByIds(sharedDatasourceIds))); |
100 | 100 |
} |
101 | 101 |
|
102 |
if (includeByOthers) {
|
|
103 |
ret.setDatasourcesOfOthers(getDatasourcesOfUserType(getRepositoriesOfUser(userEmail)));
|
|
102 |
if (Boolean.parseBoolean(includeByOthers)) {
|
|
103 |
ret.setDatasourcesOfOthers(getDatasourcesOfUserType(getRepositoriesOfUser(user))); |
|
104 | 104 |
} |
105 | 105 |
} catch (BrokerException e) { |
106 | 106 |
e.printStackTrace(); |
... | ... | |
251 | 251 |
} |
252 | 252 |
|
253 | 253 |
@Override |
254 |
public Map<String, List<SimpleSubscriptionDesc>> getSimpleSubscriptionsOfUser(@PathVariable("userEmail") String userEmail) throws BrokerException { |
|
254 |
public Map<String, List<SimpleSubscriptionDesc>> getSimpleSubscriptionsOfUser( String userEmail) |
|
255 |
throws BrokerException { |
|
255 | 256 |
|
256 | 257 |
final String service = "/subscriptions"; |
257 | 258 |
|
258 |
//build the uri params |
|
259 | 259 |
UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(openairePath + service) |
260 | 260 |
.queryParam("email", userEmail); |
261 | 261 |
|
262 |
//create new template engine
|
|
262 |
LOGGER.debug(builder.build().encode().toUri());
|
|
263 | 263 |
ResponseEntity<Map<String, List<SimpleSubscriptionDesc>>> resp; |
264 | 264 |
try { |
265 |
//communicate with endpoint |
|
266 | 265 |
resp = restTemplate.exchange( |
267 | 266 |
builder.build().encode().toUri(), |
268 | 267 |
HttpMethod.GET, |
modules/uoa-repository-manager-service/trunk/src/main/java/eu/dnetlib/repo/manager/service/controllers/ValidatorApiImpl.java | ||
---|---|---|
168 | 168 |
|
169 | 169 |
@Override |
170 | 170 |
public List<StoredJob> getStoredJobsNew(@RequestParam("user") @ApiParam(value = "User email", required = true) String user, |
171 |
@RequestParam("jobType") @ApiParam(value = "Equals to filter job type on validation history page", required = true) String jobType, |
|
172 |
@RequestParam("offset") @ApiParam(value = "Page number", required = true) Integer offset, |
|
173 |
@RequestParam(value = "limit", required = false, defaultValue = "10") @ApiParam(value = "Null value") Integer limit, |
|
174 |
@RequestParam(value = "dateFrom", required = false, defaultValue = "2018-02-08") @ApiParam(value = "Null value") String dateFrom, |
|
175 |
@RequestParam(value = "dateTo", required = false, defaultValue = "2018-02-08") @ApiParam(value = "Null value") String dateTo, |
|
176 |
@RequestParam("validationStatus") @ApiParam(value = "Equals to filter validation jobs", required = true) String validationStatus) throws ValidatorServiceException { |
|
177 |
return getValidationService().getStoredJobsNew(user, jobType, offset, limit, dateFrom, dateTo, validationStatus); |
|
171 |
@RequestParam(value = "jobType", required = false) |
|
172 |
@ApiParam(value = "Equals to filter job type on validation history page") String jobType, |
|
173 |
@RequestParam("offset") @ApiParam(value = "Page number", required = true) String offset, |
|
174 |
@RequestParam(value = "limit", required = false,defaultValue = "10") @ApiParam(value = "Null value") String limit, |
|
175 |
@RequestParam(value = "dateFrom", required = false) @ApiParam(value = "Null value") String dateFrom, |
|
176 |
@RequestParam(value = "dateTo", required = false) @ApiParam(value = "Null value") String dateTo, |
|
177 |
@RequestParam("validationStatus") @ApiParam(value = "Equals to filter validation jobs", required = true) String validationStatus |
|
178 |
) throws ValidatorServiceException { |
|
179 |
return getValidationService().getStoredJobsNew(user, jobType, Integer.parseInt(offset), Integer.parseInt(limit), dateFrom, dateTo, validationStatus); |
|
178 | 180 |
} |
179 | 181 |
|
180 | 182 |
@Override |
modules/uoa-repository-manager-service/trunk/src/main/java/eu/dnetlib/repo/manager/service/controllers/MonitorApiImpl.java | ||
---|---|---|
38 | 38 |
|
39 | 39 |
@Override |
40 | 40 |
public JobsOfUser getJobsOfUser(@RequestParam("user") @ApiParam(value = "User email", required = true) String user, |
41 |
@RequestParam(value = "jobType", required = false) @ApiParam(value = "Equals to filter job type on validation history page") String jobType, |
|
41 |
@RequestParam(value = "jobType", required = false) |
|
42 |
@ApiParam(value = "Equals to filter job type on validation history page") String jobType, |
|
42 | 43 |
@RequestParam("offset") @ApiParam(value = "Page number", required = true) String offset, |
43 |
@RequestParam(value = "limit", required = false, defaultValue = "10") @ApiParam(value = "Null value") String limit,
|
|
44 |
@RequestParam(value = "limit", required = false,defaultValue = "10") @ApiParam(value = "Null value") String limit, |
|
44 | 45 |
@RequestParam(value = "dateFrom", required = false) @ApiParam(value = "Null value") String dateFrom, |
45 | 46 |
@RequestParam(value = "dateTo", required = false) @ApiParam(value = "Null value") String dateTo, |
46 | 47 |
@RequestParam("validationStatus") @ApiParam(value = "Equals to filter validation jobs", required = true) String validationStatus, |
modules/uoa-repository-manager-service/trunk/src/main/java/eu/dnetlib/repo/manager/service/controllers/BrokerApi.java | ||
---|---|---|
19 | 19 |
public interface BrokerApi { |
20 | 20 |
|
21 | 21 |
@RequestMapping(value = "/getDatasourcesOfUser" , method = RequestMethod.POST,produces = MediaType.APPLICATION_JSON_VALUE) |
22 |
DatasourcesBroker getDatasourcesOfUser(@RequestBody String params) throws BrokerException, JSONException;
|
|
22 |
DatasourcesBroker getDatasourcesOfUser(String user,String includeShared,String includeByOthers) throws BrokerException, JSONException;
|
|
23 | 23 |
|
24 | 24 |
@RequestMapping(value = "/getTopicsForDatasource/{datasourceName}" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE) |
25 | 25 |
List<BrowseEntry> getTopicsForDatasource(String datasourceName) throws BrokerException; |
... | ... | |
36 | 36 |
|
37 | 37 |
@RequestMapping(value = "/getSimpleSubscriptionsOfUser/{userEmail}" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE) |
38 | 38 |
@ResponseBody |
39 |
Map<String, List<SimpleSubscriptionDesc>> getSimpleSubscriptionsOfUser(String userEmail) throws BrokerException; |
|
39 |
Map<String, List<SimpleSubscriptionDesc>> getSimpleSubscriptionsOfUser(@PathVariable("userEmail") String userEmail) throws BrokerException;
|
|
40 | 40 |
|
41 |
@RequestMapping(value = "/subscribe" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE) |
|
41 |
@RequestMapping(value = "/subscribe" , method = RequestMethod.POST,consumes = MediaType.APPLICATION_JSON_VALUE, |
|
42 |
produces = MediaType.APPLICATION_JSON_VALUE) |
|
42 | 43 |
@ResponseBody |
43 | 44 |
Subscription subscribe(@RequestBody OpenaireSubscription obj) throws BrokerException; |
44 | 45 |
|
45 |
@RequestMapping(value = "/unsubscribe/{subscriptionId}" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE) |
|
46 |
@RequestMapping(value = "/unsubscribe/{subscriptionId}" , method = RequestMethod.POST,consumes = MediaType.APPLICATION_JSON_VALUE, |
|
47 |
produces = MediaType.APPLICATION_JSON_VALUE) |
|
46 | 48 |
@ResponseBody |
47 | 49 |
void unsubscribe(String subscriptionId) throws BrokerException; |
48 | 50 |
|
Also available in: Unified diff
1. Add swagger explanation for broker/validator paramaters
2. Change subscribe/unsubcribe methods of broker from GET to POST