Revision 57176
Added by Ioannis Diplas over 4 years ago
DashboardController.java | ||
---|---|---|
1 | 1 |
package eu.dnetlib.repo.manager.controllers; |
2 | 2 |
|
3 | 3 |
import eu.dnetlib.repo.manager.domain.BrokerSummary; |
4 |
import eu.dnetlib.repo.manager.domain.CollectionMonitorSummary; |
|
4 | 5 |
import eu.dnetlib.repo.manager.domain.RepositorySummaryInfo; |
5 | 6 |
import eu.dnetlib.repo.manager.domain.UsageSummary; |
6 | 7 |
import eu.dnetlib.repo.manager.service.BrokerService; |
... | ... | |
51 | 52 |
produces = MediaType.APPLICATION_JSON_VALUE) |
52 | 53 |
@ResponseBody |
53 | 54 |
@PreAuthorize("hasRole('ROLE_USER')") |
54 |
public List<AggregationDetails> getCollectionMonitorSummary(
|
|
55 |
public CollectionMonitorSummary getCollectionMonitorSummary(
|
|
55 | 56 |
@PathVariable("repoId") String repoId, |
56 | 57 |
@RequestParam(name = "size", required = false, defaultValue = "20") int size) throws JSONException { |
57 |
return repositoryService.getRepositoryAggregations(repoId,size); |
|
58 |
|
|
59 |
List<AggregationDetails> aggregationDetails = repositoryService.getRepositoryAggregations(repoId,0,size); |
|
60 |
CollectionMonitorSummary collectionMonitorSummary = new CollectionMonitorSummary(); |
|
61 |
collectionMonitorSummary.setAggregationDetails(aggregationDetails); |
|
62 |
size=0; |
|
63 |
do { |
|
64 |
aggregationDetails = repositoryService.getRepositoryAggregations(repoId,size,size+50); |
|
65 |
for(AggregationDetails aggregationDetail : aggregationDetails){ |
|
66 |
if(aggregationDetail.getIndexedVersion()){ |
|
67 |
collectionMonitorSummary.setLastIndexedVersion(aggregationDetail); |
|
68 |
break; |
|
69 |
} |
|
70 |
} |
|
71 |
size+=30; |
|
72 |
}while (aggregationDetails.size() != 0 && collectionMonitorSummary.getLastIndexedVersion()==null); |
|
73 |
|
|
74 |
return collectionMonitorSummary; |
|
58 | 75 |
} |
59 | 76 |
|
60 | 77 |
@RequestMapping(value = "/usageSummary/{repoId}" , method = RequestMethod.GET, |
... | ... | |
62 | 79 |
@ResponseBody |
63 | 80 |
@PreAuthorize("hasRole('ROLE_USER')") |
64 | 81 |
public UsageSummary getUsageSummary( |
65 |
@PathVariable("repoId") String repoId) throws RepositoryServiceException { |
|
82 |
@PathVariable("repoId") String repoId |
|
83 |
) throws RepositoryServiceException { |
|
66 | 84 |
return new UsageSummary(repositoryService.getMetricsInfoForRepository(repoId), piWikService.getPiwikSiteForRepo(repoId)); |
67 | 85 |
} |
68 | 86 |
|
Also available in: Unified diff
Pushing fixes on summaries