1. Bug fix on piwik
2. Add new emails 3. Bug fix on repository api
This commit is contained in:
parent
7e3c8194d5
commit
d83612439f
|
@ -41,7 +41,9 @@ public class FrontEndLinkURIAuthenticationSuccessHandler implements Authenticati
|
||||||
else
|
else
|
||||||
userInfo.addProperty("sub", URLEncoder.encode(authOIDC.getUserInfo().getSub(), "UTF-8"));
|
userInfo.addProperty("sub", URLEncoder.encode(authOIDC.getUserInfo().getSub(), "UTF-8"));
|
||||||
|
|
||||||
userInfo.addProperty("fullname", URLEncoder.encode(authOIDC.getUserInfo().getName(), "UTF-8"));
|
|
||||||
|
if(authOIDC.getUserInfo().getName() != null)
|
||||||
|
userInfo.addProperty("fullname", URLEncoder.encode(authOIDC.getUserInfo().getName(), "UTF-8"));
|
||||||
|
|
||||||
if (authOIDC.getUserInfo().getGivenName() == null)
|
if (authOIDC.getUserInfo().getGivenName() == null)
|
||||||
userInfo.addProperty("firstname", "");
|
userInfo.addProperty("firstname", "");
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
package eu.dnetlib.repo.manager.service.controllers;
|
package eu.dnetlib.repo.manager.service.controllers;
|
||||||
|
|
||||||
import eu.dnetlib.domain.data.PiwikInfo;
|
import eu.dnetlib.domain.data.PiwikInfo;
|
||||||
|
import eu.dnetlib.domain.data.Repository;
|
||||||
|
import org.springframework.security.core.Authentication;
|
||||||
|
|
||||||
public interface EmailUtils {
|
public interface EmailUtils {
|
||||||
|
|
||||||
|
@ -14,4 +16,8 @@ public interface EmailUtils {
|
||||||
void sendAdministratorMetricsEnabled(PiwikInfo piwikInfo) throws Exception;
|
void sendAdministratorMetricsEnabled(PiwikInfo piwikInfo) throws Exception;
|
||||||
|
|
||||||
void sendUserMetricsEnabled(PiwikInfo piwikInfo) throws Exception;
|
void sendUserMetricsEnabled(PiwikInfo piwikInfo) throws Exception;
|
||||||
|
|
||||||
|
void sendUserRegistrationEmail(Repository repository, Authentication authentication) throws Exception;
|
||||||
|
|
||||||
|
void sendUserUpdateRepositoryEmail(Repository repository, Authentication authentication) throws Exception;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,13 @@
|
||||||
package eu.dnetlib.repo.manager.service.controllers;
|
package eu.dnetlib.repo.manager.service.controllers;
|
||||||
|
|
||||||
import eu.dnetlib.domain.data.PiwikInfo;
|
import eu.dnetlib.domain.data.PiwikInfo;
|
||||||
|
import eu.dnetlib.domain.data.Repository;
|
||||||
import eu.dnetlib.repo.manager.service.config.CascadingPropertyLoader;
|
import eu.dnetlib.repo.manager.service.config.CascadingPropertyLoader;
|
||||||
import eu.dnetlib.utils.MailLibrary;
|
import eu.dnetlib.utils.MailLibrary;
|
||||||
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.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.security.core.Authentication;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
import javax.annotation.PostConstruct;
|
||||||
|
@ -43,7 +45,7 @@ public class EmailUtilsImpl implements EmailUtils {
|
||||||
|
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
public void init(){
|
public void init(){
|
||||||
System.out.println("base url -> " + this.baseUrl);
|
System.out.println("url -> " + this.baseUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -186,6 +188,38 @@ public class EmailUtilsImpl implements EmailUtils {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void sendUserRegistrationEmail(Repository repository, Authentication authentication) throws Exception{
|
||||||
|
/*try {
|
||||||
|
String subject = "OpenAIRE content provider registration request started for " +
|
||||||
|
repository.getDatasourceType() + "[" + repository.getEnglishName() + "]";
|
||||||
|
|
||||||
|
String message = "Dear " + authentication.getName() + ",\n" +
|
||||||
|
"\n" +
|
||||||
|
"We received a request to register the \"" + repository.getDatasourceType() + "[" + repository.getEnglishName() + "]" +
|
||||||
|
" to the OpenAIRE compliant list of content providers. " +
|
||||||
|
"\n A validation process against the OpenAIRE guidelines compatibility " +
|
||||||
|
" has been started. You will be informed in another message once the process is finished." +
|
||||||
|
"\n" +
|
||||||
|
"Please do not reply to this message\n" +
|
||||||
|
"This message has been generated automatically.\n" +
|
||||||
|
"If you have any questions, write to 'helpdesk@openaire.eu'. \n" +
|
||||||
|
"Regards,\n" +
|
||||||
|
"the OpenAIRE technical team\n";
|
||||||
|
|
||||||
|
this.sendMail(repository.getRegisteredBy(), subject, message, false, null);
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
LOGGER.error("Error while sending registration notification email to user: " + repository.getRegisteredBy(), e);
|
||||||
|
throw e;
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void sendUserUpdateRepositoryEmail(Repository repository, Authentication authentication) throws Exception {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private void sendMail(String email, String subject, String message, boolean sendToSpecial, List<String> repoAdminMails) throws Exception {
|
private void sendMail(String email, String subject, String message, boolean sendToSpecial, List<String> repoAdminMails) throws Exception {
|
||||||
ArrayList<String> to = new ArrayList<String>();
|
ArrayList<String> to = new ArrayList<String>();
|
||||||
to.add(email);
|
to.add(email);
|
||||||
|
|
|
@ -73,7 +73,7 @@ public class PiWikApiImpl implements PiWikApi{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@PreAuthorize("hasRole('ROLE_ADMIN') or (hasRole('ROLE_USER') and #piwikInfo.requestorEmail == authentication.userInfo.email)")
|
@PreAuthorize("hasRole('ROLE_ADMIN') or hasRole('ROLE_PORTAL_ADMIN') or (hasRole('ROLE_USER') and #piwikInfo.requestorEmail == authentication.userInfo.email)")
|
||||||
public PiwikInfo savePiwikInfo(@RequestBody PiwikInfo piwikInfo) {
|
public PiwikInfo savePiwikInfo(@RequestBody PiwikInfo piwikInfo) {
|
||||||
JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
|
JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
|
||||||
jdbcTemplate.update(INSERT_PIWIK_INFO, new Object[]{piwikInfo.getRepositoryId(), piwikInfo.getSiteId(), piwikInfo.getRequestorName(),
|
jdbcTemplate.update(INSERT_PIWIK_INFO, new Object[]{piwikInfo.getRepositoryId(), piwikInfo.getSiteId(), piwikInfo.getRequestorName(),
|
||||||
|
@ -94,7 +94,7 @@ public class PiWikApiImpl implements PiWikApi{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@PreAuthorize("hasRole('ROLE_ADMIN')")
|
@PreAuthorize("hasRole('ROLE_ADMIN') or hasRole('ROLE_PORTAL_ADMIN')")
|
||||||
public ResponseEntity<Object> approvePiwikSite(@PathVariable("repositoryId") String repositoryId) {
|
public ResponseEntity<Object> approvePiwikSite(@PathVariable("repositoryId") String repositoryId) {
|
||||||
new JdbcTemplate(dataSource).update(APPROVE_PIWIK_SITE, new Object[] {repositoryId}, new int[] {Types.VARCHAR});
|
new JdbcTemplate(dataSource).update(APPROVE_PIWIK_SITE, new Object[] {repositoryId}, new int[] {Types.VARCHAR});
|
||||||
return new ResponseEntity<>("OK",HttpStatus.OK);
|
return new ResponseEntity<>("OK",HttpStatus.OK);
|
||||||
|
@ -108,7 +108,7 @@ public class PiWikApiImpl implements PiWikApi{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@PreAuthorize("hasRole('ROLE_ADMIN')")
|
@PreAuthorize("hasRole('ROLE_ADMIN') or hasRole('ROLE_PORTAL_ADMIN')")
|
||||||
public ResponseEntity<Object> markPiwikSiteAsValidated(@PathVariable("repositoryId") String repositoryId) throws RepositoryServiceException {
|
public ResponseEntity<Object> markPiwikSiteAsValidated(@PathVariable("repositoryId") String repositoryId) throws RepositoryServiceException {
|
||||||
try {
|
try {
|
||||||
approvePiwikSite(repositoryId);
|
approvePiwikSite(repositoryId);
|
||||||
|
@ -129,7 +129,7 @@ public class PiWikApiImpl implements PiWikApi{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@PreAuthorize("hasRole('ROLE_ADMIN') or (hasRole('ROLE_USER') and #piwikInfo.requestorEmail == authentication.userInfo.email)")
|
@PreAuthorize("hasRole('ROLE_ADMIN') or hasRole('ROLE_PORTAL_ADMIN') or (hasRole('ROLE_USER') and #piwikInfo.requestorEmail == authentication.userInfo.email)")
|
||||||
public PiwikInfo enableMetricsForRepository(@RequestParam("officialName") String officialName,
|
public PiwikInfo enableMetricsForRepository(@RequestParam("officialName") String officialName,
|
||||||
@RequestParam("repoWebsite") String repoWebsite,
|
@RequestParam("repoWebsite") String repoWebsite,
|
||||||
@RequestBody PiwikInfo piwikInfo) throws RepositoryServiceException {
|
@RequestBody PiwikInfo piwikInfo) throws RepositoryServiceException {
|
||||||
|
|
|
@ -8,6 +8,7 @@ import eu.dnetlib.repo.manager.shared.*;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
|
import org.springframework.security.core.Authentication;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -100,7 +101,7 @@ public interface RepositoryApi {
|
||||||
@RequestMapping(value = "/updateRepository", method = RequestMethod.POST,
|
@RequestMapping(value = "/updateRepository", method = RequestMethod.POST,
|
||||||
consumes = MediaType.APPLICATION_JSON_VALUE)
|
consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
Repository updateRepository(Repository repository) throws JSONException;
|
Repository updateRepository(Repository repository, Authentication authentication) throws Exception;
|
||||||
|
|
||||||
@RequestMapping(value = "/getUrlsOfUserRepos/{user_email}/{page}/{size}/",method = RequestMethod.GET,
|
@RequestMapping(value = "/getUrlsOfUserRepos/{user_email}/{page}/{size}/",method = RequestMethod.GET,
|
||||||
produces = MediaType.APPLICATION_JSON_VALUE)
|
produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
|
|
|
@ -20,12 +20,11 @@ import org.json.JSONObject;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.core.ParameterizedTypeReference;
|
import org.springframework.core.ParameterizedTypeReference;
|
||||||
import org.springframework.http.HttpEntity;
|
import org.springframework.http.*;
|
||||||
import org.springframework.http.HttpHeaders;
|
|
||||||
import org.springframework.http.HttpMethod;
|
|
||||||
import org.springframework.http.ResponseEntity;
|
|
||||||
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.security.core.Authentication;
|
||||||
|
import org.springframework.security.core.context.SecurityContextHolder;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
@ -36,6 +35,7 @@ import org.springframework.web.util.UriComponents;
|
||||||
import org.springframework.web.util.UriComponentsBuilder;
|
import org.springframework.web.util.UriComponentsBuilder;
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
import javax.annotation.PostConstruct;
|
||||||
|
import javax.xml.ws.Response;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.sql.Timestamp;
|
import java.sql.Timestamp;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
@ -115,6 +115,7 @@ public class RepositoryApiImpl implements RepositoryApi {
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
private void init() {
|
private void init() {
|
||||||
LOGGER.debug("Initialization method of repository api!");
|
LOGGER.debug("Initialization method of repository api!");
|
||||||
|
LOGGER.debug("Updated version!");
|
||||||
|
|
||||||
restTemplate = new RestTemplate();
|
restTemplate = new RestTemplate();
|
||||||
restTemplate.getMessageConverters().add(new MappingJackson2HttpMessageConverter());
|
restTemplate.getMessageConverters().add(new MappingJackson2HttpMessageConverter());
|
||||||
|
@ -378,29 +379,37 @@ public class RepositoryApiImpl implements RepositoryApi {
|
||||||
|
|
||||||
repository = this.setRepositoryFeatures(datatype,repository);
|
repository = this.setRepositoryFeatures(datatype,repository);
|
||||||
LOGGER.debug("storing " + datatype + " repository with id: " + repository.getId());
|
LOGGER.debug("storing " + datatype + " repository with id: " + repository.getId());
|
||||||
this.storeRepository(repository);
|
this.storeRepository(repository, SecurityContextHolder.getContext().getAuthentication());
|
||||||
return repository;
|
return repository;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@PreAuthorize("hasRole('ROLE_USER') and #repository.registeredBy == authentication.userInfo.email")
|
//@PreAuthorize("hasRole('ROLE_USER') and #repository.registeredBy == authentication.userInfo.email")
|
||||||
public Repository updateRepository(@RequestBody Repository repository) throws JSONException {
|
public Repository updateRepository(Repository repository,Authentication authentication) throws Exception {
|
||||||
UriComponents uriComponents = UriComponentsBuilder
|
UriComponents uriComponents = UriComponentsBuilder
|
||||||
.fromHttpUrl(baseAddress + "/ds/update/")
|
.fromHttpUrl(baseAddress + "/ds/update/")
|
||||||
.build()
|
.build()
|
||||||
.encode();
|
.encode();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String json_repository = Converter.repositoryObjectToJson(repository);
|
String json_repository = Converter.repositoryObectToJson(repository);
|
||||||
HttpEntity<String> httpEntity = new HttpEntity <String> (json_repository,httpHeaders);
|
|
||||||
restTemplate.postForObject(uriComponents.toUri(),httpEntity,String.class);
|
LOGGER.debug("JSON to update -> " + json_repository);
|
||||||
|
|
||||||
|
HttpEntity<String> httpEntity = new HttpEntity<String>(json_repository, httpHeaders);
|
||||||
|
ResponseEntity responseEntity = restTemplate.postForObject(uriComponents.toUri(), httpEntity, ResponseEntity.class);
|
||||||
|
|
||||||
|
if (responseEntity.getStatusCode().equals(HttpStatus.OK))
|
||||||
|
emailUtils.sendUserUpdateRepositoryEmail(repository, authentication);
|
||||||
|
else
|
||||||
|
LOGGER.debug(responseEntity.getBody().toString());
|
||||||
|
|
||||||
return repository;
|
return repository;
|
||||||
}catch (Exception e){
|
} catch (Exception e) {
|
||||||
LOGGER.debug("Exception on updateRepository" , e);
|
LOGGER.debug("Exception on updateRepository" , e);
|
||||||
emailUtils.reportException(e);
|
emailUtils.reportException(e);
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Repository setRepositoryFeatures(String datatype, Repository repository) {
|
private Repository setRepositoryFeatures(String datatype, Repository repository) {
|
||||||
|
@ -446,7 +455,7 @@ public class RepositoryApiImpl implements RepositoryApi {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void storeRepository(Repository repository) throws JSONException {
|
private void storeRepository(Repository repository, Authentication authentication) throws Exception {
|
||||||
|
|
||||||
Date utilDate = new Date();
|
Date utilDate = new Date();
|
||||||
Timestamp date = new Timestamp(utilDate.getTime());
|
Timestamp date = new Timestamp(utilDate.getTime());
|
||||||
|
@ -469,7 +478,13 @@ public class RepositoryApiImpl implements RepositoryApi {
|
||||||
}
|
}
|
||||||
|
|
||||||
HttpEntity<String> httpEntity = new HttpEntity <String> (json_repository,httpHeaders);
|
HttpEntity<String> httpEntity = new HttpEntity <String> (json_repository,httpHeaders);
|
||||||
restTemplate.postForObject(uriComponents.toUri(),httpEntity,String.class);
|
ResponseEntity responseEntity = restTemplate.postForObject(uriComponents.toUri(), httpEntity, ResponseEntity.class);
|
||||||
|
|
||||||
|
if(responseEntity.getStatusCode().equals(HttpStatus.OK))
|
||||||
|
emailUtils.sendUserRegistrationEmail(repository,authentication);
|
||||||
|
else {
|
||||||
|
LOGGER.debug(responseEntity.getBody().toString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -32,6 +32,9 @@ public class StatsApiImpl implements StatsApi {
|
||||||
@Value("${search.api.usagestats}")
|
@Value("${search.api.usagestats}")
|
||||||
private String usagestatsBaseAddress;
|
private String usagestatsBaseAddress;
|
||||||
|
|
||||||
|
@Value("${search.api.usageEvents}")
|
||||||
|
private String usagestatsEvents;
|
||||||
|
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
private void init() {
|
private void init() {
|
||||||
LOGGER.debug("Initialization method of statistics api!");
|
LOGGER.debug("Initialization method of statistics api!");
|
||||||
|
@ -138,17 +141,12 @@ public class StatsApiImpl implements StatsApi {
|
||||||
|
|
||||||
private Integer getUsageStatsTotal() throws JSONException {
|
private Integer getUsageStatsTotal() throws JSONException {
|
||||||
UriComponents uriComponents = UriComponentsBuilder
|
UriComponents uriComponents = UriComponentsBuilder
|
||||||
.fromHttpUrl(usagestatsBaseAddress + "/totals")
|
.fromHttpUrl(usagestatsEvents)
|
||||||
.build().encode();
|
.build().encode();
|
||||||
|
|
||||||
String rs = restTemplate.getForObject(uriComponents.toUri(), String.class);
|
String rs = restTemplate.getForObject(uriComponents.toUri(), String.class);
|
||||||
|
|
||||||
JSONObject resultSet = new JSONObject(rs);
|
JSONObject resultSet = new JSONObject(rs);
|
||||||
|
JSONObject totals = resultSet.getJSONObject("totals");
|
||||||
String downloads = resultSet.getString("downloads");
|
return Integer.valueOf(totals.getString("events"));
|
||||||
String views = resultSet.getString("views");
|
|
||||||
|
|
||||||
|
|
||||||
return Integer.valueOf(downloads) + Integer.valueOf(views);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -236,8 +236,8 @@ public class Converter {
|
||||||
jsonObject.put("longitude",repository.getLongitude().toString());
|
jsonObject.put("longitude",repository.getLongitude().toString());
|
||||||
jsonObject.put("latitude",repository.getLatitude().toString());
|
jsonObject.put("latitude",repository.getLatitude().toString());
|
||||||
jsonObject.put("timezone",repository.getTimezone());
|
jsonObject.put("timezone",repository.getTimezone());
|
||||||
jsonObject.put("namespaceprefix",repository.getNamespacePrefix());
|
// jsonObject.put("namespaceprefix",repository.getNamespacePrefix());
|
||||||
jsonObject.put("languages",repository.getOdLanguages());
|
// jsonObject.put("languages",repository.getOdLanguages());
|
||||||
jsonObject.put("dateofvalidation",convertDateToString(repository.getDateOfValidation()));
|
jsonObject.put("dateofvalidation",convertDateToString(repository.getDateOfValidation()));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -247,16 +247,16 @@ public class Converter {
|
||||||
jsonObject.put("typology",repository.getDatasourceClass());
|
jsonObject.put("typology",repository.getDatasourceClass());
|
||||||
jsonObject.put("platform",repository.getTypology());
|
jsonObject.put("platform",repository.getTypology());
|
||||||
|
|
||||||
jsonObject.put("dateofcollection",convertDateToString(repository.getDateOfCollection()));
|
// jsonObject.put("dateofcollection",convertDateToString(repository.getDateOfCollection()));
|
||||||
jsonObject.put("activationId",repository.getActivationId());
|
// jsonObject.put("activationId",repository.getActivationId());
|
||||||
jsonObject.put("description",repository.getDescription());
|
jsonObject.put("description",repository.getDescription());
|
||||||
jsonObject.put("eissn",repository.getEissn());
|
// jsonObject.put("eissn",repository.getEissn());
|
||||||
jsonObject.put("issn",repository.getIssn());
|
// jsonObject.put("issn",repository.getIssn());
|
||||||
jsonObject.put("lissn",repository.getLissn());
|
// jsonObject.put("lissn",repository.getLissn());
|
||||||
jsonObject.put("registeredby",repository.getRegisteredBy());
|
jsonObject.put("registeredby",repository.getRegisteredBy());
|
||||||
|
|
||||||
jsonObject.put("aggregator",repository.getAggregator());
|
// jsonObject.put("aggregator",repository.getAggregator());
|
||||||
jsonObject.put("collectedfrom",repository.getCollectedFrom());
|
// jsonObject.put("collectedfrom",repository.getCollectedFrom());
|
||||||
|
|
||||||
jsonObject.put("managed",repository.isRegistered());
|
jsonObject.put("managed",repository.isRegistered());
|
||||||
|
|
||||||
|
@ -269,7 +269,7 @@ public class Converter {
|
||||||
|
|
||||||
JSONArray organizations = new JSONArray();
|
JSONArray organizations = new JSONArray();
|
||||||
organizations.put(organization);
|
organizations.put(organization);
|
||||||
jsonObject.put("organizations",organizations);
|
// jsonObject.put("organizations",organizations);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
infrastructure.name=integration
|
infrastructure.name=integration
|
||||||
|
|
||||||
## Container properties
|
## Container properties
|
||||||
container.hostname=aleka.athenarc.gr
|
container.hostname=localhost
|
||||||
container.context=uoa-repository-manager-service
|
container.context=uoa-repository-manager-service
|
||||||
container.port = 8480
|
container.port = 8480
|
||||||
|
|
||||||
|
@ -69,14 +69,15 @@ oidc.secret = AMQtGlbTXNjwjhF0st28LmM6V0XypMdaVS7tJmGuYFlmH36iIv4t7tVqYuLYrNPkhn
|
||||||
|
|
||||||
#oidc.dev.home = http://koulis.athenarc.gr:4200/uoa-repository-manager-service/openid_connect_login
|
#oidc.dev.home = http://koulis.athenarc.gr:4200/uoa-repository-manager-service/openid_connect_login
|
||||||
#webapp.dev.front = http://koulis.athenarc.gr:4200/landing
|
#webapp.dev.front = http://koulis.athenarc.gr:4200/landing
|
||||||
oidc.dev.home = http://aleka.athenarc.gr:4200/uoa-repository-manager-service/openid_connect_login
|
oidc.dev.home = http://localhost:4200/uoa-repository-manager-service/openid_connect_login
|
||||||
webapp.dev.front = http://aleka.athenarc.gr:4200/landing
|
webapp.dev.front = http://localhost:4200/landing
|
||||||
|
|
||||||
##REDIS-AAI
|
##REDIS-AAI
|
||||||
|
|
||||||
redis.host = audrey.athenarc.gr
|
redis.host = aleka.athenarc.gr
|
||||||
redis.port = 6379
|
redis.port = 6379
|
||||||
redis.password = E#Szvnidd
|
redis.password =
|
||||||
|
#redis.password = E#Szvnidd
|
||||||
aai.mode = develop
|
aai.mode = develop
|
||||||
|
|
||||||
|
|
||||||
|
@ -91,4 +92,5 @@ services.repomanager.usagestats.sushiliteEndpoint = http://beta.services.openair
|
||||||
|
|
||||||
##SEARCH API
|
##SEARCH API
|
||||||
search.api.baseAddress=https://beta.services.openaire.eu/search/v2/api
|
search.api.baseAddress=https://beta.services.openaire.eu/search/v2/api
|
||||||
search.api.usagestats=https://services.openaire.eu/usagestats
|
search.api.usagestats=https://services.openaire.eu/usagestats
|
||||||
|
search.api.usageEvents=http://beta.lbs.openaire.eu:8080/ajax/summary
|
||||||
|
|
|
@ -50,6 +50,7 @@
|
||||||
|
|
||||||
<util:map id="userRoles">
|
<util:map id="userRoles">
|
||||||
<entry key="urn:geant:openaire.eu:group:Super+Administrator#aai.openaire.eu" value="ROLE_ADMIN"/>
|
<entry key="urn:geant:openaire.eu:group:Super+Administrator#aai.openaire.eu" value="ROLE_ADMIN"/>
|
||||||
|
<entry key="urn:geant:openaire.eu:group:Portal+Administrator#aai.openaire.eu" value="ROLE_PORTAL_ADMIN"/>
|
||||||
</util:map>
|
</util:map>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,32 +1,7 @@
|
||||||
#log4j.rootLogger = WARN, R
|
|
||||||
#
|
|
||||||
#log4j.logger.eu.dnetlib = DEBUG
|
|
||||||
#log4j.logger.eu.dnetlib.clients.data.datasourcemanager.ws.Converter = FATAL
|
|
||||||
#log4j.logger.org.springframework = DEBUG, S
|
|
||||||
#log4j.additivity.org.springframework = false
|
|
||||||
#
|
|
||||||
#log4j.logger.com.opensymphony.xwork2.ognl.OgnlValueStack = FATAL
|
|
||||||
#log4j.logger.com.opensymphony.xwork2.ObjectFactory = FATAL
|
|
||||||
#
|
|
||||||
#log4j.logger.eu.dnetlib.repo.manager=DEBUG
|
|
||||||
#
|
|
||||||
#log4j.appender.R=org.apache.log4j.RollingFileAppender
|
|
||||||
#log4j.appender.R.File=/var/log/dnet/repository-service/repository-service.log
|
|
||||||
#log4j.appender.R.MaxFileSize=10MB
|
|
||||||
#log4j.appender.R.MaxBackupIndex=10
|
|
||||||
#log4j.appender.R.layout=org.apache.log4j.PatternLayout
|
|
||||||
#log4j.appender.R.layout.ConversionPattern= %d %p %t [%c] - %m%n
|
|
||||||
#
|
|
||||||
#log4j.appender.S=org.apache.log4j.RollingFileAppender
|
|
||||||
#log4j.appender.S.File=/var/log/dnet/repository-service/repository-service-spring.log
|
|
||||||
#log4j.appender.S.MaxFileSize=10MB
|
|
||||||
#log4j.appender.S.MaxBackupIndex=10
|
|
||||||
#log4j.appender.S.layout=org.apache.log4j.PatternLayout
|
|
||||||
#log4j.appender.S.layout.ConversionPattern= %d %p %t [%c] - %m%n
|
|
||||||
|
|
||||||
|
|
||||||
log4j.rootLogger = WARN, R
|
log4j.rootLogger = WARN, R
|
||||||
|
|
||||||
|
log4j.logger.eu.dnetlib = DEBUG
|
||||||
|
log4j.logger.eu.dnetlib.clients.data.datasourcemanager.ws.Converter = FATAL
|
||||||
log4j.logger.org.springframework = DEBUG, S
|
log4j.logger.org.springframework = DEBUG, S
|
||||||
log4j.additivity.org.springframework = false
|
log4j.additivity.org.springframework = false
|
||||||
|
|
||||||
|
@ -35,10 +10,36 @@ log4j.logger.com.opensymphony.xwork2.ObjectFactory = FATAL
|
||||||
|
|
||||||
log4j.logger.eu.dnetlib.repo.manager=DEBUG
|
log4j.logger.eu.dnetlib.repo.manager=DEBUG
|
||||||
|
|
||||||
log4j.appender.R=org.apache.log4j.ConsoleAppender
|
log4j.appender.R=org.apache.log4j.RollingFileAppender
|
||||||
|
#log4j.appender.R.File=/var/log/dnet/repo-manager/repo-manager-gui.log
|
||||||
|
log4j.appender.R.File=/var/log/tomcat_dnet/8780/repository-service.log
|
||||||
|
log4j.appender.R.MaxFileSize=10MB
|
||||||
|
log4j.appender.R.MaxBackupIndex=10
|
||||||
log4j.appender.R.layout=org.apache.log4j.PatternLayout
|
log4j.appender.R.layout=org.apache.log4j.PatternLayout
|
||||||
log4j.appender.R.layout.ConversionPattern= %d %p %t [%c] - %m%n
|
log4j.appender.R.layout.ConversionPattern= %d %p %t [%c] - %m%n
|
||||||
|
|
||||||
log4j.appender.S=org.apache.log4j.ConsoleAppender
|
log4j.appender.S=org.apache.log4j.RollingFileAppender
|
||||||
|
#log4j.appender.S.File=/var/log/dnet/repo-manager/repo-manager-gui-spring.log
|
||||||
|
log4j.appender.S.File=/var/log/tomcat_dnet/8780/repository-service-spring.log
|
||||||
|
log4j.appender.S.MaxFileSize=10MB
|
||||||
|
log4j.appender.S.MaxBackupIndex=10
|
||||||
log4j.appender.S.layout=org.apache.log4j.PatternLayout
|
log4j.appender.S.layout=org.apache.log4j.PatternLayout
|
||||||
log4j.appender.S.layout.ConversionPattern= %d %p %t [%c] - %m%n
|
log4j.appender.S.layout.ConversionPattern= %d %p %t [%c] - %m%n
|
||||||
|
|
||||||
|
#log4j.rootLogger = WARN, R
|
||||||
|
#
|
||||||
|
#log4j.logger.org.springframework = DEBUG, S
|
||||||
|
#log4j.additivity.org.springframework = false
|
||||||
|
#
|
||||||
|
#log4j.logger.com.opensymphony.xwork2.ognl.OgnlValueStack = FATAL
|
||||||
|
#log4j.logger.com.opensymphony.xwork2.ObjectFactory = FATAL
|
||||||
|
#
|
||||||
|
#log4j.logger.eu.dnetlib.repo.manager=DEBUG
|
||||||
|
#
|
||||||
|
#log4j.appender.R=org.apache.log4j.ConsoleAppender
|
||||||
|
#log4j.appender.R.layout=org.apache.log4j.PatternLayout
|
||||||
|
#log4j.appender.R.layout.ConversionPattern= %d %p %t [%c] - %m%n
|
||||||
|
#
|
||||||
|
#log4j.appender.S=org.apache.log4j.ConsoleAppender
|
||||||
|
#log4j.appender.S.layout=org.apache.log4j.PatternLayout
|
||||||
|
#log4j.appender.S.layout.ConversionPattern= %d %p %t [%c] - %m%n
|
|
@ -0,0 +1,32 @@
|
||||||
|
package unitest;
|
||||||
|
|
||||||
|
import eu.dnetlib.repo.manager.service.config.RepoManagerContextLoaderListener;
|
||||||
|
import eu.dnetlib.repo.manager.service.utils.OaiTools;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.springframework.test.context.ContextConfiguration;
|
||||||
|
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||||
|
import org.springframework.test.context.web.WebAppConfiguration;
|
||||||
|
|
||||||
|
@RunWith(SpringJUnit4ClassRunner.class)
|
||||||
|
@ContextConfiguration(classes = RepoManagerContextLoaderListener.class)
|
||||||
|
//@WebAppConfiguration
|
||||||
|
public class ValidatorTest {
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void identiFy(){
|
||||||
|
|
||||||
|
String url = "https://repozitorij.srce.unizg.hr/oai";
|
||||||
|
|
||||||
|
|
||||||
|
System.out.println("Identify repository with url : " + url);
|
||||||
|
try {
|
||||||
|
System.out.println(OaiTools.identifyRepository(url));
|
||||||
|
} catch (Exception e) {
|
||||||
|
System.out.println(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue