1
|
package eu.dnetlib.statsapi.controllers;
|
2
|
|
3
|
import eu.dnetlib.statsapi.entity.Funder;
|
4
|
import eu.dnetlib.statsapi.entity.Result;
|
5
|
import eu.dnetlib.statsapi.repos.BaseRepository;
|
6
|
|
7
|
import org.apache.log4j.Logger;
|
8
|
import org.springframework.beans.factory.annotation.Autowired;
|
9
|
import org.springframework.web.bind.annotation.CrossOrigin;
|
10
|
import org.springframework.web.bind.annotation.PathVariable;
|
11
|
import org.springframework.web.bind.annotation.RequestMapping;
|
12
|
import org.springframework.web.bind.annotation.RequestMethod;
|
13
|
import org.springframework.web.bind.annotation.RestController;
|
14
|
|
15
|
|
16
|
@RestController
|
17
|
@CrossOrigin(methods = RequestMethod.GET, origins = "*")
|
18
|
public class StatsController {
|
19
|
@Autowired
|
20
|
private BaseRepository repository;
|
21
|
|
22
|
private final Logger log = Logger.getLogger(this.getClass());
|
23
|
|
24
|
@RequestMapping(value = "/numbers/{number}")
|
25
|
public Result getNumber(@PathVariable(value="number") String number) {
|
26
|
log.info("request for number: " + number);
|
27
|
return repository.getNumber(number);
|
28
|
}
|
29
|
|
30
|
@RequestMapping(value = "/funders/{funder}")
|
31
|
public Result getFunder(@PathVariable(value="funder") String funder) {
|
32
|
log.info("request for funder: " + funder);
|
33
|
return repository.getFunder(funder);
|
34
|
}
|
35
|
|
36
|
@RequestMapping(value = "/communities/{community}")
|
37
|
public Result getCommunity(@PathVariable(value="community") String community) {
|
38
|
log.info("request for community: " + community);
|
39
|
return repository.getCommunity(community);
|
40
|
}
|
41
|
|
42
|
}
|