Usage summary custom return object with PiwikInfo and MetricsInfo

This commit is contained in:
Ioannis Diplas 2019-09-27 09:46:21 +00:00
parent 8f1e214a6b
commit 9bc44f8f97
2 changed files with 45 additions and 2 deletions

View File

@ -2,6 +2,7 @@ package eu.dnetlib.repo.manager.controllers;
import eu.dnetlib.repo.manager.domain.BrokerSummary;
import eu.dnetlib.repo.manager.domain.RepositorySummaryInfo;
import eu.dnetlib.repo.manager.domain.UsageSummary;
import eu.dnetlib.repo.manager.service.BrokerService;
import eu.dnetlib.repo.manager.service.DashboardService;
import eu.dnetlib.repo.manager.service.PiWikService;
@ -33,6 +34,9 @@ public class DashboardController {
@Autowired
private BrokerService brokerService;
@Autowired
private PiWikService piWikService;
@RequestMapping(value = "/getRepositoriesSummary/{userEmail}/{page}/{size}" , method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
@ -57,9 +61,9 @@ public class DashboardController {
produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
@PreAuthorize("hasRole('ROLE_USER')")
public MetricsInfo getUsageSummary(
public UsageSummary getUsageSummary(
@PathVariable("repoId") String repoId) throws RepositoryServiceException {
return repositoryService.getMetricsInfoForRepository(repoId);
return new UsageSummary(repositoryService.getMetricsInfoForRepository(repoId), piWikService.getPiwikSiteForRepo(repoId));
}
@RequestMapping(value = "/brokerSummary/{email}/{ds_name}" , method = RequestMethod.GET,

View File

@ -0,0 +1,39 @@
package eu.dnetlib.repo.manager.domain;
import eu.dnetlib.domain.data.PiwikInfo;
import eu.dnetlib.repo.manager.shared.MetricsInfo;
import eu.dnetlib.repo.manager.shared.broker.BrowseEntry;
import eu.dnetlib.repo.manager.shared.broker.SimpleSubscriptionDesc;
import java.util.List;
import java.util.Map;
public class UsageSummary {
private MetricsInfo metricsInfo;
private PiwikInfo piwikInfo;
public UsageSummary() {
}
public UsageSummary(MetricsInfo metricsInfo, PiwikInfo piwikInfo) {
this.metricsInfo = metricsInfo;
this.piwikInfo = piwikInfo;
}
public MetricsInfo getMetricsInfo() {
return metricsInfo;
}
public void setMetricsInfo(MetricsInfo metricsInfo) {
this.metricsInfo = metricsInfo;
}
public PiwikInfo getPiwikInfo() {
return piwikInfo;
}
public void setPiwikInfo(PiwikInfo piwikInfo) {
this.piwikInfo = piwikInfo;
}
}