Project

General

Profile

« Previous | Next » 

Revision 57155

Implementing summaries for collection, usage and broker

View differences:

DashboardController.java
1 1
package eu.dnetlib.repo.manager.controllers;
2 2

  
3
import eu.dnetlib.repo.manager.domain.BrokerSummary;
3 4
import eu.dnetlib.repo.manager.domain.RepositorySummaryInfo;
5
import eu.dnetlib.repo.manager.service.BrokerService;
4 6
import eu.dnetlib.repo.manager.service.DashboardService;
7
import eu.dnetlib.repo.manager.service.PiWikService;
8
import eu.dnetlib.repo.manager.service.RepositoryService;
9
import eu.dnetlib.repo.manager.shared.AggregationDetails;
10
import eu.dnetlib.repo.manager.shared.BrokerException;
11
import eu.dnetlib.repo.manager.shared.MetricsInfo;
12
import eu.dnetlib.repo.manager.shared.RepositoryServiceException;
5 13
import io.swagger.annotations.Api;
6 14
import org.json.JSONException;
7 15
import org.springframework.beans.factory.annotation.Autowired;
......
19 27
    @Autowired
20 28
    private DashboardService dashboardService;
21 29

  
30
    @Autowired
31
    private RepositoryService repositoryService;
32

  
33
    @Autowired
34
    private BrokerService brokerService;
35

  
22 36
    @RequestMapping(value = "/getRepositoriesSummary/{userEmail}/{page}/{size}" , method = RequestMethod.GET,
23 37
            produces = MediaType.APPLICATION_JSON_VALUE)
24 38
    @ResponseBody
......
28 42
                                                                  @PathVariable("size") String size) throws JSONException {
29 43
        return dashboardService.getRepositoriesSummaryInfo(userEmail, page, size);
30 44
    }
45

  
46
    @RequestMapping(value = "/collectionMonitorSummary/{repoId}" , method = RequestMethod.GET,
47
            produces = MediaType.APPLICATION_JSON_VALUE)
48
    @ResponseBody
49
    @PreAuthorize("hasRole('ROLE_USER')")
50
    public List<AggregationDetails> getCollectionMonitorSummary(
51
            @PathVariable("repoId") String repoId,
52
            @RequestParam(name = "size", required = false, defaultValue = "20") int size) throws JSONException {
53
        return repositoryService.getRepositoryAggregations(repoId,size);
54
    }
55

  
56
    @RequestMapping(value = "/usageSummary/{repoId}" , method = RequestMethod.GET,
57
            produces = MediaType.APPLICATION_JSON_VALUE)
58
    @ResponseBody
59
    @PreAuthorize("hasRole('ROLE_USER')")
60
    public MetricsInfo getUsageSummary(
61
            @PathVariable("repoId") String repoId) throws RepositoryServiceException {
62
        return repositoryService.getMetricsInfoForRepository(repoId);
63
    }
64

  
65
    @RequestMapping(value = "/brokerSummary/{email}/{ds_name}" , method = RequestMethod.GET,
66
            produces = MediaType.APPLICATION_JSON_VALUE)
67
    @ResponseBody
68
    @PreAuthorize("hasRole('ROLE_USER')")
69
    public BrokerSummary getBrokerSummary(
70
            @PathVariable("email") String email,
71
            @PathVariable("ds_name") String datasourceName) throws BrokerException {
72
        return new BrokerSummary(brokerService.getSimpleSubscriptionsOfUser(email), brokerService.getTopicsForDatasource(datasourceName));
73
    }
74

  
75

  
76

  
77

  
31 78
}

Also available in: Unified diff