Project

General

Profile

« Previous | Next » 

Revision 55384

[Trunk]

update the method to get the community pids that a user is subscribed to

View differences:

modules/uoa-admin-tools/src/main/java/eu/dnetlib/uoaadmintools/controllers/CommunitySubscribersController.java
81 81
        return communitySubscriberDAO.save(communitySubscribers);
82 82
    }
83 83

  
84
    @RequestMapping(value = "/subscriber/{email}/communities", method = RequestMethod.GET)
85
    public List<Community> getCommunitiesPerSubcriber(@PathVariable(value="email", required = true) String email) {
84
    @RequestMapping(value = "/subscriber/communities", method = RequestMethod.GET)
85
    public List<String> getCommunitiesPerSubcriber(@RequestParam(value="email", required = true) String email) {
86 86
        List<CommunitySubscribers> communitySubscribers = communitySubscriberDAO.findAll();
87

  
88
        List<Community> list = new ArrayList<>();
89

  
87
        List<String> list = new ArrayList<>();
90 88
        for(CommunitySubscribers s:communitySubscribers){
91
            if(s.getSubscribers().indexOf(email)!=-1){
92
                list.add(communityDAO.findByPid(s.getPid()));
89
            for(Subscriber sub:s.getSubscribers()) {
90
                if (sub.getEmail().equals(email)) {
91
                    list.add(s.getPid());
92
                    break;
93
                }
93 94
            }
94 95
        }
95

  
96 96
        return list;
97 97
    }
98 98
}

Also available in: Unified diff