Project

General

Profile

« Previous | Next » 

Revision 50409

Add getSubscriptionsOfUser method. Rename old one to getSimpleSubscriptionsOfUser

View differences:

modules/uoa-repository-manager-service/trunk/src/main/java/eu/dnetlib/repo/manager/service/controllers/BrokerApiImpl.java
254 254
    }
255 255

  
256 256
    @Override
257
    public Map<String, List<SimpleSubscriptionDesc>> getSubscriptionsOfUser(@PathVariable("userEmail") String userEmail) throws BrokerException {
257
    public Map<String, List<SimpleSubscriptionDesc>> getSimpleSubscriptionsOfUser(@PathVariable("userEmail") String userEmail) throws BrokerException {
258 258

  
259 259
        final String service = "/subscriptions";
260 260

  
......
379 379
        return resp.getBody();
380 380
    }
381 381

  
382
    @Override
383
    public Map<String, List<Subscription>> getSubscriptionsOfUser(@PathVariable("userEmail") String userEmail)
384
            throws BrokerException {
382 385

  
386
        Map<String, List<SimpleSubscriptionDesc>> simpleSubs = getSimpleSubscriptionsOfUser(userEmail);
387
        Map<String,List<Subscription>> subs = new HashMap<>();
388
        List<Subscription> subscriptions = null;
389

  
390
        for(String s:simpleSubs.keySet()){
391
            List<SimpleSubscriptionDesc> simpleSubscriptionDescs = simpleSubs.get(s);
392
            for(SimpleSubscriptionDesc simpleSubscriptionDesc : simpleSubscriptionDescs) {
393
                subscriptions = new ArrayList<>();
394
                subscriptions.add(getSubscription(simpleSubscriptionDesc.getId()));
395
            }
396
            subs.put(s,subscriptions);
397
        }
398
        return subs;
399
    }
400

  
401

  
383 402
}
modules/uoa-repository-manager-service/trunk/src/main/java/eu/dnetlib/repo/manager/service/controllers/BrokerApi.java
29 29
    @RequestMapping(value = "/showEvents" , method = RequestMethod.POST,produces = MediaType.APPLICATION_JSON_VALUE)
30 30
    EventsPage showEvents(@RequestBody String params) throws BrokerException, JSONException;
31 31

  
32
    @RequestMapping(value = "/getSubscriptionsOfUser/{userEmail}" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
32
    @RequestMapping(value = "/getSimpleSubscriptionsOfUser/{userEmail}" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
33 33
    @ResponseBody
34
    Map<String, List<SimpleSubscriptionDesc>> getSubscriptionsOfUser(String userEmail) throws BrokerException;
34
    Map<String, List<SimpleSubscriptionDesc>> getSimpleSubscriptionsOfUser(String userEmail) throws BrokerException;
35 35

  
36 36
    @RequestMapping(value = "/subscribe" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
37 37
    @ResponseBody
......
54 54
            ,produces = MediaType.APPLICATION_JSON_VALUE)
55 55
    @ResponseBody
56 56
    EventsPage getNotificationsBySubscriptionId(String subscriptionId,String page,String size) throws BrokerException;
57

  
58
    @RequestMapping(value = "/getSubscriptionsOfUser/{userEmail}" , method = RequestMethod.GET
59
            ,produces = MediaType.APPLICATION_JSON_VALUE)
60
    @ResponseBody
61
    Map<String, List<Subscription>> getSubscriptionsOfUser(String userEmail) throws BrokerException;
57 62
}

Also available in: Unified diff