Project

General

Profile

1
package eu.dnetlib.uoaorcidservice.controllers;
2

    
3
import eu.dnetlib.uoaorcidservice.configuration.properties.OrcidConfig;
4
import eu.dnetlib.uoaorcidservice.services.MetricsService;
5
import org.apache.log4j.Logger;
6
import org.springframework.beans.factory.annotation.Autowired;
7
import org.springframework.web.bind.annotation.CrossOrigin;
8
import org.springframework.web.bind.annotation.RequestMapping;
9
import org.springframework.web.bind.annotation.RequestMethod;
10
import org.springframework.web.bind.annotation.RestController;
11

    
12
import java.util.List;
13

    
14
@RestController
15
@CrossOrigin(origins = "*")
16
public class MetricsController {
17
    private final Logger log = Logger.getLogger(this.getClass());
18
    private final Logger orcid_log = Logger.getLogger("ORCID-" + this.getClass().getName());
19

    
20
    @Autowired
21
    private MetricsService metricsService;
22

    
23

    
24
    @RequestMapping(value = "/report/worksPerDashboard", method = RequestMethod.GET)
25
    public List<Object> countWorksPerDashboard() {
26
        return metricsService.countWorksPerDashboard();
27
    }
28

    
29
    @RequestMapping(value = "/report/worksPerYear", method = RequestMethod.GET)
30
    public List<Object> countWorksPerYear() {
31
        return metricsService.countWorksPerYear();
32
    }
33

    
34
    @RequestMapping(value = "/report/worksPerYearAndMonth", method = RequestMethod.GET)
35
    public List<Object> countWorksPerYearAndMonth() {
36
        return metricsService.countWorksPerYearAndMonth();
37
    }
38

    
39
    @RequestMapping(value = "/report/worksPerOrcid", method = RequestMethod.GET)
40
    public List<Object> countWorksPerOrcid() {
41
        return metricsService.countWorksPerOrcid();
42
    }
43

    
44
    @RequestMapping(value = "/report/uniqueUsersWithLinksPerMonth", method = RequestMethod.GET)
45
    public List<Object> countUniqueUsersWithLinksPerMonth() {
46
        return metricsService.countUniqueUsersWithLinksPerMonth();
47
    }
48

    
49
    @RequestMapping(value = "/report/uniqueUsersWithLinksPerYear", method = RequestMethod.GET)
50
    public List<Object> countUniqueUsersWithLinksPerYear() {
51
        return metricsService.countUniqueUsersWithLinksPerYear();
52
    }
53

    
54
    @RequestMapping(value = "/report/newUsersPerMonth", method = RequestMethod.GET)
55
    public List<Object> countNewUsersPerMonth() {
56
        return metricsService.countNewUsersPerMonth();
57
    }
58

    
59
    @RequestMapping(value = "/report/newUsersPerYear", method = RequestMethod.GET)
60
    public List<Object> countNewUsersPerYear() {
61
        return metricsService.countNewUsersPerYear();
62
    }
63

    
64
    @RequestMapping(value = "/report/tokensPerOrcid", method = RequestMethod.GET)
65
    public List<Object> countTokensPerOrcid() {
66
        return metricsService.countTokensPerOrcid();
67
    }
68

    
69
    @RequestMapping(value = "/report/totalUniqueUsers", method = RequestMethod.GET)
70
    public List<Object> countTotalUniqueUsers() {
71
        return metricsService.countTotalUniqueUsers();
72
    }
73

    
74
    @RequestMapping(value = "/report/totalWorks", method = RequestMethod.GET)
75
    public List<Object> countTotalWorks() {
76
        return metricsService.countTotalWorks();
77
    }
78
}
(1-1/6)