refactoring
This commit is contained in:
parent
3149357f8e
commit
36aa53273e
50
pom.xml
50
pom.xml
|
@ -137,21 +137,21 @@
|
|||
<!-- <artifactId>log4j</artifactId>-->
|
||||
<!-- <version>${log4j.version}</version>-->
|
||||
<!-- </dependency>-->
|
||||
<dependency>
|
||||
<groupId>eu.dnetlib</groupId>
|
||||
<artifactId>uoa-domain</artifactId>
|
||||
<version>[2.0.0-SNAPSHOT, 3.0.0)</version>
|
||||
<exclusions>
|
||||
<exclusion> <!-- declare the exclusion here -->
|
||||
<groupId>cglib</groupId>
|
||||
<artifactId>cglib</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>eu.dnetlib</groupId>-->
|
||||
<!-- <artifactId>uoa-domain</artifactId>-->
|
||||
<!-- <version>[2.0.0-SNAPSHOT, 3.0.0)</version>-->
|
||||
<!-- <exclusions>-->
|
||||
<!-- <exclusion> <!– declare the exclusion here –>-->
|
||||
<!-- <groupId>cglib</groupId>-->
|
||||
<!-- <artifactId>cglib</artifactId>-->
|
||||
<!-- </exclusion>-->
|
||||
<!-- <exclusion>-->
|
||||
<!-- <groupId>log4j</groupId>-->
|
||||
<!-- <artifactId>log4j</artifactId>-->
|
||||
<!-- </exclusion>-->
|
||||
<!-- </exclusions>-->
|
||||
<!-- </dependency>-->
|
||||
<dependency>
|
||||
<groupId>eu.dnetlib</groupId>
|
||||
<artifactId>dnet-openaire-usage-stats-sushilite</artifactId>
|
||||
|
@ -291,7 +291,7 @@
|
|||
<dependency>
|
||||
<groupId>org.springframework.session</groupId>
|
||||
<artifactId>spring-session-data-redis</artifactId>
|
||||
</dependency>
|
||||
</dependency>
|
||||
<!--
|
||||
<dependency>
|
||||
<groupId>org.springframework.session</groupId>
|
||||
|
@ -305,13 +305,13 @@
|
|||
<dependency>
|
||||
<groupId>redis.clients</groupId>
|
||||
<artifactId>jedis</artifactId>
|
||||
<version>${jedis.version}</version>
|
||||
<!--<version>3.7.0</version>-->
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-pool2</artifactId>
|
||||
</dependency>
|
||||
<version>${jedis.version}</version>
|
||||
<!--<version>3.7.0</version>-->
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-pool2</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.code.gson</groupId>
|
||||
<artifactId>gson</artifactId>
|
||||
|
@ -327,8 +327,8 @@
|
|||
<groupId>com.netflix.hystrix</groupId>
|
||||
<artifactId>hystrix-core</artifactId>
|
||||
<version>1.5.18</version>
|
||||
</dependency>
|
||||
<!--
|
||||
</dependency>
|
||||
<!--
|
||||
<dependency>
|
||||
<groupId>com.netflix.rxjava</groupId>
|
||||
<artifactId>rxjava-core</artifactId>
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package eu.dnetlib.repo.manager.config;
|
||||
|
||||
import eu.dnetlib.repo.manager.service.ValidatorServiceImpl;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
@ -24,4 +23,4 @@ public class AsyncConfiguration implements AsyncConfigurer {
|
|||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,18 +15,21 @@ import gr.uoa.di.driver.util.StaticServiceLocator;
|
|||
import gr.uoa.di.driver.xml.VocabularyXmlConverter;
|
||||
import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
|
||||
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
|
||||
@ComponentScan(basePackages = {"org.eurocris.openaire.cris.validator.service"})
|
||||
public class Config {
|
||||
|
||||
@Value("${services.provide.iSLookUpService.url}")
|
||||
private String lookupURL;
|
||||
|
||||
@Value("${services.provide.validatorService.url}")
|
||||
@Value("${services.provide.validatorService.url}")
|
||||
private String validatorUrl;
|
||||
|
||||
@Bean(name="vocabularyLoader")
|
||||
@Bean(name = "vocabularyLoader")
|
||||
public VocabularyLoader createVocabularyLoader() throws Exception {
|
||||
ISVocabularyLoader loader = new ISVocabularyLoader();
|
||||
|
||||
|
@ -78,4 +81,4 @@ public class Config {
|
|||
|
||||
return locator;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,14 +7,14 @@ import org.apache.log4j.Logger;
|
|||
import org.mitre.openid.connect.client.OIDCAuthoritiesMapper;
|
||||
import org.mitre.openid.connect.model.UserInfo;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.security.core.GrantedAuthority;
|
||||
import org.springframework.security.core.authority.SimpleGrantedAuthority;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
@ComponentScan
|
||||
@Component
|
||||
public class OpenAIREAuthoritiesMapper implements OIDCAuthoritiesMapper {
|
||||
|
||||
|
|
|
@ -2,7 +2,8 @@ package eu.dnetlib.repo.manager.config;
|
|||
|
||||
import org.apache.log4j.Logger;
|
||||
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.http.HttpHeaders;
|
||||
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
||||
|
@ -15,9 +16,6 @@ import javax.annotation.PostConstruct;
|
|||
|
||||
@Configuration
|
||||
@EnableRedisHttpSession
|
||||
@ComponentScan(basePackages = {
|
||||
"org.eurocris.openaire.cris.validator.service",
|
||||
"eu.dnetlib.repo.manager.*"})
|
||||
public class RedisConfiguration {
|
||||
|
||||
private static Logger LOGGER = Logger.getLogger(RedisConfiguration.class);
|
||||
|
@ -35,18 +33,18 @@ public class RedisConfiguration {
|
|||
private String domain;
|
||||
|
||||
@PostConstruct
|
||||
private void init(){
|
||||
LOGGER.info(String.format("Redis : %s Port : %s Password : %s",host,port,password));
|
||||
private void init() {
|
||||
LOGGER.info(String.format("Redis : %s Port : %s Password : %s", host, port, password));
|
||||
}
|
||||
|
||||
@Bean
|
||||
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.setHostName(host);
|
||||
jedisConnectionFactory.setPort(Integer.parseInt(port));
|
||||
jedisConnectionFactory.setUsePool(true);
|
||||
if(password != null) jedisConnectionFactory.setPassword(password);
|
||||
if (password != null) jedisConnectionFactory.setPassword(password);
|
||||
return jedisConnectionFactory;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
package eu.dnetlib.repo.manager.config;
|
||||
|
||||
import eu.dnetlib.repo.manager.controllers.*;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
||||
import springfox.documentation.builders.PathSelectors;
|
||||
|
@ -23,17 +21,7 @@ import java.util.ArrayList;
|
|||
@Configuration
|
||||
@EnableSwagger2
|
||||
@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
|
||||
public Docket productApi() {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
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.broker.*;
|
||||
import eu.dnetlib.repo.manager.service.BrokerServiceImpl;
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package eu.dnetlib.repo.manager.controllers;
|
||||
|
||||
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.DashboardService;
|
||||
import eu.dnetlib.repo.manager.service.PiWikService;
|
||||
|
@ -18,7 +20,7 @@ import java.util.List;
|
|||
|
||||
@RestController
|
||||
@RequestMapping(value = "/dashboard")
|
||||
@Api(description = "Dashboard API", tags = {"dashboard"})
|
||||
@Api(description = "Dashboard API", tags = {"dashboard"})
|
||||
public class DashboardController {
|
||||
|
||||
@Autowired
|
||||
|
@ -33,17 +35,17 @@ public class DashboardController {
|
|||
@Autowired
|
||||
private PiWikService piWikService;
|
||||
|
||||
@RequestMapping(value = "/getRepositoriesSummary/{page}/{size}" , method = RequestMethod.GET,
|
||||
@RequestMapping(value = "/getRepositoriesSummary/{page}/{size}", method = RequestMethod.GET,
|
||||
produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@ResponseBody
|
||||
@PreAuthorize("hasAuthority('REGISTERED_USER')")
|
||||
public List<RepositorySummaryInfo> getRepositoriesSummaryInfo(
|
||||
@PathVariable("page") String page,
|
||||
@PathVariable("size") String size) throws JSONException {
|
||||
@PathVariable("page") String page,
|
||||
@PathVariable("size") String size) throws JSONException {
|
||||
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)
|
||||
@ResponseBody
|
||||
@PreAuthorize("hasAuthority('REGISTERED_USER')")
|
||||
|
@ -51,25 +53,25 @@ public class DashboardController {
|
|||
@PathVariable("repoId") String repoId,
|
||||
@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.setAggregationDetails(aggregationDetails);
|
||||
size=0;
|
||||
size = 0;
|
||||
do {
|
||||
aggregationDetails = repositoryService.getRepositoryAggregations(repoId,size,size+50);
|
||||
for(AggregationDetails aggregationDetail : aggregationDetails){
|
||||
if(aggregationDetail.getIndexedVersion()){
|
||||
aggregationDetails = repositoryService.getRepositoryAggregations(repoId, size, size + 50);
|
||||
for (AggregationDetails aggregationDetail : aggregationDetails) {
|
||||
if (aggregationDetail.getIndexedVersion()) {
|
||||
collectionMonitorSummary.setLastIndexedVersion(aggregationDetail);
|
||||
break;
|
||||
}
|
||||
}
|
||||
size+=30;
|
||||
}while (aggregationDetails.size() != 0 && collectionMonitorSummary.getLastIndexedVersion()==null);
|
||||
size += 30;
|
||||
} while (aggregationDetails.size() != 0 && collectionMonitorSummary.getLastIndexedVersion() == null);
|
||||
|
||||
return collectionMonitorSummary;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/usageSummary/{repoId}" , method = RequestMethod.GET,
|
||||
@RequestMapping(value = "/usageSummary/{repoId}", method = RequestMethod.GET,
|
||||
produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@ResponseBody
|
||||
@PreAuthorize("hasAuthority('REGISTERED_USER')")
|
||||
|
@ -79,16 +81,14 @@ public class DashboardController {
|
|||
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)
|
||||
@ResponseBody
|
||||
@PreAuthorize("hasAuthority('REGISTERED_USER')")
|
||||
public BrokerSummary getBrokerSummary(
|
||||
@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.repo.manager.domain.BrokerException;
|
||||
import eu.dnetlib.repo.manager.exception.BrokerException;
|
||||
import eu.dnetlib.repo.manager.exception.EndPointException;
|
||||
import eu.dnetlib.repo.manager.exception.ResourceNotFoundException;
|
||||
import eu.dnetlib.repo.manager.exception.ServerError;
|
||||
|
@ -33,35 +33,35 @@ public class GenericControllerAdvice {
|
|||
@ExceptionHandler(ResourceNotFoundException.class)
|
||||
@ResponseBody
|
||||
public ServerError securityException(HttpServletRequest req, Exception ex) {
|
||||
return new ServerError(req.getRequestURL().toString(),ex);
|
||||
return new ServerError(req.getRequestURL().toString(), ex);
|
||||
}
|
||||
|
||||
@ResponseStatus(HttpStatus.FORBIDDEN)
|
||||
@ExceptionHandler(AccessDeniedException.class)
|
||||
@ResponseBody
|
||||
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)
|
||||
@ExceptionHandler(UnknownHostException.class)
|
||||
@ResponseBody
|
||||
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)
|
||||
@ExceptionHandler({JSONException.class,BrokerException.class,ValidatorServiceException.class})
|
||||
@ExceptionHandler({JSONException.class, BrokerException.class, ValidatorServiceException.class})
|
||||
@ResponseBody
|
||||
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)
|
||||
@ExceptionHandler(EndPointException.class)
|
||||
@ResponseBody
|
||||
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.OrderByType;
|
||||
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 io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
|
|
|
@ -5,6 +5,7 @@ import eu.dnetlib.repo.manager.domain.RepositoryInterface;
|
|||
import eu.dnetlib.repo.manager.domain.*;
|
||||
import eu.dnetlib.repo.manager.domain.dto.RepositoryTerms;
|
||||
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.service.RepositoryService;
|
||||
import eu.dnetlib.repo.manager.service.security.AuthorizationService;
|
||||
|
@ -65,8 +66,9 @@ public class RepositoryController {
|
|||
produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@ResponseBody
|
||||
@PreAuthorize("hasAuthority('REGISTERED_USER')")
|
||||
public List<RepositorySnippet> getRepositoriesSnippetsOfUser() throws Exception {
|
||||
return repositoryService.getRepositoriesSnippetsOfUser("0", "100"); // FIXME
|
||||
public List<RepositorySnippet> getRepositoriesSnippetsOfUser(@RequestParam(name = "page", defaultValue = "0") int page,
|
||||
@RequestParam(name = "size", defaultValue = "1000") int pageSize) throws Exception {
|
||||
return repositoryService.getRepositoriesSnippetsOfUser(String.valueOf(page), String.valueOf(pageSize));
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/terms", method = RequestMethod.POST,
|
||||
|
@ -110,7 +112,7 @@ public class RepositoryController {
|
|||
Repository repo = repositoryService.getRepositoryById(id);
|
||||
|
||||
if (repo != null)
|
||||
logger.info("Returning repository " + repo.getId() + " registered by " + repo.getRegisteredBy());
|
||||
logger.info("Returning repository " + repo.getId() + " registered by " + repo.getRegisteredby());
|
||||
else
|
||||
logger.info("Requested repository " + id + " not found");
|
||||
return repo;
|
||||
|
@ -158,6 +160,7 @@ public class RepositoryController {
|
|||
return repositoryService.addRepository(datatype, repository);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@RequestMapping(value = "/getDnetCountries", method = RequestMethod.GET,
|
||||
produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@ResponseBody
|
||||
|
@ -165,6 +168,7 @@ public class RepositoryController {
|
|||
return repositoryService.getDnetCountries();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@RequestMapping(value = "/getTypologies", method = RequestMethod.GET,
|
||||
produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@ResponseBody
|
||||
|
@ -172,6 +176,7 @@ public class RepositoryController {
|
|||
return repositoryService.getTypologies();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@RequestMapping(value = "/getTimezones", method = RequestMethod.GET,
|
||||
produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@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.StoredJob;
|
||||
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.service.EmailUtils;
|
||||
import eu.dnetlib.repo.manager.service.ValidatorServiceImpl;
|
||||
|
|
|
@ -17,7 +17,6 @@ public class DatasourceDetails {
|
|||
protected Double latitude = 0.0;
|
||||
protected Double longitude = 0.0;
|
||||
protected Double timezone = 0.0;
|
||||
// protected String timezone;
|
||||
protected String namespaceprefix;
|
||||
protected String languages;
|
||||
protected Date dateofvalidation;
|
||||
|
@ -41,7 +40,6 @@ public class DatasourceDetails {
|
|||
protected Set<OrganizationDetails> organizations;
|
||||
protected Set<IdentitiesDetails> identities;
|
||||
protected String status;
|
||||
@Deprecated
|
||||
protected String typology;
|
||||
protected Date registrationdate;
|
||||
|
||||
|
@ -121,14 +119,6 @@ public class DatasourceDetails {
|
|||
this.longitude = longitude;
|
||||
}
|
||||
|
||||
// public String getTimezone() {
|
||||
// return timezone;
|
||||
// }
|
||||
//
|
||||
// public void setTimezone(String timezone) {
|
||||
// this.timezone = timezone;
|
||||
// }
|
||||
|
||||
public String getNamespaceprefix() {
|
||||
return namespaceprefix;
|
||||
}
|
||||
|
|
|
@ -12,62 +12,13 @@ import java.util.*;
|
|||
public class Repository extends DatasourceDetails {
|
||||
private static final long serialVersionUID = -7241644234046760972L;
|
||||
|
||||
@Deprecated
|
||||
private String datasourceType;
|
||||
|
||||
private List<RepositoryInterface> interfaces = new ArrayList<>();
|
||||
|
||||
private static List<DataCollectionType> dataCollectionTypes = new ArrayList<>();
|
||||
|
||||
|
||||
private PiwikInfo piwikInfo;
|
||||
|
||||
private List<String> environments = new ArrayList<>();
|
||||
|
||||
public Repository() {
|
||||
// this.setDateOfCreation(new Date()); // FIXME: remove this ???
|
||||
// this.setResourceKind("RepositoryServiceResources");
|
||||
// this.setResourceType("RepositoryServiceResourceType");
|
||||
}
|
||||
|
||||
public String getRegisteredBy() {
|
||||
return registeredby;
|
||||
}
|
||||
|
||||
public void setRegisteredBy(String registeredBy) {
|
||||
this.registeredby = registeredBy;
|
||||
}
|
||||
|
||||
public String getEnglishName() {
|
||||
return englishname;
|
||||
}
|
||||
|
||||
public void setEnglishName(String englishName) {
|
||||
this.englishname = englishName;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getOfficialName() {
|
||||
return officialname;
|
||||
}
|
||||
|
||||
public void setOfficialName(String officialName) {
|
||||
this.officialname = officialName;
|
||||
}
|
||||
|
||||
public List<RepositoryInterface> getInterfaces() {
|
||||
|
@ -78,18 +29,6 @@ public class Repository extends DatasourceDetails {
|
|||
this.interfaces = interfaces;
|
||||
}
|
||||
|
||||
public String getTypology() {
|
||||
return typology;
|
||||
}
|
||||
|
||||
public void setTypology(String typology) {
|
||||
this.typology = typology;
|
||||
}
|
||||
|
||||
public Double getLatitude() {
|
||||
return latitude;
|
||||
}
|
||||
|
||||
public Double getTimezone() {
|
||||
return timezone;
|
||||
}
|
||||
|
@ -113,164 +52,6 @@ public class Repository extends DatasourceDetails {
|
|||
this.dataCollectionTypes = dataCollectionTypes;
|
||||
}
|
||||
|
||||
public void setEnvironments(List<String> environments) {
|
||||
this.environments = environments;
|
||||
}
|
||||
|
||||
public List<String> getEnvironments() {
|
||||
return environments;
|
||||
}
|
||||
|
||||
public String getPlatform() {
|
||||
return platform;
|
||||
}
|
||||
|
||||
public void setPlatform(String platform) {
|
||||
this.platform = platform;
|
||||
}
|
||||
|
||||
public String getSubjects() {
|
||||
return subjects;
|
||||
}
|
||||
|
||||
public void setSubjects(String subjects) {
|
||||
this.subjects = subjects;
|
||||
}
|
||||
|
||||
// new
|
||||
|
||||
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 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 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 String getEoscDatasourceType() {
|
||||
return eoscDatasourceType;
|
||||
}
|
||||
|
||||
public void setEoscDatasourceType(String eoscDatasourceType) {
|
||||
this.eoscDatasourceType = eoscDatasourceType;
|
||||
}
|
||||
|
||||
public Date getDateOfValidation() {
|
||||
return dateofvalidation;
|
||||
}
|
||||
|
||||
public void setDateOfValidation(Date dateOfValidation) {
|
||||
this.dateofvalidation = dateOfValidation;
|
||||
}
|
||||
|
||||
public Date getDateOfCollection() {
|
||||
return dateofcollection;
|
||||
}
|
||||
|
||||
public void setDateOfCollection(Date dateOfCollection) {
|
||||
this.dateofcollection = dateOfCollection;
|
||||
}
|
||||
|
||||
public String getActivationId() {
|
||||
return activationId;
|
||||
}
|
||||
|
||||
public void setActivationId(String activationId) {
|
||||
this.activationId = activationId;
|
||||
}
|
||||
|
||||
public String getAggregator() {
|
||||
return aggregator;
|
||||
}
|
||||
|
||||
public void setAggregator(String aggregator) {
|
||||
this.aggregator = aggregator;
|
||||
}
|
||||
|
||||
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 void setLatitude(Double latitude) {
|
||||
this.latitude = latitude;
|
||||
}
|
||||
|
||||
public PiwikInfo getPiwikInfo() {
|
||||
return piwikInfo;
|
||||
}
|
||||
|
@ -279,78 +60,6 @@ public class Repository extends DatasourceDetails {
|
|||
this.piwikInfo = piwikInfo;
|
||||
}
|
||||
|
||||
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 getDatasourceType() {
|
||||
return datasourceType;
|
||||
}
|
||||
|
||||
public void setDatasourceType(String datasourceType) {
|
||||
this.datasourceType = datasourceType;
|
||||
}
|
||||
|
||||
public Date getRegistrationdate() {
|
||||
return registrationdate;
|
||||
}
|
||||
|
||||
public void setRegistrationdate(Date registrationdate) {
|
||||
this.registrationdate = registrationdate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return officialname.hashCode();
|
||||
|
@ -358,23 +67,23 @@ public class Repository extends DatasourceDetails {
|
|||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (!(o instanceof eu.dnetlib.domain.data.Repository))
|
||||
if (!(o instanceof Repository))
|
||||
return false;
|
||||
else
|
||||
return this.equals((eu.dnetlib.domain.data.Repository) o);
|
||||
return this.equals((Repository) o);
|
||||
}
|
||||
|
||||
public boolean equals(eu.dnetlib.domain.data.Repository r) {
|
||||
public boolean equals(Repository r) {
|
||||
// TODO: fill with required fields...
|
||||
|
||||
if (this.getEnglishName() != null && r.getEnglishName() == null) {
|
||||
if (this.getEnglishname() != null && r.getEnglishname() == null) {
|
||||
return false;
|
||||
} else if (this.getEnglishName() == null
|
||||
&& r.getEnglishName() != null) {
|
||||
} else if (this.getEnglishname() == null
|
||||
&& r.getEnglishname() != null) {
|
||||
return false;
|
||||
} else if (this.getEnglishName() != null
|
||||
&& r.getEnglishName() != null) {
|
||||
return this.getEnglishName().equals(r.getEnglishName());
|
||||
} else if (this.getEnglishname() != null
|
||||
&& r.getEnglishname() != null) {
|
||||
return this.getEnglishname().equals(r.getEnglishname());
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -24,8 +24,6 @@ public class RepositorySnippet {
|
|||
private Date lastConsentTermsOfUseDate;
|
||||
private Boolean fullTextDownload;
|
||||
private Set<OrganizationDetails> organizations;
|
||||
|
||||
@Deprecated
|
||||
private String typology;
|
||||
|
||||
|
||||
|
|
|
@ -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.
|
|
@ -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.
|
|
@ -1,6 +1,6 @@
|
|||
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.broker.*;
|
||||
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.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.Term;
|
||||
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.broker.BrowseEntry;
|
||||
import eu.dnetlib.repo.manager.exception.BrokerException;
|
||||
import eu.dnetlib.repo.manager.exception.RepositoryServiceException;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
|
|
@ -4,7 +4,7 @@ import eu.dnetlib.domain.data.PiwikInfo;
|
|||
import eu.dnetlib.repo.manager.domain.Repository;
|
||||
import eu.dnetlib.repo.manager.domain.RepositoryInterface;
|
||||
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 org.apache.log4j.Logger;
|
||||
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 {
|
||||
try {
|
||||
String subject = "OpenAIRE content provider registration for " +
|
||||
repository.getDatasourceType() + "[" + repository.getOfficialName() + "]";
|
||||
repository.getEoscDatasourceType() + "[" + repository.getOfficialname() + "]";
|
||||
|
||||
String message = "Dear administrator" + ",\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. " +
|
||||
"\n\n" +
|
||||
"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 {
|
||||
try {
|
||||
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 "+SecurityContextHolder.getContext().getAuthentication().getName()+",\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. " +
|
||||
"\n\n" +
|
||||
"Please do not reply to this message\n" +
|
||||
|
@ -209,10 +209,10 @@ public class EmailUtilsImpl implements EmailUtils {
|
|||
"Regards,\n" +
|
||||
"the OpenAIRE technical team\n";
|
||||
|
||||
this.sendMail(repository.getRegisteredBy(), subject, message);
|
||||
this.sendMail(repository.getRegisteredby(), subject, message);
|
||||
|
||||
} 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;
|
||||
}
|
||||
}
|
||||
|
@ -221,7 +221,7 @@ public class EmailUtilsImpl implements EmailUtils {
|
|||
public void sendAdminRegisterInterfaceEmail(Repository repository, String comment, RepositoryInterface repositoryInterface, Authentication authentication) throws Exception {
|
||||
try {
|
||||
String subject = "OpenAIRE new interface registration request started for " +
|
||||
repository.getDatasourceType() + "[" + repository.getOfficialName() + "]";
|
||||
repository.getEoscDatasourceType() + "[" + repository.getOfficialname() + "]";
|
||||
|
||||
String message = "Dear administrator" + ",\n" +
|
||||
"\n" +
|
||||
|
@ -229,7 +229,7 @@ public class EmailUtilsImpl implements EmailUtils {
|
|||
"Base URL: " + repositoryInterface.getBaseurl() + "\n" +
|
||||
"Set: " + repositoryInterface.getAccessSet() + "\n" +
|
||||
"Guidelines: " + repositoryInterface.getCompatibilityOverride() + "\n\n" +
|
||||
"to " + repository.getDatasourceType() + "[" + repository.getOfficialName() + "].\n";
|
||||
"to " + repository.getEoscDatasourceType() + "[" + repository.getOfficialname() + "].\n";
|
||||
|
||||
if (comment != null)
|
||||
message += "\nThe users comment was '" + comment + "'\n";
|
||||
|
@ -256,7 +256,7 @@ public class EmailUtilsImpl implements EmailUtils {
|
|||
public void sendUserRegisterInterfaceEmail(Repository repository, String comment, RepositoryInterface repositoryInterface, Authentication authentication) throws Exception {
|
||||
try {
|
||||
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" +
|
||||
"\n" +
|
||||
|
@ -264,7 +264,7 @@ public class EmailUtilsImpl implements EmailUtils {
|
|||
"Base URL: " + repositoryInterface.getBaseurl() + "\n" +
|
||||
"Set: " + repositoryInterface.getAccessSet() + "\n" +
|
||||
"Guidelines: " + repositoryInterface.getCompatibilityOverride() + "\n\n" +
|
||||
"to " + repository.getDatasourceType() + "[" + repository.getOfficialName() + "].\n";
|
||||
"to " + repository.getEoscDatasourceType() + "[" + repository.getOfficialname() + "].\n";
|
||||
|
||||
if (comment != null) {
|
||||
message += "\n Your comment was '" + comment + "'\n";
|
||||
|
@ -278,10 +278,10 @@ public class EmailUtilsImpl implements EmailUtils {
|
|||
"Regards,\n" +
|
||||
"the OpenAIRE technical team\n";
|
||||
|
||||
this.sendMail(repository.getRegisteredBy(), subject, message);
|
||||
this.sendMail(repository.getRegisteredby(), subject, message);
|
||||
|
||||
} 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;
|
||||
}
|
||||
}
|
||||
|
@ -290,17 +290,17 @@ public class EmailUtilsImpl implements EmailUtils {
|
|||
public void sendUserRegistrationResultsSuccessEmail(String issuerEmail, String jobId, RepositoryInterface repositoryInterface, Repository repository, Authentication authentication) throws Exception {
|
||||
try {
|
||||
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 user,\n" +
|
||||
"\n" +
|
||||
"the compatibility test on " + "[" + repository.getOfficialName() + "]" +
|
||||
" was successful and the datasource type \""+ repository.getDatasourceType() + "\" will be prepared for aggregation in OpenAIRE."+
|
||||
"the compatibility test on " + "[" + repository.getOfficialname() + "]" +
|
||||
" was successful and the datasource type \""+ repository.getEoscDatasourceType() + "\" will be prepared for aggregation in OpenAIRE."+
|
||||
"\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()+
|
||||
"\nOfficial Name:" + repository.getOfficialName() +
|
||||
"Registration identifier in OpenAIRE: "+ repository.getNamespaceprefix()+
|
||||
"\nOfficial Name:" + repository.getOfficialname() +
|
||||
"\n\nBase URL: "+ repositoryInterface.getBaseurl() +
|
||||
"\n\nValidation Set: " + repositoryInterface.getAccessSet() +
|
||||
"\n\nGuidelines: "+ repositoryInterface.getCompatibilityOverride() +
|
||||
|
@ -311,10 +311,10 @@ public class EmailUtilsImpl implements EmailUtils {
|
|||
"Regards,\n" +
|
||||
"the OpenAIRE technical team\n";
|
||||
|
||||
this.sendMail(repository.getRegisteredBy(), subject, message);
|
||||
this.sendMail(repository.getRegisteredby(), subject, message);
|
||||
|
||||
} 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;
|
||||
}
|
||||
}
|
||||
|
@ -323,16 +323,16 @@ public class EmailUtilsImpl implements EmailUtils {
|
|||
public void sendAdminRegistrationResultsSuccessEmail(String issuerEmail, String jobId,RepositoryInterface repositoryInterface, Repository repository, Authentication authentication) throws Exception {
|
||||
try {
|
||||
String subject = "OpenAIRE new interface registration request - results (success) for " +
|
||||
repository.getDatasourceType() + "[" + repository.getOfficialName() + "]";
|
||||
repository.getEoscDatasourceType() + "[" + repository.getOfficialname() + "]";
|
||||
|
||||
String message = "Dear admin ,\n" +
|
||||
"\n" +
|
||||
"the compatibility test on " + "[" + repository.getOfficialName() + "]" +
|
||||
" was successful and the datasource type \""+ repository.getDatasourceType() + "\" will be prepared for aggregation in OpenAIRE."+
|
||||
"the compatibility test on " + "[" + repository.getOfficialname() + "]" +
|
||||
" was successful and the datasource type \""+ repository.getEoscDatasourceType() + "\" will be prepared for aggregation in OpenAIRE."+
|
||||
"\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()+
|
||||
"\nOfficial Name:" + repository.getOfficialName() +
|
||||
"Registration identifier in OpenAIRE: "+ repository.getNamespaceprefix()+
|
||||
"\nOfficial Name:" + repository.getOfficialname() +
|
||||
"\n\nBase URL: "+ repositoryInterface.getBaseurl() +
|
||||
"\n\nValidation Set: " + repositoryInterface.getAccessSet() +
|
||||
"\n\nGuidelines: "+ repositoryInterface.getCompatibilityOverride() +
|
||||
|
@ -347,7 +347,7 @@ public class EmailUtilsImpl implements EmailUtils {
|
|||
this.sendMail(this.provideAdminEmail, subject, message);
|
||||
|
||||
} 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;
|
||||
}
|
||||
}
|
||||
|
@ -356,16 +356,16 @@ public class EmailUtilsImpl implements EmailUtils {
|
|||
public void sendUserRegistrationResultsFailureEmail(String jobId, RepositoryInterface repositoryInterface, Repository repository, Authentication authentication) throws Exception {
|
||||
try {
|
||||
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 user,\n" +
|
||||
"\n" +
|
||||
"the compatibility test on " + "[" + repository.getOfficialName() + "]" +
|
||||
"the compatibility test on " + "[" + repository.getOfficialname() + "]" +
|
||||
" was not successful and the registration process was interrupted."+
|
||||
"\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()+
|
||||
"\nOfficial Name:" + repository.getOfficialName() +
|
||||
"Registration identifier in OpenAIRE: "+ repository.getNamespaceprefix()+
|
||||
"\nOfficial Name:" + repository.getOfficialname() +
|
||||
"\n\nBase URL: "+ repositoryInterface.getBaseurl() +
|
||||
"\n\nValidation Set: " + repositoryInterface.getAccessSet() +
|
||||
"\n\nGuidelines: "+ repositoryInterface.getCompatibilityOverride() +
|
||||
|
@ -376,10 +376,10 @@ public class EmailUtilsImpl implements EmailUtils {
|
|||
"Regards,\n" +
|
||||
"the OpenAIRE technical team\n";
|
||||
|
||||
this.sendMail(repository.getRegisteredBy(), subject, message);
|
||||
this.sendMail(repository.getRegisteredby(), subject, message);
|
||||
|
||||
} 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;
|
||||
}
|
||||
}
|
||||
|
@ -388,16 +388,16 @@ public class EmailUtilsImpl implements EmailUtils {
|
|||
public void sendAdminRegistrationResultsFailureEmail(String issuerEmail, String jobId, RepositoryInterface repositoryInterface, Repository repository, Authentication authentication) throws Exception {
|
||||
try {
|
||||
String subject = "OpenAIRE new interface registration request - results (failure) for " +
|
||||
repository.getDatasourceType() + "[" + repository.getOfficialName() + "]";
|
||||
repository.getEoscDatasourceType() + "[" + repository.getOfficialname() + "]";
|
||||
|
||||
String message = "Dear admin,\n" +
|
||||
"\n" +
|
||||
"the compatibility test on " + "[" + repository.getOfficialName() + "]" +
|
||||
"the compatibility test on " + "[" + repository.getOfficialname() + "]" +
|
||||
" was not successful and the registration process was interrupted."+
|
||||
"\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()+
|
||||
"\nOfficial Name:" + repository.getOfficialName() +
|
||||
"Registration identifier in OpenAIRE: "+ repository.getNamespaceprefix()+
|
||||
"\nOfficial Name:" + repository.getOfficialname() +
|
||||
"\n\nBase URL: "+ repositoryInterface.getBaseurl() +
|
||||
"\n\nValidation Set: " + repositoryInterface.getAccessSet() +
|
||||
"\n\nGuidelines: "+ repositoryInterface.getCompatibilityOverride() +
|
||||
|
@ -412,7 +412,7 @@ public class EmailUtilsImpl implements EmailUtils {
|
|||
this.sendMail(this.provideAdminEmail, subject, message);
|
||||
|
||||
} 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;
|
||||
}
|
||||
}
|
||||
|
@ -421,15 +421,15 @@ public class EmailUtilsImpl implements EmailUtils {
|
|||
public void sendUserUpdateResultsSuccessEmail(String issuer, String jobId, RepositoryInterface repositoryInterface, Repository repository, Authentication authentication) throws Exception {
|
||||
try {
|
||||
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 user,\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" +
|
||||
"Registration identifier in OpenAIRE: "+ repository.getNamespacePrefix()+
|
||||
"\nOfficial Name:" + repository.getOfficialName() +
|
||||
"Registration identifier in OpenAIRE: "+ repository.getNamespaceprefix()+
|
||||
"\nOfficial Name:" + repository.getOfficialname() +
|
||||
"\n\nBase URL: "+ repositoryInterface.getBaseurl() +
|
||||
"\n\nValidation Set: " + repositoryInterface.getAccessSet() +
|
||||
"\n\nGuidelines: "+ repositoryInterface.getCompatibilityOverride() +
|
||||
|
@ -452,14 +452,14 @@ public class EmailUtilsImpl implements EmailUtils {
|
|||
public void sendAdminUpdateResultsSuccessEmail(String issuerEmail, String jobId, RepositoryInterface repositoryInterface, Repository repository, Authentication authentication) throws Exception {
|
||||
try {
|
||||
String subject = "OpenAIRE interface update request - results (success) for " +
|
||||
repository.getDatasourceType() + "[" + repository.getOfficialName() + "]";
|
||||
repository.getEoscDatasourceType() + "[" + repository.getOfficialname() + "]";
|
||||
|
||||
String message = "Dear admin,\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" +
|
||||
"Registration identifier in OpenAIRE: "+ repository.getNamespacePrefix()+
|
||||
"\nOfficial Name:" + repository.getOfficialName() +
|
||||
"Registration identifier in OpenAIRE: "+ repository.getNamespaceprefix()+
|
||||
"\nOfficial Name:" + repository.getOfficialname() +
|
||||
"\n\nBase URL: "+ repositoryInterface.getBaseurl() +
|
||||
"\n\nValidation Set: " + repositoryInterface.getAccessSet() +
|
||||
"\n\nGuidelines: "+ repositoryInterface.getCompatibilityOverride() +
|
||||
|
@ -483,17 +483,17 @@ public class EmailUtilsImpl implements EmailUtils {
|
|||
public void sendUserUpdateResultsFailureEmail(String issuer, String jobId, RepositoryInterface repositoryInterface, Repository repository, Authentication authentication) throws Exception {
|
||||
try {
|
||||
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 user,\n" +
|
||||
"\n" +
|
||||
"the compatibility test on " + "[" + repository.getOfficialName() + "]" +
|
||||
"the compatibility test on " + "[" + repository.getOfficialname() + "]" +
|
||||
" was not successful."+
|
||||
"\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()+
|
||||
"\nOfficial Name:" + repository.getOfficialName() +
|
||||
"Registration identifier in OpenAIRE: "+ repository.getNamespaceprefix()+
|
||||
"\nOfficial Name:" + repository.getOfficialname() +
|
||||
"\n\nBase URL: "+ repositoryInterface.getBaseurl() +
|
||||
"\n\nValidation Set: " + repositoryInterface.getAccessSet() +
|
||||
"\n\nGuidelines: "+ repositoryInterface.getCompatibilityOverride() +
|
||||
|
@ -507,7 +507,7 @@ public class EmailUtilsImpl implements EmailUtils {
|
|||
this.sendMail(issuer, subject, message);
|
||||
|
||||
} 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;
|
||||
}
|
||||
}
|
||||
|
@ -516,16 +516,16 @@ public class EmailUtilsImpl implements EmailUtils {
|
|||
public void sendAdminUpdateResultsFailureEmail(String issuerEmail, String jobId, RepositoryInterface repositoryInterface, Repository repository, Authentication authentication) throws Exception {
|
||||
try {
|
||||
String subject = "OpenAIRE interface update request - results (failure) for " +
|
||||
repository.getDatasourceType() + "[" + repository.getOfficialName() + "]";
|
||||
repository.getEoscDatasourceType() + "[" + repository.getOfficialname() + "]";
|
||||
|
||||
String message = "Dear admin,\n" +
|
||||
"\n" +
|
||||
"the compatibility test on " + "[" + repository.getOfficialName() + "]" +
|
||||
"the compatibility test on " + "[" + repository.getOfficialname() + "]" +
|
||||
" was not successful."+
|
||||
"\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()+
|
||||
"\nOfficial Name:" + repository.getOfficialName() +
|
||||
"Registration identifier in OpenAIRE: "+ repository.getNamespaceprefix()+
|
||||
"\nOfficial Name:" + repository.getOfficialname() +
|
||||
"\n\nBase URL: "+ repositoryInterface.getBaseurl() +
|
||||
"\n\nValidation Set: " + repositoryInterface.getAccessSet() +
|
||||
"\n\nGuidelines: "+ repositoryInterface.getCompatibilityOverride() +
|
||||
|
@ -540,7 +540,7 @@ public class EmailUtilsImpl implements EmailUtils {
|
|||
this.sendMail(this.provideAdminEmail, subject, message);
|
||||
|
||||
} 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;
|
||||
}
|
||||
}
|
||||
|
@ -598,7 +598,7 @@ public class EmailUtilsImpl implements EmailUtils {
|
|||
|
||||
String message = "Dear admin,\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" +
|
||||
"Regards,\n" +
|
||||
"the OpenAIRE technical team\n";
|
||||
|
@ -615,11 +615,11 @@ public class EmailUtilsImpl implements EmailUtils {
|
|||
public void sendAdminUpdateRepositoryInfoEmail(Repository repository, Authentication authentication) throws Exception {
|
||||
try {
|
||||
String subject = "OpenAIRE content provider update information for " +
|
||||
repository.getDatasourceType() + "[" + repository.getOfficialName() + "]";
|
||||
repository.getEoscDatasourceType() + "[" + repository.getOfficialname() + "]";
|
||||
|
||||
String message = "Dear administrator" + ",\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" +
|
||||
"This message has been generated automatically.\n\n" +
|
||||
"Regards,\n" +
|
||||
|
@ -637,22 +637,22 @@ public class EmailUtilsImpl implements EmailUtils {
|
|||
public void sendUserUpdateRepositoryInfoEmail(Repository repository, Authentication authentication) throws Exception {
|
||||
try {
|
||||
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 user,\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" +
|
||||
"This message has been generated automatically.\n\n" +
|
||||
"If you have any questions, write to 'helpdesk@openaire.eu'. \n\n" +
|
||||
"Regards,\n" +
|
||||
"the OpenAIRE technical team\n";
|
||||
|
||||
this.sendMail(repository.getRegisteredBy(), subject, message);
|
||||
this.sendMail(repository.getRegisteredby(), subject, message);
|
||||
|
||||
} 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;
|
||||
}
|
||||
}
|
||||
|
@ -661,7 +661,7 @@ public class EmailUtilsImpl implements EmailUtils {
|
|||
public void sendAdminUpdateInterfaceEmail(Repository repository, String comment, RepositoryInterface repositoryInterface, Authentication authentication) throws Exception {
|
||||
try {
|
||||
String subject = "OpenAIRE interface update request started for " +
|
||||
repository.getDatasourceType() + "[" + repository.getOfficialName() + "]";
|
||||
repository.getEoscDatasourceType() + "[" + repository.getOfficialname() + "]";
|
||||
|
||||
String message = "Dear administrator" + ",\n" +
|
||||
"\n" +
|
||||
|
@ -669,7 +669,7 @@ public class EmailUtilsImpl implements EmailUtils {
|
|||
"Base URL: " + repositoryInterface.getBaseurl() + "\n" +
|
||||
"Set: " + repositoryInterface.getAccessSet() + "\n" +
|
||||
"Guidelines: " + repositoryInterface.getCompatibilityOverride() + "\n\n" +
|
||||
"for " + repository.getDatasourceType() + "[" + repository.getOfficialName() + "].\n";
|
||||
"for " + repository.getEoscDatasourceType() + "[" + repository.getOfficialname() + "].\n";
|
||||
|
||||
if (comment != null)
|
||||
message += "\nThe users comment was '" + comment + "'\n";
|
||||
|
@ -694,7 +694,7 @@ public class EmailUtilsImpl implements EmailUtils {
|
|||
public void sendUserUpdateInterfaceEmail(Repository repository, String comment, RepositoryInterface repositoryInterface, Authentication authentication) throws Exception {
|
||||
try {
|
||||
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 user,\n" +
|
||||
|
@ -703,7 +703,7 @@ public class EmailUtilsImpl implements EmailUtils {
|
|||
"Base URL: " + repositoryInterface.getBaseurl() + "\n" +
|
||||
"Set: " + repositoryInterface.getAccessSet() + "\n" +
|
||||
"Guidelines: " + repositoryInterface.getCompatibilityOverride() + "\n\n" +
|
||||
"for " + repository.getDatasourceType() + "[" + repository.getOfficialName() + "].\n";
|
||||
"for " + repository.getEoscDatasourceType() + "[" + repository.getOfficialname() + "].\n";
|
||||
|
||||
if (comment != null) {
|
||||
message += "\n Your comment was '" + comment + "'\n";
|
||||
|
@ -716,10 +716,10 @@ public class EmailUtilsImpl implements EmailUtils {
|
|||
"Regards,\n" +
|
||||
"the OpenAIRE technical team\n";
|
||||
|
||||
this.sendMail(repository.getRegisteredBy(), subject, message);
|
||||
this.sendMail(repository.getRegisteredby(), subject, message);
|
||||
|
||||
} 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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ package eu.dnetlib.repo.manager.service;
|
|||
import eu.dnetlib.domain.data.PiwikInfo;
|
||||
import eu.dnetlib.repo.manager.domain.OrderByField;
|
||||
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 java.util.List;
|
||||
|
|
|
@ -5,7 +5,7 @@ import eu.dnetlib.domain.data.PiwikInfo;
|
|||
import eu.dnetlib.repo.manager.domain.Repository;
|
||||
import eu.dnetlib.repo.manager.domain.OrderByField;
|
||||
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.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
|
|
@ -3,12 +3,12 @@ package eu.dnetlib.repo.manager.service;
|
|||
import eu.dnetlib.repo.manager.domain.Repository;
|
||||
import eu.dnetlib.repo.manager.domain.RepositoryInterface;
|
||||
import eu.dnetlib.repo.manager.domain.*;
|
||||
import eu.dnetlib.repo.manager.exception.RepositoryServiceException;
|
||||
import eu.dnetlib.repo.manager.exception.ResourceNotFoundException;
|
||||
import org.json.JSONException;
|
||||
import org.springframework.security.core.Authentication;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
|
|
@ -11,6 +11,8 @@ import eu.dnetlib.domain.enabling.Vocabulary;
|
|||
import eu.dnetlib.domain.functionality.validator.JobForValidation;
|
||||
import eu.dnetlib.repo.manager.domain.*;
|
||||
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.service.aai.registry.AaiRegistryService;
|
||||
import eu.dnetlib.repo.manager.service.security.AuthoritiesUpdater;
|
||||
|
@ -72,7 +74,7 @@ public class RepositoryServiceImpl implements RepositoryService {
|
|||
@Value("${services.provide.usageStatisticsNumbersBaseURL}")
|
||||
private String usageStatisticsNumbersBaseURL;
|
||||
|
||||
private Converter converter;
|
||||
private final Converter converter;
|
||||
|
||||
private static final Map<String, List<String>> dataSourceClass = new HashMap<>();
|
||||
private static final Map<String, String> invertedDataSourceClass = new HashMap<>();
|
||||
|
@ -113,31 +115,19 @@ public class RepositoryServiceImpl implements RepositoryService {
|
|||
LOGGER.debug("Updated version!");
|
||||
|
||||
for (String key : this.getVocabulary("dnet:datasource_typologies").getAsMap().keySet()) {
|
||||
if (key.contains("pubsrepository")) { // do not change order <--
|
||||
if (key.contains("aggregator")) {
|
||||
dataSourceClass.putIfAbsent("aggregator", new ArrayList<>());
|
||||
dataSourceClass.get("aggregator").add(key);
|
||||
} else if (key.contains("crissystem")) {
|
||||
dataSourceClass.putIfAbsent("dris", new ArrayList<>());
|
||||
dataSourceClass.get("dris").add(key);
|
||||
} else if (key.contains("pubsrepository::journal")) { // do not change order -->
|
||||
dataSourceClass.putIfAbsent("journal", Collections.singletonList("pubsrepository::journal"));
|
||||
} else if (key.contains("pubsrepository")) { // do not change order <--
|
||||
dataSourceClass.putIfAbsent("opendoar", new ArrayList<>());
|
||||
dataSourceClass.get("opendoar").add(key);
|
||||
} else if (key.contains("datarepository")) {
|
||||
dataSourceClass.putIfAbsent("re3data", Collections.singletonList("datarepository::unknown"));
|
||||
} else if (key.contains("crissystem")) {
|
||||
// dataSourceClass.putIfAbsent("cris", new ArrayList<>());
|
||||
dataSourceClass.putIfAbsent("dris", new ArrayList<>());
|
||||
dataSourceClass.get("dris").add(key);
|
||||
}
|
||||
}
|
||||
|
||||
for (String key : this.getVocabulary("dnet:eosc_datasource_types").getAsMap().keySet()) {
|
||||
if (key.contains("Aggregator")) {
|
||||
dataSourceClass.putIfAbsent("aggregator", new ArrayList<>());
|
||||
dataSourceClass.get("aggregator").add(key);
|
||||
} else if (key.contains("CRIS system")) {
|
||||
dataSourceClass.putIfAbsent("cris", new ArrayList<>());
|
||||
dataSourceClass.get("cris").add(key);
|
||||
} else if (key.contains("Journal archive")) {
|
||||
dataSourceClass.putIfAbsent("journal", new ArrayList<>());
|
||||
dataSourceClass.get("journal").add(key);
|
||||
} else if (key.contains("Repository")) {
|
||||
dataSourceClass.putIfAbsent("repository", new ArrayList<>());
|
||||
dataSourceClass.get("repository").add(key);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -321,15 +311,8 @@ public class RepositoryServiceImpl implements RepositoryService {
|
|||
}
|
||||
|
||||
private Repository updateRepositoryInfo(Repository r) throws JSONException {
|
||||
|
||||
/*
|
||||
* from datasource class
|
||||
* we get the datasource type form the inverted map
|
||||
* */
|
||||
r.setDatasourceType(getRepositoryType(r.getEoscDatasourceType()));
|
||||
r.setInterfaces(this.getRepositoryInterface(r.getId()));
|
||||
r.setPiwikInfo(piWikService.getPiwikSiteForRepo(r.getId()));
|
||||
// r.setCountryName(getCountryName(r.getCountryCode()));
|
||||
return r;
|
||||
}
|
||||
|
||||
|
@ -350,14 +333,26 @@ public class RepositoryServiceImpl implements RepositoryService {
|
|||
|
||||
@Override
|
||||
public List<RepositorySnippet> getRepositoriesSnippetsOfUser(String page, String size) throws Exception {
|
||||
Collection<String> repoIds = roleMappingService.getRepoIdsByRoleIds(authorizationService.getUserRoles());
|
||||
return getRepositoriesSnippets(new ArrayList<>(repoIds));
|
||||
return getRepositoriesSnippetsOfUser(null, page, size);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RepositorySnippet> getRepositoriesSnippetsOfUser(String userEmail, String page, String size) throws Exception {
|
||||
Collection<String> repoIds = roleMappingService.getRepoIdsByRoleIds(authorizationService.getUserRoles(userEmail));
|
||||
return getRepositoriesSnippets(new ArrayList<>(repoIds));
|
||||
int from = Integer.parseInt(page) * Integer.parseInt(size);
|
||||
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
|
||||
|
@ -486,26 +481,37 @@ public class RepositoryServiceImpl implements RepositoryService {
|
|||
|
||||
LOGGER.debug("storing " + datatype + " repository with id: " + repository.getId());
|
||||
|
||||
// repository.setCountryCode(countriesMap.get(repository.getCountryName()));
|
||||
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")) {
|
||||
repository.setEoscDatasourceType("Journal archive");
|
||||
repository.setId("openaire____::issn" + repository.getIssn());
|
||||
repository.setNamespacePrefix("issn" + repository.getIssn());
|
||||
repository.setNamespaceprefix("issn" + repository.getIssn());
|
||||
this.storeRepository(repository, SecurityContextHolder.getContext().getAuthentication());
|
||||
} else if (datatype.equals("aggregator")) {
|
||||
repository.setId("openaire____::" + DigestUtils.md5Hex(repository.getOfficialName()));
|
||||
repository.setNamespacePrefix(DigestUtils.md5Hex(repository.getOfficialName()).substring(0, 12));
|
||||
repository.setEoscDatasourceType("Aggregator");
|
||||
repository.setId("openaire____::" + DigestUtils.md5Hex(repository.getOfficialname()));
|
||||
repository.setNamespaceprefix(DigestUtils.md5Hex(repository.getOfficialname()).substring(0, 12));
|
||||
this.storeRepository(repository, SecurityContextHolder.getContext().getAuthentication());
|
||||
} else {
|
||||
if (repository.getTypology().contains("crissystem")) {
|
||||
repository.setEoscDatasourceType("CRIS system");
|
||||
} else {
|
||||
repository.setEoscDatasourceType("Repository");
|
||||
}
|
||||
this.latentUpdate(repository, SecurityContextHolder.getContext().getAuthentication());
|
||||
}
|
||||
|
||||
// TODO: move the following code elsewhere (creation and assignment of role to user) ??
|
||||
// Create new role
|
||||
String newRoleName = roleMappingService.getRoleIdByRepoId(repository.getId());
|
||||
Role newRole = new Role(newRoleName, repository.getOfficialName());
|
||||
Role newRole = new Role(newRoleName, repository.getOfficialname());
|
||||
Integer couId = null;
|
||||
try {
|
||||
couId = registryCalls.createRole(newRole);
|
||||
|
@ -598,7 +604,7 @@ public class RepositoryServiceImpl implements RepositoryService {
|
|||
|
||||
Date utilDate = new Date();
|
||||
Timestamp date = new Timestamp(utilDate.getTime());
|
||||
repository.setDateOfCollection(date);
|
||||
repository.setDateofcollection(date);
|
||||
repository.setAggregator("OPENAIRE");
|
||||
// repository.setCountryCode(countriesMap.get(repository.getCountryName()));
|
||||
|
||||
|
@ -698,8 +704,8 @@ public class RepositoryServiceImpl implements RepositoryService {
|
|||
job.setDatasourceId(repo.getId());
|
||||
job.setDesiredCompatibilityLevel(iFace.getCompatibilityOverride());
|
||||
job.setInterfaceId(iFace.getId());
|
||||
job.setOfficialName(repo.getOfficialName());
|
||||
job.setRepoType(repo.getDatasourceType());
|
||||
job.setOfficialName(repo.getOfficialname());
|
||||
job.setRepoType(repo.getEoscDatasourceType());
|
||||
job.setUserEmail(userEmail);
|
||||
job.setValidationSet((iFace.getAccessSet().isEmpty() ? "none" : iFace.getAccessSet()));
|
||||
job.setRecords(-1);
|
||||
|
@ -845,6 +851,12 @@ public class RepositoryServiceImpl implements RepositoryService {
|
|||
if (entry.getKey().contains("crissystem"))
|
||||
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);
|
||||
|
||||
|
@ -853,11 +865,14 @@ public class RepositoryServiceImpl implements RepositoryService {
|
|||
private Map<String, String> filterResults(Map<String, String> map, String mode) {
|
||||
|
||||
HashMap<String, String> filteredMap = new HashMap<>();
|
||||
for (String key : map.keySet())
|
||||
if (dataSourceClass.get(mode).contains(key))
|
||||
filteredMap.put(key, map.get(key));
|
||||
if (map != null && mode != null) {
|
||||
for (String key : map.keySet())
|
||||
if (dataSourceClass.get(mode).contains(key))
|
||||
filteredMap.put(key, map.get(key));
|
||||
|
||||
return filteredMap;
|
||||
return filteredMap;
|
||||
}
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -5,7 +5,7 @@ import eu.dnetlib.domain.functionality.validator.JobForValidation;
|
|||
import eu.dnetlib.domain.functionality.validator.RuleSet;
|
||||
import eu.dnetlib.domain.functionality.validator.StoredJob;
|
||||
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 org.json.JSONException;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
|
|
|
@ -5,7 +5,7 @@ import eu.dnetlib.repo.manager.domain.RepositoryInterface;
|
|||
import eu.dnetlib.domain.functionality.validator.*;
|
||||
import eu.dnetlib.repo.manager.domain.Constants;
|
||||
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.OaiTools;
|
||||
import gr.uoa.di.driver.util.ServiceLocator;
|
||||
|
|
Loading…
Reference in New Issue