Revision 57176
Added by Ioannis Diplas over 4 years ago
modules/uoa-repository-manager-service/trunk/src/main/java/eu/dnetlib/repo/manager/service/RepositoryService.java | ||
---|---|---|
25 | 25 |
|
26 | 26 |
Repository getRepositoryById(String id) throws JSONException, ResourceNotFoundException; |
27 | 27 |
|
28 |
List<AggregationDetails> getRepositoryAggregations(String id, int size) throws JSONException; |
|
28 |
List<AggregationDetails> getRepositoryAggregations(String id, int from, int size) throws JSONException;
|
|
29 | 29 |
|
30 | 30 |
Map<String,List<AggregationDetails>> getRepositoryAggregationsByYear(String id) throws JSONException; |
31 | 31 |
|
modules/uoa-repository-manager-service/trunk/src/main/java/eu/dnetlib/repo/manager/service/BrokerService.java | ||
---|---|---|
34 | 34 |
|
35 | 35 |
Map<String, List<SimpleSubscriptionDesc>> getSimpleSubscriptionsOfUser(String userEmail) throws BrokerException; |
36 | 36 |
|
37 |
Map<String, List<SimpleSubscriptionDesc>> getSimpleSubscriptionsOfUserByRepoId(String userEmail, String repoId) throws BrokerException; |
|
38 |
|
|
37 | 39 |
Subscription subscribe(OpenaireSubscription obj) throws BrokerException; |
38 | 40 |
|
39 | 41 |
ResponseEntity<Object> unsubscribe(String subscriptionId) throws BrokerException; |
modules/uoa-repository-manager-service/trunk/src/main/java/eu/dnetlib/repo/manager/service/RepositoryServiceImpl.java | ||
---|---|---|
290 | 290 |
|
291 | 291 |
|
292 | 292 |
@Override |
293 |
public List<AggregationDetails> getRepositoryAggregations(String id, int size) throws JSONException { |
|
293 |
public List<AggregationDetails> getRepositoryAggregations(String id, int from, int size) throws JSONException {
|
|
294 | 294 |
|
295 | 295 |
LOGGER.debug("Retreiving aggregations for repository with id : " + id ); |
296 |
UriComponents uriComponents = searchDatasource("0","100");
|
|
296 |
UriComponents uriComponents = searchDatasource(from+"",size+"");
|
|
297 | 297 |
RequestFilter requestFilter = new RequestFilter(); |
298 | 298 |
requestFilter.setId(id); |
299 | 299 |
|
modules/uoa-repository-manager-service/trunk/src/main/java/eu/dnetlib/repo/manager/service/BrokerServiceImpl.java | ||
---|---|---|
260 | 260 |
} |
261 | 261 |
|
262 | 262 |
@Override |
263 |
public Map<String, List<SimpleSubscriptionDesc>> getSimpleSubscriptionsOfUserByRepoId(String userEmail, String repoId) throws BrokerException { |
|
264 |
Map<String, List<SimpleSubscriptionDesc>> subscriptionsOfUser = getSimpleSubscriptionsOfUser(userEmail); |
|
265 |
|
|
266 |
return null; |
|
267 |
} |
|
268 |
|
|
269 |
@Override |
|
263 | 270 |
public Subscription subscribe(OpenaireSubscription obj) throws BrokerException { |
264 | 271 |
final String service = "/subscribe"; |
265 | 272 |
|
modules/uoa-repository-manager-service/trunk/src/main/java/eu/dnetlib/repo/manager/service/DashboardServiceImpl.java | ||
---|---|---|
49 | 49 |
repositorySummaryInfo.setLogoURL(repository.getLogoUrl()); |
50 | 50 |
|
51 | 51 |
//TODO getRepositoryAggregations returns only the 20 more recent items. Is it positive that we will find an indexed version there? |
52 |
List<AggregationDetails> aggregationDetailsList = repositoryService.getRepositoryAggregations(repository.getId(),20); |
|
52 |
List<AggregationDetails> aggregationDetailsList = repositoryService.getRepositoryAggregations(repository.getId(),0,20);
|
|
53 | 53 |
for(AggregationDetails aggregationDetails: aggregationDetailsList) { |
54 | 54 |
if(aggregationDetails.getIndexedVersion()) { |
55 | 55 |
repositorySummaryInfo.setRecordsCollected(aggregationDetails.getNumberOfRecords()); |
modules/uoa-repository-manager-service/trunk/src/main/java/eu/dnetlib/repo/manager/controllers/RepositoryController.java | ||
---|---|---|
80 | 80 |
produces = MediaType.APPLICATION_JSON_VALUE) |
81 | 81 |
@ResponseBody |
82 | 82 |
public List<AggregationDetails> getRepositoryAggregations(@PathVariable("id") String id) throws JSONException { |
83 |
return repositoryService.getRepositoryAggregations(id,20); |
|
83 |
return repositoryService.getRepositoryAggregations(id,0,20);
|
|
84 | 84 |
} |
85 | 85 |
|
86 | 86 |
@RequestMapping(value = "/getRepositoryAggregationsByYear/{id}", method = RequestMethod.GET, |
modules/uoa-repository-manager-service/trunk/src/main/java/eu/dnetlib/repo/manager/controllers/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 |
|
modules/uoa-repository-manager-service/trunk/src/main/java/eu/dnetlib/repo/manager/domain/CollectionMonitorSummary.java | ||
---|---|---|
1 |
package eu.dnetlib.repo.manager.domain; |
|
2 |
|
|
3 |
import eu.dnetlib.repo.manager.shared.AggregationDetails; |
|
4 |
import eu.dnetlib.repo.manager.shared.broker.BrowseEntry; |
|
5 |
import eu.dnetlib.repo.manager.shared.broker.SimpleSubscriptionDesc; |
|
6 |
|
|
7 |
import java.util.List; |
|
8 |
import java.util.Map; |
|
9 |
|
|
10 |
public class CollectionMonitorSummary { |
|
11 |
private List<AggregationDetails> aggregationDetails; |
|
12 |
|
|
13 |
private AggregationDetails lastIndexedVersion; |
|
14 |
|
|
15 |
public CollectionMonitorSummary(){} |
|
16 |
|
|
17 |
public CollectionMonitorSummary(List<AggregationDetails> aggregationDetails, AggregationDetails lastIndexedVersion) { |
|
18 |
this.aggregationDetails = aggregationDetails; |
|
19 |
this.lastIndexedVersion = lastIndexedVersion; |
|
20 |
} |
|
21 |
|
|
22 |
public List<AggregationDetails> getAggregationDetails() { |
|
23 |
return aggregationDetails; |
|
24 |
} |
|
25 |
|
|
26 |
public void setAggregationDetails(List<AggregationDetails> aggregationDetails) { |
|
27 |
this.aggregationDetails = aggregationDetails; |
|
28 |
} |
|
29 |
|
|
30 |
public AggregationDetails getLastIndexedVersion() { |
|
31 |
return lastIndexedVersion; |
|
32 |
} |
|
33 |
|
|
34 |
public void setLastIndexedVersion(AggregationDetails lastIndexedVersion) { |
|
35 |
this.lastIndexedVersion = lastIndexedVersion; |
|
36 |
} |
|
37 |
} |
Also available in: Unified diff
Pushing fixes on summaries