Project

General

Profile

« Previous | Next » 

Revision 56761

Triggering validation job from provide on Interface Update and Interface Add

View differences:

modules/uoa-repository-manager-service/trunk/src/main/java/eu/dnetlib/repo/manager/service/RepositoryService.java
1 1
package eu.dnetlib.repo.manager.service;
2 2

  
3
import eu.dnetlib.api.functionality.ValidatorServiceException;
3 4
import eu.dnetlib.domain.data.Repository;
4 5
import eu.dnetlib.domain.data.RepositoryInterface;
5 6
import eu.dnetlib.repo.manager.domain.RepositorySnippet;
......
45 46
    RepositoryInterface addRepositoryInterface(String datatype,
46 47
                                               String repoId,
47 48
                                               String registeredBy,
48
                                               RepositoryInterface iFace) throws JSONException,ResourceNotFoundException;
49
                                               RepositoryInterface iFace) throws JSONException, ResourceNotFoundException, ValidatorServiceException;
49 50

  
50 51
    List<String> getDnetCountries();
51 52

  
modules/uoa-repository-manager-service/trunk/src/main/java/eu/dnetlib/repo/manager/service/SushiliteServiceImpl.java
34 34

  
35 35
    @Override
36 36
    @PreAuthorize("hasRole('ROLE_USER')")
