1
|
package eu.dnetlib.statsapi.controllers;
|
2
|
|
3
|
import eu.dnetlib.statsapi.domain.Result;
|
4
|
import eu.dnetlib.statsapi.repositories.CommunityRepository;
|
5
|
|
6
|
import org.apache.log4j.Logger;
|
7
|
import org.springframework.beans.factory.annotation.Autowired;
|
8
|
import org.springframework.web.bind.annotation.PathVariable;
|
9
|
import org.springframework.web.bind.annotation.RequestMapping;
|
10
|
import org.springframework.web.bind.annotation.RestController;
|
11
|
|
12
|
@RestController
|
13
|
public class CommunityController {
|
14
|
@Autowired
|
15
|
private CommunityRepository communityRepository;
|
16
|
|
17
|
private final Logger log = Logger.getLogger(this.getClass());
|
18
|
|
19
|
@RequestMapping(value = "/communities/{community}")
|
20
|
public Result getCommunity(@PathVariable(value = "community") String community) {
|
21
|
log.info("request for community: " + community);
|
22
|
return communityRepository.getCommunity(community);
|
23
|
}
|
24
|
|
25
|
@RequestMapping(value = "/communities/refresh")
|
26
|
public Result refreshCommunities() {
|
27
|
log.info("refreshing communities");
|
28
|
return communityRepository.refreshCommunities();
|
29
|
}
|
30
|
}
|