Revision 51837
Added by Tsampikos Livisianos almost 6 years ago
StatsController.java | ||
---|---|---|
1 | 1 |
package eu.dnetlib.statsapi.controllers; |
2 | 2 |
|
3 |
import eu.dnetlib.statsapi.entity.Result;
|
|
4 |
import eu.dnetlib.statsapi.repos.BaseRepository;
|
|
3 |
import eu.dnetlib.statsapi.domain.Result;
|
|
4 |
import eu.dnetlib.statsapi.repositories.StatsRepository;
|
|
5 | 5 |
|
6 | 6 |
import org.apache.log4j.Logger; |
7 | 7 |
import org.springframework.beans.factory.annotation.Autowired; |
... | ... | |
16 | 16 |
@CrossOrigin(methods = RequestMethod.GET, origins = "*") |
17 | 17 |
public class StatsController { |
18 | 18 |
@Autowired |
19 |
private BaseRepository repository;
|
|
19 |
private StatsRepository repository;
|
|
20 | 20 |
|
21 | 21 |
private final Logger log = Logger.getLogger(this.getClass()); |
22 | 22 |
|
23 | 23 |
@RequestMapping(value = "/numbers/{number}") |
24 |
public Result getNumber(@PathVariable(value="number") String number) {
|
|
24 |
public Result getNumber(@PathVariable(value = "number") String number) {
|
|
25 | 25 |
log.info("request for number: " + number); |
26 | 26 |
return repository.getNumber(number); |
27 | 27 |
} |
28 | 28 |
|
29 |
@RequestMapping(value = "/funders/{funder}") |
|
30 |
public Result getFunder(@PathVariable(value="funder") String funder) { |
|
31 |
log.info("request for funder: " + funder); |
|
32 |
return repository.getFunder(funder); |
|
33 |
} |
|
34 |
|
|
35 |
@RequestMapping(value = "/communities/{community}") |
|
36 |
public Result getCommunity(@PathVariable(value="community") String community) { |
|
37 |
log.info("request for community: " + community); |
|
38 |
return repository.getCommunity(community); |
|
39 |
} |
|
40 |
|
|
41 |
@RequestMapping(value = "/communities/refresh") |
|
42 |
public Result refreshCommunities() { |
|
43 |
log.info("refreshing communities"); |
|
44 |
return repository.refreshCommunities(); |
|
45 |
} |
|
46 |
|
|
47 | 29 |
} |
Also available in: Unified diff
refactor everything