diff --git a/src/main/java/eu/dnetlib/repo/manager/config/Config.java b/src/main/java/eu/dnetlib/repo/manager/config/Config.java index 039f704..6f9c1c7 100644 --- a/src/main/java/eu/dnetlib/repo/manager/config/Config.java +++ b/src/main/java/eu/dnetlib/repo/manager/config/Config.java @@ -24,7 +24,7 @@ public class Config { private static Logger LOGGER = Logger.getLogger(Config.class); - @Value("${redis.host:194.177.192.121}") + @Value("${redis.host}") private String host; @Value("${redis.port:6379}") @@ -38,15 +38,16 @@ public class Config { @PostConstruct private void init(){ - LOGGER.info(host); + LOGGER.info(String.format("Redis : %s Port : %s Password : %s",host,port,password)); } @Bean - JedisConnectionFactory connectionFactory() { + public JedisConnectionFactory connectionFactory() { LOGGER.info(String.format("Redis : %s Port : %s Password : %s",host,port,password)); JedisConnectionFactory jedisConnectionFactory = new JedisConnectionFactory(); jedisConnectionFactory.setHostName(host); jedisConnectionFactory.setPort(Integer.parseInt(port)); + jedisConnectionFactory.setUsePool(true); if(password != null) jedisConnectionFactory.setPassword(password); return jedisConnectionFactory; } diff --git a/src/main/java/eu/dnetlib/repo/manager/controllers/RepositoryController.java b/src/main/java/eu/dnetlib/repo/manager/controllers/RepositoryController.java index de661d6..a1238e9 100644 --- a/src/main/java/eu/dnetlib/repo/manager/controllers/RepositoryController.java +++ b/src/main/java/eu/dnetlib/repo/manager/controllers/RepositoryController.java @@ -1,5 +1,6 @@ package eu.dnetlib.repo.manager.controllers; +import eu.dnetlib.api.functionality.ValidatorServiceException; import eu.dnetlib.domain.data.Repository; import eu.dnetlib.domain.data.RepositoryInterface; import eu.dnetlib.repo.manager.domain.RepositorySnippet; @@ -139,7 +140,6 @@ public class RepositoryController { @RequestMapping(value = "/updateRepository", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE) @ResponseBody - //@PreAuthorize("hasRole('ROLE_USER') and #repository.registeredBy == authentication.userInfo.email") public Repository updateRepository(@RequestBody Repository repository,Authentication authentication) throws Exception { return repositoryService.updateRepository(repository, authentication); } @@ -158,7 +158,7 @@ public class RepositoryController { public RepositoryInterface addRepositoryInterface(@RequestParam("datatype") String datatype, @RequestParam("repoId") String repoId, @RequestParam("registeredBy") String registeredBy, - @RequestBody RepositoryInterface repositoryInterface) throws JSONException,ResourceNotFoundException { + @RequestBody RepositoryInterface repositoryInterface) throws JSONException, ResourceNotFoundException, ValidatorServiceException { return repositoryService.addRepositoryInterface(datatype, repoId, registeredBy, repositoryInterface); } diff --git a/src/main/java/eu/dnetlib/repo/manager/service/DashboardServiceImpl.java b/src/main/java/eu/dnetlib/repo/manager/service/DashboardServiceImpl.java index ed2496e..d2fef5f 100644 --- a/src/main/java/eu/dnetlib/repo/manager/service/DashboardServiceImpl.java +++ b/src/main/java/eu/dnetlib/repo/manager/service/DashboardServiceImpl.java @@ -32,63 +32,63 @@ public class DashboardServiceImpl implements DashboardService { private BrokerService brokerService; @Override - public List getRepositoriesSummaryInfo(@PathVariable("userEmail") String userEmail, - @PathVariable("page") String page, - @PathVariable("size") String size) throws JSONException { + public List getRepositoriesSummaryInfo(String userEmail, + String page, + String size){ List repositorySummaryInfoList = new ArrayList<>(); -try { + try { - List repositoriesOfUser = repositoryService.getRepositoriesOfUser(userEmail, page, size); - for(Repository repository: repositoriesOfUser) { + List repositoriesOfUser = repositoryService.getRepositoriesOfUser(userEmail, page, size); + for(Repository repository: repositoriesOfUser) { - RepositorySummaryInfo repositorySummaryInfo = new RepositorySummaryInfo(); - repositorySummaryInfo.setId(repository.getId()); - repositorySummaryInfo.setRepositoryName(repository.getOfficialName()); - repositorySummaryInfo.setLogoURL(repository.getLogoUrl()); + RepositorySummaryInfo repositorySummaryInfo = new RepositorySummaryInfo(); + repositorySummaryInfo.setId(repository.getId()); + repositorySummaryInfo.setRepositoryName(repository.getOfficialName()); + repositorySummaryInfo.setLogoURL(repository.getLogoUrl()); - //TODO getRepositoryAggregations returns only the 20 more recent items. Is it positive that we will find an indexed version there? - List aggregationDetailsList = repositoryService.getRepositoryAggregations(repository.getId()); - for(AggregationDetails aggregationDetails: aggregationDetailsList) { - if(aggregationDetails.getIndexedVersion()) { - repositorySummaryInfo.setRecordsCollected(aggregationDetails.getNumberOfRecords()); - repositorySummaryInfo.setLastIndexedVersion(aggregationDetails.getDate()); - break; + //TODO getRepositoryAggregations returns only the 20 more recent items. Is it positive that we will find an indexed version there? + List aggregationDetailsList = repositoryService.getRepositoryAggregations(repository.getId()); + for(AggregationDetails aggregationDetails: aggregationDetailsList) { + if(aggregationDetails.getIndexedVersion()) { + repositorySummaryInfo.setRecordsCollected(aggregationDetails.getNumberOfRecords()); + repositorySummaryInfo.setLastIndexedVersion(aggregationDetails.getDate()); + break; + } + } + + try { + + MetricsInfo metricsInfo = repositoryService.getMetricsInfoForRepository(repository.getId()); + repositorySummaryInfo.setTotalDownloads(metricsInfo.getMetricsNumbers().getTotalDownloads()); + repositorySummaryInfo.setTotalViews(metricsInfo.getMetricsNumbers().getTotalViews()); + + } catch (RepositoryServiceException e) { + logger.error("Exception getting metrics info for repository: " + repository.getId(), e); + } + + try { + + List events = brokerService.getTopicsForDatasource(repository.getOfficialName()); + Long totalEvents = 0L; + for(BrowseEntry browseEntry: events) + totalEvents += browseEntry.getSize(); + repositorySummaryInfo.setEnrichmentEvents(totalEvents); + + + } catch (BrokerException e) { + logger.error("Exception getting broker events for repository: " + repository.getId(), e); + } + + repositorySummaryInfoList.add(repositorySummaryInfo); } - } - try { - - MetricsInfo metricsInfo = repositoryService.getMetricsInfoForRepository(repository.getId()); - repositorySummaryInfo.setTotalDownloads(metricsInfo.getMetricsNumbers().getTotalDownloads()); - repositorySummaryInfo.setTotalViews(metricsInfo.getMetricsNumbers().getTotalViews()); - - } catch (RepositoryServiceException e) { - logger.error("Exception getting metrics info for repository: " + repository.getId(), e); - } - - try { - - List events = brokerService.getTopicsForDatasource(repository.getOfficialName()); - Long totalEvents = 0L; - for(BrowseEntry browseEntry: events) - totalEvents += browseEntry.getSize(); - repositorySummaryInfo.setEnrichmentEvents(totalEvents); - - - } catch (BrokerException e) { - logger.error("Exception getting broker events for repository: " + repository.getId(), e); - } - - repositorySummaryInfoList.add(repositorySummaryInfo); + } catch (Exception e) { + logger.error("Something baad happened!", e); + e.printStackTrace(); } -} catch (Exception e) { - logger.error("Something baad happened!", e); - e.printStackTrace(); -} - return repositorySummaryInfoList; } } diff --git a/src/main/java/eu/dnetlib/repo/manager/service/RepositoryService.java b/src/main/java/eu/dnetlib/repo/manager/service/RepositoryService.java index 341e85b..fb2ab36 100644 --- a/src/main/java/eu/dnetlib/repo/manager/service/RepositoryService.java +++ b/src/main/java/eu/dnetlib/repo/manager/service/RepositoryService.java @@ -1,5 +1,6 @@ package eu.dnetlib.repo.manager.service; +import eu.dnetlib.api.functionality.ValidatorServiceException; import eu.dnetlib.domain.data.Repository; import eu.dnetlib.domain.data.RepositoryInterface; import eu.dnetlib.repo.manager.domain.RepositorySnippet; @@ -45,7 +46,7 @@ public interface RepositoryService { RepositoryInterface addRepositoryInterface(String datatype, String repoId, String registeredBy, - RepositoryInterface iFace) throws JSONException,ResourceNotFoundException; + RepositoryInterface iFace) throws JSONException, ResourceNotFoundException, ValidatorServiceException; List getDnetCountries(); diff --git a/src/main/java/eu/dnetlib/repo/manager/service/RepositoryServiceImpl.java b/src/main/java/eu/dnetlib/repo/manager/service/RepositoryServiceImpl.java index 6ffc0fd..ccebaeb 100644 --- a/src/main/java/eu/dnetlib/repo/manager/service/RepositoryServiceImpl.java +++ b/src/main/java/eu/dnetlib/repo/manager/service/RepositoryServiceImpl.java @@ -152,9 +152,9 @@ public class RepositoryServiceImpl implements RepositoryService { @Override - public List getRepositoriesByCountry(@PathVariable("country") String country, - @PathVariable("mode") String mode, - @RequestParam(value = "managed",required=false) Boolean managed) throws JSONException, IOException { + public List getRepositoriesByCountry(String country, + String mode, + Boolean managed) throws JSONException, IOException { LOGGER.debug("Getting repositories by country!"); int page = 0; @@ -251,9 +251,9 @@ public class RepositoryServiceImpl implements RepositoryService { } @Override - public List getRepositoriesOfUser(@PathVariable("userEmail") String userEmail, - @PathVariable("page") String page, - @PathVariable("size") String size) throws JSONException { + public List getRepositoriesOfUser(String userEmail, + String page, + String size) throws JSONException { LOGGER.debug("Retreiving repositories of user : " + userEmail ); UriComponents uriComponents = searchDatasource(page,size); @@ -276,7 +276,7 @@ public class RepositoryServiceImpl implements RepositoryService { } @Override - public Repository getRepositoryById(@PathVariable("id") String id) throws JSONException,ResourceNotFoundException { + public Repository getRepositoryById(String id) throws JSONException,ResourceNotFoundException { LOGGER.debug("Retreiving repositories with id : " + id ); Repository repo = null; @@ -303,7 +303,7 @@ public class RepositoryServiceImpl implements RepositoryService { @Override - public List getRepositoryAggregations(@PathVariable("id") String id) throws JSONException { + public List getRepositoryAggregations(String id) throws JSONException { LOGGER.debug("Retreiving aggregations for repository with id : " + id ); UriComponents uriComponents = searchDatasource("0","100"); @@ -332,7 +332,7 @@ public class RepositoryServiceImpl implements RepositoryService { } @Override - public Map> getRepositoryAggregationsByYear(@PathVariable("id") String id) throws JSONException { + public Map> getRepositoryAggregationsByYear(String id) throws JSONException { LOGGER.debug("Retreiving aggregations (by year) for repository with id : " + id ); UriComponents uriComponents = searchDatasource("0","100"); RequestFilter requestFilter = new RequestFilter(); @@ -369,9 +369,9 @@ public class RepositoryServiceImpl implements RepositoryService { @Override - public List getRepositoriesByName(@PathVariable("name") String name, - @PathVariable("page") String page, - @PathVariable("size") String size) throws JSONException { + public List getRepositoriesByName(String name, + String page, + String size) throws JSONException { LOGGER.debug("Retreiving repositories with official name : " + name ); UriComponents uriComponents = searchDatasource("0","100"); @@ -393,7 +393,7 @@ public class RepositoryServiceImpl implements RepositoryService { } @Override - public List getRepositoryInterface(@PathVariable("id") String id) throws JSONException { + public List getRepositoryInterface(String id) throws JSONException { UriComponents uriComponents = UriComponentsBuilder .fromHttpUrl(baseAddress + "/ds/api/") @@ -412,8 +412,8 @@ public class RepositoryServiceImpl implements RepositoryService { } @Override - public Repository addRepository(@RequestParam("datatype") String datatype, - @RequestBody Repository repository) throws Exception { + public Repository addRepository(String datatype, + Repository repository) throws Exception { LOGGER.debug("storing " + datatype + " repository with id: " + repository.getId()); @@ -447,11 +447,6 @@ public class RepositoryServiceImpl implements RepositoryService { String json_repository = Converter.repositoryObjectToJson(repository); LOGGER.debug("JSON to add(update) -> " + json_repository); -// -// // TODO delete these 3 lines -// HttpHeaders temp = new HttpHeaders(); -// temp.setContentType(MediaType.APPLICATION_JSON_UTF8); - HttpEntity httpEntity = new HttpEntity(json_repository, httpHeaders); ResponseEntity responseEntity = restTemplate.exchange(uriComponents.toUri(),HttpMethod.POST, httpEntity, ResponseEntity.class); @@ -472,7 +467,7 @@ public class RepositoryServiceImpl implements RepositoryService { } @Override - public Repository updateRepository(@RequestBody Repository repository,Authentication authentication) throws Exception { + public Repository updateRepository(Repository repository,Authentication authentication) throws Exception { UriComponents uriComponents = UriComponentsBuilder .fromHttpUrl(baseAddress + "/ds/update/") .build() @@ -501,31 +496,6 @@ public class RepositoryServiceImpl implements RepositoryService { } } - private void updateInterface(String datatype,RepositoryInterface iFace) { - //TODO call update base url - //((DatasourceManagerService) this.dmService.getService()).updateBaseUrl(repo.getId(), iFace.getId(), iFace.getBaseUrl()); - if (!iFace.getAccessSet().isEmpty()) { - LOGGER.debug("set not empty: " + iFace.getAccessSet()); - //TODO call update method for access params - // ((DatasourceManagerService) this.dmService.getService()).updateAccessParam(repo.getId(), iFace.getId(), "set", iFace.getAccessSet(), false); - } else { - //TODO call deleteAccessParamOrExtraField - //((DatasourceManagerService) this.dmService.getService()).deleteAccessParamOrExtraField(repo.getId(), iFace.getId(), "set"); - } - //TODO update content description - //((DatasourceManagerService) this.dmService.getService()).updateContentDescription(repo.getId(), iFace.getId(), "metadata"); - if (datatype.equals("re3data")) { - //TODO call update access params - // ((DatasourceManagerService) this.dmService.getService()).updateAccessParam(repo.getId(), iFace.getId(), "format", "oai_datacite", false); - iFace.setAccessFormat("oai_datacite"); - } else { - //TODO call update access params - //((DatasourceManagerService) this.dmService.getService()).updateAccessParam(repo.getId(), iFace.getId(), "format", "oai_dc", false); - iFace.setAccessFormat("oai_dc"); - } - - } - private void storeRepository(Repository repository, Authentication authentication) throws Exception { Date utilDate = new Date(); @@ -551,8 +521,8 @@ public class RepositoryServiceImpl implements RepositoryService { } @Override - public void deleteRepositoryInterface(@RequestParam("id") String id , - @RequestParam("registeredBy") String registeredBy){ + public void deleteRepositoryInterface(String id , + String registeredBy){ UriComponents uriComponents = UriComponentsBuilder .fromHttpUrl(baseAddress + "/ds/api/") .path("/{id}") @@ -562,10 +532,10 @@ public class RepositoryServiceImpl implements RepositoryService { } @Override - public RepositoryInterface addRepositoryInterface(@RequestParam("datatype") String datatype, - @RequestParam("repoId") String repoId, - @RequestParam("registeredBy") String registeredBy, - @RequestBody RepositoryInterface repositoryInterface) throws JSONException,ResourceNotFoundException { + public RepositoryInterface addRepositoryInterface(String datatype, + String repoId, + String registeredBy, + RepositoryInterface repositoryInterface) throws JSONException, ResourceNotFoundException, ValidatorServiceException { try { Repository e = this.getRepositoryById(repoId); repositoryInterface = createRepositoryInterface(e,repositoryInterface,datatype); @@ -576,11 +546,13 @@ public class RepositoryServiceImpl implements RepositoryService { .build() .encode(); - HttpEntity httpEntity = new HttpEntity (json_interface,httpHeaders); + HttpEntity httpEntity = new HttpEntity <> (json_interface,httpHeaders); restTemplate.postForObject(uriComponents.toUri(),httpEntity,String.class); + submitInterfaceValidation(e, registeredBy, repositoryInterface); + return repositoryInterface; - } catch (JSONException e) { + } catch (JSONException | ValidatorServiceException e) { LOGGER.debug("Exception on addRepositoryInterface" , e); emailUtils.reportException(e); throw e; @@ -588,17 +560,18 @@ public class RepositoryServiceImpl implements RepositoryService { } @Override - public RepositoryInterface updateRepositoryInterface(@RequestParam("repoId") String repoId, - @RequestParam("registeredBy") String registeredBy, - @RequestBody RepositoryInterface repositoryInterface) throws Exception { + public RepositoryInterface updateRepositoryInterface(String repoId, + String registeredBy, + RepositoryInterface repositoryInterface) throws Exception { this.updateBaseUrl(repoId,repositoryInterface.getId(),repositoryInterface.getBaseUrl()); this.updateCompliance(repoId,repositoryInterface.getId(),repositoryInterface.getCompliance()); this.updateValidationSet(repoId,repositoryInterface.getId(),repositoryInterface.getAccessSet()); + submitInterfaceValidation(getRepositoryById(repoId),registeredBy,repositoryInterface); return repositoryInterface; } - private void submitInterfaceValidation(Repository repo, String repoType, String userEmail, RepositoryInterface iFace) throws ValidatorServiceException { + private void submitInterfaceValidation(Repository repo, String userEmail, RepositoryInterface iFace) throws ValidatorServiceException { JobForValidation job = new JobForValidation(); job.setActivationId(UUID.randomUUID().toString()); @@ -607,11 +580,10 @@ public class RepositoryServiceImpl implements RepositoryService { job.setDatasourceId(repo.getId()); job.setDesiredCompatibilityLevel(iFace.getDesiredCompatibilityLevel()); job.setInterfaceId(iFace.getId()); -// job.setInterfaceIdOld(null); job.setOfficialName(repo.getOfficialName()); - job.setRepoType(repoType); + job.setRepoType(repo.getDatasourceType()); job.setUserEmail(userEmail); - job.setValidationSet(iFace.getAccessSet()); + job.setValidationSet((iFace.getAccessSet().isEmpty() ? "none" : iFace.getAccessSet())); job.setRecords(-1); job.setRegistration(true); job.setUpdateExisting(false); @@ -645,9 +617,10 @@ public class RepositoryServiceImpl implements RepositoryService { iFace.setAccessProtocol("oai"); iFace.setMetadataIdentifierPath("//*[local-name()='header']/*[local-name()='identifier']"); iFace.setId("api_________::" + repo.getId() + "::" + UUID.randomUUID().toString().substring(0, 8)); - if (iFace.getAccessSet().isEmpty()) { + if (iFace.getAccessSet() == null || iFace.getAccessSet().isEmpty()) { LOGGER.debug("set is empty: " + iFace.getAccessSet()); iFace.removeAccessSet(); + iFace.setAccessSet("none"); } return iFace; } @@ -670,9 +643,9 @@ public class RepositoryServiceImpl implements RepositoryService { } @Override - public List getUrlsOfUserRepos(@PathVariable("user_email") String userEmail, - @PathVariable("page") String page, - @PathVariable("size") String size) throws JSONException { + public List getUrlsOfUserRepos(String userEmail, + String page, + String size){ UriComponents uriComponents = UriComponentsBuilder .fromHttpUrl(baseAddress + "/api/baseurl/") .path("/{page}/{size}") @@ -690,7 +663,7 @@ public class RepositoryServiceImpl implements RepositoryService { } @Override - public List getDatasourceVocabularies(@PathVariable("mode") String mode) { + public List getDatasourceVocabularies(String mode) { List resultSet = new ArrayList<>(); for (Map.Entry entry : this.getVocabulary("dnet:datasource_typologies").getAsMap().entrySet()) { @@ -723,7 +696,7 @@ public class RepositoryServiceImpl implements RepositoryService { @Override - public Map getCompatibilityClasses(@PathVariable("mode") String mode) { + public Map getCompatibilityClasses(String mode) { LOGGER.debug("Getting compatibility classes for mode: " + mode); Map retMap = new HashMap(); @@ -752,7 +725,7 @@ public class RepositoryServiceImpl implements RepositoryService { } @Override - public Map getDatasourceClasses(@PathVariable("mode") String mode) { + public Map getDatasourceClasses(String mode) { LOGGER.debug("Getting datasource classes for mode: " + mode); @@ -793,7 +766,7 @@ public class RepositoryServiceImpl implements RepositoryService { } @Override - public MetricsInfo getMetricsInfoForRepository(@PathVariable("repoId") String repoId) throws RepositoryServiceException { + public MetricsInfo getMetricsInfoForRepository(String repoId) throws RepositoryServiceException { try { MetricsInfo metricsInfo = new MetricsInfo(); @@ -809,7 +782,7 @@ public class RepositoryServiceImpl implements RepositoryService { } @Override - public Map getListLatestUpdate(@PathVariable("mode") String mode) throws JSONException { + public Map getListLatestUpdate(String mode) throws JSONException { if(mode.equals("opendoar")) return Collections.singletonMap("lastCollectionDate", getRepositoryInterface("openaire____::"+mode).get(0).getLastCollectionDate()); else diff --git a/src/main/java/eu/dnetlib/repo/manager/service/SushiliteServiceImpl.java b/src/main/java/eu/dnetlib/repo/manager/service/SushiliteServiceImpl.java index a7d6d97..76e7e28 100644 --- a/src/main/java/eu/dnetlib/repo/manager/service/SushiliteServiceImpl.java +++ b/src/main/java/eu/dnetlib/repo/manager/service/SushiliteServiceImpl.java @@ -34,18 +34,18 @@ public class SushiliteServiceImpl implements SushiliteService { @Override @PreAuthorize("hasRole('ROLE_USER')") - public ReportResponseWrapper getReportResults(@PathVariable("page") String page, - @PathVariable("pageSize") String pageSize, - @RequestParam(value = "Report") String Report, - @RequestParam(value = "Release",defaultValue="4") String Release, - @RequestParam(value = "RequestorID",required=false,defaultValue="anonymous") String RequestorID, - @RequestParam(value = "BeginDate",required=false,defaultValue="") String BeginDate, - @RequestParam(value = "EndDate",required=false,defaultValue="") String EndDate, - @RequestParam(value = "RepositoryIdentifier") String RepositoryIdentifier, - @RequestParam(value = "ItemIdentifier",required=false,defaultValue="") String ItemIdentifier, - @RequestParam(value = "ItemDataType",required=false,defaultValue="") String ItemDataType, - @RequestParam(value = "Granularity") String Granularity, - @RequestParam(value = "Pretty",required=false,defaultValue="") String Pretty) { + public ReportResponseWrapper getReportResults(String page, + String pageSize, + String Report, + String Release, + String RequestorID, + String BeginDate, + String EndDate, + String RepositoryIdentifier, + String ItemIdentifier, + String ItemDataType, + String Granularity, + String Pretty) { //build the uri params UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(this.usagestatsSushiliteEndpoint + "GetReport/") diff --git a/src/main/java/eu/dnetlib/repo/manager/service/ValidatorServiceImpl.java b/src/main/java/eu/dnetlib/repo/manager/service/ValidatorServiceImpl.java index 6edb48d..b8d28fc 100644 --- a/src/main/java/eu/dnetlib/repo/manager/service/ValidatorServiceImpl.java +++ b/src/main/java/eu/dnetlib/repo/manager/service/ValidatorServiceImpl.java @@ -88,7 +88,7 @@ public class ValidatorServiceImpl implements ValidatorService { @Override @PreAuthorize("hasRole('ROLE_USER') and #jobForValidation.userEmail == authentication.userInfo.email") - public JobForValidation submitJobForValidation(@RequestBody JobForValidation jobForValidation) throws ValidatorServiceException { + public JobForValidation submitJobForValidation(JobForValidation jobForValidation) throws ValidatorServiceException { LOGGER.debug("Submit job for validation with id : " + jobForValidation.getDatasourceId()); try { emailUtils.sendSubmitJobForValidationEmail(SecurityContextHolder.getContext().getAuthentication(),jobForValidation); @@ -105,8 +105,8 @@ public class ValidatorServiceImpl implements ValidatorService { @Override @PreAuthorize("hasRole('ROLE_USER') and #email == authentication.userInfo.email") - public ResponseEntity reSubmitJobForValidation(@PathVariable("email") String email, - @PathVariable("jobId") String jobId) throws JSONException, ValidatorServiceException { + public ResponseEntity reSubmitJobForValidation(String email, + String jobId) throws JSONException, ValidatorServiceException { LOGGER.debug("Resubmit validation job with id : " + jobId); StoredJob job = monitorApi.getJobSummary(jobId,"all"); Set contentRules = new HashSet(); @@ -136,13 +136,13 @@ public class ValidatorServiceImpl implements ValidatorService { } @Override - public List getRuleSets(@PathVariable("mode") String mode) { + public List getRuleSets(String mode) { LOGGER.info("Getting rulesets for mode: " + mode); return rulesetMap.get(mode); } @Override - public List getSetsOfRepository(@RequestParam(value = "url", required = true) String url) { + public List getSetsOfRepository(String url) { LOGGER.debug("Getting sets of repository with url : " + url); try { return OaiTools.getSetsOfRepo(url); @@ -154,7 +154,7 @@ public class ValidatorServiceImpl implements ValidatorService { } @Override - public boolean identifyRepo(@RequestParam(value = "url", required = true) String url) { + public boolean identifyRepo(String url) { LOGGER.debug("Identify repository with url : " + url); try { return OaiTools.identifyRepository(url); @@ -166,7 +166,7 @@ public class ValidatorServiceImpl implements ValidatorService { } @Override - public RuleSet getRuleSet(@PathVariable("acronym") String acronym) { + public RuleSet getRuleSet(String acronym) { LOGGER.debug("Getting ruleset with acronym : " + acronym); RuleSet ruleSet = null; try { @@ -187,15 +187,13 @@ public class ValidatorServiceImpl implements ValidatorService { @Override @PreAuthorize("hasRole('ROLE_USER')") - public List getStoredJobsNew(@RequestParam("user") @ApiParam(value = "User email", required = true) String user, - @RequestParam(value = "jobType", required = false) - @ApiParam(value = "Equals to filter job type on validation history page") String jobType, - @RequestParam("offset") @ApiParam(value = "Page number", required = true) String offset, - @RequestParam(value = "limit", required = false,defaultValue = "10") @ApiParam(value = "Null value") String limit, - @RequestParam(value = "dateFrom", required = false) @ApiParam(value = "Null value") String dateFrom, - @RequestParam(value = "dateTo", required = false) @ApiParam(value = "Null value") String dateTo, - @RequestParam("validationStatus") @ApiParam(value = "Equals to filter validation jobs", required = true) String validationStatus - ) throws ValidatorServiceException { + public List getStoredJobsNew(String user, + String jobType, + String offset, + String limit, + String dateFrom, + String dateTo, + String validationStatus ) throws ValidatorServiceException { return getValidationService().getStoredJobsNew(user, jobType, Integer.parseInt(offset), Integer.parseInt(limit), dateFrom, dateTo, validationStatus); } @@ -205,7 +203,7 @@ public class ValidatorServiceImpl implements ValidatorService { } @Override - public InterfaceInformation getInterfaceInformation(@RequestParam(value = "baseUrl", required = true) String baseUrl) throws ValidationServiceException { + public InterfaceInformation getInterfaceInformation(String baseUrl) throws ValidationServiceException { try { LOGGER.debug("Getting interface information with url: " + baseUrl); InterfaceInformation interfaceInformation = new InterfaceInformation();