37
    public ReportResponseWrapper getReportResults(@PathVariable("page") String page,
38
                                                  @PathVariable("pageSize") String pageSize,
39
                                                  @RequestParam(value = "Report") String Report,
40
                                                  @RequestParam(value = "Release",defaultValue="4") String Release,
41
                                                  @RequestParam(value = "RequestorID",required=false,defaultValue="anonymous") String RequestorID,
42
                                                  @RequestParam(value = "BeginDate",required=false,defaultValue="") String BeginDate,
43
                                                  @RequestParam(value = "EndDate",required=false,defaultValue="") String EndDate,
44
                                                  @RequestParam(value = "RepositoryIdentifier") String RepositoryIdentifier,
45
                                                  @RequestParam(value = "ItemIdentifier",required=false,defaultValue="") String ItemIdentifier,
46
                                                  @RequestParam(value = "ItemDataType",required=false,defaultValue="") String ItemDataType,
47
                                                  @RequestParam(value = "Granularity") String Granularity,
48
                                                  @RequestParam(value = "Pretty",required=false,defaultValue="") String Pretty) {
37
    public ReportResponseWrapper getReportResults(String page,
38
                                                  String pageSize,
39
                                                  String Report,
40
                                                  String Release,
41
                                                  String RequestorID,
42
                                                  String BeginDate,
43
                                                  String EndDate,
44
                                                  String RepositoryIdentifier,
45
                                                  String ItemIdentifier,
46
                                                  String ItemDataType,
47
                                                  String Granularity,
48
                                                  String Pretty) {
49 49

  
50 50
            //build the uri params
51 51
            UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(this.usagestatsSushiliteEndpoint + "GetReport/")
modules/uoa-repository-manager-service/trunk/src/main/java/eu/dnetlib/repo/manager/service/RepositoryServiceImpl.java
152 152

  
153 153

  
154 154
    @Override
155
    public List<RepositorySnippet> getRepositoriesByCountry(@PathVariable("country") String country,
156
                                                            @PathVariable("mode") String mode,
157
                                                            @RequestParam(value = "managed",required=false) Boolean managed) throws JSONException, IOException {
155
    public List<RepositorySnippet> getRepositoriesByCountry(String country,
156
                                                            String mode,
157
                                                            Boolean managed) throws JSONException, IOException {
158 158

  
159 159
        LOGGER.debug("Getting repositories by country!");
160 160
        int page = 0;
......
251 251
    }
252 252

  
253 253
    @Override
254
    public List<Repository> getRepositoriesOfUser(@PathVariable("userEmail") String userEmail,
255
                                                  @PathVariable("page") String page,
256
                                                  @PathVariable("size") String size) throws JSONException {
254
    public List<Repository> getRepositoriesOfUser(String userEmail,
255
                                                  String page,
256
                                                  String size) throws JSONException {
257 257

  
258 258
        LOGGER.debug("Retreiving repositories of user : " + userEmail );
259 259
        UriComponents uriComponents = searchDatasource(page,size);
......
276 276
    }
277 277

  
278 278
    @Override
279
    public Repository getRepositoryById(@PathVariable("id") String id) throws JSONException,ResourceNotFoundException {
279
    public Repository getRepositoryById(String id) throws JSONException,ResourceNotFoundException {
280 280

  
281 281
        LOGGER.debug("Retreiving repositories with id : " + id );
282 282
        Repository repo = null;
......
303 303

  
304 304

  
305 305
    @Override
306
    public List<AggregationDetails> getRepositoryAggregations(@PathVariable("id") String id) throws JSONException {
306
    public List<AggregationDetails> getRepositoryAggregations(String id) throws JSONException {
307 307

  
308 308
        LOGGER.debug("Retreiving aggregations for repository with id : " + id );
309 309
        UriComponents uriComponents = searchDatasource("0","100");
......
332 332
    }
333 333

  
334 334
    @Override
335
    public Map<String, List<AggregationDetails>> getRepositoryAggregationsByYear(@PathVariable("id") String id) throws JSONException {
335
    public Map<String, List<AggregationDetails>> getRepositoryAggregationsByYear(String id) throws JSONException {
336 336
        LOGGER.debug("Retreiving aggregations (by year) for repository with id : " + id );
337 337
        UriComponents uriComponents = searchDatasource("0","100");
338 338
        RequestFilter requestFilter = new RequestFilter();
......
369 369

  
370 370

  
371 371
    @Override
372
    public List<Repository> getRepositoriesByName(@PathVariable("name") String name,
373
                                                  @PathVariable("page") String page,
374
                                                  @PathVariable("size") String size) throws JSONException {
372
    public List<Repository> getRepositoriesByName(String name,
373
                                                  String page,
374
                                                  String size) throws JSONException {
375 375

  
376 376
        LOGGER.debug("Retreiving  repositories with official name : " + name );
377 377
        UriComponents uriComponents = searchDatasource("0","100");
......
393 393
    }
394 394

  
395 395
    @Override
396
    public List<RepositoryInterface> getRepositoryInterface(@PathVariable("id") String id) throws JSONException {
396
    public List<RepositoryInterface> getRepositoryInterface(String id) throws JSONException {
397 397

  
398 398
        UriComponents uriComponents = UriComponentsBuilder
399 399
                .fromHttpUrl(baseAddress + "/ds/api/")
......
412 412
    }
413 413

  
414 414
    @Override
415
    public Repository addRepository(@RequestParam("datatype") String datatype,
416
                                    @RequestBody Repository repository) throws Exception {
415
    public Repository addRepository(String datatype,
416
                                    Repository repository) throws Exception {
417 417

  
418 418
        LOGGER.debug("storing " + datatype + " repository with id: " + repository.getId());
419 419

  
......
447 447
            String json_repository = Converter.repositoryObjectToJson(repository);
448 448
            LOGGER.debug("JSON to add(update) -> " + json_repository);
449 449

  
450
//
451
//            // TODO delete these 3 lines
452
//            HttpHeaders temp = new HttpHeaders();
453
//            temp.setContentType(MediaType.APPLICATION_JSON_UTF8);
454

  
455 450
            HttpEntity<String> httpEntity = new HttpEntity<String>(json_repository, httpHeaders);
456 451
            ResponseEntity responseEntity = restTemplate.exchange(uriComponents.toUri(),HttpMethod.POST, httpEntity, ResponseEntity.class);
457 452

  
......
472 467
    }
473 468

  
474 469
    @Override
475
    public Repository updateRepository(@RequestBody Repository repository,Authentication authentication) throws Exception {
470
    public Repository updateRepository(Repository repository,Authentication authentication) throws Exception {
476 471
        UriComponents uriComponents = UriComponentsBuilder
477 472
                .fromHttpUrl(baseAddress + "/ds/update/")
478 473
                .build()
......
501 496
        }
502 497
    }
503 498

  
504
    private void updateInterface(String datatype,RepositoryInterface iFace) {
505
        //TODO call update base url
506
        //((DatasourceManagerService) this.dmService.getService()).updateBaseUrl(repo.getId(), iFace.getId(), iFace.getBaseUrl());
507
        if (!iFace.getAccessSet().isEmpty()) {
508
            LOGGER.debug("set not empty: " + iFace.getAccessSet());
509
            //TODO call update method for access params
510
            // ((DatasourceManagerService) this.dmService.getService()).updateAccessParam(repo.getId(), iFace.getId(), "set", iFace.getAccessSet(), false);
511
        } else {
512
            //TODO call deleteAccessParamOrExtraField
513
            //((DatasourceManagerService) this.dmService.getService()).deleteAccessParamOrExtraField(repo.getId(), iFace.getId(), "set");
514
        }
515
        //TODO update content description
516
        //((DatasourceManagerService) this.dmService.getService()).updateContentDescription(repo.getId(), iFace.getId(), "metadata");
517
        if (datatype.equals("re3data")) {
518
            //TODO call update access params
519
            //  ((DatasourceManagerService) this.dmService.getService()).updateAccessParam(repo.getId(), iFace.getId(), "format", "oai_datacite", false);
520
            iFace.setAccessFormat("oai_datacite");
521
        } else {
522
            //TODO call update access params
523
            //((DatasourceManagerService) this.dmService.getService()).updateAccessParam(repo.getId(), iFace.getId(), "format", "oai_dc", false);
524
            iFace.setAccessFormat("oai_dc");
525
        }
526

  
527
    }
528

  
529 499
    private void storeRepository(Repository repository, Authentication authentication) throws Exception {
530 500

  
531 501
        Date utilDate = new Date();
......
551 521
    }
552 522

  
553 523
    @Override
554
    public void deleteRepositoryInterface(@RequestParam("id") String id ,
555
                                          @RequestParam("registeredBy") String registeredBy){
524
    public void deleteRepositoryInterface(String id ,
525
                                          String registeredBy){
556 526
        UriComponents uriComponents = UriComponentsBuilder
557 527
                .fromHttpUrl(baseAddress + "/ds/api/")
558 528
                .path("/{id}")
......
562 532
    }
563 533

  
564 534
    @Override
565
    public RepositoryInterface addRepositoryInterface(@RequestParam("datatype") String datatype,
566
                                                      @RequestParam("repoId") String repoId,
567
                                                      @RequestParam("registeredBy") String registeredBy,
568
                                                      @RequestBody RepositoryInterface repositoryInterface) throws JSONException,ResourceNotFoundException {
535
    public RepositoryInterface addRepositoryInterface(String datatype,
536
                                                      String repoId,
537
                                                      String registeredBy,
538
                                                      RepositoryInterface repositoryInterface) throws JSONException, ResourceNotFoundException, ValidatorServiceException {
569 539
        try {
570 540
            Repository e = this.getRepositoryById(repoId);
571 541
            repositoryInterface = createRepositoryInterface(e,repositoryInterface,datatype);
......
576 546
                    .build()
577 547
                    .encode();
578 548

  
579
            HttpEntity<String> httpEntity = new HttpEntity <String> (json_interface,httpHeaders);
549
            HttpEntity<String> httpEntity = new HttpEntity <> (json_interface,httpHeaders);
580 550
            restTemplate.postForObject(uriComponents.toUri(),httpEntity,String.class);
551
            submitInterfaceValidation(e, registeredBy, repositoryInterface);
552

  
581 553
            return repositoryInterface;
582 554

  
583
        } catch (JSONException e) {
555
        } catch (JSONException | ValidatorServiceException e) {
584 556
            LOGGER.debug("Exception on addRepositoryInterface" , e);
585 557
            emailUtils.reportException(e);
586 558
            throw e;
......
588 560
    }
589 561

  
590 562
    @Override
591
    public RepositoryInterface updateRepositoryInterface(@RequestParam("repoId") String repoId,
592
                                                         @RequestParam("registeredBy") String registeredBy,
593
                                                         @RequestBody RepositoryInterface repositoryInterface) throws Exception {
563
    public RepositoryInterface updateRepositoryInterface(String repoId,
564
                                                         String registeredBy,
565
                                                         RepositoryInterface repositoryInterface) throws Exception {
594 566

  
595 567
        this.updateBaseUrl(repoId,repositoryInterface.getId(),repositoryInterface.getBaseUrl());
596 568
        this.updateCompliance(repoId,repositoryInterface.getId(),repositoryInterface.getCompliance());
597 569
        this.updateValidationSet(repoId,repositoryInterface.getId(),repositoryInterface.getAccessSet());
570
        submitInterfaceValidation(getRepositoryById(repoId),registeredBy,repositoryInterface);
598 571
        return repositoryInterface;
599 572
    }
600 573

  
601
    private void submitInterfaceValidation(Repository repo, String repoType, String userEmail, RepositoryInterface iFace) throws ValidatorServiceException {
574
    private void submitInterfaceValidation(Repository repo, String userEmail, RepositoryInterface iFace) throws ValidatorServiceException {
602 575
        JobForValidation job = new JobForValidation();
603 576

  
604 577
        job.setActivationId(UUID.randomUUID().toString());
......
607 580
        job.setDatasourceId(repo.getId());
608 581
        job.setDesiredCompatibilityLevel(iFace.getDesiredCompatibilityLevel());
609 582
        job.setInterfaceId(iFace.getId());
610
//        job.setInterfaceIdOld(null);
611 583
        job.setOfficialName(repo.getOfficialName());
612
        job.setRepoType(repoType);
584
        job.setRepoType(repo.getDatasourceType());
613 585
        job.setUserEmail(userEmail);
614
        job.setValidationSet(iFace.getAccessSet());
586
        job.setValidationSet((iFace.getAccessSet().isEmpty() ? "none" : iFace.getAccessSet()));
615 587
        job.setRecords(-1);
616 588
        job.setRegistration(true);
617 589
        job.setUpdateExisting(false);
......
645 617
        iFace.setAccessProtocol("oai");
646 618
        iFace.setMetadataIdentifierPath("//*[local-name()='header']/*[local-name()='identifier']");
647 619
        iFace.setId("api_________::" + repo.getId() + "::" + UUID.randomUUID().toString().substring(0, 8));
648
        if (iFace.getAccessSet().isEmpty()) {
620
        if (iFace.getAccessSet() == null || iFace.getAccessSet().isEmpty()) {
649 621
            LOGGER.debug("set is empty: " + iFace.getAccessSet());
650 622
            iFace.removeAccessSet();
623
            iFace.setAccessSet("none");
651 624
        }
652 625
        return iFace;
653 626
    }
......
670 643
    }
671 644

  
672 645
    @Override
673
    public List<String> getUrlsOfUserRepos(@PathVariable("user_email") String userEmail,
674
                                           @PathVariable("page") String page,
675
                                           @PathVariable("size") String size) throws JSONException {
646
    public List<String> getUrlsOfUserRepos(String userEmail,
647
                                           String page,
648
                                           String size){
676 649
        UriComponents uriComponents = UriComponentsBuilder
677 650
                .fromHttpUrl(baseAddress + "/api/baseurl/")
678 651
                .path("/{page}/{size}")
......
690 663
    }
691 664

  
692 665
    @Override
693
    public List<String> getDatasourceVocabularies(@PathVariable("mode") String mode) {
666
    public List<String> getDatasourceVocabularies(String mode) {
694 667

  
695 668
        List<String> resultSet = new ArrayList<>();
696 669
        for (Map.Entry<String, String> entry : this.getVocabulary("dnet:datasource_typologies").getAsMap().entrySet()) {
......
723 696

  
724 697

  
725 698
    @Override
726
    public Map<String, String> getCompatibilityClasses(@PathVariable("mode") String mode)  {
699
    public Map<String, String> getCompatibilityClasses(String mode)  {
727 700

  
728 701
        LOGGER.debug("Getting compatibility classes for mode: " + mode);
729 702
        Map<String, String> retMap = new HashMap<String, String>();
......
752 725
    }
753 726

  
754 727
    @Override
755
    public Map<String, String> getDatasourceClasses(@PathVariable("mode") String mode)  {
728
    public Map<String, String> getDatasourceClasses(String mode)  {
756 729

  
757 730
        LOGGER.debug("Getting datasource classes for mode: " + mode);
758 731

  
......
793 766
    }
794 767

  
795 768
    @Override
796
    public MetricsInfo getMetricsInfoForRepository(@PathVariable("repoId")  String repoId) throws RepositoryServiceException {
769
    public MetricsInfo getMetricsInfoForRepository(String repoId) throws RepositoryServiceException {
797 770
        try {
798 771

  
799 772
            MetricsInfo metricsInfo = new MetricsInfo();
......
809 782
    }
810 783

  
811 784
    @Override
812
    public Map<String, String> getListLatestUpdate(@PathVariable("mode")  String mode) throws JSONException {
785
    public Map<String, String> getListLatestUpdate(String mode) throws JSONException {
813 786
        if(mode.equals("opendoar"))
814 787
            return Collections.singletonMap("lastCollectionDate", getRepositoryInterface("openaire____::"+mode).get(0).getLastCollectionDate());
815 788
        else
modules/uoa-repository-manager-service/trunk/src/main/java/eu/dnetlib/repo/manager/service/ValidatorServiceImpl.java
88 88

  
89 89
    @Override
90 90
    @PreAuthorize("hasRole('ROLE_USER') and #jobForValidation.userEmail == authentication.userInfo.email")
91
    public JobForValidation submitJobForValidation(@RequestBody JobForValidation jobForValidation) throws ValidatorServiceException {
91
    public JobForValidation submitJobForValidation(JobForValidation jobForValidation) throws ValidatorServiceException {
92 92
        LOGGER.debug("Submit job for validation with id : " + jobForValidation.getDatasourceId());
93 93
        try {
94 94
            emailUtils.sendSubmitJobForValidationEmail(SecurityContextHolder.getContext().getAuthentication(),jobForValidation);
......
105 105

  
106 106
    @Override
107 107
    @PreAuthorize("hasRole('ROLE_USER') and #email == authentication.userInfo.email")
108
    public ResponseEntity<Object> reSubmitJobForValidation(@PathVariable("email") String email,
109
                                                           @PathVariable("jobId") String jobId) throws JSONException, ValidatorServiceException {
108
    public ResponseEntity<Object> reSubmitJobForValidation(String email,
109
                                                           String jobId) throws JSONException, ValidatorServiceException {
110 110
        LOGGER.debug("Resubmit validation job with id : " + jobId);
111 111
        StoredJob job = monitorApi.getJobSummary(jobId,"all");
112 112
        Set<Integer> contentRules = new HashSet<Integer>();
......
136 136
    }
137 137

  
138 138
    @Override
139
    public List<RuleSet> getRuleSets(@PathVariable("mode") String mode) {
139
    public List<RuleSet> getRuleSets(String mode) {
140 140
        LOGGER.info("Getting rulesets for mode: " + mode);
141 141
        return rulesetMap.get(mode);
142 142
    }
143 143

  
144 144
    @Override
145
    public List<String> getSetsOfRepository(@RequestParam(value = "url", required = true) String url) {
145
    public List<String> getSetsOfRepository(String url) {
146 146
        LOGGER.debug("Getting sets of repository with url : " + url);
147 147
        try {
148 148
            return OaiTools.getSetsOfRepo(url);
......
154 154
    }
155 155

  
156 156
    @Override
157
    public boolean identifyRepo(@RequestParam(value = "url", required = true) String url) {
157
    public boolean identifyRepo(String url) {
158 158
        LOGGER.debug("Identify repository with url : " + url);
159 159
        try {
160 160
            return OaiTools.identifyRepository(url);
......
166 166
    }
167 167

  
168 168
    @Override
169
    public RuleSet getRuleSet(@PathVariable("acronym") String acronym) {
169
    public RuleSet getRuleSet(String acronym) {
170 170
        LOGGER.debug("Getting ruleset with acronym : " + acronym);
171 171
        RuleSet ruleSet = null;
172 172
        try {
......
187 187

  
188 188
    @Override
189 189
    @PreAuthorize("hasRole('ROLE_USER')")
190
    public List<StoredJob> getStoredJobsNew(@RequestParam("user") @ApiParam(value = "User email", required = true) String user,
191
                                            @RequestParam(value = "jobType", required = false)
192
                                            @ApiParam(value = "Equals to filter job type on validation history page") String jobType,
193
                                            @RequestParam("offset") @ApiParam(value = "Page number", required = true) String offset,
194
                                            @RequestParam(value = "limit", required = false,defaultValue = "10") @ApiParam(value = "Null value") String limit,
195
                                            @RequestParam(value = "dateFrom", required = false) @ApiParam(value = "Null value") String dateFrom,
196
                                            @RequestParam(value = "dateTo", required = false) @ApiParam(value = "Null value") String dateTo,
197
                                            @RequestParam("validationStatus") @ApiParam(value = "Equals to filter validation jobs", required = true) String validationStatus
198
                                            ) throws ValidatorServiceException {
190
    public List<StoredJob> getStoredJobsNew(String user,
191
                                            String jobType,
192
                                            String offset,
193
                                            String limit,
194
                                            String dateFrom,
195
                                            String dateTo,
196
                                            String validationStatus ) throws ValidatorServiceException {
199 197
        return getValidationService().getStoredJobsNew(user, jobType, Integer.parseInt(offset), Integer.parseInt(limit), dateFrom, dateTo, validationStatus);
200 198
    }
201 199

  
......
205 203
    }
206 204

  
207 205
    @Override
208
    public InterfaceInformation getInterfaceInformation(@RequestParam(value = "baseUrl", required = true) String baseUrl) throws ValidationServiceException {
206
    public InterfaceInformation getInterfaceInformation(String baseUrl) throws ValidationServiceException {
209 207
        try {
210 208
            LOGGER.debug("Getting interface information with url: " + baseUrl);
211 209
            InterfaceInformation interfaceInformation = new InterfaceInformation();
modules/uoa-repository-manager-service/trunk/src/main/java/eu/dnetlib/repo/manager/service/DashboardServiceImpl.java
32 32
    private BrokerService brokerService;
33 33

  
34 34
    @Override
35
    public List<RepositorySummaryInfo> getRepositoriesSummaryInfo(@PathVariable("userEmail") String userEmail,
36
                                                                  @PathVariable("page") String page,
37
                                                                  @PathVariable("size") String size) throws JSONException {
35
    public List<RepositorySummaryInfo> getRepositoriesSummaryInfo(String userEmail,
36
                                                                  String page,
37
                                                                  String size){
38 38

  
39 39
        List<RepositorySummaryInfo> repositorySummaryInfoList = new ArrayList<>();
40 40

  
41
try {
41
        try {
42 42

  
43
        List<Repository> repositoriesOfUser = repositoryService.getRepositoriesOfUser(userEmail, page, size);
44
        for(Repository repository: repositoriesOfUser) {
43
                List<Repository> repositoriesOfUser = repositoryService.getRepositoriesOfUser(userEmail, page, size);
44
                for(Repository repository: repositoriesOfUser) {
45 45

  
46
            RepositorySummaryInfo repositorySummaryInfo = new RepositorySummaryInfo();
47
            repositorySummaryInfo.setId(repository.getId());
48
            repositorySummaryInfo.setRepositoryName(repository.getOfficialName());
49
            repositorySummaryInfo.setLogoURL(repository.getLogoUrl());
46
                    RepositorySummaryInfo repositorySummaryInfo = new RepositorySummaryInfo();
47
                    repositorySummaryInfo.setId(repository.getId());
48
                    repositorySummaryInfo.setRepositoryName(repository.getOfficialName());
49
                    repositorySummaryInfo.setLogoURL(repository.getLogoUrl());
50 50

  
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());
53
            for(AggregationDetails aggregationDetails: aggregationDetailsList) {
54
                if(aggregationDetails.getIndexedVersion()) {
55
                    repositorySummaryInfo.setRecordsCollected(aggregationDetails.getNumberOfRecords());
56
                    repositorySummaryInfo.setLastIndexedVersion(aggregationDetails.getDate());
57
                    break;
58
                }
59
            }
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());
53
                    for(AggregationDetails aggregationDetails: aggregationDetailsList) {
54
                        if(aggregationDetails.getIndexedVersion()) {
55
                            repositorySummaryInfo.setRecordsCollected(aggregationDetails.getNumberOfRecords());
56
                            repositorySummaryInfo.setLastIndexedVersion(aggregationDetails.getDate());
57
                            break;
58
                        }
59
                    }
60 60

  
61
            try {
61
                    try {
62 62

  
63
                MetricsInfo metricsInfo = repositoryService.getMetricsInfoForRepository(repository.getId());
64
                repositorySummaryInfo.setTotalDownloads(metricsInfo.getMetricsNumbers().getTotalDownloads());
65
                repositorySummaryInfo.setTotalViews(metricsInfo.getMetricsNumbers().getTotalViews());
63
                        MetricsInfo metricsInfo = repositoryService.getMetricsInfoForRepository(repository.getId());
64
                        repositorySummaryInfo.setTotalDownloads(metricsInfo.getMetricsNumbers().getTotalDownloads());
65
                        repositorySummaryInfo.setTotalViews(metricsInfo.getMetricsNumbers().getTotalViews());
66 66

  
67
            } catch (RepositoryServiceException e) {
68
                logger.error("Exception getting metrics info for repository: " + repository.getId(), e);
69
            }
67
                    } catch (RepositoryServiceException e) {
68
                        logger.error("Exception getting metrics info for repository: " + repository.getId(), e);
69
                    }
70 70

  
71
            try {
71
                    try {
72 72

  
73
                List<BrowseEntry> events = brokerService.getTopicsForDatasource(repository.getOfficialName());
74
                Long totalEvents = 0L;
75
                for(BrowseEntry browseEntry: events)
76
                    totalEvents += browseEntry.getSize();
77
                repositorySummaryInfo.setEnrichmentEvents(totalEvents);
73
                        List<BrowseEntry> events = brokerService.getTopicsForDatasource(repository.getOfficialName());
74
                        Long totalEvents = 0L;
75
                        for(BrowseEntry browseEntry: events)
76
                            totalEvents += browseEntry.getSize();
77
                        repositorySummaryInfo.setEnrichmentEvents(totalEvents);
78 78

  
79 79

  
80
            } catch (BrokerException e) {
81
                logger.error("Exception getting broker events for repository: " + repository.getId(), e);
82
            }
80
                    } catch (BrokerException e) {
81
                        logger.error("Exception getting broker events for repository: " + repository.getId(), e);
82
                    }
83 83

  
84
            repositorySummaryInfoList.add(repositorySummaryInfo);
84
                    repositorySummaryInfoList.add(repositorySummaryInfo);
85
                }
86

  
87
        } catch (Exception e) {
88
            logger.error("Something baad happened!", e);
89
            e.printStackTrace();
85 90
        }
86 91

  
87
} catch (Exception e) {
88
	logger.error("Something baad happened!", e);
89
	e.printStackTrace();
90
}
91

  
92 92
        return repositorySummaryInfoList;
93 93
    }
94 94
}
modules/uoa-repository-manager-service/trunk/src/main/java/eu/dnetlib/repo/manager/config/Config.java
24 24

  
25 25
    private static Logger LOGGER = Logger.getLogger(Config.class);
26 26

  
27
    @Value("${redis.host:194.177.192.121}")
27
    @Value("${redis.host}")
28 28
    private String host;
29 29

  
30 30
    @Value("${redis.port:6379}")
......
38 38

  
39 39
    @PostConstruct
40 40
    private void init(){
41
        LOGGER.info(host);
41
        LOGGER.info(String.format("Redis : %s Port : %s Password : %s",host,port,password));
42 42
    }
43 43

  
44 44
    @Bean
45
    JedisConnectionFactory connectionFactory() {
45
    public JedisConnectionFactory connectionFactory() {
46 46
        LOGGER.info(String.format("Redis : %s Port : %s Password : %s",host,port,password));
47 47
        JedisConnectionFactory jedisConnectionFactory = new JedisConnectionFactory();
48 48
        jedisConnectionFactory.setHostName(host);
49 49
        jedisConnectionFactory.setPort(Integer.parseInt(port));
50
        jedisConnectionFactory.setUsePool(true);
50 51
        if(password != null) jedisConnectionFactory.setPassword(password);
51 52
        return jedisConnectionFactory;
52 53
    }
modules/uoa-repository-manager-service/trunk/src/main/java/eu/dnetlib/repo/manager/controllers/RepositoryController.java
1 1
package eu.dnetlib.repo.manager.controllers;
2 2

  
3
import eu.dnetlib.api.functionality.ValidatorServiceException;
3 4
import eu.dnetlib.domain.data.Repository;
4 5
import eu.dnetlib.domain.data.RepositoryInterface;
5 6
import eu.dnetlib.repo.manager.domain.RepositorySnippet;
......
139 140
    @RequestMapping(value = "/updateRepository", method = RequestMethod.POST,
140 141
            consumes = MediaType.APPLICATION_JSON_VALUE)
141 142
    @ResponseBody
142
    //@PreAuthorize("hasRole('ROLE_USER') and #repository.registeredBy == authentication.userInfo.email")
143 143
    public Repository updateRepository(@RequestBody Repository repository,Authentication authentication) throws Exception {
144 144
        return repositoryService.updateRepository(repository, authentication);
145 145
    }
......
158 158
    public RepositoryInterface addRepositoryInterface(@RequestParam("datatype") String datatype,
159 159
                                                      @RequestParam("repoId") String repoId,
160 160
                                                      @RequestParam("registeredBy") String registeredBy,
161
                                                      @RequestBody RepositoryInterface repositoryInterface) throws JSONException,ResourceNotFoundException {
161
                                                      @RequestBody RepositoryInterface repositoryInterface) throws JSONException, ResourceNotFoundException, ValidatorServiceException {
162 162
        return repositoryService.addRepositoryInterface(datatype, repoId, registeredBy, repositoryInterface);
163 163
    }
164 164

  

Also available in: Unified diff