From 04ce834f598bf9ef77a90440adf131eba5cb5622 Mon Sep 17 00:00:00 2001 From: "panagiotis.kanakakis" Date: Thu, 15 Feb 2018 07:45:37 +0000 Subject: [PATCH] 1. Bug fixes on parameters for BrokerApi --- pom.xml | 6 ------ .../service/controllers/BrokerApi.java | 18 ++++++++-------- .../service/controllers/BrokerApiImpl.java | 21 ++++++++----------- 3 files changed, 18 insertions(+), 27 deletions(-) diff --git a/pom.xml b/pom.xml index e25e778..aca3231 100644 --- a/pom.xml +++ b/pom.xml @@ -152,12 +152,6 @@ 2.7.2 - - org.slf4j - slf4j-log4j12 - 1.5.6 - - xerces xercesImpl diff --git a/src/main/java/eu/dnetlib/repo/manager/service/controllers/BrokerApi.java b/src/main/java/eu/dnetlib/repo/manager/service/controllers/BrokerApi.java index 402508a..1975701 100644 --- a/src/main/java/eu/dnetlib/repo/manager/service/controllers/BrokerApi.java +++ b/src/main/java/eu/dnetlib/repo/manager/service/controllers/BrokerApi.java @@ -25,23 +25,23 @@ public interface BrokerApi { List getTopicsForDatasource(String datasourceName) throws BrokerException; @RequestMapping(value = "/advancedShowEvents/{page}/{size}" , method = RequestMethod.POST,produces = MediaType.APPLICATION_JSON_VALUE) - EventsPage advancedShowEvents(@PathVariable("page") String page, - @PathVariable("size") String size, - @RequestBody AdvQueryObject advQueryObject) throws BrokerException, JSONException ,IOException; + EventsPage advancedShowEvents(String page, + String size, + AdvQueryObject advQueryObject) throws BrokerException, JSONException ,IOException; @RequestMapping(value = "/showEvents/{datasourceName}/{topic}/{page}" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE) - EventsPage showEvents(@PathVariable("datasourceName") String datasourceName, - @PathVariable("topic") String topic, - @PathVariable("page") String page) throws BrokerException, JSONException; + EventsPage showEvents(String datasourceName, + String topic, + String page) throws BrokerException, JSONException; @RequestMapping(value = "/getSimpleSubscriptionsOfUser/{userEmail}" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE) @ResponseBody - Map> getSimpleSubscriptionsOfUser(@PathVariable("userEmail") String userEmail) throws BrokerException; + Map> getSimpleSubscriptionsOfUser(String userEmail) throws BrokerException; @RequestMapping(value = "/subscribe" , method = RequestMethod.POST,consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE) @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, produces = MediaType.APPLICATION_JSON_VALUE) @@ -50,7 +50,7 @@ public interface BrokerApi { @RequestMapping(value = "/getSubscription/{subscriptionId}" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE) @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) diff --git a/src/main/java/eu/dnetlib/repo/manager/service/controllers/BrokerApiImpl.java b/src/main/java/eu/dnetlib/repo/manager/service/controllers/BrokerApiImpl.java index 7401871..0250542 100644 --- a/src/main/java/eu/dnetlib/repo/manager/service/controllers/BrokerApiImpl.java +++ b/src/main/java/eu/dnetlib/repo/manager/service/controllers/BrokerApiImpl.java @@ -22,6 +22,7 @@ import org.springframework.stereotype.Component; import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.MultiValueMap; 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.client.RestClientException; import org.springframework.web.client.RestTemplate; @@ -132,15 +133,9 @@ public class BrokerApiImpl implements BrokerApi { } @Override - public EventsPage advancedShowEvents(String page,String size,AdvQueryObject advQueryObject) throws BrokerException, JSONException ,IOException { - /*JSONObject json_params = new JSONObject(params); - - 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);*/ + public EventsPage advancedShowEvents(@PathVariable("page") String page, + @PathVariable("size") String size, + @RequestBody AdvQueryObject advQueryObject) throws BrokerException, JSONException ,IOException { final String service = "/events/{page}/{pageSize}"; @@ -219,7 +214,9 @@ public class BrokerApiImpl implements BrokerApi { } @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); @@ -251,7 +248,7 @@ public class BrokerApiImpl implements BrokerApi { } @Override - public Map> getSimpleSubscriptionsOfUser( String userEmail) + public Map> getSimpleSubscriptionsOfUser(@PathVariable("userEmail") String userEmail) throws BrokerException { final String service = "/subscriptions"; @@ -276,7 +273,7 @@ public class BrokerApiImpl implements BrokerApi { } @Override - public Subscription subscribe(OpenaireSubscription obj) throws BrokerException { + public Subscription subscribe(@RequestBody OpenaireSubscription obj) throws BrokerException { final String service = "/subscribe"; //build the uri params