Triggering validation job from provide on Interface Update and Interface Add
This commit is contained in:
parent
fa94488f3f
commit
8b1ad0b920
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -32,63 +32,63 @@ public class DashboardServiceImpl implements DashboardService {
|
|||
private BrokerService brokerService;
|
||||
|
||||
@Override
|
||||
public List<RepositorySummaryInfo> getRepositoriesSummaryInfo(@PathVariable("userEmail") String userEmail,
|
||||
@PathVariable("page") String page,
|
||||
@PathVariable("size") String size) throws JSONException {
|
||||
public List<RepositorySummaryInfo> getRepositoriesSummaryInfo(String userEmail,
|
||||
String page,
|
||||
String size){
|
||||
|
||||
List<RepositorySummaryInfo> repositorySummaryInfoList = new ArrayList<>();
|
||||
|
||||
try {
|
||||
try {
|
||||
|
||||
List<Repository> repositoriesOfUser = repositoryService.getRepositoriesOfUser(userEmail, page, size);
|
||||
for(Repository repository: repositoriesOfUser) {
|
||||
List<Repository> 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<AggregationDetails> 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<AggregationDetails> 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<BrowseEntry> 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<BrowseEntry> 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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<String> getDnetCountries();
|
||||
|
||||
|
|
|
@ -152,9 +152,9 @@ public class RepositoryServiceImpl implements RepositoryService {
|
|||
|
||||
|
||||
@Override
|
||||
public List<RepositorySnippet> getRepositoriesByCountry(@PathVariable("country") String country,
|
||||
@PathVariable("mode") String mode,
|
||||
@RequestParam(value = "managed",required=false) Boolean managed) throws JSONException, IOException {
|
||||
public List<RepositorySnippet> 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<Repository> getRepositoriesOfUser(@PathVariable("userEmail") String userEmail,
|
||||
@PathVariable("page") String page,
|
||||
@PathVariable("size") String size) throws JSONException {
|
||||
public List<Repository> 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<AggregationDetails> getRepositoryAggregations(@PathVariable("id") String id) throws JSONException {
|
||||
public List<AggregationDetails> 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<String, List<AggregationDetails>> getRepositoryAggregationsByYear(@PathVariable("id") String id) throws JSONException {
|
||||
public Map<String, List<AggregationDetails>> 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<Repository> getRepositoriesByName(@PathVariable("name") String name,
|
||||
@PathVariable("page") String page,
|
||||
@PathVariable("size") String size) throws JSONException {
|
||||
public List<Repository> 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<RepositoryInterface> getRepositoryInterface(@PathVariable("id") String id) throws JSONException {
|
||||
public List<RepositoryInterface> 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<String> httpEntity = new HttpEntity<String>(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<String> httpEntity = new HttpEntity <String> (json_interface,httpHeaders);
|
||||
HttpEntity<String> 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<String> getUrlsOfUserRepos(@PathVariable("user_email") String userEmail,
|
||||
@PathVariable("page") String page,
|
||||
@PathVariable("size") String size) throws JSONException {
|
||||
public List<String> 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<String> getDatasourceVocabularies(@PathVariable("mode") String mode) {
|
||||
public List<String> getDatasourceVocabularies(String mode) {
|
||||
|
||||
List<String> resultSet = new ArrayList<>();
|
||||
for (Map.Entry<String, String> entry : this.getVocabulary("dnet:datasource_typologies").getAsMap().entrySet()) {
|
||||
|
@ -723,7 +696,7 @@ public class RepositoryServiceImpl implements RepositoryService {
|
|||
|
||||
|
||||
@Override
|
||||
public Map<String, String> getCompatibilityClasses(@PathVariable("mode") String mode) {
|
||||
public Map<String, String> getCompatibilityClasses(String mode) {
|
||||
|
||||
LOGGER.debug("Getting compatibility classes for mode: " + mode);
|
||||
Map<String, String> retMap = new HashMap<String, String>();
|
||||
|
@ -752,7 +725,7 @@ public class RepositoryServiceImpl implements RepositoryService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> getDatasourceClasses(@PathVariable("mode") String mode) {
|
||||
public Map<String, String> 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<String, String> getListLatestUpdate(@PathVariable("mode") String mode) throws JSONException {
|
||||
public Map<String, String> getListLatestUpdate(String mode) throws JSONException {
|
||||
if(mode.equals("opendoar"))
|
||||
return Collections.singletonMap("lastCollectionDate", getRepositoryInterface("openaire____::"+mode).get(0).getLastCollectionDate());
|
||||
else
|
||||
|
|
|
@ -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/")
|
||||
|
|
|
@ -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<Object> reSubmitJobForValidation(@PathVariable("email") String email,
|
||||
@PathVariable("jobId") String jobId) throws JSONException, ValidatorServiceException {
|
||||
public ResponseEntity<Object> reSubmitJobForValidation(String email,
|
||||
String jobId) throws JSONException, ValidatorServiceException {
|
||||
LOGGER.debug("Resubmit validation job with id : " + jobId);
|
||||
StoredJob job = monitorApi.getJobSummary(jobId,"all");
|
||||
Set<Integer> contentRules = new HashSet<Integer>();
|
||||
|
@ -136,13 +136,13 @@ public class ValidatorServiceImpl implements ValidatorService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<RuleSet> getRuleSets(@PathVariable("mode") String mode) {
|
||||
public List<RuleSet> getRuleSets(String mode) {
|
||||
LOGGER.info("Getting rulesets for mode: " + mode);
|
||||
return rulesetMap.get(mode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getSetsOfRepository(@RequestParam(value = "url", required = true) String url) {
|
||||
public List<String> 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<StoredJob> 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<StoredJob> 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();
|
||||
|
|
Loading…
Reference in New Issue