Revision 50860
Added by Panagiotis Kanakakis about 6 years ago
BrokerApiImpl.java | ||
---|---|---|
86 | 86 |
|
87 | 87 |
|
88 | 88 |
@Override |
89 |
public DatasourcesBroker getDatasourcesOfUser(@RequestParam("user") @ApiParam(value = "User email", required = true) String user, |
|
89 |
public DatasourcesBroker getDatasourcesOfUser(@RequestParam("user") |
|
90 |
@ApiParam(value = "User email", required = true) String user, |
|
90 | 91 |
@RequestParam("includeShared") |
91 |
@ApiParam(value = "Include shared datasources", required = true) String includeShared, |
|
92 |
@RequestParam("includeByOthers") @ApiParam(value = "Include datasources of other", required = true) String includeByOthers) throws JSONException { |
|
92 |
@ApiParam(value = "Include shared datasources", required = true , defaultValue = "false") String includeShared, |
|
93 |
@RequestParam("includeByOthers") |
|
94 |
@ApiParam(value = "Include datasources of other", required = true,defaultValue = "false") String includeByOthers) throws JSONException { |
|
93 | 95 |
|
94 | 96 |
DatasourcesBroker ret = new DatasourcesBroker(); |
95 | 97 |
try { |
96 | 98 |
ret.setDatasourcesOfUser(getDatasourcesOfUserType(getRepositoriesOfUser(user))); |
99 |
//TODO fix bug when values are true |
|
97 | 100 |
if (Boolean.parseBoolean(includeShared)) { |
98 |
//TODO whatever nikonas was saying |
|
99 | 101 |
List<String> sharedDatasourceIds = new ArrayList<String>(); |
100 | 102 |
ret.setSharedDatasources(getDatasourcesOfUserType(getRepositoriesByIds(sharedDatasourceIds))); |
101 | 103 |
} |
... | ... | |
214 | 216 |
} |
215 | 217 |
|
216 | 218 |
@Override |
217 |
public EventsPage showEvents(@PathVariable("datasourceName") String datasourceName, |
|
218 |
@PathVariable("topic") String topic, |
|
219 |
@PathVariable("page") String page) throws BrokerException, JSONException { |
|
219 |
public EventsPage showEvents(@RequestParam("datasourceName") String datasourceName, |
|
220 |
@RequestParam("topic") String topic, |
|
221 |
@RequestParam("page") String page, |
|
222 |
@RequestParam("size") String size) throws BrokerException, JSONException { |
|
220 | 223 |
|
221 |
/*JSONObject json_params = new JSONObject(params);
|
|
224 |
final String service = "/events";
|
|
222 | 225 |
|
223 |
String datasourceName = json_params.getString("datasourceName"); |
|
224 |
String topic = json_params.getString("topic"); |
|
225 |
String page = json_params.getString("page");*/ |
|
226 |
|
|
227 |
final String service = "/showEvents"; |
|
228 |
|
|
229 |
//build the uri params |
|
230 | 226 |
UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(openairePath + service) |
231 | 227 |
.queryParam("ds", datasourceName) |
232 | 228 |
.queryParam("topic", topic) |
233 |
.queryParam("page", page);
|
|
229 |
.path("/{page}/{size}/");
|
|
234 | 230 |
|
235 | 231 |
ResponseEntity<EventsPage> resp; |
236 | 232 |
try { |
237 |
//communicate with endpoint |
|
238 | 233 |
resp = restTemplate.exchange( |
239 |
builder.build().encode().toUri(), |
|
234 |
builder.build().expand(page, size).encode().toUri(),
|
|
240 | 235 |
HttpMethod.GET, |
241 | 236 |
null, |
242 | 237 |
new ParameterizedTypeReference<EventsPage>() { |
Also available in: Unified diff
1. Broker api bug fixes on urls
2. Piwik changes on methods.
3. Validator url changes