Compare commits
9 Commits
master
...
new-dataso
Author | SHA1 | Date |
---|---|---|
Konstantinos Spyrou | 54f3ad2bd2 | |
Konstantinos Spyrou | 36aa53273e | |
Konstantinos Spyrou | 3149357f8e | |
Konstantinos Spyrou | 7aa70bff48 | |
Konstantinos Spyrou | d72e669eff | |
Antonis Lempesis | 9d2fd6d51c | |
Antonis Lempesis | db094db709 | |
Antonis Lempesis | 504efc4244 | |
Antonis Lempesis | f4516845dd |
38
pom.xml
38
pom.xml
|
@ -137,21 +137,21 @@
|
||||||
<!-- <artifactId>log4j</artifactId>-->
|
<!-- <artifactId>log4j</artifactId>-->
|
||||||
<!-- <version>${log4j.version}</version>-->
|
<!-- <version>${log4j.version}</version>-->
|
||||||
<!-- </dependency>-->
|
<!-- </dependency>-->
|
||||||
<dependency>
|
<!-- <dependency>-->
|
||||||
<groupId>eu.dnetlib</groupId>
|
<!-- <groupId>eu.dnetlib</groupId>-->
|
||||||
<artifactId>uoa-domain</artifactId>
|
<!-- <artifactId>uoa-domain</artifactId>-->
|
||||||
<version>[2.0.0-SNAPSHOT, 3.0.0)</version>
|
<!-- <version>[2.0.0-SNAPSHOT, 3.0.0)</version>-->
|
||||||
<exclusions>
|
<!-- <exclusions>-->
|
||||||
<exclusion> <!-- declare the exclusion here -->
|
<!-- <exclusion> <!– declare the exclusion here –>-->
|
||||||
<groupId>cglib</groupId>
|
<!-- <groupId>cglib</groupId>-->
|
||||||
<artifactId>cglib</artifactId>
|
<!-- <artifactId>cglib</artifactId>-->
|
||||||
</exclusion>
|
<!-- </exclusion>-->
|
||||||
<exclusion>
|
<!-- <exclusion>-->
|
||||||
<groupId>log4j</groupId>
|
<!-- <groupId>log4j</groupId>-->
|
||||||
<artifactId>log4j</artifactId>
|
<!-- <artifactId>log4j</artifactId>-->
|
||||||
</exclusion>
|
<!-- </exclusion>-->
|
||||||
</exclusions>
|
<!-- </exclusions>-->
|
||||||
</dependency>
|
<!-- </dependency>-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>eu.dnetlib</groupId>
|
<groupId>eu.dnetlib</groupId>
|
||||||
<artifactId>dnet-openaire-usage-stats-sushilite</artifactId>
|
<artifactId>dnet-openaire-usage-stats-sushilite</artifactId>
|
||||||
|
@ -308,10 +308,10 @@
|
||||||
<version>${jedis.version}</version>
|
<version>${jedis.version}</version>
|
||||||
<!--<version>3.7.0</version>-->
|
<!--<version>3.7.0</version>-->
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.commons</groupId>
|
<groupId>org.apache.commons</groupId>
|
||||||
<artifactId>commons-pool2</artifactId>
|
<artifactId>commons-pool2</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.google.code.gson</groupId>
|
<groupId>com.google.code.gson</groupId>
|
||||||
<artifactId>gson</artifactId>
|
<artifactId>gson</artifactId>
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package eu.dnetlib.repo.manager.config;
|
package eu.dnetlib.repo.manager.config;
|
||||||
|
|
||||||
import eu.dnetlib.repo.manager.service.ValidatorServiceImpl;
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler;
|
import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
|
@ -15,9 +15,12 @@ import gr.uoa.di.driver.util.StaticServiceLocator;
|
||||||
import gr.uoa.di.driver.xml.VocabularyXmlConverter;
|
import gr.uoa.di.driver.xml.VocabularyXmlConverter;
|
||||||
import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
|
import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.context.annotation.*;
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.ComponentScan;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
|
@ComponentScan(basePackages = {"org.eurocris.openaire.cris.validator.service"})
|
||||||
public class Config {
|
public class Config {
|
||||||
|
|
||||||
@Value("${services.provide.iSLookUpService.url}")
|
@Value("${services.provide.iSLookUpService.url}")
|
||||||
|
@ -26,7 +29,7 @@ public class Config {
|
||||||
@Value("${services.provide.validatorService.url}")
|
@Value("${services.provide.validatorService.url}")
|
||||||
private String validatorUrl;
|
private String validatorUrl;
|
||||||
|
|
||||||
@Bean(name="vocabularyLoader")
|
@Bean(name = "vocabularyLoader")
|
||||||
public VocabularyLoader createVocabularyLoader() throws Exception {
|
public VocabularyLoader createVocabularyLoader() throws Exception {
|
||||||
ISVocabularyLoader loader = new ISVocabularyLoader();
|
ISVocabularyLoader loader = new ISVocabularyLoader();
|
||||||
|
|
||||||
|
|
|
@ -7,14 +7,14 @@ import org.apache.log4j.Logger;
|
||||||
import org.mitre.openid.connect.client.OIDCAuthoritiesMapper;
|
import org.mitre.openid.connect.client.OIDCAuthoritiesMapper;
|
||||||
import org.mitre.openid.connect.model.UserInfo;
|
import org.mitre.openid.connect.model.UserInfo;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.context.annotation.ComponentScan;
|
|
||||||
import org.springframework.security.core.GrantedAuthority;
|
import org.springframework.security.core.GrantedAuthority;
|
||||||
import org.springframework.security.core.authority.SimpleGrantedAuthority;
|
import org.springframework.security.core.authority.SimpleGrantedAuthority;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.Collection;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
@ComponentScan
|
|
||||||
@Component
|
@Component
|
||||||
public class OpenAIREAuthoritiesMapper implements OIDCAuthoritiesMapper {
|
public class OpenAIREAuthoritiesMapper implements OIDCAuthoritiesMapper {
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,8 @@ package eu.dnetlib.repo.manager.config;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.context.annotation.*;
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.data.redis.connection.jedis.JedisConnectionFactory;
|
import org.springframework.data.redis.connection.jedis.JedisConnectionFactory;
|
||||||
import org.springframework.http.HttpHeaders;
|
import org.springframework.http.HttpHeaders;
|
||||||
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
||||||
|
@ -15,9 +16,6 @@ import javax.annotation.PostConstruct;
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
@EnableRedisHttpSession
|
@EnableRedisHttpSession
|
||||||
@ComponentScan(basePackages = {
|
|
||||||
"org.eurocris.openaire.cris.validator.service",
|
|
||||||
"eu.dnetlib.repo.manager.*"})
|
|
||||||
public class RedisConfiguration {
|
public class RedisConfiguration {
|
||||||
|
|
||||||
private static Logger LOGGER = Logger.getLogger(RedisConfiguration.class);
|
private static Logger LOGGER = Logger.getLogger(RedisConfiguration.class);
|
||||||
|
@ -35,18 +33,18 @@ public class RedisConfiguration {
|
||||||
private String domain;
|
private String domain;
|
||||||
|
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
private void init(){
|
private void init() {
|
||||||
LOGGER.info(String.format("Redis : %s Port : %s Password : %s",host,port,password));
|
LOGGER.info(String.format("Redis : %s Port : %s Password : %s", host, port, password));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public JedisConnectionFactory connectionFactory() {
|
public JedisConnectionFactory connectionFactory() {
|
||||||
LOGGER.info(String.format("Redis : %s Port : %s Password : %s",host,port,password));
|
LOGGER.info(String.format("Redis : %s Port : %s Password : %s", host, port, password));
|
||||||
JedisConnectionFactory jedisConnectionFactory = new JedisConnectionFactory();
|
JedisConnectionFactory jedisConnectionFactory = new JedisConnectionFactory();
|
||||||
jedisConnectionFactory.setHostName(host);
|
jedisConnectionFactory.setHostName(host);
|
||||||
jedisConnectionFactory.setPort(Integer.parseInt(port));
|
jedisConnectionFactory.setPort(Integer.parseInt(port));
|
||||||
jedisConnectionFactory.setUsePool(true);
|
jedisConnectionFactory.setUsePool(true);
|
||||||
if(password != null) jedisConnectionFactory.setPassword(password);
|
if (password != null) jedisConnectionFactory.setPassword(password);
|
||||||
return jedisConnectionFactory;
|
return jedisConnectionFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
package eu.dnetlib.repo.manager.config;
|
package eu.dnetlib.repo.manager.config;
|
||||||
|
|
||||||
import eu.dnetlib.repo.manager.controllers.*;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.ComponentScan;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
||||||
import springfox.documentation.builders.PathSelectors;
|
import springfox.documentation.builders.PathSelectors;
|
||||||
|
@ -23,16 +21,6 @@ import java.util.ArrayList;
|
||||||
@Configuration
|
@Configuration
|
||||||
@EnableSwagger2
|
@EnableSwagger2
|
||||||
@EnableWebMvc
|
@EnableWebMvc
|
||||||
@ComponentScan(basePackageClasses = {
|
|
||||||
RepositoryController.class,
|
|
||||||
MonitorController.class,
|
|
||||||
ValidatorController.class,
|
|
||||||
PiWikController.class,
|
|
||||||
BrokerController.class,
|
|
||||||
StatsController.class,
|
|
||||||
UserController.class,
|
|
||||||
SushiliteController.class
|
|
||||||
},basePackages = "eu.dnetlib.repo.manager.*")
|
|
||||||
public class SwaggerConfig {
|
public class SwaggerConfig {
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package eu.dnetlib.repo.manager.controllers;
|
package eu.dnetlib.repo.manager.controllers;
|
||||||
|
|
||||||
import eu.dnetlib.repo.manager.domain.BrokerException;
|
import eu.dnetlib.repo.manager.exception.BrokerException;
|
||||||
import eu.dnetlib.repo.manager.domain.Term;
|
import eu.dnetlib.repo.manager.domain.Term;
|
||||||
import eu.dnetlib.repo.manager.domain.broker.*;
|
import eu.dnetlib.repo.manager.domain.broker.*;
|
||||||
import eu.dnetlib.repo.manager.service.BrokerServiceImpl;
|
import eu.dnetlib.repo.manager.service.BrokerServiceImpl;
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
package eu.dnetlib.repo.manager.controllers;
|
package eu.dnetlib.repo.manager.controllers;
|
||||||
|
|
||||||
import eu.dnetlib.repo.manager.domain.*;
|
import eu.dnetlib.repo.manager.domain.*;
|
||||||
|
import eu.dnetlib.repo.manager.exception.BrokerException;
|
||||||
|
import eu.dnetlib.repo.manager.exception.RepositoryServiceException;
|
||||||
import eu.dnetlib.repo.manager.service.BrokerService;
|
import eu.dnetlib.repo.manager.service.BrokerService;
|
||||||
import eu.dnetlib.repo.manager.service.DashboardService;
|
import eu.dnetlib.repo.manager.service.DashboardService;
|
||||||
import eu.dnetlib.repo.manager.service.PiWikService;
|
import eu.dnetlib.repo.manager.service.PiWikService;
|
||||||
|
@ -33,7 +35,7 @@ public class DashboardController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private PiWikService piWikService;
|
private PiWikService piWikService;
|
||||||
|
|
||||||
@RequestMapping(value = "/getRepositoriesSummary/{page}/{size}" , method = RequestMethod.GET,
|
@RequestMapping(value = "/getRepositoriesSummary/{page}/{size}", method = RequestMethod.GET,
|
||||||
produces = MediaType.APPLICATION_JSON_VALUE)
|
produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
@PreAuthorize("hasAuthority('REGISTERED_USER')")
|
@PreAuthorize("hasAuthority('REGISTERED_USER')")
|
||||||
|
@ -43,7 +45,7 @@ public class DashboardController {
|
||||||
return dashboardService.getRepositoriesSummaryInfo(((OIDCAuthenticationToken) SecurityContextHolder.getContext().getAuthentication()).getUserInfo().getEmail(), page, size);
|
return dashboardService.getRepositoriesSummaryInfo(((OIDCAuthenticationToken) SecurityContextHolder.getContext().getAuthentication()).getUserInfo().getEmail(), page, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value = "/collectionMonitorSummary/{repoId}" , method = RequestMethod.GET,
|
@RequestMapping(value = "/collectionMonitorSummary/{repoId}", method = RequestMethod.GET,
|
||||||
produces = MediaType.APPLICATION_JSON_VALUE)
|
produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
@PreAuthorize("hasAuthority('REGISTERED_USER')")
|
@PreAuthorize("hasAuthority('REGISTERED_USER')")
|
||||||
|
@ -51,25 +53,25 @@ public class DashboardController {
|
||||||
@PathVariable("repoId") String repoId,
|
@PathVariable("repoId") String repoId,
|
||||||
@RequestParam(name = "size", required = false, defaultValue = "20") int size) throws JSONException {
|
@RequestParam(name = "size", required = false, defaultValue = "20") int size) throws JSONException {
|
||||||
|
|
||||||
List<AggregationDetails> aggregationDetails = repositoryService.getRepositoryAggregations(repoId,0,size);
|
List<AggregationDetails> aggregationDetails = repositoryService.getRepositoryAggregations(repoId, 0, size);
|
||||||
CollectionMonitorSummary collectionMonitorSummary = new CollectionMonitorSummary();
|
CollectionMonitorSummary collectionMonitorSummary = new CollectionMonitorSummary();
|
||||||
collectionMonitorSummary.setAggregationDetails(aggregationDetails);
|
collectionMonitorSummary.setAggregationDetails(aggregationDetails);
|
||||||
size=0;
|
size = 0;
|
||||||
do {
|
do {
|
||||||
aggregationDetails = repositoryService.getRepositoryAggregations(repoId,size,size+50);
|
aggregationDetails = repositoryService.getRepositoryAggregations(repoId, size, size + 50);
|
||||||
for(AggregationDetails aggregationDetail : aggregationDetails){
|
for (AggregationDetails aggregationDetail : aggregationDetails) {
|
||||||
if(aggregationDetail.getIndexedVersion()){
|
if (aggregationDetail.getIndexedVersion()) {
|
||||||
collectionMonitorSummary.setLastIndexedVersion(aggregationDetail);
|
collectionMonitorSummary.setLastIndexedVersion(aggregationDetail);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
size+=30;
|
size += 30;
|
||||||
}while (aggregationDetails.size() != 0 && collectionMonitorSummary.getLastIndexedVersion()==null);
|
} while (aggregationDetails.size() != 0 && collectionMonitorSummary.getLastIndexedVersion() == null);
|
||||||
|
|
||||||
return collectionMonitorSummary;
|
return collectionMonitorSummary;
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value = "/usageSummary/{repoId}" , method = RequestMethod.GET,
|
@RequestMapping(value = "/usageSummary/{repoId}", method = RequestMethod.GET,
|
||||||
produces = MediaType.APPLICATION_JSON_VALUE)
|
produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
@PreAuthorize("hasAuthority('REGISTERED_USER')")
|
@PreAuthorize("hasAuthority('REGISTERED_USER')")
|
||||||
|
@ -79,16 +81,14 @@ public class DashboardController {
|
||||||
return new UsageSummary(repositoryService.getMetricsInfoForRepository(repoId), piWikService.getPiwikSiteForRepo(repoId));
|
return new UsageSummary(repositoryService.getMetricsInfoForRepository(repoId), piWikService.getPiwikSiteForRepo(repoId));
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value = "/brokerSummary/{ds_name}" , method = RequestMethod.GET,
|
@RequestMapping(value = "/brokerSummary/{ds_name}", method = RequestMethod.GET,
|
||||||
produces = MediaType.APPLICATION_JSON_VALUE)
|
produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
@PreAuthorize("hasAuthority('REGISTERED_USER')")
|
@PreAuthorize("hasAuthority('REGISTERED_USER')")
|
||||||
public BrokerSummary getBrokerSummary(
|
public BrokerSummary getBrokerSummary(
|
||||||
@PathVariable("ds_name") String datasourceName) throws BrokerException {
|
@PathVariable("ds_name") String datasourceName) throws BrokerException {
|
||||||
return new BrokerSummary(brokerService.getSimpleSubscriptionsOfUser( ((OIDCAuthenticationToken) SecurityContextHolder.getContext().getAuthentication()).getUserInfo().getEmail()), brokerService.getTopicsForDatasource(datasourceName));
|
return new BrokerSummary(brokerService.getSimpleSubscriptionsOfUser(((OIDCAuthenticationToken) SecurityContextHolder.getContext().getAuthentication()).getUserInfo().getEmail()), brokerService.getTopicsForDatasource(datasourceName));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ package eu.dnetlib.repo.manager.controllers;
|
||||||
|
|
||||||
|
|
||||||
import eu.dnetlib.api.functionality.ValidatorServiceException;
|
import eu.dnetlib.api.functionality.ValidatorServiceException;
|
||||||
import eu.dnetlib.repo.manager.domain.BrokerException;
|
import eu.dnetlib.repo.manager.exception.BrokerException;
|
||||||
import eu.dnetlib.repo.manager.exception.EndPointException;
|
import eu.dnetlib.repo.manager.exception.EndPointException;
|
||||||
import eu.dnetlib.repo.manager.exception.ResourceNotFoundException;
|
import eu.dnetlib.repo.manager.exception.ResourceNotFoundException;
|
||||||
import eu.dnetlib.repo.manager.exception.ServerError;
|
import eu.dnetlib.repo.manager.exception.ServerError;
|
||||||
|
@ -33,35 +33,35 @@ public class GenericControllerAdvice {
|
||||||
@ExceptionHandler(ResourceNotFoundException.class)
|
@ExceptionHandler(ResourceNotFoundException.class)
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public ServerError securityException(HttpServletRequest req, Exception ex) {
|
public ServerError securityException(HttpServletRequest req, Exception ex) {
|
||||||
return new ServerError(req.getRequestURL().toString(),ex);
|
return new ServerError(req.getRequestURL().toString(), ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ResponseStatus(HttpStatus.FORBIDDEN)
|
@ResponseStatus(HttpStatus.FORBIDDEN)
|
||||||
@ExceptionHandler(AccessDeniedException.class)
|
@ExceptionHandler(AccessDeniedException.class)
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public ServerError accessDeniedException(HttpServletRequest req, Exception ex) {
|
public ServerError accessDeniedException(HttpServletRequest req, Exception ex) {
|
||||||
return new ServerError(req.getRequestURL().toString(),ex);
|
return new ServerError(req.getRequestURL().toString(), ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ResponseStatus(HttpStatus.NOT_FOUND)
|
@ResponseStatus(HttpStatus.NOT_FOUND)
|
||||||
@ExceptionHandler(UnknownHostException.class)
|
@ExceptionHandler(UnknownHostException.class)
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public ServerError unknownHostException(HttpServletRequest req, Exception ex) {
|
public ServerError unknownHostException(HttpServletRequest req, Exception ex) {
|
||||||
return new ServerError(req.getRequestURL().toString(),ex);
|
return new ServerError(req.getRequestURL().toString(), ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
|
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
|
||||||
@ExceptionHandler({JSONException.class,BrokerException.class,ValidatorServiceException.class})
|
@ExceptionHandler({JSONException.class, BrokerException.class, ValidatorServiceException.class})
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public ServerError internalException(HttpServletRequest req, Exception ex) {
|
public ServerError internalException(HttpServletRequest req, Exception ex) {
|
||||||
return new ServerError(req.getRequestURL().toString(),ex);
|
return new ServerError(req.getRequestURL().toString(), ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ResponseStatus(HttpStatus.GATEWAY_TIMEOUT)
|
@ResponseStatus(HttpStatus.GATEWAY_TIMEOUT)
|
||||||
@ExceptionHandler(EndPointException.class)
|
@ExceptionHandler(EndPointException.class)
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public ServerError endPointException(HttpServletRequest req, Exception ex) {
|
public ServerError endPointException(HttpServletRequest req, Exception ex) {
|
||||||
return new ServerError(req.getRequestURL().toString(),ex);
|
return new ServerError(req.getRequestURL().toString(), ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import eu.dnetlib.domain.data.PiwikInfo;
|
||||||
import eu.dnetlib.repo.manager.domain.OrderByField;
|
import eu.dnetlib.repo.manager.domain.OrderByField;
|
||||||
import eu.dnetlib.repo.manager.domain.OrderByType;
|
import eu.dnetlib.repo.manager.domain.OrderByType;
|
||||||
import eu.dnetlib.repo.manager.domain.Paging;
|
import eu.dnetlib.repo.manager.domain.Paging;
|
||||||
import eu.dnetlib.repo.manager.domain.RepositoryServiceException;
|
import eu.dnetlib.repo.manager.exception.RepositoryServiceException;
|
||||||
import eu.dnetlib.repo.manager.service.PiWikServiceImpl;
|
import eu.dnetlib.repo.manager.service.PiWikServiceImpl;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiImplicitParam;
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
package eu.dnetlib.repo.manager.controllers;
|
package eu.dnetlib.repo.manager.controllers;
|
||||||
|
|
||||||
import eu.dnetlib.domain.data.Repository;
|
import eu.dnetlib.repo.manager.domain.Repository;
|
||||||
import eu.dnetlib.domain.data.RepositoryInterface;
|
import eu.dnetlib.repo.manager.domain.RepositoryInterface;
|
||||||
import eu.dnetlib.repo.manager.domain.*;
|
import eu.dnetlib.repo.manager.domain.*;
|
||||||
import eu.dnetlib.repo.manager.domain.dto.RepositoryTerms;
|
import eu.dnetlib.repo.manager.domain.dto.RepositoryTerms;
|
||||||
import eu.dnetlib.repo.manager.domain.dto.User;
|
import eu.dnetlib.repo.manager.domain.dto.User;
|
||||||
|
import eu.dnetlib.repo.manager.exception.RepositoryServiceException;
|
||||||
import eu.dnetlib.repo.manager.exception.ResourceNotFoundException;
|
import eu.dnetlib.repo.manager.exception.ResourceNotFoundException;
|
||||||
import eu.dnetlib.repo.manager.service.RepositoryService;
|
import eu.dnetlib.repo.manager.service.RepositoryService;
|
||||||
import eu.dnetlib.repo.manager.service.security.AuthorizationService;
|
import eu.dnetlib.repo.manager.service.security.AuthorizationService;
|
||||||
|
@ -65,8 +66,9 @@ public class RepositoryController {
|
||||||
produces = MediaType.APPLICATION_JSON_VALUE)
|
produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
@PreAuthorize("hasAuthority('REGISTERED_USER')")
|
@PreAuthorize("hasAuthority('REGISTERED_USER')")
|
||||||
public List<RepositorySnippet> getRepositoriesSnippetsOfUser() throws Exception {
|
public List<RepositorySnippet> getRepositoriesSnippetsOfUser(@RequestParam(name = "page", defaultValue = "0") int page,
|
||||||
return repositoryService.getRepositoriesSnippetsOfUser("0", "100"); // FIXME
|
@RequestParam(name = "size", defaultValue = "1000") int pageSize) throws Exception {
|
||||||
|
return repositoryService.getRepositoriesSnippetsOfUser(String.valueOf(page), String.valueOf(pageSize));
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value = "/terms", method = RequestMethod.POST,
|
@RequestMapping(value = "/terms", method = RequestMethod.POST,
|
||||||
|
@ -110,7 +112,7 @@ public class RepositoryController {
|
||||||
Repository repo = repositoryService.getRepositoryById(id);
|
Repository repo = repositoryService.getRepositoryById(id);
|
||||||
|
|
||||||
if (repo != null)
|
if (repo != null)
|
||||||
logger.info("Returning repository " + repo.getId() + " registered by " + repo.getRegisteredBy());
|
logger.info("Returning repository " + repo.getId() + " registered by " + repo.getRegisteredby());
|
||||||
else
|
else
|
||||||
logger.info("Requested repository " + id + " not found");
|
logger.info("Requested repository " + id + " not found");
|
||||||
return repo;
|
return repo;
|
||||||
|
@ -158,6 +160,7 @@ public class RepositoryController {
|
||||||
return repositoryService.addRepository(datatype, repository);
|
return repositoryService.addRepository(datatype, repository);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
@RequestMapping(value = "/getDnetCountries", method = RequestMethod.GET,
|
@RequestMapping(value = "/getDnetCountries", method = RequestMethod.GET,
|
||||||
produces = MediaType.APPLICATION_JSON_VALUE)
|
produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
|
@ -165,6 +168,7 @@ public class RepositoryController {
|
||||||
return repositoryService.getDnetCountries();
|
return repositoryService.getDnetCountries();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
@RequestMapping(value = "/getTypologies", method = RequestMethod.GET,
|
@RequestMapping(value = "/getTypologies", method = RequestMethod.GET,
|
||||||
produces = MediaType.APPLICATION_JSON_VALUE)
|
produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
|
@ -172,6 +176,7 @@ public class RepositoryController {
|
||||||
return repositoryService.getTypologies();
|
return repositoryService.getTypologies();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
@RequestMapping(value = "/getTimezones", method = RequestMethod.GET,
|
@RequestMapping(value = "/getTimezones", method = RequestMethod.GET,
|
||||||
produces = MediaType.APPLICATION_JSON_VALUE)
|
produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
|
@ -225,13 +230,6 @@ public class RepositoryController {
|
||||||
return repositoryService.getUrlsOfUserRepos(((OIDCAuthenticationToken) SecurityContextHolder.getContext().getAuthentication()).getUserInfo().getEmail(), page, size);
|
return repositoryService.getUrlsOfUserRepos(((OIDCAuthenticationToken) SecurityContextHolder.getContext().getAuthentication()).getUserInfo().getEmail(), page, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value = "/getDatasourceVocabularies/{mode}", method = RequestMethod.GET,
|
|
||||||
produces = MediaType.APPLICATION_JSON_VALUE)
|
|
||||||
@ResponseBody
|
|
||||||
public List<String> getDatasourceVocabularies(@PathVariable("mode") String mode) {
|
|
||||||
return repositoryService.getDatasourceVocabularies(mode);
|
|
||||||
}
|
|
||||||
|
|
||||||
@RequestMapping(value = "/getCompatibilityClasses/{mode}", method = RequestMethod.GET,
|
@RequestMapping(value = "/getCompatibilityClasses/{mode}", method = RequestMethod.GET,
|
||||||
produces = MediaType.APPLICATION_JSON_VALUE)
|
produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
|
|
|
@ -5,7 +5,7 @@ import eu.dnetlib.domain.functionality.validator.JobForValidation;
|
||||||
import eu.dnetlib.domain.functionality.validator.RuleSet;
|
import eu.dnetlib.domain.functionality.validator.RuleSet;
|
||||||
import eu.dnetlib.domain.functionality.validator.StoredJob;
|
import eu.dnetlib.domain.functionality.validator.StoredJob;
|
||||||
import eu.dnetlib.repo.manager.domain.InterfaceInformation;
|
import eu.dnetlib.repo.manager.domain.InterfaceInformation;
|
||||||
import eu.dnetlib.repo.manager.domain.ValidationServiceException;
|
import eu.dnetlib.repo.manager.exception.ValidationServiceException;
|
||||||
import eu.dnetlib.repo.manager.exception.ResourceNotFoundException;
|
import eu.dnetlib.repo.manager.exception.ResourceNotFoundException;
|
||||||
import eu.dnetlib.repo.manager.service.EmailUtils;
|
import eu.dnetlib.repo.manager.service.EmailUtils;
|
||||||
import eu.dnetlib.repo.manager.service.ValidatorServiceImpl;
|
import eu.dnetlib.repo.manager.service.ValidatorServiceImpl;
|
||||||
|
|
|
@ -1,38 +0,0 @@
|
||||||
package eu.dnetlib.repo.manager.domain;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class Aggregations{
|
|
||||||
|
|
||||||
private List<AggregationDetails> aggregationHistory = new ArrayList<>();
|
|
||||||
private AggregationDetails lastCollection;
|
|
||||||
private AggregationDetails lastTransformation;
|
|
||||||
|
|
||||||
public Aggregations() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<AggregationDetails> getAggregationHistory() {
|
|
||||||
return aggregationHistory;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAggregationHistory(List<AggregationDetails> aggregationHistory) {
|
|
||||||
this.aggregationHistory = aggregationHistory;
|
|
||||||
}
|
|
||||||
|
|
||||||
public AggregationDetails getLastCollection() {
|
|
||||||
return lastCollection;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLastCollection(AggregationDetails lastCollection) {
|
|
||||||
this.lastCollection = lastCollection;
|
|
||||||
}
|
|
||||||
|
|
||||||
public AggregationDetails getLastTransformation() {
|
|
||||||
return lastTransformation;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLastTransformation(AggregationDetails lastTransformation) {
|
|
||||||
this.lastTransformation = lastTransformation;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,188 @@
|
||||||
|
package eu.dnetlib.repo.manager.domain;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
public class ApiDetails {
|
||||||
|
protected String id = null;
|
||||||
|
protected String protocol = null;
|
||||||
|
protected String datasource = null;
|
||||||
|
protected String contentdescription = null;
|
||||||
|
protected String eoscDatasourceType = null;
|
||||||
|
protected String compatibility;
|
||||||
|
protected String compatibilityOverride;
|
||||||
|
protected Integer lastCollectionTotal;
|
||||||
|
protected Date lastCollectionDate;
|
||||||
|
protected Integer lastAggregationTotal;
|
||||||
|
protected Date lastAggregationDate;
|
||||||
|
protected Integer lastDownloadTotal;
|
||||||
|
protected Date lastDownloadDate;
|
||||||
|
protected String baseurl;
|
||||||
|
protected Boolean removable = false;
|
||||||
|
protected Set<ApiParamDetails> apiParams;
|
||||||
|
protected String metadataIdentifierPath = "";
|
||||||
|
@Deprecated
|
||||||
|
protected String typology = null;
|
||||||
|
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getProtocol() {
|
||||||
|
return protocol;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDatasource() {
|
||||||
|
return datasource;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getContentdescription() {
|
||||||
|
return contentdescription;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCompatibility() {
|
||||||
|
return compatibility;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getLastCollectionTotal() {
|
||||||
|
return lastCollectionTotal;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getLastCollectionDate() {
|
||||||
|
return lastCollectionDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getLastAggregationTotal() {
|
||||||
|
return lastAggregationTotal;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getLastAggregationDate() {
|
||||||
|
return lastAggregationDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getLastDownloadTotal() {
|
||||||
|
return lastDownloadTotal;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getLastDownloadDate() {
|
||||||
|
return lastDownloadDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBaseurl() {
|
||||||
|
return baseurl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApiDetails setId(final String id) {
|
||||||
|
this.id = id;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApiDetails setProtocol(final String protocol) {
|
||||||
|
this.protocol = protocol;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApiDetails setDatasource(final String datasource) {
|
||||||
|
this.datasource = datasource;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApiDetails setContentdescription(final String contentdescription) {
|
||||||
|
this.contentdescription = contentdescription;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApiDetails setCompatibility(final String compatibility) {
|
||||||
|
this.compatibility = compatibility;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApiDetails setLastCollectionTotal(final Integer lastCollectionTotal) {
|
||||||
|
this.lastCollectionTotal = lastCollectionTotal;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApiDetails setLastCollectionDate(final Date lastCollectionDate) {
|
||||||
|
this.lastCollectionDate = lastCollectionDate;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApiDetails setLastAggregationTotal(final Integer lastAggregationTotal) {
|
||||||
|
this.lastAggregationTotal = lastAggregationTotal;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApiDetails setLastAggregationDate(final Date lastAggregationDate) {
|
||||||
|
this.lastAggregationDate = lastAggregationDate;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApiDetails setLastDownloadTotal(final Integer lastDownloadTotal) {
|
||||||
|
this.lastDownloadTotal = lastDownloadTotal;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApiDetails setLastDownloadDate(final Date lastDownloadDate) {
|
||||||
|
this.lastDownloadDate = lastDownloadDate;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApiDetails setBaseurl(final String baseurl) {
|
||||||
|
this.baseurl = baseurl;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Set<ApiParamDetails> getApiParams() {
|
||||||
|
return apiParams;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setApiParams(final Set<ApiParamDetails> apiParams) {
|
||||||
|
this.apiParams = apiParams;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCompatibilityOverride() {
|
||||||
|
return compatibilityOverride;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApiDetails setCompatibilityOverride(final String compatibilityOverride) {
|
||||||
|
this.compatibilityOverride = compatibilityOverride;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean getRemovable() {
|
||||||
|
return removable;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApiDetails setRemovable(final Boolean removable) {
|
||||||
|
this.removable = removable;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMetadataIdentifierPath() {
|
||||||
|
return metadataIdentifierPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApiDetails setMetadataIdentifierPath(final String metadataIdentifierPath) {
|
||||||
|
this.metadataIdentifierPath = metadataIdentifierPath;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEoscDatasourceType() {
|
||||||
|
return eoscDatasourceType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApiDetails setEoscDatasourceType(final String eoscDatasourceType) {
|
||||||
|
this.eoscDatasourceType = eoscDatasourceType;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTypology() {
|
||||||
|
return typology;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApiDetails setTypology(final String typology) {
|
||||||
|
this.typology = typology;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
package eu.dnetlib.repo.manager.domain;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class ApiDetailsResponse extends Response {
|
||||||
|
|
||||||
|
private List<ApiDetails> api;
|
||||||
|
|
||||||
|
|
||||||
|
public List<ApiDetails> getApi() {
|
||||||
|
return api;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApiDetailsResponse setApi(final List<ApiDetails> api) {
|
||||||
|
this.api = api;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
package eu.dnetlib.repo.manager.domain;
|
||||||
|
|
||||||
|
public class ApiParamDetails {
|
||||||
|
|
||||||
|
protected String param;
|
||||||
|
protected String value;
|
||||||
|
|
||||||
|
|
||||||
|
public String getParam() {
|
||||||
|
return param;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setParam(final String param) {
|
||||||
|
this.param = param;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setValue(final String value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,321 @@
|
||||||
|
package eu.dnetlib.repo.manager.domain;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.Set;
|
||||||
|
import javax.persistence.Transient;
|
||||||
|
|
||||||
|
public class DatasourceDetails {
|
||||||
|
|
||||||
|
protected String id;
|
||||||
|
@Transient
|
||||||
|
protected String openaireId;
|
||||||
|
protected String officialname;
|
||||||
|
protected String englishname;
|
||||||
|
protected String websiteurl;
|
||||||
|
protected String logourl;
|
||||||
|
protected String contactemail;
|
||||||
|
protected Double latitude = 0.0;
|
||||||
|
protected Double longitude = 0.0;
|
||||||
|
protected Double timezone = 0.0;
|
||||||
|
protected String namespaceprefix;
|
||||||
|
protected String languages;
|
||||||
|
protected Date dateofvalidation;
|
||||||
|
protected String eoscDatasourceType;
|
||||||
|
protected Date dateofcollection;
|
||||||
|
protected String platform;
|
||||||
|
protected String activationId;
|
||||||
|
protected String description;
|
||||||
|
protected String issn;
|
||||||
|
protected String eissn;
|
||||||
|
protected String lissn;
|
||||||
|
protected String registeredby;
|
||||||
|
protected String subjects;
|
||||||
|
protected String aggregator = "OPENAIRE";
|
||||||
|
protected String collectedfrom;
|
||||||
|
protected Boolean managed;
|
||||||
|
protected Boolean consentTermsOfUse;
|
||||||
|
protected Boolean fullTextDownload;
|
||||||
|
protected Date consentTermsOfUseDate;
|
||||||
|
protected Date lastConsentTermsOfUseDate;
|
||||||
|
protected Set<OrganizationDetails> organizations;
|
||||||
|
protected Set<IdentitiesDetails> identities;
|
||||||
|
protected String status;
|
||||||
|
protected String typology;
|
||||||
|
protected Date registrationdate;
|
||||||
|
|
||||||
|
public DatasourceDetails() {
|
||||||
|
// no arg constructor
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOpenaireId() {
|
||||||
|
return openaireId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOpenaireId(String openaireId) {
|
||||||
|
this.openaireId = openaireId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOfficialname() {
|
||||||
|
return officialname;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOfficialname(String officialname) {
|
||||||
|
this.officialname = officialname;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEnglishname() {
|
||||||
|
return englishname;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEnglishname(String englishname) {
|
||||||
|
this.englishname = englishname;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getWebsiteurl() {
|
||||||
|
return websiteurl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWebsiteurl(String websiteurl) {
|
||||||
|
this.websiteurl = websiteurl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLogourl() {
|
||||||
|
return logourl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLogourl(String logourl) {
|
||||||
|
this.logourl = logourl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getContactemail() {
|
||||||
|
return contactemail;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setContactemail(String contactemail) {
|
||||||
|
this.contactemail = contactemail;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Double getLatitude() {
|
||||||
|
return latitude;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLatitude(Double latitude) {
|
||||||
|
this.latitude = latitude;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Double getLongitude() {
|
||||||
|
return longitude;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLongitude(Double longitude) {
|
||||||
|
this.longitude = longitude;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNamespaceprefix() {
|
||||||
|
return namespaceprefix;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNamespaceprefix(String namespaceprefix) {
|
||||||
|
this.namespaceprefix = namespaceprefix;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLanguages() {
|
||||||
|
return languages;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLanguages(String languages) {
|
||||||
|
this.languages = languages;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getDateofvalidation() {
|
||||||
|
return dateofvalidation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDateofvalidation(Date dateofvalidation) {
|
||||||
|
this.dateofvalidation = dateofvalidation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEoscDatasourceType() {
|
||||||
|
return eoscDatasourceType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEoscDatasourceType(String eoscDatasourceType) {
|
||||||
|
this.eoscDatasourceType = eoscDatasourceType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getDateofcollection() {
|
||||||
|
return dateofcollection;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDateofcollection(Date dateofcollection) {
|
||||||
|
this.dateofcollection = dateofcollection;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPlatform() {
|
||||||
|
return platform;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPlatform(String platform) {
|
||||||
|
this.platform = platform;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getActivationId() {
|
||||||
|
return activationId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setActivationId(String activationId) {
|
||||||
|
this.activationId = activationId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescription(String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getIssn() {
|
||||||
|
return issn;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIssn(String issn) {
|
||||||
|
this.issn = issn;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEissn() {
|
||||||
|
return eissn;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEissn(String eissn) {
|
||||||
|
this.eissn = eissn;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLissn() {
|
||||||
|
return lissn;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLissn(String lissn) {
|
||||||
|
this.lissn = lissn;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRegisteredby() {
|
||||||
|
return registeredby;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRegisteredby(String registeredby) {
|
||||||
|
this.registeredby = registeredby;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSubjects() {
|
||||||
|
return subjects;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSubjects(String subjects) {
|
||||||
|
this.subjects = subjects;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAggregator() {
|
||||||
|
return aggregator;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAggregator(String aggregator) {
|
||||||
|
this.aggregator = aggregator;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCollectedfrom() {
|
||||||
|
return collectedfrom;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCollectedfrom(String collectedfrom) {
|
||||||
|
this.collectedfrom = collectedfrom;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean getManaged() {
|
||||||
|
return managed;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setManaged(Boolean managed) {
|
||||||
|
this.managed = managed;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean getConsentTermsOfUse() {
|
||||||
|
return consentTermsOfUse;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setConsentTermsOfUse(Boolean consentTermsOfUse) {
|
||||||
|
this.consentTermsOfUse = consentTermsOfUse;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean getFullTextDownload() {
|
||||||
|
return fullTextDownload;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFullTextDownload(Boolean fullTextDownload) {
|
||||||
|
this.fullTextDownload = fullTextDownload;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getConsentTermsOfUseDate() {
|
||||||
|
return consentTermsOfUseDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setConsentTermsOfUseDate(Date consentTermsOfUseDate) {
|
||||||
|
this.consentTermsOfUseDate = consentTermsOfUseDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getLastConsentTermsOfUseDate() {
|
||||||
|
return lastConsentTermsOfUseDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLastConsentTermsOfUseDate(Date lastConsentTermsOfUseDate) {
|
||||||
|
this.lastConsentTermsOfUseDate = lastConsentTermsOfUseDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Set<OrganizationDetails> getOrganizations() {
|
||||||
|
return organizations;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOrganizations(Set<OrganizationDetails> organizations) {
|
||||||
|
this.organizations = organizations;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Set<IdentitiesDetails> getIdentities() {
|
||||||
|
return identities;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIdentities(Set<IdentitiesDetails> identities) {
|
||||||
|
this.identities = identities;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStatus() {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatus(String status) {
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTypology() {
|
||||||
|
return typology;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTypology(String typology) {
|
||||||
|
this.typology = typology;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getRegistrationdate() {
|
||||||
|
return registrationdate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRegistrationdate(Date registrationdate) {
|
||||||
|
this.registrationdate = registrationdate;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,47 +0,0 @@
|
||||||
package eu.dnetlib.repo.manager.domain;
|
|
||||||
|
|
||||||
import eu.dnetlib.domain.data.Repository;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by stefania on 12/17/15.
|
|
||||||
*/
|
|
||||||
public class DatasourceRegistrationState extends WizardState {
|
|
||||||
|
|
||||||
private String mode;
|
|
||||||
private String selectedRepositoryId;
|
|
||||||
|
|
||||||
private Repository repository;
|
|
||||||
|
|
||||||
public DatasourceRegistrationState() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public DatasourceRegistrationState(String mode, String selectedRepositoryId, Repository repository) {
|
|
||||||
this.mode = mode;
|
|
||||||
this.selectedRepositoryId = selectedRepositoryId;
|
|
||||||
this.repository = repository;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getMode() {
|
|
||||||
return mode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMode(String mode) {
|
|
||||||
this.mode = mode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSelectedRepositoryId() {
|
|
||||||
return selectedRepositoryId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSelectedRepositoryId(String selectedRepositoryId) {
|
|
||||||
this.selectedRepositoryId = selectedRepositoryId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Repository getRepository() {
|
|
||||||
return repository;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRepository(Repository repository) {
|
|
||||||
this.repository = repository;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
package eu.dnetlib.repo.manager.domain;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class DatasourceResponse extends Response {
|
||||||
|
|
||||||
|
private List<DatasourceDetails> datasourceInfo = Lists.newArrayList();
|
||||||
|
|
||||||
|
public DatasourceResponse addDatasourceInfo(final DatasourceDetails datasourceInfo) {
|
||||||
|
getDatasourceInfo().add(datasourceInfo);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<DatasourceDetails> getDatasourceInfo() {
|
||||||
|
return datasourceInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DatasourceResponse setDatasourceInfo(final List<DatasourceDetails> datasourceInfo) {
|
||||||
|
this.datasourceInfo = datasourceInfo;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,60 +0,0 @@
|
||||||
package eu.dnetlib.repo.manager.domain;
|
|
||||||
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by nikonas on 21/12/15.
|
|
||||||
*/
|
|
||||||
public class DatasourceVocabularies{
|
|
||||||
|
|
||||||
private Map<String, String> countries;
|
|
||||||
private List<Timezone> timezones;
|
|
||||||
private Map<String, String> datasourceClasses;
|
|
||||||
private List<String> typologies;
|
|
||||||
private Map<String, String> compatibilityLevels;
|
|
||||||
|
|
||||||
public DatasourceVocabularies() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public Map<String, String> getCountries() {
|
|
||||||
return countries;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCountries(Map<String, String> countries) {
|
|
||||||
this.countries = countries;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Timezone> getTimezones() {
|
|
||||||
return timezones;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTimezones(List<Timezone> timezones) {
|
|
||||||
this.timezones = timezones;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Map<String, String> getDatasourceClasses() {
|
|
||||||
return datasourceClasses;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDatasourceClasses(Map<String, String> datasourceClasses) {
|
|
||||||
this.datasourceClasses = datasourceClasses;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> getTypologies() {
|
|
||||||
return typologies;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTypologies(List<String> typologies) {
|
|
||||||
this.typologies = typologies;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Map<String, String> getCompatibilityLevels() {
|
|
||||||
return compatibilityLevels;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCompatibilityLevels(Map<String, String> compatibilityLevels) {
|
|
||||||
this.compatibilityLevels = compatibilityLevels;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,6 +1,6 @@
|
||||||
package eu.dnetlib.repo.manager.domain;
|
package eu.dnetlib.repo.manager.domain;
|
||||||
|
|
||||||
import eu.dnetlib.domain.data.Repository;
|
import eu.dnetlib.repo.manager.domain.Repository;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
|
@ -0,0 +1,79 @@
|
||||||
|
package eu.dnetlib.repo.manager.domain;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import com.google.gson.GsonBuilder;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Queue;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
public class Header {
|
||||||
|
|
||||||
|
private long total;
|
||||||
|
private int page;
|
||||||
|
private int size;
|
||||||
|
private long time;
|
||||||
|
private int statusCode;
|
||||||
|
private List<String> errors = Lists.newArrayList();
|
||||||
|
|
||||||
|
private Queue<Throwable> exceptions = Lists.newLinkedList();
|
||||||
|
public static Header newInsance() {
|
||||||
|
return new Header();
|
||||||
|
}
|
||||||
|
public Header() {
|
||||||
|
}
|
||||||
|
public long getTime() {
|
||||||
|
return time;
|
||||||
|
}
|
||||||
|
public Header setTime(final long time) {
|
||||||
|
this.time = time;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
public int getStatusCode() {
|
||||||
|
return statusCode;
|
||||||
|
}
|
||||||
|
public Header setStatusCode(final int statusCode) {
|
||||||
|
this.statusCode = statusCode;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
public long getTotal() {
|
||||||
|
return total;
|
||||||
|
}
|
||||||
|
public int getPage() {
|
||||||
|
return page;
|
||||||
|
}
|
||||||
|
public int getSize() {
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
public Header setPage(final int page) {
|
||||||
|
this.page = page;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
public Header setSize(final int size) {
|
||||||
|
this.size = size;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
public Header setTotal(final long total) {
|
||||||
|
this.total = total;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
public Queue<Throwable> getExceptions() {
|
||||||
|
return exceptions;
|
||||||
|
}
|
||||||
|
public Header setExceptions(final Queue<Throwable> exceptions) {
|
||||||
|
this.exceptions = exceptions;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
public List<String> getErrors() {
|
||||||
|
return getExceptions().stream()
|
||||||
|
.map(Throwable::getMessage)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
public Header setErrors(final List<String> errors) {
|
||||||
|
this.errors = errors;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
public String toJson() {
|
||||||
|
return new GsonBuilder().setPrettyPrinting().create().toJson(this);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
package eu.dnetlib.repo.manager.domain;
|
||||||
|
|
||||||
|
public class IdentitiesDetails {
|
||||||
|
private String pid;
|
||||||
|
private String issuertype;
|
||||||
|
|
||||||
|
public IdentitiesDetails() {
|
||||||
|
// no arg constructor
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPid() {
|
||||||
|
return pid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getIssuertype() {
|
||||||
|
return issuertype;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IdentitiesDetails setPid(final String pid) {
|
||||||
|
this.pid = pid;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IdentitiesDetails setIssuertype(final String issuertype) {
|
||||||
|
this.issuertype = issuertype;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,54 @@
|
||||||
|
package eu.dnetlib.repo.manager.domain;
|
||||||
|
|
||||||
|
public class OrganizationDetails {
|
||||||
|
|
||||||
|
private String legalshortname;
|
||||||
|
private String legalname;
|
||||||
|
private String websiteurl;
|
||||||
|
private String logourl;
|
||||||
|
private String country;
|
||||||
|
|
||||||
|
public OrganizationDetails() {
|
||||||
|
// no arg constructor
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLegalshortname() {
|
||||||
|
return legalshortname;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLegalshortname(String legalshortname) {
|
||||||
|
this.legalshortname = legalshortname;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLegalname() {
|
||||||
|
return legalname;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLegalname(String legalname) {
|
||||||
|
this.legalname = legalname;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getWebsiteurl() {
|
||||||
|
return websiteurl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWebsiteurl(String websiteurl) {
|
||||||
|
this.websiteurl = websiteurl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLogourl() {
|
||||||
|
return logourl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLogourl(String logourl) {
|
||||||
|
this.logourl = logourl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCountry() {
|
||||||
|
return country;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCountry(String country) {
|
||||||
|
this.country = country;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,91 @@
|
||||||
|
package eu.dnetlib.repo.manager.domain;
|
||||||
|
|
||||||
|
import eu.dnetlib.domain.data.DataCollectionType;
|
||||||
|
import eu.dnetlib.domain.data.PiwikInfo;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The domain object for the Repository resource data structure
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class Repository extends DatasourceDetails {
|
||||||
|
private static final long serialVersionUID = -7241644234046760972L;
|
||||||
|
|
||||||
|
private List<RepositoryInterface> interfaces = new ArrayList<>();
|
||||||
|
|
||||||
|
private static List<DataCollectionType> dataCollectionTypes = new ArrayList<>();
|
||||||
|
|
||||||
|
private PiwikInfo piwikInfo;
|
||||||
|
|
||||||
|
public Repository() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<RepositoryInterface> getInterfaces() {
|
||||||
|
return interfaces;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setInterfaces(List<RepositoryInterface> interfaces) {
|
||||||
|
this.interfaces = interfaces;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Double getTimezone() {
|
||||||
|
return timezone;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTimezone(Double timezone) throws IllegalArgumentException {
|
||||||
|
if (timezone < -12 || timezone > 12 || (timezone % 0.5) != 0) {
|
||||||
|
String t = String.valueOf(timezone);
|
||||||
|
throw new IllegalArgumentException(
|
||||||
|
"timezone must be in the range [-12.0, 12.0] and must me divided by 0.5. Value given is "
|
||||||
|
+ t);
|
||||||
|
}
|
||||||
|
this.timezone = timezone;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<DataCollectionType> getDataCollectionTypes() {
|
||||||
|
return dataCollectionTypes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDataCollectionTypes(
|
||||||
|
List<DataCollectionType> dataCollectionTypes) {
|
||||||
|
this.dataCollectionTypes = dataCollectionTypes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PiwikInfo getPiwikInfo() {
|
||||||
|
return piwikInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPiwikInfo(PiwikInfo piwikInfo) {
|
||||||
|
this.piwikInfo = piwikInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return officialname.hashCode();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (!(o instanceof Repository))
|
||||||
|
return false;
|
||||||
|
else
|
||||||
|
return this.equals((Repository) o);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean equals(Repository r) {
|
||||||
|
// TODO: fill with required fields...
|
||||||
|
|
||||||
|
if (this.getEnglishname() != null && r.getEnglishname() == null) {
|
||||||
|
return false;
|
||||||
|
} else if (this.getEnglishname() == null
|
||||||
|
&& r.getEnglishname() != null) {
|
||||||
|
return false;
|
||||||
|
} else if (this.getEnglishname() != null
|
||||||
|
&& r.getEnglishname() != null) {
|
||||||
|
return this.getEnglishname().equals(r.getEnglishname());
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,57 @@
|
||||||
|
package eu.dnetlib.repo.manager.domain;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
public class RepositoryInterface extends ApiDetails {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 8013272950607614479L;
|
||||||
|
|
||||||
|
public void updateApiParam(String param, String value) {
|
||||||
|
for (ApiParamDetails entry : apiParams) {
|
||||||
|
if (entry.getParam().equals(param)) {
|
||||||
|
entry.setValue(value);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ApiParamDetails newSet = new ApiParamDetails();
|
||||||
|
newSet.setParam(param);
|
||||||
|
newSet.setValue(value);
|
||||||
|
this.apiParams.add(newSet);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAccessSet(String accessSet) {
|
||||||
|
if (accessSet != null) {
|
||||||
|
updateApiParam("set", accessSet);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAccessSet() {
|
||||||
|
Map<String, String> map;
|
||||||
|
if (apiParams != null) {
|
||||||
|
map = apiParams.stream()
|
||||||
|
.filter(Objects::nonNull)
|
||||||
|
.filter(k -> k.getParam() == null && k.getValue() == null)
|
||||||
|
.collect(Collectors.toMap(ApiParamDetails::getParam, ApiParamDetails::getValue));
|
||||||
|
return map.get("set");
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAccessFormat(String accessFormat) {
|
||||||
|
updateApiParam("format", accessFormat);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAccessFormat() {
|
||||||
|
Map<String, String> map;
|
||||||
|
if (apiParams != null) {
|
||||||
|
map = apiParams.stream()
|
||||||
|
.filter(Objects::nonNull)
|
||||||
|
.filter(k -> k.getParam() == null && k.getValue() == null)
|
||||||
|
.collect(Collectors.toMap(ApiParamDetails::getParam, ApiParamDetails::getValue));
|
||||||
|
return map.get("format");
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
|
@ -4,6 +4,7 @@ package eu.dnetlib.repo.manager.domain;
|
||||||
import eu.dnetlib.domain.data.PiwikInfo;
|
import eu.dnetlib.domain.data.PiwikInfo;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
public class RepositorySnippet {
|
public class RepositorySnippet {
|
||||||
|
|
||||||
|
@ -12,18 +13,18 @@ public class RepositorySnippet {
|
||||||
private String officialname;
|
private String officialname;
|
||||||
private String englishname;
|
private String englishname;
|
||||||
private String websiteurl;
|
private String websiteurl;
|
||||||
private String typology;
|
|
||||||
private String registeredby;
|
private String registeredby;
|
||||||
private Organization[] organizations;
|
private Date registrationdate;
|
||||||
private String registrationdate;
|
private String eoscDatasourceType;
|
||||||
private String logoUrl;
|
private String logoUrl;
|
||||||
private String description;
|
private String description;
|
||||||
private String fullTextDownload;
|
private Boolean consentTermsOfUse;
|
||||||
private String consentTermsOfUse;
|
|
||||||
private Date consentTermsOfUseDate;
|
private Date consentTermsOfUseDate;
|
||||||
|
|
||||||
private Date lastConsentTermsOfUseDate;
|
private Date lastConsentTermsOfUseDate;
|
||||||
private String eoscDatasourceType;
|
private Boolean fullTextDownload;
|
||||||
|
private Set<OrganizationDetails> organizations;
|
||||||
|
private String typology;
|
||||||
|
|
||||||
|
|
||||||
private PiwikInfo piwikInfo;
|
private PiwikInfo piwikInfo;
|
||||||
|
@ -79,19 +80,18 @@ public class RepositorySnippet {
|
||||||
this.typology = typology;
|
this.typology = typology;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Organization[] getOrganizations() {
|
public Set<OrganizationDetails> getOrganizations() {
|
||||||
return organizations;
|
return organizations;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setOrganizations(Organization[] organizations) {
|
public void setOrganizations(Set<OrganizationDetails> organizations) {
|
||||||
this.organizations = organizations;
|
this.organizations = organizations;
|
||||||
}
|
}
|
||||||
|
public Date getRegistrationdate() {
|
||||||
public String getRegistrationdate() {
|
|
||||||
return registrationdate;
|
return registrationdate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRegistrationdate(String registrationdate) {
|
public void setRegistrationdate(Date registrationdate) {
|
||||||
this.registrationdate = registrationdate;
|
this.registrationdate = registrationdate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,19 +119,19 @@ public class RepositorySnippet {
|
||||||
this.description = description;
|
this.description = description;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getFullTextDownload() {
|
public Boolean getFullTextDownload() {
|
||||||
return fullTextDownload;
|
return fullTextDownload;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFullTextDownload(String fullTextDownload) {
|
public void setFullTextDownload(Boolean fullTextDownload) {
|
||||||
this.fullTextDownload = fullTextDownload;
|
this.fullTextDownload = fullTextDownload;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getConsentTermsOfUse() {
|
public Boolean getConsentTermsOfUse() {
|
||||||
return consentTermsOfUse;
|
return consentTermsOfUse;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setConsentTermsOfUse(String consentTermsOfUse) {
|
public void setConsentTermsOfUse(Boolean consentTermsOfUse) {
|
||||||
this.consentTermsOfUse = consentTermsOfUse;
|
this.consentTermsOfUse = consentTermsOfUse;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ public class RequestFilter{
|
||||||
|
|
||||||
private String registeredby = null;
|
private String registeredby = null;
|
||||||
private String typology = null;
|
private String typology = null;
|
||||||
|
private String eoscDatasourceType = null;
|
||||||
private String country = null;
|
private String country = null;
|
||||||
private String id = null;
|
private String id = null;
|
||||||
private String officialname = null;
|
private String officialname = null;
|
||||||
|
@ -28,6 +29,14 @@ public class RequestFilter{
|
||||||
this.typology = typology;
|
this.typology = typology;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getEoscDatasourceType() {
|
||||||
|
return eoscDatasourceType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEoscDatasourceType(String eoscDatasourceType) {
|
||||||
|
this.eoscDatasourceType = eoscDatasourceType;
|
||||||
|
}
|
||||||
|
|
||||||
public String getRegisteredby() {
|
public String getRegisteredby() {
|
||||||
return registeredby;
|
return registeredby;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
package eu.dnetlib.repo.manager.domain;
|
||||||
|
|
||||||
|
public class Response {
|
||||||
|
|
||||||
|
private Header header;
|
||||||
|
|
||||||
|
public Response() {
|
||||||
|
this.header = new Header();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Header getHeader() {
|
||||||
|
return header;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Response setHeader(final Header header) {
|
||||||
|
this.header = header;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,16 +0,0 @@
|
||||||
package eu.dnetlib.repo.manager.domain;
|
|
||||||
|
|
||||||
|
|
||||||
import eu.dnetlib.domain.functionality.validator.JobForValidation;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by stefania on 2/10/16.
|
|
||||||
*/
|
|
||||||
public class ValidationState extends WizardState {
|
|
||||||
|
|
||||||
private JobForValidation jobForValidation = new JobForValidation();
|
|
||||||
|
|
||||||
public JobForValidation getJobForValidation() {
|
|
||||||
return jobForValidation;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,9 +0,0 @@
|
||||||
package eu.dnetlib.repo.manager.domain;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by stefania on 2/10/16.
|
|
||||||
*/
|
|
||||||
public class WizardState {
|
|
||||||
}
|
|
|
@ -1,4 +1,4 @@
|
||||||
package eu.dnetlib.repo.manager.domain;
|
package eu.dnetlib.repo.manager.exception;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
|
@ -1,4 +1,4 @@
|
||||||
package eu.dnetlib.repo.manager.domain;
|
package eu.dnetlib.repo.manager.exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by nikonas on 7/12/15.
|
* Created by nikonas on 7/12/15.
|
|
@ -1,4 +1,4 @@
|
||||||
package eu.dnetlib.repo.manager.domain;
|
package eu.dnetlib.repo.manager.exception;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package eu.dnetlib.repo.manager.domain;
|
package eu.dnetlib.repo.manager.exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by nikonas on 7/12/15.
|
* Created by nikonas on 7/12/15.
|
|
@ -1,6 +1,6 @@
|
||||||
package eu.dnetlib.repo.manager.service;
|
package eu.dnetlib.repo.manager.service;
|
||||||
|
|
||||||
import eu.dnetlib.repo.manager.domain.BrokerException;
|
import eu.dnetlib.repo.manager.exception.BrokerException;
|
||||||
import eu.dnetlib.repo.manager.domain.Term;
|
import eu.dnetlib.repo.manager.domain.Term;
|
||||||
import eu.dnetlib.repo.manager.domain.broker.*;
|
import eu.dnetlib.repo.manager.domain.broker.*;
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
|
|
|
@ -2,7 +2,7 @@ package eu.dnetlib.repo.manager.service;
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.JsonNode;
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import eu.dnetlib.repo.manager.domain.BrokerException;
|
import eu.dnetlib.repo.manager.exception.BrokerException;
|
||||||
import eu.dnetlib.repo.manager.domain.RepositorySnippet;
|
import eu.dnetlib.repo.manager.domain.RepositorySnippet;
|
||||||
import eu.dnetlib.repo.manager.domain.Term;
|
import eu.dnetlib.repo.manager.domain.Term;
|
||||||
import eu.dnetlib.repo.manager.domain.Tuple;
|
import eu.dnetlib.repo.manager.domain.Tuple;
|
||||||
|
|
|
@ -2,6 +2,8 @@ package eu.dnetlib.repo.manager.service;
|
||||||
|
|
||||||
import eu.dnetlib.repo.manager.domain.*;
|
import eu.dnetlib.repo.manager.domain.*;
|
||||||
import eu.dnetlib.repo.manager.domain.broker.BrowseEntry;
|
import eu.dnetlib.repo.manager.domain.broker.BrowseEntry;
|
||||||
|
import eu.dnetlib.repo.manager.exception.BrokerException;
|
||||||
|
import eu.dnetlib.repo.manager.exception.RepositoryServiceException;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package eu.dnetlib.repo.manager.service;
|
package eu.dnetlib.repo.manager.service;
|
||||||
|
|
||||||
import eu.dnetlib.domain.data.PiwikInfo;
|
import eu.dnetlib.domain.data.PiwikInfo;
|
||||||
import eu.dnetlib.domain.data.Repository;
|
import eu.dnetlib.repo.manager.domain.Repository;
|
||||||
import eu.dnetlib.domain.data.RepositoryInterface;
|
import eu.dnetlib.repo.manager.domain.RepositoryInterface;
|
||||||
import eu.dnetlib.domain.functionality.validator.JobForValidation;
|
import eu.dnetlib.domain.functionality.validator.JobForValidation;
|
||||||
import org.springframework.scheduling.annotation.Async;
|
import org.springframework.scheduling.annotation.Async;
|
||||||
import org.springframework.security.core.Authentication;
|
import org.springframework.security.core.Authentication;
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
package eu.dnetlib.repo.manager.service;
|
package eu.dnetlib.repo.manager.service;
|
||||||
|
|
||||||
import eu.dnetlib.domain.data.PiwikInfo;
|
import eu.dnetlib.domain.data.PiwikInfo;
|
||||||
import eu.dnetlib.domain.data.Repository;
|
import eu.dnetlib.repo.manager.domain.Repository;
|
||||||
import eu.dnetlib.domain.data.RepositoryInterface;
|
import eu.dnetlib.repo.manager.domain.RepositoryInterface;
|
||||||
import eu.dnetlib.domain.functionality.validator.JobForValidation;
|
import eu.dnetlib.domain.functionality.validator.JobForValidation;
|
||||||
import eu.dnetlib.repo.manager.domain.ValidationServiceException;
|
import eu.dnetlib.repo.manager.exception.ValidationServiceException;
|
||||||
import eu.dnetlib.utils.MailLibrary;
|
import eu.dnetlib.utils.MailLibrary;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.mitre.openid.connect.model.OIDCAuthenticationToken;
|
import org.mitre.openid.connect.model.OIDCAuthenticationToken;
|
||||||
|
@ -169,11 +169,11 @@ public class EmailUtilsImpl implements EmailUtils {
|
||||||
public void sendAdminRegistrationEmail(Repository repository, Authentication authentication) throws Exception {
|
public void sendAdminRegistrationEmail(Repository repository, Authentication authentication) throws Exception {
|
||||||
try {
|
try {
|
||||||
String subject = "OpenAIRE content provider registration for " +
|
String subject = "OpenAIRE content provider registration for " +
|
||||||
repository.getDatasourceType() + "[" + repository.getOfficialName() + "]";
|
repository.getEoscDatasourceType() + "[" + repository.getOfficialname() + "]";
|
||||||
|
|
||||||
String message = "Dear administrator" + ",\n" +
|
String message = "Dear administrator" + ",\n" +
|
||||||
"\n" +
|
"\n" +
|
||||||
"We received a request to register the " + repository.getDatasourceType() + "[" + repository.getOfficialName() + "]" +
|
"We received a request to register the " + repository.getEoscDatasourceType() + "[" + repository.getOfficialname() + "]" +
|
||||||
" to the OpenAIRE compliant list of content providers. " +
|
" to the OpenAIRE compliant list of content providers. " +
|
||||||
"\n\n" +
|
"\n\n" +
|
||||||
"User Contact: " + authentication.getName() + " (" + ((OIDCAuthenticationToken) authentication).getUserInfo().getEmail() + ")" +
|
"User Contact: " + authentication.getName() + " (" + ((OIDCAuthenticationToken) authentication).getUserInfo().getEmail() + ")" +
|
||||||
|
@ -195,12 +195,12 @@ public class EmailUtilsImpl implements EmailUtils {
|
||||||
public void sendUserRegistrationEmail(Repository repository, Authentication authentication) throws Exception {
|
public void sendUserRegistrationEmail(Repository repository, Authentication authentication) throws Exception {
|
||||||
try {
|
try {
|
||||||
String subject = "OpenAIRE content provider registration for " +
|
String subject = "OpenAIRE content provider registration for " +
|
||||||
repository.getDatasourceType() + "[" + repository.getOfficialName() + "]";
|
repository.getEoscDatasourceType() + "[" + repository.getOfficialname() + "]";
|
||||||
|
|
||||||
// String message = "Dear " + ((OIDCAuthenticationToken) authentication).getUserInfo().getName() + ",\n" +
|
// String message = "Dear " + ((OIDCAuthenticationToken) authentication).getUserInfo().getName() + ",\n" +
|
||||||
String message = "Dear "+SecurityContextHolder.getContext().getAuthentication().getName()+",\n" +
|
String message = "Dear "+SecurityContextHolder.getContext().getAuthentication().getName()+",\n" +
|
||||||
"\n" +
|
"\n" +
|
||||||
"We received a request to register the " + repository.getDatasourceType() + "[" + repository.getOfficialName() + "]" +
|
"We received a request to register the " + repository.getEoscDatasourceType() + "[" + repository.getOfficialname() + "]" +
|
||||||
" to the OpenAIRE compliant list of content providers. " +
|
" to the OpenAIRE compliant list of content providers. " +
|
||||||
"\n\n" +
|
"\n\n" +
|
||||||
"Please do not reply to this message\n" +
|
"Please do not reply to this message\n" +
|
||||||
|
@ -209,10 +209,10 @@ public class EmailUtilsImpl implements EmailUtils {
|
||||||
"Regards,\n" +
|
"Regards,\n" +
|
||||||
"the OpenAIRE technical team\n";
|
"the OpenAIRE technical team\n";
|
||||||
|
|
||||||
this.sendMail(repository.getRegisteredBy(), subject, message);
|
this.sendMail(repository.getRegisteredby(), subject, message);
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOGGER.error("Error while sending registration notification email to user: " + repository.getRegisteredBy(), e);
|
LOGGER.error("Error while sending registration notification email to user: " + repository.getRegisteredby(), e);
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -221,15 +221,15 @@ public class EmailUtilsImpl implements EmailUtils {
|
||||||
public void sendAdminRegisterInterfaceEmail(Repository repository, String comment, RepositoryInterface repositoryInterface, Authentication authentication) throws Exception {
|
public void sendAdminRegisterInterfaceEmail(Repository repository, String comment, RepositoryInterface repositoryInterface, Authentication authentication) throws Exception {
|
||||||
try {
|
try {
|
||||||
String subject = "OpenAIRE new interface registration request started for " +
|
String subject = "OpenAIRE new interface registration request started for " +
|
||||||
repository.getDatasourceType() + "[" + repository.getOfficialName() + "]";
|
repository.getEoscDatasourceType() + "[" + repository.getOfficialname() + "]";
|
||||||
|
|
||||||
String message = "Dear administrator" + ",\n" +
|
String message = "Dear administrator" + ",\n" +
|
||||||
"\n" +
|
"\n" +
|
||||||
"We received a request to add the following interface: \n\n" +
|
"We received a request to add the following interface: \n\n" +
|
||||||
"Base URL: " + repositoryInterface.getBaseUrl() + "\n" +
|
"Base URL: " + repositoryInterface.getBaseurl() + "\n" +
|
||||||
"Set: " + repositoryInterface.getAccessSet() + "\n" +
|
"Set: " + repositoryInterface.getAccessSet() + "\n" +
|
||||||
"Guidelines: " + repositoryInterface.getDesiredCompatibilityLevel() + "\n\n" +
|
"Guidelines: " + repositoryInterface.getCompatibilityOverride() + "\n\n" +
|
||||||
"to " + repository.getDatasourceType() + "[" + repository.getOfficialName() + "].\n";
|
"to " + repository.getEoscDatasourceType() + "[" + repository.getOfficialname() + "].\n";
|
||||||
|
|
||||||
if (comment != null)
|
if (comment != null)
|
||||||
message += "\nThe users comment was '" + comment + "'\n";
|
message += "\nThe users comment was '" + comment + "'\n";
|
||||||
|
@ -256,15 +256,15 @@ public class EmailUtilsImpl implements EmailUtils {
|
||||||
public void sendUserRegisterInterfaceEmail(Repository repository, String comment, RepositoryInterface repositoryInterface, Authentication authentication) throws Exception {
|
public void sendUserRegisterInterfaceEmail(Repository repository, String comment, RepositoryInterface repositoryInterface, Authentication authentication) throws Exception {
|
||||||
try {
|
try {
|
||||||
String subject = "OpenAIRE new interface registration request started for " +
|
String subject = "OpenAIRE new interface registration request started for " +
|
||||||
repository.getDatasourceType() + "[" + repository.getOfficialName() + "]";
|
repository.getEoscDatasourceType() + "[" + repository.getOfficialname() + "]";
|
||||||
|
|
||||||
String message = "Dear "+SecurityContextHolder.getContext().getAuthentication().getName()+",\n" +
|
String message = "Dear "+SecurityContextHolder.getContext().getAuthentication().getName()+",\n" +
|
||||||
"\n" +
|
"\n" +
|
||||||
"We received a request to add the following interface: \n\n" +
|
"We received a request to add the following interface: \n\n" +
|
||||||
"Base URL: " + repositoryInterface.getBaseUrl() + "\n" +
|
"Base URL: " + repositoryInterface.getBaseurl() + "\n" +
|
||||||
"Set: " + repositoryInterface.getAccessSet() + "\n" +
|
"Set: " + repositoryInterface.getAccessSet() + "\n" +
|
||||||
"Guidelines: " + repositoryInterface.getDesiredCompatibilityLevel() + "\n\n" +
|
"Guidelines: " + repositoryInterface.getCompatibilityOverride() + "\n\n" +
|
||||||
"to " + repository.getDatasourceType() + "[" + repository.getOfficialName() + "].\n";
|
"to " + repository.getEoscDatasourceType() + "[" + repository.getOfficialname() + "].\n";
|
||||||
|
|
||||||
if (comment != null) {
|
if (comment != null) {
|
||||||
message += "\n Your comment was '" + comment + "'\n";
|
message += "\n Your comment was '" + comment + "'\n";
|
||||||
|
@ -278,10 +278,10 @@ public class EmailUtilsImpl implements EmailUtils {
|
||||||
"Regards,\n" +
|
"Regards,\n" +
|
||||||
"the OpenAIRE technical team\n";
|
"the OpenAIRE technical team\n";
|
||||||
|
|
||||||
this.sendMail(repository.getRegisteredBy(), subject, message);
|
this.sendMail(repository.getRegisteredby(), subject, message);
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOGGER.error("Error while sending registration of interface notification email to user: " + repository.getRegisteredBy(), e);
|
LOGGER.error("Error while sending registration of interface notification email to user: " + repository.getRegisteredby(), e);
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -290,20 +290,20 @@ public class EmailUtilsImpl implements EmailUtils {
|
||||||
public void sendUserRegistrationResultsSuccessEmail(String issuerEmail, String jobId, RepositoryInterface repositoryInterface, Repository repository, Authentication authentication) throws Exception {
|
public void sendUserRegistrationResultsSuccessEmail(String issuerEmail, String jobId, RepositoryInterface repositoryInterface, Repository repository, Authentication authentication) throws Exception {
|
||||||
try {
|
try {
|
||||||
String subject = "OpenAIRE new interface registration request - results (success) for " +
|
String subject = "OpenAIRE new interface registration request - results (success) for " +
|
||||||
repository.getDatasourceType() + "[" + repository.getOfficialName() + "]";
|
repository.getEoscDatasourceType() + "[" + repository.getOfficialname() + "]";
|
||||||
|
|
||||||
// String message = "Dear " + ((OIDCAuthenticationToken) authentication).getUserInfo().getName() + ",\n" +
|
// String message = "Dear " + ((OIDCAuthenticationToken) authentication).getUserInfo().getName() + ",\n" +
|
||||||
String message = "Dear user,\n" +
|
String message = "Dear user,\n" +
|
||||||
"\n" +
|
"\n" +
|
||||||
"the compatibility test on " + "[" + repository.getOfficialName() + "]" +
|
"the compatibility test on " + "[" + repository.getOfficialname() + "]" +
|
||||||
" was successful and the datasource type \""+ repository.getDatasourceType() + "\" will be prepared for aggregation in OpenAIRE."+
|
" was successful and the datasource type \""+ repository.getEoscDatasourceType() + "\" will be prepared for aggregation in OpenAIRE."+
|
||||||
"\n\n" +
|
"\n\n" +
|
||||||
"Please note that it usually takes about 3-4 weeks until a data source is indexed and it’s metadata visible on openaire.eu.\n\n" +
|
"Please note that it usually takes about 3-4 weeks until a data source is indexed and it’s metadata visible on openaire.eu.\n\n" +
|
||||||
"Registration identifier in OpenAIRE: "+ repository.getNamespacePrefix()+
|
"Registration identifier in OpenAIRE: "+ repository.getNamespaceprefix()+
|
||||||
"\nOfficial Name:" + repository.getOfficialName() +
|
"\nOfficial Name:" + repository.getOfficialname() +
|
||||||
"\n\nBase URL: "+ repositoryInterface.getBaseUrl() +
|
"\n\nBase URL: "+ repositoryInterface.getBaseurl() +
|
||||||
"\n\nValidation Set: " + repositoryInterface.getAccessSet() +
|
"\n\nValidation Set: " + repositoryInterface.getAccessSet() +
|
||||||
"\n\nGuidelines: "+ repositoryInterface.getDesiredCompatibilityLevel() +
|
"\n\nGuidelines: "+ repositoryInterface.getCompatibilityOverride() +
|
||||||
"\n\nYou can review the validation results here.\n" + valBaseUrl + "" + jobId +
|
"\n\nYou can review the validation results here.\n" + valBaseUrl + "" + jobId +
|
||||||
"\n\n\nPlease do not reply to this email\n"+
|
"\n\n\nPlease do not reply to this email\n"+
|
||||||
"This message has been generated manually\n\n"+
|
"This message has been generated manually\n\n"+
|
||||||
|
@ -311,10 +311,10 @@ public class EmailUtilsImpl implements EmailUtils {
|
||||||
"Regards,\n" +
|
"Regards,\n" +
|
||||||
"the OpenAIRE technical team\n";
|
"the OpenAIRE technical team\n";
|
||||||
|
|
||||||
this.sendMail(repository.getRegisteredBy(), subject, message);
|
this.sendMail(repository.getRegisteredby(), subject, message);
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOGGER.error("Error while sending registration notification email to user: " + repository.getRegisteredBy(), e);
|
LOGGER.error("Error while sending registration notification email to user: " + repository.getRegisteredby(), e);
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -323,19 +323,19 @@ public class EmailUtilsImpl implements EmailUtils {
|
||||||
public void sendAdminRegistrationResultsSuccessEmail(String issuerEmail, String jobId,RepositoryInterface repositoryInterface, Repository repository, Authentication authentication) throws Exception {
|
public void sendAdminRegistrationResultsSuccessEmail(String issuerEmail, String jobId,RepositoryInterface repositoryInterface, Repository repository, Authentication authentication) throws Exception {
|
||||||
try {
|
try {
|
||||||
String subject = "OpenAIRE new interface registration request - results (success) for " +
|
String subject = "OpenAIRE new interface registration request - results (success) for " +
|
||||||
repository.getDatasourceType() + "[" + repository.getOfficialName() + "]";
|
repository.getEoscDatasourceType() + "[" + repository.getOfficialname() + "]";
|
||||||
|
|
||||||
String message = "Dear admin ,\n" +
|
String message = "Dear admin ,\n" +
|
||||||
"\n" +
|
"\n" +
|
||||||
"the compatibility test on " + "[" + repository.getOfficialName() + "]" +
|
"the compatibility test on " + "[" + repository.getOfficialname() + "]" +
|
||||||
" was successful and the datasource type \""+ repository.getDatasourceType() + "\" will be prepared for aggregation in OpenAIRE."+
|
" was successful and the datasource type \""+ repository.getEoscDatasourceType() + "\" will be prepared for aggregation in OpenAIRE."+
|
||||||
"\n\n" +
|
"\n\n" +
|
||||||
"Please note that it usually takes about 3-4 weeks until a data source is indexed and it’s metadata visible on openaire.eu.\n\n" +
|
"Please note that it usually takes about 3-4 weeks until a data source is indexed and it’s metadata visible on openaire.eu.\n\n" +
|
||||||
"Registration identifier in OpenAIRE: "+ repository.getNamespacePrefix()+
|
"Registration identifier in OpenAIRE: "+ repository.getNamespaceprefix()+
|
||||||
"\nOfficial Name:" + repository.getOfficialName() +
|
"\nOfficial Name:" + repository.getOfficialname() +
|
||||||
"\n\nBase URL: "+ repositoryInterface.getBaseUrl() +
|
"\n\nBase URL: "+ repositoryInterface.getBaseurl() +
|
||||||
"\n\nValidation Set: " + repositoryInterface.getAccessSet() +
|
"\n\nValidation Set: " + repositoryInterface.getAccessSet() +
|
||||||
"\n\nGuidelines: "+ repositoryInterface.getDesiredCompatibilityLevel() +
|
"\n\nGuidelines: "+ repositoryInterface.getCompatibilityOverride() +
|
||||||
"\n\nUser Contact:"+ issuerEmail +""+
|
"\n\nUser Contact:"+ issuerEmail +""+
|
||||||
"\n\nYou can review the validation results here.\n" + valBaseUrl + "" + jobId +
|
"\n\nYou can review the validation results here.\n" + valBaseUrl + "" + jobId +
|
||||||
"\n\n\nPlease do not reply to this email\n"+
|
"\n\n\nPlease do not reply to this email\n"+
|
||||||
|
@ -347,7 +347,7 @@ public class EmailUtilsImpl implements EmailUtils {
|
||||||
this.sendMail(this.provideAdminEmail, subject, message);
|
this.sendMail(this.provideAdminEmail, subject, message);
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOGGER.error("Error while sending registration notification email to user: " + repository.getRegisteredBy(), e);
|
LOGGER.error("Error while sending registration notification email to user: " + repository.getRegisteredby(), e);
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -356,19 +356,19 @@ public class EmailUtilsImpl implements EmailUtils {
|
||||||
public void sendUserRegistrationResultsFailureEmail(String jobId, RepositoryInterface repositoryInterface, Repository repository, Authentication authentication) throws Exception {
|
public void sendUserRegistrationResultsFailureEmail(String jobId, RepositoryInterface repositoryInterface, Repository repository, Authentication authentication) throws Exception {
|
||||||
try {
|
try {
|
||||||
String subject = "OpenAIRE new interface registration request - results (failure) for " +
|
String subject = "OpenAIRE new interface registration request - results (failure) for " +
|
||||||
repository.getDatasourceType() + "[" + repository.getOfficialName() + "]";
|
repository.getEoscDatasourceType() + "[" + repository.getOfficialname() + "]";
|
||||||
// String message = "Dear " + ((OIDCAuthenticationToken) authentication).getUserInfo().getName() + ",\n" +
|
// String message = "Dear " + ((OIDCAuthenticationToken) authentication).getUserInfo().getName() + ",\n" +
|
||||||
String message = "Dear user,\n" +
|
String message = "Dear user,\n" +
|
||||||
"\n" +
|
"\n" +
|
||||||
"the compatibility test on " + "[" + repository.getOfficialName() + "]" +
|
"the compatibility test on " + "[" + repository.getOfficialname() + "]" +
|
||||||
" was not successful and the registration process was interrupted."+
|
" was not successful and the registration process was interrupted."+
|
||||||
"\n\n" +
|
"\n\n" +
|
||||||
"We will check what caused the problem and get back to you within a couple of days.\n\n" +
|
"We will check what caused the problem and get back to you within a couple of days.\n\n" +
|
||||||
"Registration identifier in OpenAIRE: "+ repository.getNamespacePrefix()+
|
"Registration identifier in OpenAIRE: "+ repository.getNamespaceprefix()+
|
||||||
"\nOfficial Name:" + repository.getOfficialName() +
|
"\nOfficial Name:" + repository.getOfficialname() +
|
||||||
"\n\nBase URL: "+ repositoryInterface.getBaseUrl() +
|
"\n\nBase URL: "+ repositoryInterface.getBaseurl() +
|
||||||
"\n\nValidation Set: " + repositoryInterface.getAccessSet() +
|
"\n\nValidation Set: " + repositoryInterface.getAccessSet() +
|
||||||
"\n\nGuidelines: "+ repositoryInterface.getDesiredCompatibilityLevel() +
|
"\n\nGuidelines: "+ repositoryInterface.getCompatibilityOverride() +
|
||||||
"\n\nYou can review the validation results here.\n" + valBaseUrl + "" + jobId +
|
"\n\nYou can review the validation results here.\n" + valBaseUrl + "" + jobId +
|
||||||
"\n\n\nPlease do not reply to this email\n"+
|
"\n\n\nPlease do not reply to this email\n"+
|
||||||
"This message has been generated manually\n\n"+
|
"This message has been generated manually\n\n"+
|
||||||
|
@ -376,10 +376,10 @@ public class EmailUtilsImpl implements EmailUtils {
|
||||||
"Regards,\n" +
|
"Regards,\n" +
|
||||||
"the OpenAIRE technical team\n";
|
"the OpenAIRE technical team\n";
|
||||||
|
|
||||||
this.sendMail(repository.getRegisteredBy(), subject, message);
|
this.sendMail(repository.getRegisteredby(), subject, message);
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOGGER.error("Error while sending registration notification email to user: " + repository.getRegisteredBy(), e);
|
LOGGER.error("Error while sending registration notification email to user: " + repository.getRegisteredby(), e);
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -388,19 +388,19 @@ public class EmailUtilsImpl implements EmailUtils {
|
||||||
public void sendAdminRegistrationResultsFailureEmail(String issuerEmail, String jobId, RepositoryInterface repositoryInterface, Repository repository, Authentication authentication) throws Exception {
|
public void sendAdminRegistrationResultsFailureEmail(String issuerEmail, String jobId, RepositoryInterface repositoryInterface, Repository repository, Authentication authentication) throws Exception {
|
||||||
try {
|
try {
|
||||||
String subject = "OpenAIRE new interface registration request - results (failure) for " +
|
String subject = "OpenAIRE new interface registration request - results (failure) for " +
|
||||||
repository.getDatasourceType() + "[" + repository.getOfficialName() + "]";
|
repository.getEoscDatasourceType() + "[" + repository.getOfficialname() + "]";
|
||||||
|
|
||||||
String message = "Dear admin,\n" +
|
String message = "Dear admin,\n" +
|
||||||
"\n" +
|
"\n" +
|
||||||
"the compatibility test on " + "[" + repository.getOfficialName() + "]" +
|
"the compatibility test on " + "[" + repository.getOfficialname() + "]" +
|
||||||
" was not successful and the registration process was interrupted."+
|
" was not successful and the registration process was interrupted."+
|
||||||
"\n\n" +
|
"\n\n" +
|
||||||
"We will check what caused the problem and get back to you within a couple of days.\n\n" +
|
"We will check what caused the problem and get back to you within a couple of days.\n\n" +
|
||||||
"Registration identifier in OpenAIRE: "+ repository.getNamespacePrefix()+
|
"Registration identifier in OpenAIRE: "+ repository.getNamespaceprefix()+
|
||||||
"\nOfficial Name:" + repository.getOfficialName() +
|
"\nOfficial Name:" + repository.getOfficialname() +
|
||||||
"\n\nBase URL: "+ repositoryInterface.getBaseUrl() +
|
"\n\nBase URL: "+ repositoryInterface.getBaseurl() +
|
||||||
"\n\nValidation Set: " + repositoryInterface.getAccessSet() +
|
"\n\nValidation Set: " + repositoryInterface.getAccessSet() +
|
||||||
"\n\nGuidelines: "+ repositoryInterface.getDesiredCompatibilityLevel() +
|
"\n\nGuidelines: "+ repositoryInterface.getCompatibilityOverride() +
|
||||||
"\n\nUser Contact:"+ issuerEmail +""+
|
"\n\nUser Contact:"+ issuerEmail +""+
|
||||||
"\n\nYou can review the validation results here.\n" + valBaseUrl + "" + jobId +
|
"\n\nYou can review the validation results here.\n" + valBaseUrl + "" + jobId +
|
||||||
"\n\n\nPlease do not reply to this email\n"+
|
"\n\n\nPlease do not reply to this email\n"+
|
||||||
|
@ -412,7 +412,7 @@ public class EmailUtilsImpl implements EmailUtils {
|
||||||
this.sendMail(this.provideAdminEmail, subject, message);
|
this.sendMail(this.provideAdminEmail, subject, message);
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOGGER.error("Error while sending registration notification email to user: " + repository.getRegisteredBy(), e);
|
LOGGER.error("Error while sending registration notification email to user: " + repository.getRegisteredby(), e);
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -421,18 +421,18 @@ public class EmailUtilsImpl implements EmailUtils {
|
||||||
public void sendUserUpdateResultsSuccessEmail(String issuer, String jobId, RepositoryInterface repositoryInterface, Repository repository, Authentication authentication) throws Exception {
|
public void sendUserUpdateResultsSuccessEmail(String issuer, String jobId, RepositoryInterface repositoryInterface, Repository repository, Authentication authentication) throws Exception {
|
||||||
try {
|
try {
|
||||||
String subject = "OpenAIRE interface update request - results (success) for " +
|
String subject = "OpenAIRE interface update request - results (success) for " +
|
||||||
repository.getDatasourceType() + "[" + repository.getOfficialName() + "]";
|
repository.getEoscDatasourceType() + "[" + repository.getOfficialname() + "]";
|
||||||
|
|
||||||
// String message = "Dear " + ((OIDCAuthenticationToken) authentication).getUserInfo().getName() + ",\n" +
|
// String message = "Dear " + ((OIDCAuthenticationToken) authentication).getUserInfo().getName() + ",\n" +
|
||||||
String message = "Dear user,\n" +
|
String message = "Dear user,\n" +
|
||||||
"\n" +
|
"\n" +
|
||||||
"the compatibility test on [" + repository.getOfficialName()+"] has been successful\n\n" +
|
"the compatibility test on [" + repository.getOfficialname()+"] has been successful\n\n" +
|
||||||
"We will check your transmitted information and adjust the aggregation settings accordingly. Please note that it usually takes about 3-4 weeks until the changes are visible on openaire.eu."+"\n\n" +
|
"We will check your transmitted information and adjust the aggregation settings accordingly. Please note that it usually takes about 3-4 weeks until the changes are visible on openaire.eu."+"\n\n" +
|
||||||
"Registration identifier in OpenAIRE: "+ repository.getNamespacePrefix()+
|
"Registration identifier in OpenAIRE: "+ repository.getNamespaceprefix()+
|
||||||
"\nOfficial Name:" + repository.getOfficialName() +
|
"\nOfficial Name:" + repository.getOfficialname() +
|
||||||
"\n\nBase URL: "+ repositoryInterface.getBaseUrl() +
|
"\n\nBase URL: "+ repositoryInterface.getBaseurl() +
|
||||||
"\n\nValidation Set: " + repositoryInterface.getAccessSet() +
|
"\n\nValidation Set: " + repositoryInterface.getAccessSet() +
|
||||||
"\n\nGuidelines: "+ repositoryInterface.getDesiredCompatibilityLevel() +
|
"\n\nGuidelines: "+ repositoryInterface.getCompatibilityOverride() +
|
||||||
"\n\nYou can review the validation results here.\n" + valBaseUrl + "" + jobId +
|
"\n\nYou can review the validation results here.\n" + valBaseUrl + "" + jobId +
|
||||||
"\n\n\nPlease do not reply to this email\n"+
|
"\n\n\nPlease do not reply to this email\n"+
|
||||||
"This message has been generated manually\n\n"+
|
"This message has been generated manually\n\n"+
|
||||||
|
@ -452,17 +452,17 @@ public class EmailUtilsImpl implements EmailUtils {
|
||||||
public void sendAdminUpdateResultsSuccessEmail(String issuerEmail, String jobId, RepositoryInterface repositoryInterface, Repository repository, Authentication authentication) throws Exception {
|
public void sendAdminUpdateResultsSuccessEmail(String issuerEmail, String jobId, RepositoryInterface repositoryInterface, Repository repository, Authentication authentication) throws Exception {
|
||||||
try {
|
try {
|
||||||
String subject = "OpenAIRE interface update request - results (success) for " +
|
String subject = "OpenAIRE interface update request - results (success) for " +
|
||||||
repository.getDatasourceType() + "[" + repository.getOfficialName() + "]";
|
repository.getEoscDatasourceType() + "[" + repository.getOfficialname() + "]";
|
||||||
|
|
||||||
String message = "Dear admin,\n" +
|
String message = "Dear admin,\n" +
|
||||||
"\n" +
|
"\n" +
|
||||||
"the compatibility test on [" + repository.getOfficialName()+"] has been successful\n\n" +
|
"the compatibility test on [" + repository.getOfficialname()+"] has been successful\n\n" +
|
||||||
"We will check your transmitted information and adjust the aggregation settings accordingly. Please note that it usually takes about 3-4 weeks until the changes are visible on openaire.eu."+"\n\n" +
|
"We will check your transmitted information and adjust the aggregation settings accordingly. Please note that it usually takes about 3-4 weeks until the changes are visible on openaire.eu."+"\n\n" +
|
||||||
"Registration identifier in OpenAIRE: "+ repository.getNamespacePrefix()+
|
"Registration identifier in OpenAIRE: "+ repository.getNamespaceprefix()+
|
||||||
"\nOfficial Name:" + repository.getOfficialName() +
|
"\nOfficial Name:" + repository.getOfficialname() +
|
||||||
"\n\nBase URL: "+ repositoryInterface.getBaseUrl() +
|
"\n\nBase URL: "+ repositoryInterface.getBaseurl() +
|
||||||
"\n\nValidation Set: " + repositoryInterface.getAccessSet() +
|
"\n\nValidation Set: " + repositoryInterface.getAccessSet() +
|
||||||
"\n\nGuidelines: "+ repositoryInterface.getDesiredCompatibilityLevel() +
|
"\n\nGuidelines: "+ repositoryInterface.getCompatibilityOverride() +
|
||||||
"\n\nUser Contact:"+ issuerEmail +""+
|
"\n\nUser Contact:"+ issuerEmail +""+
|
||||||
"\n\nYou can review the validation results here.\n" + valBaseUrl + "" + jobId +
|
"\n\nYou can review the validation results here.\n" + valBaseUrl + "" + jobId +
|
||||||
"\n\n\nPlease do not reply to this email\n"+
|
"\n\n\nPlease do not reply to this email\n"+
|
||||||
|
@ -483,20 +483,20 @@ public class EmailUtilsImpl implements EmailUtils {
|
||||||
public void sendUserUpdateResultsFailureEmail(String issuer, String jobId, RepositoryInterface repositoryInterface, Repository repository, Authentication authentication) throws Exception {
|
public void sendUserUpdateResultsFailureEmail(String issuer, String jobId, RepositoryInterface repositoryInterface, Repository repository, Authentication authentication) throws Exception {
|
||||||
try {
|
try {
|
||||||
String subject = "OpenAIRE interface update request - results (failure) for " +
|
String subject = "OpenAIRE interface update request - results (failure) for " +
|
||||||
repository.getDatasourceType() + "[" + repository.getOfficialName() + "]";
|
repository.getEoscDatasourceType() + "[" + repository.getOfficialname() + "]";
|
||||||
|
|
||||||
// String message = "Dear " + ((OIDCAuthenticationToken) authentication).getUserInfo().getName() + ",\n" +
|
// String message = "Dear " + ((OIDCAuthenticationToken) authentication).getUserInfo().getName() + ",\n" +
|
||||||
String message = "Dear user,\n" +
|
String message = "Dear user,\n" +
|
||||||
"\n" +
|
"\n" +
|
||||||
"the compatibility test on " + "[" + repository.getOfficialName() + "]" +
|
"the compatibility test on " + "[" + repository.getOfficialname() + "]" +
|
||||||
" was not successful."+
|
" was not successful."+
|
||||||
"\n\n" +
|
"\n\n" +
|
||||||
"WWe will check your transmitted information to see what caused the problem and get back to you within a couple of days.\n\n" +
|
"WWe will check your transmitted information to see what caused the problem and get back to you within a couple of days.\n\n" +
|
||||||
"Registration identifier in OpenAIRE: "+ repository.getNamespacePrefix()+
|
"Registration identifier in OpenAIRE: "+ repository.getNamespaceprefix()+
|
||||||
"\nOfficial Name:" + repository.getOfficialName() +
|
"\nOfficial Name:" + repository.getOfficialname() +
|
||||||
"\n\nBase URL: "+ repositoryInterface.getBaseUrl() +
|
"\n\nBase URL: "+ repositoryInterface.getBaseurl() +
|
||||||
"\n\nValidation Set: " + repositoryInterface.getAccessSet() +
|
"\n\nValidation Set: " + repositoryInterface.getAccessSet() +
|
||||||
"\n\nGuidelines: "+ repositoryInterface.getDesiredCompatibilityLevel() +
|
"\n\nGuidelines: "+ repositoryInterface.getCompatibilityOverride() +
|
||||||
"\n\nYou can review the validation results here.\n" + valBaseUrl + "" + jobId +
|
"\n\nYou can review the validation results here.\n" + valBaseUrl + "" + jobId +
|
||||||
"\n\n\nPlease do not reply to this email\n"+
|
"\n\n\nPlease do not reply to this email\n"+
|
||||||
"This message has been generated manually\n\n"+
|
"This message has been generated manually\n\n"+
|
||||||
|
@ -507,7 +507,7 @@ public class EmailUtilsImpl implements EmailUtils {
|
||||||
this.sendMail(issuer, subject, message);
|
this.sendMail(issuer, subject, message);
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOGGER.error("Error while sending registration notification email to user: " + repository.getRegisteredBy(), e);
|
LOGGER.error("Error while sending registration notification email to user: " + repository.getRegisteredby(), e);
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -516,19 +516,19 @@ public class EmailUtilsImpl implements EmailUtils {
|
||||||
public void sendAdminUpdateResultsFailureEmail(String issuerEmail, String jobId, RepositoryInterface repositoryInterface, Repository repository, Authentication authentication) throws Exception {
|
public void sendAdminUpdateResultsFailureEmail(String issuerEmail, String jobId, RepositoryInterface repositoryInterface, Repository repository, Authentication authentication) throws Exception {
|
||||||
try {
|
try {
|
||||||
String subject = "OpenAIRE interface update request - results (failure) for " +
|
String subject = "OpenAIRE interface update request - results (failure) for " +
|
||||||
repository.getDatasourceType() + "[" + repository.getOfficialName() + "]";
|
repository.getEoscDatasourceType() + "[" + repository.getOfficialname() + "]";
|
||||||
|
|
||||||
String message = "Dear admin,\n" +
|
String message = "Dear admin,\n" +
|
||||||
"\n" +
|
"\n" +
|
||||||
"the compatibility test on " + "[" + repository.getOfficialName() + "]" +
|
"the compatibility test on " + "[" + repository.getOfficialname() + "]" +
|
||||||
" was not successful."+
|
" was not successful."+
|
||||||
"\n\n" +
|
"\n\n" +
|
||||||
"WWe will check your transmitted information to see what caused the problem and get back to you within a couple of days.\n\n" +
|
"WWe will check your transmitted information to see what caused the problem and get back to you within a couple of days.\n\n" +
|
||||||
"Registration identifier in OpenAIRE: "+ repository.getNamespacePrefix()+
|
"Registration identifier in OpenAIRE: "+ repository.getNamespaceprefix()+
|
||||||
"\nOfficial Name:" + repository.getOfficialName() +
|
"\nOfficial Name:" + repository.getOfficialname() +
|
||||||
"\n\nBase URL: "+ repositoryInterface.getBaseUrl() +
|
"\n\nBase URL: "+ repositoryInterface.getBaseurl() +
|
||||||
"\n\nValidation Set: " + repositoryInterface.getAccessSet() +
|
"\n\nValidation Set: " + repositoryInterface.getAccessSet() +
|
||||||
"\n\nGuidelines: "+ repositoryInterface.getDesiredCompatibilityLevel() +
|
"\n\nGuidelines: "+ repositoryInterface.getCompatibilityOverride() +
|
||||||
"\n\nUser Contact:"+ issuerEmail +""+
|
"\n\nUser Contact:"+ issuerEmail +""+
|
||||||
"\n\nYou can review the validation results here.\n" + valBaseUrl + "" + jobId +
|
"\n\nYou can review the validation results here.\n" + valBaseUrl + "" + jobId +
|
||||||
"\n\n\nPlease do not reply to this email\n"+
|
"\n\n\nPlease do not reply to this email\n"+
|
||||||
|
@ -540,7 +540,7 @@ public class EmailUtilsImpl implements EmailUtils {
|
||||||
this.sendMail(this.provideAdminEmail, subject, message);
|
this.sendMail(this.provideAdminEmail, subject, message);
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOGGER.error("Error while sending registration notification email to user: " + repository.getRegisteredBy(), e);
|
LOGGER.error("Error while sending registration notification email to user: " + repository.getRegisteredby(), e);
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -598,7 +598,7 @@ public class EmailUtilsImpl implements EmailUtils {
|
||||||
|
|
||||||
String message = "Dear admin,\n" +
|
String message = "Dear admin,\n" +
|
||||||
"\n" +
|
"\n" +
|
||||||
"the validation job that was automatically submitted for the update/registration of the interface "+repositoryInterface.getId()+" ("+repositoryInterface.getBaseUrl()+", "+repositoryInterface.getAccessSet()+") of the repository "+repository.getId()+" ("+repository.getOfficialName()+") failed to complete." +
|
"the validation job that was automatically submitted for the update/registration of the interface "+repositoryInterface.getId()+" ("+repositoryInterface.getBaseurl()+", "+repositoryInterface.getAccessSet()+") of the repository "+repository.getId()+" ("+repository.getOfficialname()+") failed to complete." +
|
||||||
"This message has been generated automatically.\n\n" +
|
"This message has been generated automatically.\n\n" +
|
||||||
"Regards,\n" +
|
"Regards,\n" +
|
||||||
"the OpenAIRE technical team\n";
|
"the OpenAIRE technical team\n";
|
||||||
|
@ -615,11 +615,11 @@ public class EmailUtilsImpl implements EmailUtils {
|
||||||
public void sendAdminUpdateRepositoryInfoEmail(Repository repository, Authentication authentication) throws Exception {
|
public void sendAdminUpdateRepositoryInfoEmail(Repository repository, Authentication authentication) throws Exception {
|
||||||
try {
|
try {
|
||||||
String subject = "OpenAIRE content provider update information for " +
|
String subject = "OpenAIRE content provider update information for " +
|
||||||
repository.getDatasourceType() + "[" + repository.getOfficialName() + "]";
|
repository.getEoscDatasourceType() + "[" + repository.getOfficialname() + "]";
|
||||||
|
|
||||||
String message = "Dear administrator" + ",\n" +
|
String message = "Dear administrator" + ",\n" +
|
||||||
"\n" +
|
"\n" +
|
||||||
"We received a request to update the basic information for " + repository.getDatasourceType() + "[" + repository.getOfficialName() + "].\n\n" +
|
"We received a request to update the basic information for " + repository.getEoscDatasourceType() + "[" + repository.getOfficialname() + "].\n\n" +
|
||||||
"Please do not reply to this message\n" +
|
"Please do not reply to this message\n" +
|
||||||
"This message has been generated automatically.\n\n" +
|
"This message has been generated automatically.\n\n" +
|
||||||
"Regards,\n" +
|
"Regards,\n" +
|
||||||
|
@ -637,22 +637,22 @@ public class EmailUtilsImpl implements EmailUtils {
|
||||||
public void sendUserUpdateRepositoryInfoEmail(Repository repository, Authentication authentication) throws Exception {
|
public void sendUserUpdateRepositoryInfoEmail(Repository repository, Authentication authentication) throws Exception {
|
||||||
try {
|
try {
|
||||||
String subject = "OpenAIRE content provider update information for " +
|
String subject = "OpenAIRE content provider update information for " +
|
||||||
repository.getDatasourceType() + "[" + repository.getOfficialName() + "]";
|
repository.getEoscDatasourceType() + "[" + repository.getOfficialname() + "]";
|
||||||
|
|
||||||
// String message = "Dear " + ((OIDCAuthenticationToken) authentication).getUserInfo().getName() + ",\n" +
|
// String message = "Dear " + ((OIDCAuthenticationToken) authentication).getUserInfo().getName() + ",\n" +
|
||||||
String message = "Dear user,\n" +
|
String message = "Dear user,\n" +
|
||||||
"\n" +
|
"\n" +
|
||||||
"We received a request to update the basic information for " + repository.getDatasourceType() + "[" + repository.getOfficialName() + "].\n\n" +
|
"We received a request to update the basic information for " + repository.getEoscDatasourceType() + "[" + repository.getOfficialname() + "].\n\n" +
|
||||||
"Please do not reply to this message\n" +
|
"Please do not reply to this message\n" +
|
||||||
"This message has been generated automatically.\n\n" +
|
"This message has been generated automatically.\n\n" +
|
||||||
"If you have any questions, write to 'helpdesk@openaire.eu'. \n\n" +
|
"If you have any questions, write to 'helpdesk@openaire.eu'. \n\n" +
|
||||||
"Regards,\n" +
|
"Regards,\n" +
|
||||||
"the OpenAIRE technical team\n";
|
"the OpenAIRE technical team\n";
|
||||||
|
|
||||||
this.sendMail(repository.getRegisteredBy(), subject, message);
|
this.sendMail(repository.getRegisteredby(), subject, message);
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOGGER.error("Error while sending registration notification email to user: " + repository.getRegisteredBy(), e);
|
LOGGER.error("Error while sending registration notification email to user: " + repository.getRegisteredby(), e);
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -661,15 +661,15 @@ public class EmailUtilsImpl implements EmailUtils {
|
||||||
public void sendAdminUpdateInterfaceEmail(Repository repository, String comment, RepositoryInterface repositoryInterface, Authentication authentication) throws Exception {
|
public void sendAdminUpdateInterfaceEmail(Repository repository, String comment, RepositoryInterface repositoryInterface, Authentication authentication) throws Exception {
|
||||||
try {
|
try {
|
||||||
String subject = "OpenAIRE interface update request started for " +
|
String subject = "OpenAIRE interface update request started for " +
|
||||||
repository.getDatasourceType() + "[" + repository.getOfficialName() + "]";
|
repository.getEoscDatasourceType() + "[" + repository.getOfficialname() + "]";
|
||||||
|
|
||||||
String message = "Dear administrator" + ",\n" +
|
String message = "Dear administrator" + ",\n" +
|
||||||
"\n" +
|
"\n" +
|
||||||
"We received a request to update the following interface: \n\n" +
|
"We received a request to update the following interface: \n\n" +
|
||||||
"Base URL: " + repositoryInterface.getBaseUrl() + "\n" +
|
"Base URL: " + repositoryInterface.getBaseurl() + "\n" +
|
||||||
"Set: " + repositoryInterface.getAccessSet() + "\n" +
|
"Set: " + repositoryInterface.getAccessSet() + "\n" +
|
||||||
"Guidelines: " + repositoryInterface.getDesiredCompatibilityLevel() + "\n\n" +
|
"Guidelines: " + repositoryInterface.getCompatibilityOverride() + "\n\n" +
|
||||||
"for " + repository.getDatasourceType() + "[" + repository.getOfficialName() + "].\n";
|
"for " + repository.getEoscDatasourceType() + "[" + repository.getOfficialname() + "].\n";
|
||||||
|
|
||||||
if (comment != null)
|
if (comment != null)
|
||||||
message += "\nThe users comment was '" + comment + "'\n";
|
message += "\nThe users comment was '" + comment + "'\n";
|
||||||
|
@ -694,16 +694,16 @@ public class EmailUtilsImpl implements EmailUtils {
|
||||||
public void sendUserUpdateInterfaceEmail(Repository repository, String comment, RepositoryInterface repositoryInterface, Authentication authentication) throws Exception {
|
public void sendUserUpdateInterfaceEmail(Repository repository, String comment, RepositoryInterface repositoryInterface, Authentication authentication) throws Exception {
|
||||||
try {
|
try {
|
||||||
String subject = "OpenAIRE interface update request started for " +
|
String subject = "OpenAIRE interface update request started for " +
|
||||||
repository.getDatasourceType() + "[" + repository.getOfficialName() + "]";
|
repository.getEoscDatasourceType() + "[" + repository.getOfficialname() + "]";
|
||||||
|
|
||||||
// String message = "Dear " + ((OIDCAuthenticationToken) authentication).getUserInfo().getName() + ",\n" +
|
// String message = "Dear " + ((OIDCAuthenticationToken) authentication).getUserInfo().getName() + ",\n" +
|
||||||
String message = "Dear user,\n" +
|
String message = "Dear user,\n" +
|
||||||
"\n" +
|
"\n" +
|
||||||
"We received a request to update the following interface: \n\n" +
|
"We received a request to update the following interface: \n\n" +
|
||||||
"Base URL: " + repositoryInterface.getBaseUrl() + "\n" +
|
"Base URL: " + repositoryInterface.getBaseurl() + "\n" +
|
||||||
"Set: " + repositoryInterface.getAccessSet() + "\n" +
|
"Set: " + repositoryInterface.getAccessSet() + "\n" +
|
||||||
"Guidelines: " + repositoryInterface.getDesiredCompatibilityLevel() + "\n\n" +
|
"Guidelines: " + repositoryInterface.getCompatibilityOverride() + "\n\n" +
|
||||||
"for " + repository.getDatasourceType() + "[" + repository.getOfficialName() + "].\n";
|
"for " + repository.getEoscDatasourceType() + "[" + repository.getOfficialname() + "].\n";
|
||||||
|
|
||||||
if (comment != null) {
|
if (comment != null) {
|
||||||
message += "\n Your comment was '" + comment + "'\n";
|
message += "\n Your comment was '" + comment + "'\n";
|
||||||
|
@ -716,10 +716,10 @@ public class EmailUtilsImpl implements EmailUtils {
|
||||||
"Regards,\n" +
|
"Regards,\n" +
|
||||||
"the OpenAIRE technical team\n";
|
"the OpenAIRE technical team\n";
|
||||||
|
|
||||||
this.sendMail(repository.getRegisteredBy(), subject, message);
|
this.sendMail(repository.getRegisteredby(), subject, message);
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOGGER.error("Error while sending registration notification email to user: " + repository.getRegisteredBy(), e);
|
LOGGER.error("Error while sending registration notification email to user: " + repository.getRegisteredby(), e);
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ package eu.dnetlib.repo.manager.service;
|
||||||
import eu.dnetlib.domain.data.PiwikInfo;
|
import eu.dnetlib.domain.data.PiwikInfo;
|
||||||
import eu.dnetlib.repo.manager.domain.OrderByField;
|
import eu.dnetlib.repo.manager.domain.OrderByField;
|
||||||
import eu.dnetlib.repo.manager.domain.OrderByType;
|
import eu.dnetlib.repo.manager.domain.OrderByType;
|
||||||
import eu.dnetlib.repo.manager.domain.RepositoryServiceException;
|
import eu.dnetlib.repo.manager.exception.RepositoryServiceException;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
|
@ -2,10 +2,10 @@ package eu.dnetlib.repo.manager.service;
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import eu.dnetlib.domain.data.PiwikInfo;
|
import eu.dnetlib.domain.data.PiwikInfo;
|
||||||
import eu.dnetlib.domain.data.Repository;
|
import eu.dnetlib.repo.manager.domain.Repository;
|
||||||
import eu.dnetlib.repo.manager.domain.OrderByField;
|
import eu.dnetlib.repo.manager.domain.OrderByField;
|
||||||
import eu.dnetlib.repo.manager.domain.OrderByType;
|
import eu.dnetlib.repo.manager.domain.OrderByType;
|
||||||
import eu.dnetlib.repo.manager.domain.RepositoryServiceException;
|
import eu.dnetlib.repo.manager.exception.RepositoryServiceException;
|
||||||
import org.apache.commons.codec.digest.DigestUtils;
|
import org.apache.commons.codec.digest.DigestUtils;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
package eu.dnetlib.repo.manager.service;
|
package eu.dnetlib.repo.manager.service;
|
||||||
|
|
||||||
import eu.dnetlib.domain.data.Repository;
|
import eu.dnetlib.repo.manager.domain.Repository;
|
||||||
import eu.dnetlib.domain.data.RepositoryInterface;
|
import eu.dnetlib.repo.manager.domain.RepositoryInterface;
|
||||||
import eu.dnetlib.repo.manager.domain.*;
|
import eu.dnetlib.repo.manager.domain.*;
|
||||||
|
import eu.dnetlib.repo.manager.exception.RepositoryServiceException;
|
||||||
import eu.dnetlib.repo.manager.exception.ResourceNotFoundException;
|
import eu.dnetlib.repo.manager.exception.ResourceNotFoundException;
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.springframework.security.core.Authentication;
|
import org.springframework.security.core.Authentication;
|
||||||
|
@ -82,8 +83,6 @@ public interface RepositoryService {
|
||||||
String page,
|
String page,
|
||||||
String size);
|
String size);
|
||||||
|
|
||||||
List<String> getDatasourceVocabularies(String mode);
|
|
||||||
|
|
||||||
Map<String, String> getCompatibilityClasses(String mode);
|
Map<String, String> getCompatibilityClasses(String mode);
|
||||||
|
|
||||||
Map<String, String> getDatasourceClasses(String mode);
|
Map<String, String> getDatasourceClasses(String mode);
|
||||||
|
|
|
@ -5,12 +5,14 @@ import com.google.gson.JsonArray;
|
||||||
import com.google.gson.JsonElement;
|
import com.google.gson.JsonElement;
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
import eu.dnetlib.api.functionality.ValidatorServiceException;
|
import eu.dnetlib.api.functionality.ValidatorServiceException;
|
||||||
import eu.dnetlib.domain.data.Repository;
|
import eu.dnetlib.repo.manager.domain.Repository;
|
||||||
import eu.dnetlib.domain.data.RepositoryInterface;
|
import eu.dnetlib.repo.manager.domain.RepositoryInterface;
|
||||||
import eu.dnetlib.domain.enabling.Vocabulary;
|
import eu.dnetlib.domain.enabling.Vocabulary;
|
||||||
import eu.dnetlib.domain.functionality.validator.JobForValidation;
|
import eu.dnetlib.domain.functionality.validator.JobForValidation;
|
||||||
import eu.dnetlib.repo.manager.domain.*;
|
import eu.dnetlib.repo.manager.domain.*;
|
||||||
import eu.dnetlib.repo.manager.domain.dto.Role;
|
import eu.dnetlib.repo.manager.domain.dto.Role;
|
||||||
|
import eu.dnetlib.repo.manager.exception.BrokerException;
|
||||||
|
import eu.dnetlib.repo.manager.exception.RepositoryServiceException;
|
||||||
import eu.dnetlib.repo.manager.exception.ResourceNotFoundException;
|
import eu.dnetlib.repo.manager.exception.ResourceNotFoundException;
|
||||||
import eu.dnetlib.repo.manager.service.aai.registry.AaiRegistryService;
|
import eu.dnetlib.repo.manager.service.aai.registry.AaiRegistryService;
|
||||||
import eu.dnetlib.repo.manager.service.security.AuthoritiesUpdater;
|
import eu.dnetlib.repo.manager.service.security.AuthoritiesUpdater;
|
||||||
|
@ -72,16 +74,16 @@ public class RepositoryServiceImpl implements RepositoryService {
|
||||||
@Value("${services.provide.usageStatisticsNumbersBaseURL}")
|
@Value("${services.provide.usageStatisticsNumbersBaseURL}")
|
||||||
private String usageStatisticsNumbersBaseURL;
|
private String usageStatisticsNumbersBaseURL;
|
||||||
|
|
||||||
|
private final Converter converter;
|
||||||
|
|
||||||
private static final Map<String, List<String>> dataSourceClass = new HashMap<>();
|
private static final Map<String, List<String>> dataSourceClass = new HashMap<>();
|
||||||
private static final Map<String, String> invertedDataSourceClass = new HashMap<>();
|
private static final Map<String, String> invertedDataSourceClass = new HashMap<>();
|
||||||
|
|
||||||
|
|
||||||
private final String[] vocabularyNames = {"dnet:countries", "dnet:datasource_typologies", "dnet:compatibilityLevel"};
|
private final String[] vocabularyNames = {"dnet:countries", "dnet:eosc_datasource_types", "dnet:compatibilityLevel"};
|
||||||
private final Map<String, Vocabulary> vocabularyMap = new ConcurrentHashMap<>();
|
private final Map<String, Vocabulary> vocabularyMap = new ConcurrentHashMap<>();
|
||||||
private final Map<String, String> countriesMap = new HashMap<>();
|
private final Map<String, String> countriesMap = new HashMap<>();
|
||||||
private final Map<String, String> inverseCountriesMap = new HashMap<>();
|
private final Map<String, String> inverseCountriesMap = new HashMap<>();
|
||||||
|
|
||||||
private HttpHeaders httpHeaders;
|
private HttpHeaders httpHeaders;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
@ -91,6 +93,7 @@ public class RepositoryServiceImpl implements RepositoryService {
|
||||||
AuthoritiesUpdater authoritiesUpdater,
|
AuthoritiesUpdater authoritiesUpdater,
|
||||||
VocabularyLoader vocabularyLoader,
|
VocabularyLoader vocabularyLoader,
|
||||||
RestTemplate restTemplate,
|
RestTemplate restTemplate,
|
||||||
|
Converter converter,
|
||||||
@Lazy EmailUtils emailUtils,
|
@Lazy EmailUtils emailUtils,
|
||||||
@Lazy ValidatorService validatorService,
|
@Lazy ValidatorService validatorService,
|
||||||
@Lazy PiWikService piWikService) {
|
@Lazy PiWikService piWikService) {
|
||||||
|
@ -100,6 +103,7 @@ public class RepositoryServiceImpl implements RepositoryService {
|
||||||
this.authoritiesUpdater = authoritiesUpdater;
|
this.authoritiesUpdater = authoritiesUpdater;
|
||||||
this.vocabularyLoader = vocabularyLoader;
|
this.vocabularyLoader = vocabularyLoader;
|
||||||
this.piWikService = piWikService;
|
this.piWikService = piWikService;
|
||||||
|
this.converter = converter;
|
||||||
this.emailUtils = emailUtils;
|
this.emailUtils = emailUtils;
|
||||||
this.validatorService = validatorService;
|
this.validatorService = validatorService;
|
||||||
this.restTemplate = restTemplate;
|
this.restTemplate = restTemplate;
|
||||||
|
@ -115,8 +119,8 @@ public class RepositoryServiceImpl implements RepositoryService {
|
||||||
dataSourceClass.putIfAbsent("aggregator", new ArrayList<>());
|
dataSourceClass.putIfAbsent("aggregator", new ArrayList<>());
|
||||||
dataSourceClass.get("aggregator").add(key);
|
dataSourceClass.get("aggregator").add(key);
|
||||||
} else if (key.contains("crissystem")) {
|
} else if (key.contains("crissystem")) {
|
||||||
dataSourceClass.putIfAbsent("cris", new ArrayList<>());
|
dataSourceClass.putIfAbsent("dris", new ArrayList<>());
|
||||||
dataSourceClass.get("cris").add(key);
|
dataSourceClass.get("dris").add(key);
|
||||||
} else if (key.contains("pubsrepository::journal")) { // do not change order -->
|
} else if (key.contains("pubsrepository::journal")) { // do not change order -->
|
||||||
dataSourceClass.putIfAbsent("journal", Collections.singletonList("pubsrepository::journal"));
|
dataSourceClass.putIfAbsent("journal", Collections.singletonList("pubsrepository::journal"));
|
||||||
} else if (key.contains("pubsrepository")) { // do not change order <--
|
} else if (key.contains("pubsrepository")) { // do not change order <--
|
||||||
|
@ -175,9 +179,9 @@ public class RepositoryServiceImpl implements RepositoryService {
|
||||||
|
|
||||||
for (String repoId : ids) {
|
for (String repoId : ids) {
|
||||||
requestFilter.setId(repoId);
|
requestFilter.setId(repoId);
|
||||||
String rs = restTemplate.postForObject(uriComponents.toUri(), requestFilter, String.class);
|
List<Repository> rs = restTemplate.postForObject(uriComponents.toUri(), requestFilter, List.class);
|
||||||
|
|
||||||
repos.addAll(Converter.jsonToRepositoryList(new JSONObject(rs)));
|
// repos.addAll(converter.toRepositoryList(new JSONObject(rs)));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Repository r : repos)
|
for (Repository r : repos)
|
||||||
|
@ -239,12 +243,10 @@ public class RepositoryServiceImpl implements RepositoryService {
|
||||||
ObjectMapper mapper = new ObjectMapper();
|
ObjectMapper mapper = new ObjectMapper();
|
||||||
|
|
||||||
String filterKey = "UNKNOWN";
|
String filterKey = "UNKNOWN";
|
||||||
if (mode.equalsIgnoreCase("opendoar"))
|
if (mode.equalsIgnoreCase("repository"))
|
||||||
filterKey = "openaire____::opendoar";
|
filterKey = "Repository";
|
||||||
else if (mode.equalsIgnoreCase("re3data"))
|
|
||||||
filterKey = "openaire____::re3data";
|
|
||||||
else if (mode.equalsIgnoreCase("cris"))
|
else if (mode.equalsIgnoreCase("cris"))
|
||||||
filterKey = "eurocrisdris::dris";
|
filterKey = "CRIS system";
|
||||||
|
|
||||||
|
|
||||||
LOGGER.debug("Country code equals : " + country);
|
LOGGER.debug("Country code equals : " + country);
|
||||||
|
@ -253,7 +255,7 @@ public class RepositoryServiceImpl implements RepositoryService {
|
||||||
UriComponents uriComponents = searchSnipperDatasource(String.valueOf(page), String.valueOf(size));
|
UriComponents uriComponents = searchSnipperDatasource(String.valueOf(page), String.valueOf(size));
|
||||||
RequestFilter requestFilter = new RequestFilter();
|
RequestFilter requestFilter = new RequestFilter();
|
||||||
requestFilter.setCountry(country);
|
requestFilter.setCountry(country);
|
||||||
requestFilter.setCollectedfrom(filterKey);
|
requestFilter.setEoscDatasourceType(filterKey);
|
||||||
|
|
||||||
String rs = restTemplate.postForObject(uriComponents.toUri(), requestFilter, String.class);
|
String rs = restTemplate.postForObject(uriComponents.toUri(), requestFilter, String.class);
|
||||||
JSONArray jsonArray = (JSONArray) new JSONObject(rs).get("datasourceInfo");
|
JSONArray jsonArray = (JSONArray) new JSONObject(rs).get("datasourceInfo");
|
||||||
|
@ -309,15 +311,8 @@ public class RepositoryServiceImpl implements RepositoryService {
|
||||||
}
|
}
|
||||||
|
|
||||||
private Repository updateRepositoryInfo(Repository r) throws JSONException {
|
private Repository updateRepositoryInfo(Repository r) throws JSONException {
|
||||||
|
|
||||||
/*
|
|
||||||
* from datasource class
|
|
||||||
* we get the datasource type form the inverted map
|
|
||||||
* */
|
|
||||||
r.setDatasourceType(getRepositoryType(r.getDatasourceClass()));
|
|
||||||
r.setInterfaces(this.getRepositoryInterface(r.getId()));
|
r.setInterfaces(this.getRepositoryInterface(r.getId()));
|
||||||
r.setPiwikInfo(piWikService.getPiwikSiteForRepo(r.getId()));
|
r.setPiwikInfo(piWikService.getPiwikSiteForRepo(r.getId()));
|
||||||
r.setCountryName(getCountryName(r.getCountryCode()));
|
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -338,21 +333,33 @@ public class RepositoryServiceImpl implements RepositoryService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<RepositorySnippet> getRepositoriesSnippetsOfUser(String page, String size) throws Exception {
|
public List<RepositorySnippet> getRepositoriesSnippetsOfUser(String page, String size) throws Exception {
|
||||||
Collection<String> repoIds = roleMappingService.getRepoIdsByRoleIds(authorizationService.getUserRoles());
|
return getRepositoriesSnippetsOfUser(null, page, size);
|
||||||
return getRepositoriesSnippets(new ArrayList<>(repoIds));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<RepositorySnippet> getRepositoriesSnippetsOfUser(String userEmail, String page, String size) throws Exception {
|
public List<RepositorySnippet> getRepositoriesSnippetsOfUser(String userEmail, String page, String size) throws Exception {
|
||||||
Collection<String> repoIds = roleMappingService.getRepoIdsByRoleIds(authorizationService.getUserRoles(userEmail));
|
int from = Integer.parseInt(page) * Integer.parseInt(size);
|
||||||
return getRepositoriesSnippets(new ArrayList<>(repoIds));
|
int to = from + Integer.parseInt(size);
|
||||||
|
List<String> repoIds = new ArrayList<>();
|
||||||
|
if (userEmail != null && !"".equals(userEmail)) {
|
||||||
|
repoIds.addAll(roleMappingService.getRepoIdsByRoleIds(authorizationService.getUserRoles(userEmail)));
|
||||||
|
} else {
|
||||||
|
repoIds.addAll(roleMappingService.getRepoIdsByRoleIds(authorizationService.getUserRoles()));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (repoIds.size() < from) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
} else if (repoIds.size() < to) {
|
||||||
|
to = repoIds.size();
|
||||||
|
}
|
||||||
|
return getRepositoriesSnippets(repoIds.subList(from, to)); // FIXME: returns less results if some repos are not found
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RepositorySnippet getRepositorySnippetById(String id) throws JSONException, ResourceNotFoundException {
|
public RepositorySnippet getRepositorySnippetById(String id) throws JSONException, ResourceNotFoundException {
|
||||||
|
|
||||||
LOGGER.debug("Retrieving repositories with id : " + id);
|
LOGGER.debug("Retrieving repositories with id : " + id);
|
||||||
RepositorySnippet repo = null;
|
RepositorySnippet repo;
|
||||||
UriComponents uriComponents = searchSnipperDatasource("0", "100");
|
UriComponents uriComponents = searchSnipperDatasource("0", "100");
|
||||||
RequestFilter requestFilter = new RequestFilter();
|
RequestFilter requestFilter = new RequestFilter();
|
||||||
requestFilter.setId(id);
|
requestFilter.setId(id);
|
||||||
|
@ -363,7 +370,7 @@ public class RepositoryServiceImpl implements RepositoryService {
|
||||||
if (jsonArray.length() == 0)
|
if (jsonArray.length() == 0)
|
||||||
throw new ResourceNotFoundException();
|
throw new ResourceNotFoundException();
|
||||||
|
|
||||||
repo = Converter.jsonToRepositorySnippetObject(jsonArray.getJSONObject(0));
|
repo = converter.toRepositorySnippet(jsonArray.getJSONObject(0));
|
||||||
return repo;
|
return repo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -371,19 +378,25 @@ public class RepositoryServiceImpl implements RepositoryService {
|
||||||
public Repository getRepositoryById(String id) throws JSONException, ResourceNotFoundException {
|
public Repository getRepositoryById(String id) throws JSONException, ResourceNotFoundException {
|
||||||
|
|
||||||
LOGGER.debug("Retrieving repositories with id : " + id);
|
LOGGER.debug("Retrieving repositories with id : " + id);
|
||||||
Repository repo = null;
|
Repository repo;
|
||||||
UriComponents uriComponents = searchDatasource("0", "100");
|
UriComponents uriComponents = searchDatasource("0", "100");
|
||||||
RequestFilter requestFilter = new RequestFilter();
|
RequestFilter requestFilter = new RequestFilter();
|
||||||
requestFilter.setId(id);
|
requestFilter.setId(id);
|
||||||
|
|
||||||
String rs = restTemplate.postForObject(uriComponents.toUri(), requestFilter, String.class);
|
// String rs = restTemplate.postForObject(uriComponents.toUri(), requestFilter, String.class);
|
||||||
JSONArray jsonArray = (JSONArray) new JSONObject(rs).get("datasourceInfo");
|
// JSONArray jsonArray = (JSONArray) new JSONObject(rs).get("datasourceInfo");
|
||||||
|
|
||||||
if (jsonArray.length() == 0)
|
DatasourceResponse response;
|
||||||
|
response = (DatasourceResponse) restTemplate.postForObject(uriComponents.toUri(), requestFilter, DatasourceResponse.class);
|
||||||
|
List<DatasourceDetails> datasources = response.getDatasourceInfo();
|
||||||
|
if (datasources.size() == 0)
|
||||||
throw new ResourceNotFoundException();
|
throw new ResourceNotFoundException();
|
||||||
|
|
||||||
repo = Converter.jsonToRepositoryObject(jsonArray.getJSONObject(0));
|
// repo = converter.toRepository(jsonArray.getJSONObject(0));
|
||||||
return updateRepositoryInfo(repo);
|
// return updateRepositoryInfo(repo);
|
||||||
|
|
||||||
|
return updateRepositoryInfo(converter.toRepository(datasources.get(0)));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -396,12 +409,9 @@ public class RepositoryServiceImpl implements RepositoryService {
|
||||||
String rs = restTemplate.getForObject(uriComponents.toUri(), String.class);
|
String rs = restTemplate.getForObject(uriComponents.toUri(), String.class);
|
||||||
JSONArray aggregationInfo = new JSONObject(rs).getJSONArray("aggregationInfo");
|
JSONArray aggregationInfo = new JSONObject(rs).getJSONArray("aggregationInfo");
|
||||||
|
|
||||||
List<AggregationDetails> aggregationHistory = new ArrayList<>(Converter.getAggregationHistoryFromJson(aggregationInfo));
|
List<AggregationDetails> aggregationHistory = new ArrayList<>(converter.toAggregationHistory(aggregationInfo));
|
||||||
|
|
||||||
return aggregationHistory;
|
return aggregationHistory;
|
||||||
// return aggregationHistory.size() == 0 ? aggregationHistory : aggregationHistory.stream()
|
|
||||||
// .sorted(Comparator.comparing(AggregationDetails::getDate).reversed())
|
|
||||||
// .collect(Collectors.toList());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -444,7 +454,7 @@ public class RepositoryServiceImpl implements RepositoryService {
|
||||||
requestFilter.setOfficialname(name);
|
requestFilter.setOfficialname(name);
|
||||||
|
|
||||||
String rs = restTemplate.postForObject(uriComponents.toUri(), requestFilter, String.class);
|
String rs = restTemplate.postForObject(uriComponents.toUri(), requestFilter, String.class);
|
||||||
List<Repository> repos = Converter.jsonToRepositoryList(new JSONObject(rs));
|
List<Repository> repos = converter.toRepositoryList(new JSONObject(rs));
|
||||||
for (Repository r : repos)
|
for (Repository r : repos)
|
||||||
updateRepositoryInfo(r);
|
updateRepositoryInfo(r);
|
||||||
return repos;
|
return repos;
|
||||||
|
@ -459,8 +469,10 @@ public class RepositoryServiceImpl implements RepositoryService {
|
||||||
.path("/{id}")
|
.path("/{id}")
|
||||||
.build().expand(id).encode();
|
.build().expand(id).encode();
|
||||||
|
|
||||||
String rs = restTemplate.getForObject(uriComponents.toUri(), String.class);
|
// String rs = restTemplate.getForObject(uriComponents.toUri(), String.class);
|
||||||
return Converter.jsonToRepositoryInterfaceList(new JSONObject(rs));
|
ApiDetailsResponse rs = restTemplate.getForObject(uriComponents.toUri(), ApiDetailsResponse.class);
|
||||||
|
|
||||||
|
return converter.toRepositoryInterfaceList(rs.getApi());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -469,26 +481,37 @@ public class RepositoryServiceImpl implements RepositoryService {
|
||||||
|
|
||||||
LOGGER.debug("storing " + datatype + " repository with id: " + repository.getId());
|
LOGGER.debug("storing " + datatype + " repository with id: " + repository.getId());
|
||||||
|
|
||||||
repository.setCountryCode(countriesMap.get(repository.getCountryName()));
|
|
||||||
repository.setActivationId(UUID.randomUUID().toString());
|
repository.setActivationId(UUID.randomUUID().toString());
|
||||||
repository.setCollectedFrom("infrastruct_::openaire");
|
repository.setCollectedfrom("infrastruct_::openaire");
|
||||||
|
|
||||||
|
// Date now = new Date();
|
||||||
|
// repository.setRegistrationdate(now);
|
||||||
|
// repository.setConsentTermsOfUseDate(now);
|
||||||
|
// repository.setLastConsentTermsOfUseDate(now);
|
||||||
|
|
||||||
if (datatype.equals("journal")) {
|
if (datatype.equals("journal")) {
|
||||||
|
repository.setEoscDatasourceType("Journal archive");
|
||||||
repository.setId("openaire____::issn" + repository.getIssn());
|
repository.setId("openaire____::issn" + repository.getIssn());
|
||||||
repository.setNamespacePrefix("issn" + repository.getIssn());
|
repository.setNamespaceprefix("issn" + repository.getIssn());
|
||||||
this.storeRepository(repository, SecurityContextHolder.getContext().getAuthentication());
|
this.storeRepository(repository, SecurityContextHolder.getContext().getAuthentication());
|
||||||
} else if (datatype.equals("aggregator")) {
|
} else if (datatype.equals("aggregator")) {
|
||||||
repository.setId("openaire____::" + DigestUtils.md5Hex(repository.getOfficialName()));
|
repository.setEoscDatasourceType("Aggregator");
|
||||||
repository.setNamespacePrefix(DigestUtils.md5Hex(repository.getOfficialName()).substring(0, 12));
|
repository.setId("openaire____::" + DigestUtils.md5Hex(repository.getOfficialname()));
|
||||||
|
repository.setNamespaceprefix(DigestUtils.md5Hex(repository.getOfficialname()).substring(0, 12));
|
||||||
this.storeRepository(repository, SecurityContextHolder.getContext().getAuthentication());
|
this.storeRepository(repository, SecurityContextHolder.getContext().getAuthentication());
|
||||||
} else {
|
} else {
|
||||||
|
if (repository.getTypology().contains("crissystem")) {
|
||||||
|
repository.setEoscDatasourceType("CRIS system");
|
||||||
|
} else {
|
||||||
|
repository.setEoscDatasourceType("Repository");
|
||||||
|
}
|
||||||
this.latentUpdate(repository, SecurityContextHolder.getContext().getAuthentication());
|
this.latentUpdate(repository, SecurityContextHolder.getContext().getAuthentication());
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: move the following code elsewhere (creation and assignment of role to user) ??
|
// TODO: move the following code elsewhere (creation and assignment of role to user) ??
|
||||||
// Create new role
|
// Create new role
|
||||||
String newRoleName = roleMappingService.getRoleIdByRepoId(repository.getId());
|
String newRoleName = roleMappingService.getRoleIdByRepoId(repository.getId());
|
||||||
Role newRole = new Role(newRoleName, repository.getOfficialName());
|
Role newRole = new Role(newRoleName, repository.getOfficialname());
|
||||||
Integer couId = null;
|
Integer couId = null;
|
||||||
try {
|
try {
|
||||||
couId = registryCalls.createRole(newRole);
|
couId = registryCalls.createRole(newRole);
|
||||||
|
@ -529,10 +552,11 @@ public class RepositoryServiceImpl implements RepositoryService {
|
||||||
.build()
|
.build()
|
||||||
.encode();
|
.encode();
|
||||||
|
|
||||||
String json_repository = Converter.repositoryObjectToJson(repository);
|
// FIXME: problematic
|
||||||
LOGGER.debug("JSON to add(update) -> " + json_repository);
|
// String json_repository = converter.toJson(repository);
|
||||||
|
// LOGGER.debug("JSON to add(update) -> " + json_repository);
|
||||||
|
|
||||||
HttpEntity<String> httpEntity = new HttpEntity<>(json_repository, httpHeaders);
|
HttpEntity<Repository> httpEntity = new HttpEntity<>(repository, httpHeaders); // TODO: check if it works (Repository contains extra fields)
|
||||||
ResponseEntity responseEntity = restTemplate.exchange(uriComponents.toUri(), HttpMethod.POST, httpEntity, ResponseEntity.class);
|
ResponseEntity responseEntity = restTemplate.exchange(uriComponents.toUri(), HttpMethod.POST, httpEntity, ResponseEntity.class);
|
||||||
|
|
||||||
if (responseEntity.getStatusCode().equals(HttpStatus.OK)) {
|
if (responseEntity.getStatusCode().equals(HttpStatus.OK)) {
|
||||||
|
@ -555,11 +579,11 @@ public class RepositoryServiceImpl implements RepositoryService {
|
||||||
.build()
|
.build()
|
||||||
.encode();
|
.encode();
|
||||||
|
|
||||||
String json_repository = Converter.repositoryObjectToJson(repository);
|
// FIXME: problematic
|
||||||
|
// String json_repository = converter.toJson(repository);
|
||||||
|
// LOGGER.debug("JSON to update -> " + json_repository);
|
||||||
|
|
||||||
LOGGER.debug("JSON to update -> " + json_repository);
|
HttpEntity<Repository> httpEntity = new HttpEntity<>(repository, httpHeaders);
|
||||||
|
|
||||||
HttpEntity<String> httpEntity = new HttpEntity<String>(json_repository, httpHeaders);
|
|
||||||
ResponseEntity responseEntity = restTemplate.exchange(uriComponents.toUri(), HttpMethod.POST, httpEntity
|
ResponseEntity responseEntity = restTemplate.exchange(uriComponents.toUri(), HttpMethod.POST, httpEntity
|
||||||
, ResponseEntity.class);
|
, ResponseEntity.class);
|
||||||
|
|
||||||
|
@ -580,16 +604,16 @@ public class RepositoryServiceImpl implements RepositoryService {
|
||||||
|
|
||||||
Date utilDate = new Date();
|
Date utilDate = new Date();
|
||||||
Timestamp date = new Timestamp(utilDate.getTime());
|
Timestamp date = new Timestamp(utilDate.getTime());
|
||||||
repository.setDateOfCollection(date);
|
repository.setDateofcollection(date);
|
||||||
repository.setAggregator("OPENAIRE");
|
repository.setAggregator("OPENAIRE");
|
||||||
repository.setCountryCode(countriesMap.get(repository.getCountryName()));
|
// repository.setCountryCode(countriesMap.get(repository.getCountryName()));
|
||||||
|
|
||||||
UriComponents uriComponents = UriComponentsBuilder
|
UriComponents uriComponents = UriComponentsBuilder
|
||||||
.fromHttpUrl(baseAddress + "/ds/add/")
|
.fromHttpUrl(baseAddress + "/ds/add/")
|
||||||
.build()
|
.build()
|
||||||
.encode();
|
.encode();
|
||||||
String json_repository = Converter.repositoryObjectToJson(repository);
|
// String json_repository = converter.toJson(repository);
|
||||||
HttpEntity<String> httpEntity = new HttpEntity<String>(json_repository, httpHeaders);
|
HttpEntity<Repository> httpEntity = new HttpEntity<>(repository, httpHeaders);
|
||||||
ResponseEntity responseEntity = restTemplate.exchange(uriComponents.toUri(), HttpMethod.POST, httpEntity, ResponseEntity.class);
|
ResponseEntity responseEntity = restTemplate.exchange(uriComponents.toUri(), HttpMethod.POST, httpEntity, ResponseEntity.class);
|
||||||
|
|
||||||
if (responseEntity.getStatusCode().equals(HttpStatus.OK)) {
|
if (responseEntity.getStatusCode().equals(HttpStatus.OK)) {
|
||||||
|
@ -622,14 +646,14 @@ public class RepositoryServiceImpl implements RepositoryService {
|
||||||
String comment, RepositoryInterface repositoryInterface) throws Exception {
|
String comment, RepositoryInterface repositoryInterface) throws Exception {
|
||||||
Repository e = this.getRepositoryById(repoId);
|
Repository e = this.getRepositoryById(repoId);
|
||||||
repositoryInterface = createRepositoryInterface(e, repositoryInterface, datatype);
|
repositoryInterface = createRepositoryInterface(e, repositoryInterface, datatype);
|
||||||
String json_interface = Converter.repositoryInterfaceObjectToJson(e, repositoryInterface);
|
// String json_interface = converter.toJson(e, repositoryInterface);
|
||||||
|
|
||||||
UriComponents uriComponents = UriComponentsBuilder
|
UriComponents uriComponents = UriComponentsBuilder
|
||||||
.fromHttpUrl(baseAddress + "/ds/api/add/")
|
.fromHttpUrl(baseAddress + "/ds/api/add/")
|
||||||
.build()
|
.build()
|
||||||
.encode();
|
.encode();
|
||||||
|
|
||||||
HttpEntity<String> httpEntity = new HttpEntity<>(json_interface, httpHeaders);
|
HttpEntity<RepositoryInterface> httpEntity = new HttpEntity<>(repositoryInterface, httpHeaders);
|
||||||
|
|
||||||
restTemplate.postForObject(uriComponents.toUri(), httpEntity, String.class);
|
restTemplate.postForObject(uriComponents.toUri(), httpEntity, String.class);
|
||||||
|
|
||||||
|
@ -650,8 +674,8 @@ public class RepositoryServiceImpl implements RepositoryService {
|
||||||
String registeredBy,
|
String registeredBy,
|
||||||
String comment, RepositoryInterface repositoryInterface) throws Exception {
|
String comment, RepositoryInterface repositoryInterface) throws Exception {
|
||||||
|
|
||||||
this.updateBaseUrl(repoId, repositoryInterface.getId(), repositoryInterface.getBaseUrl());
|
this.updateBaseUrl(repoId, repositoryInterface.getId(), repositoryInterface.getBaseurl());
|
||||||
this.updateCompliance(repoId, repositoryInterface.getId(), repositoryInterface.getCompliance());
|
this.updateCompliance(repoId, repositoryInterface.getId(), repositoryInterface.getCompatibility());
|
||||||
this.updateValidationSet(repoId, repositoryInterface.getId(), repositoryInterface.getAccessSet());
|
this.updateValidationSet(repoId, repositoryInterface.getId(), repositoryInterface.getAccessSet());
|
||||||
|
|
||||||
Repository repository = this.getRepositoryById(repoId);
|
Repository repository = this.getRepositoryById(repoId);
|
||||||
|
@ -676,12 +700,12 @@ public class RepositoryServiceImpl implements RepositoryService {
|
||||||
|
|
||||||
job.setActivationId(UUID.randomUUID().toString());
|
job.setActivationId(UUID.randomUUID().toString());
|
||||||
job.setAdminEmails(Collections.singletonList(this.adminEmail));
|
job.setAdminEmails(Collections.singletonList(this.adminEmail));
|
||||||
job.setBaseUrl(iFace.getBaseUrl());
|
job.setBaseUrl(iFace.getBaseurl());
|
||||||
job.setDatasourceId(repo.getId());
|
job.setDatasourceId(repo.getId());
|
||||||
job.setDesiredCompatibilityLevel(iFace.getDesiredCompatibilityLevel());
|
job.setDesiredCompatibilityLevel(iFace.getCompatibilityOverride());
|
||||||
job.setInterfaceId(iFace.getId());
|
job.setInterfaceId(iFace.getId());
|
||||||
job.setOfficialName(repo.getOfficialName());
|
job.setOfficialName(repo.getOfficialname());
|
||||||
job.setRepoType(repo.getDatasourceType());
|
job.setRepoType(repo.getEoscDatasourceType());
|
||||||
job.setUserEmail(userEmail);
|
job.setUserEmail(userEmail);
|
||||||
job.setValidationSet((iFace.getAccessSet().isEmpty() ? "none" : iFace.getAccessSet()));
|
job.setValidationSet((iFace.getAccessSet().isEmpty() ? "none" : iFace.getAccessSet()));
|
||||||
job.setRecords(-1);
|
job.setRecords(-1);
|
||||||
|
@ -693,8 +717,9 @@ public class RepositoryServiceImpl implements RepositoryService {
|
||||||
|
|
||||||
private RepositoryInterface createRepositoryInterface(Repository repo, RepositoryInterface iFace, String datatype) {
|
private RepositoryInterface createRepositoryInterface(Repository repo, RepositoryInterface iFace, String datatype) {
|
||||||
|
|
||||||
iFace.setContentDescription("metadata");
|
iFace.setDatasource(repo.getId());
|
||||||
iFace.setCompliance("UNKNOWN");
|
iFace.setContentdescription("metadata");
|
||||||
|
iFace.setCompatibility("UNKNOWN");
|
||||||
|
|
||||||
if (datatype.equals("re3data"))
|
if (datatype.equals("re3data"))
|
||||||
iFace.setAccessFormat("oai_datacite");
|
iFace.setAccessFormat("oai_datacite");
|
||||||
|
@ -702,8 +727,9 @@ public class RepositoryServiceImpl implements RepositoryService {
|
||||||
iFace.setAccessFormat("oai_dc");
|
iFace.setAccessFormat("oai_dc");
|
||||||
|
|
||||||
|
|
||||||
if (repo.getDatasourceClass() != null && !repo.getDatasourceClass().isEmpty())
|
// FIXME: this will probably not work
|
||||||
iFace.setTypology(repo.getDatasourceClass());
|
if (repo.getEoscDatasourceType() != null && !repo.getEoscDatasourceType().isEmpty())
|
||||||
|
iFace.setTypology(repo.getEoscDatasourceType());
|
||||||
else if (datatype.equalsIgnoreCase("journal"))
|
else if (datatype.equalsIgnoreCase("journal"))
|
||||||
iFace.setTypology("pubsrepository::journal");
|
iFace.setTypology("pubsrepository::journal");
|
||||||
else if (datatype.equalsIgnoreCase("aggregator"))
|
else if (datatype.equalsIgnoreCase("aggregator"))
|
||||||
|
@ -714,12 +740,12 @@ public class RepositoryServiceImpl implements RepositoryService {
|
||||||
iFace.setTypology("datarepository::unknown");
|
iFace.setTypology("datarepository::unknown");
|
||||||
|
|
||||||
iFace.setRemovable(true);
|
iFace.setRemovable(true);
|
||||||
iFace.setAccessProtocol("oai");
|
iFace.setProtocol("oai");
|
||||||
iFace.setMetadataIdentifierPath("//*[local-name()='header']/*[local-name()='identifier']");
|
iFace.setMetadataIdentifierPath("//*[local-name()='header']/*[local-name()='identifier']");
|
||||||
iFace.setId("api_________::" + repo.getId() + "::" + UUID.randomUUID().toString().substring(0, 8));
|
iFace.setId("api_________::" + repo.getId() + "::" + UUID.randomUUID().toString().substring(0, 8));
|
||||||
if (iFace.getAccessSet() == null || iFace.getAccessSet().isEmpty()) {
|
if (iFace.getAccessSet() == null || iFace.getAccessSet().isEmpty()) {
|
||||||
LOGGER.debug("set is empty: " + iFace.getAccessSet());
|
LOGGER.debug("set is empty: " + iFace.getAccessSet());
|
||||||
iFace.removeAccessSet();
|
// iFace.removeAccessSet();
|
||||||
iFace.setAccessSet("none");
|
iFace.setAccessSet("none");
|
||||||
}
|
}
|
||||||
return iFace;
|
return iFace;
|
||||||
|
@ -728,18 +754,18 @@ public class RepositoryServiceImpl implements RepositoryService {
|
||||||
@Override
|
@Override
|
||||||
public List<String> getDnetCountries() {
|
public List<String> getDnetCountries() {
|
||||||
LOGGER.debug("Getting dnet-countries!");
|
LOGGER.debug("Getting dnet-countries!");
|
||||||
return Converter.readFile("countries.txt");
|
return converter.readFile("countries.txt");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> getTypologies() {
|
public List<String> getTypologies() {
|
||||||
return Converter.readFile("typologies.txt");
|
return converter.readFile("typologies.txt");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Timezone> getTimezones() {
|
public List<Timezone> getTimezones() {
|
||||||
List<String> timezones = Converter.readFile("timezones.txt");
|
List<String> timezones = converter.readFile("timezones.txt");
|
||||||
return Converter.toTimezones(timezones);
|
return converter.toTimezones(timezones);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -756,33 +782,6 @@ public class RepositoryServiceImpl implements RepositoryService {
|
||||||
return Arrays.asList(restTemplate.postForObject(uriComponents.toUri(), requestFilter, String[].class));
|
return Arrays.asList(restTemplate.postForObject(uriComponents.toUri(), requestFilter, String[].class));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<String> getDatasourceVocabularies(String mode) {
|
|
||||||
|
|
||||||
List<String> resultSet = new ArrayList<>();
|
|
||||||
for (Map.Entry<String, String> entry : this.getVocabulary("dnet:datasource_typologies").getAsMap().entrySet()) {
|
|
||||||
if (mode.equalsIgnoreCase("aggregator")) {
|
|
||||||
if (entry.getKey().contains("aggregator"))
|
|
||||||
resultSet.add(entry.getValue());
|
|
||||||
} else if (mode.equalsIgnoreCase("journal")) {
|
|
||||||
if (entry.getKey().contains("journal"))
|
|
||||||
resultSet.add(entry.getValue());
|
|
||||||
} else if (mode.equalsIgnoreCase("opendoar")) {
|
|
||||||
if (entry.getKey().contains("pubsrepository"))
|
|
||||||
resultSet.add(entry.getValue());
|
|
||||||
} else if (mode.equalsIgnoreCase("re3data")) {
|
|
||||||
if (entry.getKey().contains("datarepository"))
|
|
||||||
resultSet.add(entry.getValue());
|
|
||||||
} else if (mode.equalsIgnoreCase("cris")) {
|
|
||||||
if (entry.getKey().contains("crissystem"))
|
|
||||||
resultSet.add(entry.getValue());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
return resultSet;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Vocabulary getVocabulary(String vocName) {
|
private Vocabulary getVocabulary(String vocName) {
|
||||||
|
|
||||||
if (!vocabularyMap.containsKey(vocName)) {
|
if (!vocabularyMap.containsKey(vocName)) {
|
||||||
|
@ -834,6 +833,7 @@ public class RepositoryServiceImpl implements RepositoryService {
|
||||||
|
|
||||||
Map<String, String> retMap = new HashMap<String, String>();
|
Map<String, String> retMap = new HashMap<String, String>();
|
||||||
|
|
||||||
|
// TODO: refactor (remove?)
|
||||||
for (Map.Entry<String, String> entry : this.getVocabulary("dnet:datasource_typologies").getAsMap().entrySet()) {
|
for (Map.Entry<String, String> entry : this.getVocabulary("dnet:datasource_typologies").getAsMap().entrySet()) {
|
||||||
if (mode.equalsIgnoreCase("aggregator")) {
|
if (mode.equalsIgnoreCase("aggregator")) {
|
||||||
if (entry.getKey().contains("aggregator"))
|
if (entry.getKey().contains("aggregator"))
|
||||||
|
@ -847,10 +847,16 @@ public class RepositoryServiceImpl implements RepositoryService {
|
||||||
} else if (mode.equalsIgnoreCase("re3data")) {
|
} else if (mode.equalsIgnoreCase("re3data")) {
|
||||||
if (entry.getKey().contains("datarepository"))
|
if (entry.getKey().contains("datarepository"))
|
||||||
retMap.put(entry.getKey(), entry.getValue());
|
retMap.put(entry.getKey(), entry.getValue());
|
||||||
} else if (mode.equalsIgnoreCase("cris")) {
|
} else if (mode.equalsIgnoreCase("dris")) {
|
||||||
if (entry.getKey().contains("crissystem"))
|
if (entry.getKey().contains("crissystem"))
|
||||||
retMap.put(entry.getKey(), entry.getValue());
|
retMap.put(entry.getKey(), entry.getValue());
|
||||||
}
|
}
|
||||||
|
if (mode.equalsIgnoreCase("fairsharing")) {
|
||||||
|
retMap.put(entry.getKey(), entry.getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (mode.equals("fairsharing")) {
|
||||||
|
return retMap;
|
||||||
}
|
}
|
||||||
return filterResults(retMap, mode);
|
return filterResults(retMap, mode);
|
||||||
|
|
||||||
|
@ -859,12 +865,15 @@ public class RepositoryServiceImpl implements RepositoryService {
|
||||||
private Map<String, String> filterResults(Map<String, String> map, String mode) {
|
private Map<String, String> filterResults(Map<String, String> map, String mode) {
|
||||||
|
|
||||||
HashMap<String, String> filteredMap = new HashMap<>();
|
HashMap<String, String> filteredMap = new HashMap<>();
|
||||||
|
if (map != null && mode != null) {
|
||||||
for (String key : map.keySet())
|
for (String key : map.keySet())
|
||||||
if (dataSourceClass.get(mode).contains(key))
|
if (dataSourceClass.get(mode).contains(key))
|
||||||
filteredMap.put(key, map.get(key));
|
filteredMap.put(key, map.get(key));
|
||||||
|
|
||||||
return filteredMap;
|
return filteredMap;
|
||||||
}
|
}
|
||||||
|
return Collections.emptyMap();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getCountryName(String countryCode) {
|
public String getCountryName(String countryCode) {
|
||||||
|
@ -888,15 +897,22 @@ public class RepositoryServiceImpl implements RepositoryService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, String> getListLatestUpdate(String mode) throws JSONException {
|
public Map<String, String> getListLatestUpdate(String mode) throws JSONException {
|
||||||
if (mode.equals("opendoar"))
|
Map<String, String> dates = new HashMap<>();
|
||||||
return Collections.singletonMap("lastCollectionDate", getRepositoryInterface("openaire____::" + mode).get(0).getLastCollectionDate());
|
if (mode.equals("repository")) {
|
||||||
|
dates.put("opendoar", converter.toString(getRepositoryInterface("openaire____::opendoar").get(0).getLastCollectionDate()));
|
||||||
|
dates.put("re3data", converter.toString(getRepositoryInterface("openaire____::re3data").get(1).getLastCollectionDate()));
|
||||||
|
dates.put("fairsharing", converter.toString(getRepositoryInterface("openaire____::fairsharing").get(0).getLastCollectionDate()));
|
||||||
|
return dates;
|
||||||
|
}
|
||||||
else if (mode.equals("cris"))
|
else if (mode.equals("cris"))
|
||||||
return Collections.singletonMap("lastCollectionDate", getRepositoryInterface("eurocrisdris::dris").get(0).getLastCollectionDate());
|
return Collections.singletonMap("lastCollectionDate", converter.toString(getRepositoryInterface("eurocrisdris::dris").get(0).getLastCollectionDate()));
|
||||||
|
else if (mode.equals("opendoar")) // TODO: remove this and else clause
|
||||||
|
return Collections.singletonMap("lastCollectionDate", converter.toString(getRepositoryInterface("openaire____::" + mode).get(0).getLastCollectionDate()));
|
||||||
else
|
else
|
||||||
/*
|
/*
|
||||||
* first api of re3data has null value on collection date
|
* first api of re3data has null value on collection date
|
||||||
* */
|
* */
|
||||||
return Collections.singletonMap("lastCollectionDate", getRepositoryInterface("openaire____::" + mode).get(1).getLastCollectionDate());
|
return Collections.singletonMap("lastCollectionDate", converter.toString(getRepositoryInterface("openaire____::" + mode).get(0).getLastCollectionDate()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateValidationSet(String repositoryId, String repositoryInterfaceId, String validationSet) throws Exception {
|
private void updateValidationSet(String repositoryId, String repositoryInterfaceId, String validationSet) throws Exception {
|
||||||
|
|
|
@ -5,7 +5,7 @@ import eu.dnetlib.domain.functionality.validator.JobForValidation;
|
||||||
import eu.dnetlib.domain.functionality.validator.RuleSet;
|
import eu.dnetlib.domain.functionality.validator.RuleSet;
|
||||||
import eu.dnetlib.domain.functionality.validator.StoredJob;
|
import eu.dnetlib.domain.functionality.validator.StoredJob;
|
||||||
import eu.dnetlib.repo.manager.domain.InterfaceInformation;
|
import eu.dnetlib.repo.manager.domain.InterfaceInformation;
|
||||||
import eu.dnetlib.repo.manager.domain.ValidationServiceException;
|
import eu.dnetlib.repo.manager.exception.ValidationServiceException;
|
||||||
import eu.dnetlib.repo.manager.exception.ResourceNotFoundException;
|
import eu.dnetlib.repo.manager.exception.ResourceNotFoundException;
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package eu.dnetlib.repo.manager.service;
|
package eu.dnetlib.repo.manager.service;
|
||||||
|
|
||||||
import eu.dnetlib.api.functionality.ValidatorServiceException;
|
import eu.dnetlib.api.functionality.ValidatorServiceException;
|
||||||
import eu.dnetlib.domain.data.RepositoryInterface;
|
import eu.dnetlib.repo.manager.domain.RepositoryInterface;
|
||||||
import eu.dnetlib.domain.functionality.validator.*;
|
import eu.dnetlib.domain.functionality.validator.*;
|
||||||
import eu.dnetlib.repo.manager.domain.Constants;
|
import eu.dnetlib.repo.manager.domain.Constants;
|
||||||
import eu.dnetlib.repo.manager.domain.InterfaceInformation;
|
import eu.dnetlib.repo.manager.domain.InterfaceInformation;
|
||||||
import eu.dnetlib.repo.manager.domain.ValidationServiceException;
|
import eu.dnetlib.repo.manager.exception.ValidationServiceException;
|
||||||
import eu.dnetlib.repo.manager.utils.CrisValidatorUtils;
|
import eu.dnetlib.repo.manager.utils.CrisValidatorUtils;
|
||||||
import eu.dnetlib.repo.manager.utils.OaiTools;
|
import eu.dnetlib.repo.manager.utils.OaiTools;
|
||||||
import gr.uoa.di.driver.util.ServiceLocator;
|
import gr.uoa.di.driver.util.ServiceLocator;
|
||||||
|
@ -293,7 +293,11 @@ public class ValidatorServiceImpl implements ValidatorService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<StoredJob> getJobsSummary(String repoId, int limit) throws JSONException, ValidatorServiceException {
|
public List<StoredJob> getJobsSummary(String repoId, int limit) throws JSONException, ValidatorServiceException {
|
||||||
return getValidationService().getJobSummary(repositoryService.getRepositoryInterface(repoId).stream().map(RepositoryInterface::getBaseUrl).collect(Collectors.toList()),limit);
|
return getValidationService().getJobSummary(
|
||||||
|
repositoryService.getRepositoryInterface(repoId)
|
||||||
|
.stream()
|
||||||
|
.map(RepositoryInterface::getBaseurl)
|
||||||
|
.collect(Collectors.toList()), limit);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,11 +2,7 @@ package eu.dnetlib.repo.manager.utils;
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import eu.dnetlib.domain.data.Repository;
|
import eu.dnetlib.repo.manager.domain.*;
|
||||||
import eu.dnetlib.domain.data.RepositoryInterface;
|
|
||||||
import eu.dnetlib.repo.manager.domain.AggregationDetails;
|
|
||||||
import eu.dnetlib.repo.manager.domain.RepositorySnippet;
|
|
||||||
import eu.dnetlib.repo.manager.domain.Timezone;
|
|
||||||
import org.apache.commons.codec.digest.DigestUtils;
|
import org.apache.commons.codec.digest.DigestUtils;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.json.JSONArray;
|
import org.json.JSONArray;
|
||||||
|
@ -27,366 +23,67 @@ public class Converter {
|
||||||
|
|
||||||
private static final Logger LOGGER = Logger.getLogger(Converter.class);
|
private static final Logger LOGGER = Logger.getLogger(Converter.class);
|
||||||
|
|
||||||
public static Repository jsonToRepositoryObject(JSONObject repositoryObject) throws JSONException {
|
private final ObjectMapper objectMapper;
|
||||||
|
|
||||||
Repository repository = new Repository();
|
public Converter() {
|
||||||
|
objectMapper = new ObjectMapper();
|
||||||
// JSONObject datasource = repositoryObject.getJSONObject("datasource");
|
|
||||||
JSONObject datasource = repositoryObject;
|
|
||||||
|
|
||||||
//if( datasource.equals(null))
|
|
||||||
// return null;
|
|
||||||
|
|
||||||
repository.setId(datasource.get("id").toString());
|
|
||||||
repository.setOfficialName(datasource.get("officialname").toString());
|
|
||||||
|
|
||||||
repository.setEnglishName(datasource.get("englishname").toString());
|
|
||||||
if (repository.getEnglishName().equals("null"))
|
|
||||||
repository.setEnglishName("");
|
|
||||||
|
|
||||||
repository.setWebsiteUrl(datasource.get("websiteurl").toString());
|
|
||||||
if (repository.getWebsiteUrl().equals("null"))
|
|
||||||
repository.setWebsiteUrl("");
|
|
||||||
|
|
||||||
repository.setLogoUrl(datasource.get("logourl").toString());
|
|
||||||
if (repository.getLogoUrl().equals("null"))
|
|
||||||
repository.setLogoUrl("");
|
|
||||||
|
|
||||||
repository.setContactEmail(datasource.get("contactemail").toString());
|
|
||||||
if (repository.getContactEmail().equals("null"))
|
|
||||||
repository.setContactEmail("");
|
|
||||||
|
|
||||||
|
|
||||||
repository.setLatitude(toDouble(datasource.get("latitude").toString()));
|
|
||||||
repository.setLongitude(toDouble(datasource.get("longitude").toString()));
|
|
||||||
Double timezone = toDouble(datasource.get("timezone").toString());
|
|
||||||
repository.setTimezone(timezone != null ? timezone : 0.0);
|
|
||||||
repository.setNamespacePrefix(datasource.get("namespaceprefix").toString());
|
|
||||||
repository.setOdLanguages(datasource.get("languages").toString());
|
|
||||||
repository.setDateOfValidation(convertStringToDate(datasource.get("dateofvalidation").toString()));
|
|
||||||
|
|
||||||
/* typology -> platform
|
|
||||||
* datasource class -> typology */
|
|
||||||
repository.setTypology(datasource.get("platform").toString());
|
|
||||||
if (repository.getTypology().equals("null"))
|
|
||||||
repository.setTypology("");
|
|
||||||
|
|
||||||
// // TODO: enable in future release
|
|
||||||
// /* 07-04-2022 | "typology" -> "eoscDatasourceType" */
|
|
||||||
// try { // FIXME: remove attemp to get typology if eoscDatasourceType fails
|
|
||||||
// repository.setDatasourceClass(datasource.get("eoscDatasourceType").toString());
|
|
||||||
// } catch (JSONException e) {
|
|
||||||
// repository.setDatasourceClass(datasource.get("typology").toString());
|
|
||||||
// }
|
|
||||||
repository.setDatasourceClass(datasource.get("typology").toString());
|
|
||||||
// <--
|
|
||||||
|
|
||||||
repository.setDateOfCollection(convertStringToDate(datasource.get("dateofcollection").toString()));
|
|
||||||
repository.setActivationId(datasource.get("activationId").toString());
|
|
||||||
|
|
||||||
repository.setDescription(datasource.get("description").toString());
|
|
||||||
if (repository.getDescription().equals("null"))
|
|
||||||
repository.setDescription("");
|
|
||||||
|
|
||||||
repository.setIssn(datasource.get("issn").toString());
|
|
||||||
repository.setLissn(datasource.get("lissn").toString());
|
|
||||||
if (repository.getLissn().equals("null"))
|
|
||||||
repository.setLissn("");
|
|
||||||
repository.setEissn(datasource.get("eissn").toString());
|
|
||||||
if (repository.getEissn().equals("null"))
|
|
||||||
repository.setEissn("");
|
|
||||||
repository.setRegisteredBy(datasource.get("registeredby").toString());
|
|
||||||
|
|
||||||
/* managed field */
|
|
||||||
repository.setRegistered(Boolean.parseBoolean(datasource.get("managed").toString()));
|
|
||||||
|
|
||||||
//subjects
|
|
||||||
|
|
||||||
repository.setAggregator(datasource.get("aggregator").toString());
|
|
||||||
repository.setCollectedFrom(datasource.get("collectedfrom").toString());
|
|
||||||
|
|
||||||
//TODO change organization to list
|
|
||||||
JSONArray organizations = ((JSONArray) datasource.get("organizations"));
|
|
||||||
if (organizations.length() != 0) {
|
|
||||||
repository.setOrganization(((JSONArray) datasource.get("organizations")).getJSONObject(0).get("legalname").toString());
|
|
||||||
String countryCode = ((JSONArray) datasource.get("organizations")).getJSONObject(0).get("country").toString();
|
|
||||||
repository.setCountryCode(countryCode);
|
|
||||||
}
|
}
|
||||||
|
public Repository toRepository(Object repositoryObject) {
|
||||||
|
|
||||||
repository.setConsentTermsOfUse(convertStringToBoolean(datasource.get("consentTermsOfUse").toString()));
|
Repository repository = objectMapper.convertValue(repositoryObject, Repository.class);
|
||||||
repository.setConsentTermsOfUseDate(null);
|
|
||||||
repository.setLastConsentTermsOfUseDate(null);
|
|
||||||
try {
|
|
||||||
repository.setConsentTermsOfUseDate(convertStringToDate(datasource.get("consentTermsOfUseDate").toString()));
|
|
||||||
repository.setLastConsentTermsOfUseDate(convertStringToDate(datasource.get("lastConsentTermsOfUseDate").toString()));
|
|
||||||
} catch (JSONException e) {
|
|
||||||
LOGGER.info("Error setting consentTermsOfUseDate date and lastConsentTermsOfUseDate", e);
|
|
||||||
}
|
|
||||||
repository.setFullTextDownload(convertStringToBoolean(datasource.get("fullTextDownload").toString()));
|
|
||||||
|
|
||||||
/* identities field */
|
|
||||||
|
|
||||||
return repository;
|
return repository;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Boolean convertStringToBoolean(String value) {
|
public RepositorySnippet toRepositorySnippet(JSONObject repositorySnippetObject) {
|
||||||
return value.equals("null") ? null : Boolean.valueOf(value);
|
|
||||||
|
RepositorySnippet snippet = objectMapper.convertValue(repositorySnippetObject, RepositorySnippet.class);
|
||||||
|
|
||||||
|
return snippet;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Date convertStringToDate(String date) {
|
public List<Repository> toRepositoryList(JSONObject json) throws JSONException {
|
||||||
|
|
||||||
if (Objects.equals(date, "null"))
|
|
||||||
return null;
|
|
||||||
|
|
||||||
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
|
|
||||||
try {
|
|
||||||
return formatter.parse(date);
|
|
||||||
} catch (ParseException e) {
|
|
||||||
LOGGER.error(e);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String convertDateToString(Date date) {
|
|
||||||
|
|
||||||
if (Objects.equals(date, null))
|
|
||||||
return null;
|
|
||||||
|
|
||||||
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
|
|
||||||
return formatter.format(date);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Double toDouble(String number) {
|
|
||||||
if (Objects.equals(number, "null"))
|
|
||||||
return 0.0;
|
|
||||||
else
|
|
||||||
return Double.valueOf(number);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static List<RepositorySnippet> jsonToRepositorySnippetList(JSONObject json) throws JSONException {
|
|
||||||
|
|
||||||
List<RepositorySnippet> resultSet = new ArrayList<>();
|
|
||||||
JSONArray rs = json.getJSONArray("datasourceInfo");
|
|
||||||
for (int i = 0; i < rs.length(); i++)
|
|
||||||
resultSet.add(jsonToRepositorySnippetObject(rs.getJSONObject(i)));
|
|
||||||
return resultSet;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static RepositorySnippet jsonToRepositorySnippetObject(JSONObject repositorySnippetObject) throws JSONException {
|
|
||||||
|
|
||||||
|
|
||||||
RepositorySnippet repositorySnippet = new RepositorySnippet();
|
|
||||||
|
|
||||||
// JSONObject datasource = repositorySnippetObject.getJSONObject("datasource");
|
|
||||||
|
|
||||||
|
|
||||||
repositorySnippet.setId(repositorySnippetObject.get("id").toString());
|
|
||||||
repositorySnippet.setOfficialname(repositorySnippetObject.get("officialname").toString());
|
|
||||||
|
|
||||||
repositorySnippet.setEnglishname(repositorySnippetObject.get("englishname").toString());
|
|
||||||
if (repositorySnippet.getEnglishname().equals("null"))
|
|
||||||
repositorySnippet.setEnglishname("");
|
|
||||||
|
|
||||||
repositorySnippet.setWebsiteurl(repositorySnippetObject.get("websiteurl").toString());
|
|
||||||
if (repositorySnippet.getWebsiteurl().equals("null"))
|
|
||||||
repositorySnippet.setWebsiteurl("");
|
|
||||||
|
|
||||||
repositorySnippet.setRegisteredby(repositorySnippetObject.get("registeredby").toString());
|
|
||||||
if (repositorySnippet.getRegisteredby().equals("null"))
|
|
||||||
repositorySnippet.setRegisteredby("");
|
|
||||||
|
|
||||||
repositorySnippet.setConsentTermsOfUse(repositorySnippetObject.get("consenttermsofuse").toString());
|
|
||||||
repositorySnippet.setFullTextDownload(repositorySnippetObject.get("fulltextdownload").toString());
|
|
||||||
repositorySnippet.setConsentTermsOfUseDate(convertStringToDate(repositorySnippetObject.get("consenttermsofusedate").toString()));
|
|
||||||
|
|
||||||
return repositorySnippet;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public static List<Repository> jsonToRepositoryList(JSONObject json) throws JSONException {
|
|
||||||
|
|
||||||
List<Repository> resultSet = new ArrayList<>();
|
List<Repository> resultSet = new ArrayList<>();
|
||||||
JSONArray rs = json.getJSONArray("datasourceInfo");
|
JSONArray rs = json.getJSONArray("datasourceInfo");
|
||||||
for (int i = 0; i < rs.length(); i++)
|
for (int i = 0; i < rs.length(); i++)
|
||||||
resultSet.add(jsonToRepositoryObject(rs.getJSONObject(i)));
|
resultSet.add(toRepository(rs.getJSONObject(i)));
|
||||||
return resultSet;
|
return resultSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<RepositoryInterface> jsonToRepositoryInterfaceList(JSONObject json) throws JSONException {
|
public List<RepositoryInterface> toRepositoryInterfaceList(JSONObject json) throws JSONException {
|
||||||
|
|
||||||
List<RepositoryInterface> resultSet = new ArrayList<>();
|
List<RepositoryInterface> resultSet = new ArrayList<>();
|
||||||
JSONArray rs = json.getJSONArray("api");
|
JSONArray rs = json.getJSONArray("api");
|
||||||
for (int i = 0; i < rs.length(); i++)
|
for (int i = 0; i < rs.length(); i++)
|
||||||
resultSet.add(jsonToRepositoryInterfaceObject(rs.getJSONObject(i)));
|
resultSet.add(toRepositoryInterface(rs.getJSONObject(i)));
|
||||||
return resultSet;
|
return resultSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static RepositoryInterface jsonToRepositoryInterfaceObject(JSONObject repositoryInterfaceObject) throws JSONException {
|
public List<RepositoryInterface> toRepositoryInterfaceList(List<ApiDetails> apiDetailsList) throws JSONException {
|
||||||
|
|
||||||
RepositoryInterface repositoryInterface = new RepositoryInterface();
|
List<RepositoryInterface> resultSet = new ArrayList<>();
|
||||||
|
|
||||||
repositoryInterface.setId(repositoryInterfaceObject.get("id").toString());
|
for (ApiDetails entry : apiDetailsList)
|
||||||
repositoryInterface.setAccessProtocol(repositoryInterfaceObject.get("protocol").toString());
|
resultSet.add(toRepositoryInterface(entry));
|
||||||
repositoryInterface.setContentDescription(repositoryInterfaceObject.get("contentdescription").toString());
|
return resultSet;
|
||||||
|
|
||||||
// /* 07-04-2022 | "typology" -> "eoscDatasourceType" */
|
|
||||||
// // TODO: enable in future release
|
|
||||||
// try { // FIXME: remove attemp to get typology if eoscDatasourceType fails
|
|
||||||
// repositoryInterface.setTypology(repositoryInterfaceObject.get("eoscDatasourceType").toString());
|
|
||||||
// } catch (JSONException e) {
|
|
||||||
// repositoryInterface.setTypology(repositoryInterfaceObject.get("typology").toString());
|
|
||||||
// }
|
|
||||||
repositoryInterface.setTypology(repositoryInterfaceObject.get("typology").toString());
|
|
||||||
// <--
|
|
||||||
|
|
||||||
repositoryInterface.setCompliance(repositoryInterfaceObject.get("compatibility").toString());
|
|
||||||
repositoryInterface.setLastCollectionDate(repositoryInterfaceObject.get("lastCollectionDate").toString());
|
|
||||||
|
|
||||||
repositoryInterface.setBaseUrl(repositoryInterfaceObject.get("baseurl").toString());
|
|
||||||
repositoryInterface.setRemovable(Boolean.parseBoolean(repositoryInterfaceObject.get("removable").toString()));
|
|
||||||
|
|
||||||
|
|
||||||
// repositoryInterface.setMetadataIdentifierPath(repositoryInterfaceObject.get("metadataIdentifierPath").toString());
|
|
||||||
repositoryInterface.setDesiredCompatibilityLevel(repositoryInterfaceObject.get("compatibility").toString());
|
|
||||||
//repositoryInterface.setActive(Boolean.parseBoolean(repositoryInterfaceObject.get("active").toString()));
|
|
||||||
|
|
||||||
|
|
||||||
Map<String, String> accessParams = new HashMap<>();
|
|
||||||
Map<String, String> extraFields = new HashMap<>();
|
|
||||||
|
|
||||||
ObjectMapper mapper = new ObjectMapper();
|
|
||||||
JSONArray apiparams = repositoryInterfaceObject.getJSONArray("apiParams");
|
|
||||||
|
|
||||||
for (int i = 0; i < apiparams.length(); i++)
|
|
||||||
accessParams.put(apiparams.getJSONObject(i).getString("param"), apiparams.getJSONObject(i).getString("value"));
|
|
||||||
|
|
||||||
repositoryInterface.setAccessParams(accessParams);
|
|
||||||
|
|
||||||
return repositoryInterface;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String repositoryObjectToJson(Repository repository) throws JSONException, JsonProcessingException {
|
public RepositoryInterface toRepositoryInterface(Object repositoryInterfaceObject) {
|
||||||
|
|
||||||
HashMap<String, Object> repositoryMap = new HashMap<>();
|
RepositoryInterface repoInterface = objectMapper.convertValue(repositoryInterfaceObject, RepositoryInterface.class);
|
||||||
ObjectMapper mapper = new ObjectMapper();
|
|
||||||
|
|
||||||
repositoryMap.put("id", repository.getId());
|
return repoInterface;
|
||||||
repositoryMap.put("openaireId", getOpenaireId(repository.getId()));
|
|
||||||
repositoryMap.put("officialname", repository.getOfficialName());
|
|
||||||
repositoryMap.put("englishname", repository.getEnglishName());
|
|
||||||
repositoryMap.put("websiteurl", repository.getWebsiteUrl());
|
|
||||||
repositoryMap.put("logourl", repository.getLogoUrl());
|
|
||||||
repositoryMap.put("contactemail", repository.getContactEmail());
|
|
||||||
repositoryMap.put("longitude", repository.getLongitude().toString());
|
|
||||||
repositoryMap.put("latitude", repository.getLatitude().toString());
|
|
||||||
repositoryMap.put("timezone", repository.getTimezone());
|
|
||||||
|
|
||||||
repositoryMap.put("namespaceprefix", repository.getNamespacePrefix() != null ? repository.getNamespacePrefix() : "");
|
|
||||||
repositoryMap.put("languages", repository.getOdLanguages() != null ? repository.getOdLanguages() : "");
|
|
||||||
|
|
||||||
repositoryMap.put("dateofcollection", repository.getDateOfCollection() != null ? convertDateToString(repository.getDateOfCollection()) : "");
|
|
||||||
|
|
||||||
/*
|
|
||||||
* typology -> platform
|
|
||||||
* datasource class -> typology
|
|
||||||
* */
|
|
||||||
// repositoryMap.put("eoscDatasourceType", repository.getDatasourceClass()); // TODO: enable in future release
|
|
||||||
repositoryMap.put("platform", repository.getTypology());
|
|
||||||
|
|
||||||
repositoryMap.put("dateofvalidation", repository.getDateOfCollection() != null ? convertDateToString(repository.getDateOfCollection()) : "");
|
|
||||||
repositoryMap.put("activationId", repository.getActivationId() != null ? repository.getActivationId() : "");
|
|
||||||
|
|
||||||
repositoryMap.put("description", repository.getDescription());
|
|
||||||
|
|
||||||
repositoryMap.put("eissn", repository.getEissn() != null ? repository.getEissn() : "");
|
|
||||||
repositoryMap.put("issn", repository.getIssn() != null ? repository.getIssn() : "");
|
|
||||||
repositoryMap.put("lissn", repository.getLissn() != null ? repository.getLissn() : "");
|
|
||||||
|
|
||||||
repositoryMap.put("registeredby", repository.getRegisteredBy());
|
|
||||||
|
|
||||||
repositoryMap.put("aggregator", repository.getAggregator() != null ? repository.getAggregator() : "");
|
|
||||||
repositoryMap.put("collectedfrom", repository.getCollectedFrom() != null ? repository.getCollectedFrom() : "");
|
|
||||||
|
|
||||||
repositoryMap.put("managed", repository.isRegistered());
|
|
||||||
|
|
||||||
Map<String, String> organization = new HashMap<>();
|
|
||||||
organization.put("legalname", repository.getOrganization());
|
|
||||||
organization.put("country", repository.getCountryCode());
|
|
||||||
organization.put("legalshortname", "");
|
|
||||||
organization.put("websiteurl", "");
|
|
||||||
organization.put("logourl", "");
|
|
||||||
|
|
||||||
List organizations = new ArrayList();
|
|
||||||
organizations.add(organization);
|
|
||||||
repositoryMap.put("organizations", organizations);
|
|
||||||
|
|
||||||
//TODO check identitites
|
|
||||||
//Map<String,String> identity = new HashMap<>();
|
|
||||||
|
|
||||||
if (repository.getPiwikInfo() != null) {
|
|
||||||
Map<String, Object> identity = new HashMap<>();
|
|
||||||
HashSet<Map<String, Object>> identities = new HashSet<>();
|
|
||||||
|
|
||||||
identity.put("issuertype", "piwik");
|
|
||||||
identity.put("pid", "piwik:" + repository.getPiwikInfo().getSiteId());
|
|
||||||
|
|
||||||
identities.add(identity);
|
|
||||||
|
|
||||||
repositoryMap.put("identities", identities);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
repositoryMap.put("subjects", "");
|
public String toJson(Repository repository) throws JsonProcessingException {
|
||||||
repositoryMap.put("consentTermsOfUse", repository.getConsentTermsOfUse());
|
|
||||||
repositoryMap.put("fullTextDownload", repository.getFullTextDownload());
|
|
||||||
repositoryMap.put("consentTermsOfUseDate", convertDateToString(repository.getConsentTermsOfUseDate()));
|
|
||||||
repositoryMap.put("lastConsentTermsOfUseDate", convertDateToString(repository.getLastConsentTermsOfUseDate()));
|
|
||||||
|
|
||||||
return mapper.writeValueAsString(repositoryMap);
|
return objectMapper.writeValueAsString(repository);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String repositoryInterfaceObjectToJson(Repository repository, RepositoryInterface repositoryInterface) throws JSONException {
|
public List<String> readFile(String filename) {
|
||||||
|
|
||||||
JSONObject jsonObject = new JSONObject();
|
|
||||||
|
|
||||||
jsonObject.put("id", repositoryInterface.getId());
|
|
||||||
jsonObject.put("protocol", repositoryInterface.getAccessProtocol());
|
|
||||||
jsonObject.put("datasource", repository.getId());
|
|
||||||
jsonObject.put("contentdescription", repositoryInterface.getContentDescription());
|
|
||||||
jsonObject.put("typology", repositoryInterface.getTypology());
|
|
||||||
jsonObject.put("compatibility", repositoryInterface.getDesiredCompatibilityLevel());
|
|
||||||
jsonObject.put("compatibilityOverride", repositoryInterface.getDesiredCompatibilityLevel());
|
|
||||||
|
|
||||||
jsonObject.put("lastCollectionTotal", "");
|
|
||||||
|
|
||||||
jsonObject.put("lastCollectionDate", repositoryInterface.getLastCollectionDate());
|
|
||||||
jsonObject.put("lastAggregationTotal", "");
|
|
||||||
jsonObject.put("lastAggregationDate", "");
|
|
||||||
jsonObject.put("lastDownloadTotal", "");
|
|
||||||
jsonObject.put("lastDownloadDate", "");
|
|
||||||
|
|
||||||
jsonObject.put("baseurl", repositoryInterface.getBaseUrl());
|
|
||||||
jsonObject.put("removable", repositoryInterface.isRemovable());
|
|
||||||
|
|
||||||
|
|
||||||
JSONArray apiparams = new JSONArray();
|
|
||||||
for (String param : repositoryInterface.getAccessParams().keySet()) {
|
|
||||||
JSONObject jo = new JSONObject();
|
|
||||||
jo.put("param", param);
|
|
||||||
jo.put("value", repositoryInterface.getAccessParams().get(param));
|
|
||||||
apiparams.put(jo);
|
|
||||||
}
|
|
||||||
jsonObject.put("apiParams", apiparams);
|
|
||||||
|
|
||||||
|
|
||||||
// jsonObject.put("metadataIdentifierPath",repositoryInterface.getMetadataIdentifierPath());
|
|
||||||
|
|
||||||
|
|
||||||
return jsonObject.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ArrayList<String> readFile(String filename) {
|
|
||||||
String line;
|
String line;
|
||||||
ArrayList<String> list = new ArrayList<String>();
|
List<String> list = new ArrayList<>();
|
||||||
try {
|
try {
|
||||||
//InputStream in = Converter.class.getResourceAsStream("resources/eu/dnetlib/repo/manager/service/utils/"+filename);
|
//InputStream in = Converter.class.getResourceAsStream("resources/eu/dnetlib/repo/manager/service/utils/"+filename);
|
||||||
InputStream in = Converter.class.getClass().getResourceAsStream("/eu/**/" + filename);
|
InputStream in = Converter.class.getClass().getResourceAsStream("/eu/**/" + filename);
|
||||||
|
@ -402,32 +99,16 @@ public class Converter {
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<AggregationDetails> getAggregationHistoryFromJson(JSONArray aggregationInfo) throws JSONException {
|
public List<AggregationDetails> toAggregationHistory(JSONArray aggregationInfo) throws JSONException {
|
||||||
List<AggregationDetails> aggregationDetailsList = new ArrayList<>();
|
List<AggregationDetails> aggregationDetailsList = new ArrayList<>();
|
||||||
|
|
||||||
for (int i = 0; i < aggregationInfo.length(); i++)
|
for (int i = 0; i < aggregationInfo.length(); i++)
|
||||||
aggregationDetailsList.add(jsonToAggregationDetails(aggregationInfo.getJSONObject(i)));
|
aggregationDetailsList.add(toAggregationDetails(aggregationInfo.getJSONObject(i)));
|
||||||
|
|
||||||
return aggregationDetailsList;
|
return aggregationDetailsList;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static AggregationDetails jsonToAggregationDetails(JSONObject aggregationObject) throws JSONException {
|
public List<Timezone> toTimezones(List<String> timezones) {
|
||||||
|
|
||||||
AggregationDetails aggregationDetails = new AggregationDetails();
|
|
||||||
|
|
||||||
if (aggregationObject.has("collectionMode"))
|
|
||||||
aggregationDetails.setCollectionMode(aggregationObject.get("collectionMode").toString());
|
|
||||||
if (aggregationObject.has("indexedVersion"))
|
|
||||||
aggregationDetails.setIndexedVersion(Boolean.parseBoolean(aggregationObject.get("indexedVersion").toString()));
|
|
||||||
|
|
||||||
aggregationDetails.setAggregationStage(aggregationObject.get("aggregationStage").toString());
|
|
||||||
aggregationDetails.setDate(convertStringToDate(aggregationObject.get("date").toString()));
|
|
||||||
aggregationDetails.setNumberOfRecords(Integer.parseInt(aggregationObject.get("numberOfRecords").toString()));
|
|
||||||
|
|
||||||
return aggregationDetails;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static List<Timezone> toTimezones(List<String> timezones) {
|
|
||||||
|
|
||||||
List<Timezone> tmz = new ArrayList<>();
|
List<Timezone> tmz = new ArrayList<>();
|
||||||
for (String t : timezones) {
|
for (String t : timezones) {
|
||||||
|
@ -437,10 +118,59 @@ public class Converter {
|
||||||
return tmz;
|
return tmz;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String getOpenaireId(String repositoryId) {
|
private String getOpenaireId(String repositoryId) {
|
||||||
if (repositoryId != null && repositoryId.contains("::"))
|
if (repositoryId != null && repositoryId.contains("::"))
|
||||||
return repositoryId.split("::")[0] + "::" + DigestUtils.md5Hex(repositoryId.split("::")[1]);
|
return repositoryId.split("::")[0] + "::" + DigestUtils.md5Hex(repositoryId.split("::")[1]);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Boolean convertStringToBoolean(String value) {
|
||||||
|
return value.equals("null") ? null : Boolean.valueOf(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Date toDate(String date) {
|
||||||
|
|
||||||
|
if (Objects.equals(date, "null"))
|
||||||
|
return null;
|
||||||
|
|
||||||
|
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
|
try {
|
||||||
|
return formatter.parse(date);
|
||||||
|
} catch (ParseException e) {
|
||||||
|
LOGGER.error(e);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toString(Date date) {
|
||||||
|
|
||||||
|
if (Objects.equals(date, null))
|
||||||
|
return null;
|
||||||
|
|
||||||
|
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
|
return formatter.format(date);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Double toDouble(String number) {
|
||||||
|
if (Objects.equals(number, "null"))
|
||||||
|
return 0.0;
|
||||||
|
else
|
||||||
|
return Double.valueOf(number);
|
||||||
|
}
|
||||||
|
|
||||||
|
private AggregationDetails toAggregationDetails(JSONObject aggregationObject) throws JSONException {
|
||||||
|
|
||||||
|
AggregationDetails aggregationDetails = new AggregationDetails();
|
||||||
|
|
||||||
|
if (aggregationObject.has("collectionMode"))
|
||||||
|
aggregationDetails.setCollectionMode(aggregationObject.get("collectionMode").toString());
|
||||||
|
if (aggregationObject.has("indexedVersion"))
|
||||||
|
aggregationDetails.setIndexedVersion(Boolean.parseBoolean(aggregationObject.get("indexedVersion").toString()));
|
||||||
|
|
||||||
|
aggregationDetails.setAggregationStage(aggregationObject.get("aggregationStage").toString());
|
||||||
|
aggregationDetails.setDate(toDate(aggregationObject.get("date").toString()));
|
||||||
|
aggregationDetails.setNumberOfRecords(Integer.parseInt(aggregationObject.get("numberOfRecords").toString()));
|
||||||
|
|
||||||
|
return aggregationDetails;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue