1. Bug fixes on parameters for BrokerApi

This commit is contained in:
Panagiotis Kanakakis 2018-02-15 07:45:37 +00:00
parent f62403a248
commit 04ce834f59
3 changed files with 18 additions and 27 deletions

View File

@ -152,12 +152,6 @@
<version>2.7.2</version> <version>2.7.2</version>
</dependency> </dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.5.6</version>
</dependency>
<dependency> <dependency>
<groupId>xerces</groupId> <groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId> <artifactId>xercesImpl</artifactId>

View File

@ -25,23 +25,23 @@ public interface BrokerApi {
List<BrowseEntry> getTopicsForDatasource(String datasourceName) throws BrokerException; List<BrowseEntry> getTopicsForDatasource(String datasourceName) throws BrokerException;
@RequestMapping(value = "/advancedShowEvents/{page}/{size}" , method = RequestMethod.POST,produces = MediaType.APPLICATION_JSON_VALUE) @RequestMapping(value = "/advancedShowEvents/{page}/{size}" , method = RequestMethod.POST,produces = MediaType.APPLICATION_JSON_VALUE)
EventsPage advancedShowEvents(@PathVariable("page") String page, EventsPage advancedShowEvents(String page,
@PathVariable("size") String size, String size,
@RequestBody AdvQueryObject advQueryObject) throws BrokerException, JSONException ,IOException; AdvQueryObject advQueryObject) throws BrokerException, JSONException ,IOException;
@RequestMapping(value = "/showEvents/{datasourceName}/{topic}/{page}" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE) @RequestMapping(value = "/showEvents/{datasourceName}/{topic}/{page}" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
EventsPage showEvents(@PathVariable("datasourceName") String datasourceName, EventsPage showEvents(String datasourceName,
@PathVariable("topic") String topic, String topic,
@PathVariable("page") String page) throws BrokerException, JSONException; String page) throws BrokerException, JSONException;
@RequestMapping(value = "/getSimpleSubscriptionsOfUser/{userEmail}" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE) @RequestMapping(value = "/getSimpleSubscriptionsOfUser/{userEmail}" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody @ResponseBody
Map<String, List<SimpleSubscriptionDesc>> getSimpleSubscriptionsOfUser(@PathVariable("userEmail") String userEmail) throws BrokerException; Map<String, List<SimpleSubscriptionDesc>> getSimpleSubscriptionsOfUser(String userEmail) throws BrokerException;
@RequestMapping(value = "/subscribe" , method = RequestMethod.POST,consumes = MediaType.APPLICATION_JSON_VALUE, @RequestMapping(value = "/subscribe" , method = RequestMethod.POST,consumes = MediaType.APPLICATION_JSON_VALUE,
produces = MediaType.APPLICATION_JSON_VALUE) produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody @ResponseBody
Subscription subscribe(@RequestBody OpenaireSubscription obj) throws BrokerException; Subscription subscribe(OpenaireSubscription obj) throws BrokerException;
@RequestMapping(value = "/unsubscribe/{subscriptionId}" , method = RequestMethod.POST,consumes = MediaType.APPLICATION_JSON_VALUE, @RequestMapping(value = "/unsubscribe/{subscriptionId}" , method = RequestMethod.POST,consumes = MediaType.APPLICATION_JSON_VALUE,
produces = MediaType.APPLICATION_JSON_VALUE) produces = MediaType.APPLICATION_JSON_VALUE)
@ -50,7 +50,7 @@ public interface BrokerApi {
@RequestMapping(value = "/getSubscription/{subscriptionId}" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE) @RequestMapping(value = "/getSubscription/{subscriptionId}" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody @ResponseBody
Subscription getSubscription(@PathVariable("subscriptionId") String subscriptionId) throws BrokerException; Subscription getSubscription(String subscriptionId) throws BrokerException;
@RequestMapping(value = "/getDnetTopics" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE) @RequestMapping(value = "/getDnetTopics" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)

View File

@ -22,6 +22,7 @@ import org.springframework.stereotype.Component;
import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap; import org.springframework.util.MultiValueMap;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.client.RestClientException; import org.springframework.web.client.RestClientException;
import org.springframework.web.client.RestTemplate; import org.springframework.web.client.RestTemplate;
@ -132,15 +133,9 @@ public class BrokerApiImpl implements BrokerApi {
} }
@Override @Override
public EventsPage advancedShowEvents(String page,String size,AdvQueryObject advQueryObject) throws BrokerException, JSONException ,IOException { public EventsPage advancedShowEvents(@PathVariable("page") String page,
/*JSONObject json_params = new JSONObject(params); @PathVariable("size") String size,
@RequestBody AdvQueryObject advQueryObject) throws BrokerException, JSONException ,IOException {
String page = json_params.getString("page");
String pagesize = json_params.getString("pagesize");
String json_advQueryObject = json_params.getString("advQueryObject");
ObjectMapper mapper = new ObjectMapper();
AdvQueryObject advQueryObject = mapper.readValue(json_advQueryObject, AdvQueryObject.class);*/
final String service = "/events/{page}/{pageSize}"; final String service = "/events/{page}/{pageSize}";
@ -219,7 +214,9 @@ public class BrokerApiImpl implements BrokerApi {
} }
@Override @Override
public EventsPage showEvents(String datasourceName,String topic,String page) throws BrokerException, JSONException { public EventsPage showEvents(@PathVariable("datasourceName") String datasourceName,
@PathVariable("topic") String topic,
@PathVariable("page") String page) throws BrokerException, JSONException {
/*JSONObject json_params = new JSONObject(params); /*JSONObject json_params = new JSONObject(params);
@ -251,7 +248,7 @@ public class BrokerApiImpl implements BrokerApi {
} }
@Override @Override
public Map<String, List<SimpleSubscriptionDesc>> getSimpleSubscriptionsOfUser( String userEmail) public Map<String, List<SimpleSubscriptionDesc>> getSimpleSubscriptionsOfUser(@PathVariable("userEmail") String userEmail)
throws BrokerException { throws BrokerException {
final String service = "/subscriptions"; final String service = "/subscriptions";
@ -276,7 +273,7 @@ public class BrokerApiImpl implements BrokerApi {
} }
@Override @Override
public Subscription subscribe(OpenaireSubscription obj) throws BrokerException { public Subscription subscribe(@RequestBody OpenaireSubscription obj) throws BrokerException {
final String service = "/subscribe"; final String service = "/subscribe";
//build the uri params //build the uri params