Moving branch folders to trunk.
This commit is contained in:
parent
a396e42e06
commit
ab23c7232f
16
pom.xml
16
pom.xml
|
@ -12,7 +12,7 @@
|
|||
<groupId>eu.dnetlib</groupId>
|
||||
<artifactId>uoa-repository-manager-service</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
<packaging>war</packaging>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
|
||||
<build>
|
||||
|
@ -152,6 +152,12 @@
|
|||
<version>2.7.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-log4j12</artifactId>
|
||||
<version>1.5.6</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>xerces</groupId>
|
||||
<artifactId>xercesImpl</artifactId>
|
||||
|
@ -224,14 +230,6 @@
|
|||
<version>9.1-901.jdbc3</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.apache.tomcat/tomcat-catalina -->
|
||||
<dependency>
|
||||
<groupId>org.apache.tomcat</groupId>
|
||||
<artifactId>tomcat-catalina</artifactId>
|
||||
<version>LATEST</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!--<dependency>
|
||||
<groupId>org.mitre</groupId>
|
||||
<artifactId>openid-connect-client</artifactId>
|
||||
|
|
|
@ -4,7 +4,6 @@ import eu.dnetlib.repo.manager.shared.BrokerException;
|
|||
import eu.dnetlib.repo.manager.shared.Term;
|
||||
import eu.dnetlib.repo.manager.shared.broker.*;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import org.json.JSONException;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
@ -18,49 +17,33 @@ import java.util.Map;
|
|||
@Api(description = "Broker API", tags = {"broker"})
|
||||
public interface BrokerApi {
|
||||
|
||||
@RequestMapping(value = "/getDatasourcesOfUser" , method = RequestMethod.POST,
|
||||
produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@ResponseBody
|
||||
DatasourcesBroker getDatasourcesOfUser(String user,String includeShared,String includeByOthers) throws BrokerException, JSONException;
|
||||
@RequestMapping(value = "/getDatasourcesOfUser" , method = RequestMethod.POST,produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
DatasourcesBroker getDatasourcesOfUser(@RequestBody String params) throws BrokerException, JSONException;
|
||||
|
||||
@RequestMapping(value = "/getTopicsForDatasource/{datasourceName}" , method = RequestMethod.GET,
|
||||
produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@ResponseBody
|
||||
@RequestMapping(value = "/getTopicsForDatasource/{datasourceName}" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
List<BrowseEntry> getTopicsForDatasource(String datasourceName) throws BrokerException;
|
||||
|
||||
@RequestMapping(value = "/advancedShowEvents/{page}/{size}" , method = RequestMethod.POST,
|
||||
produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@ResponseBody
|
||||
EventsPage advancedShowEvents(String page,
|
||||
String size,
|
||||
AdvQueryObject advQueryObject) throws BrokerException, JSONException ,IOException;
|
||||
@RequestMapping(value = "/advancedShowEvents" , method = RequestMethod.POST,produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
EventsPage advancedShowEvents(@RequestBody String params) throws BrokerException, JSONException ,IOException;
|
||||
|
||||
@RequestMapping(value = "/showEvents/{datasourceName}/{topic}/{page}" , method = RequestMethod.GET,
|
||||
produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@ResponseBody
|
||||
EventsPage showEvents(String datasourceName,
|
||||
String topic,
|
||||
String page,
|
||||
String size) throws BrokerException, JSONException;
|
||||
@RequestMapping(value = "/showEvents" , method = RequestMethod.POST,produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
EventsPage showEvents(@RequestBody String params) throws BrokerException, JSONException;
|
||||
|
||||
@RequestMapping(value = "/getSimpleSubscriptionsOfUser/{userEmail}" , method = RequestMethod.GET,
|
||||
produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@RequestMapping(value = "/getSimpleSubscriptionsOfUser/{userEmail}" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@ResponseBody
|
||||
Map<String, List<SimpleSubscriptionDesc>> getSimpleSubscriptionsOfUser(String userEmail) throws BrokerException;
|
||||
|
||||
@RequestMapping(value = "/subscribe" , method = RequestMethod.POST,consumes = MediaType.APPLICATION_JSON_VALUE,
|
||||
produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@RequestMapping(value = "/subscribe" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@ResponseBody
|
||||
Subscription subscribe(OpenaireSubscription obj) throws BrokerException;
|
||||
Subscription subscribe(@RequestBody OpenaireSubscription obj) throws BrokerException;
|
||||
|
||||
@RequestMapping(value = "/unsubscribe/{subscriptionId}" , method = RequestMethod.POST,consumes = MediaType.APPLICATION_JSON_VALUE,
|
||||
produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@RequestMapping(value = "/unsubscribe/{subscriptionId}" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@ResponseBody
|
||||
void unsubscribe(String subscriptionId) throws BrokerException;
|
||||
|
||||
@RequestMapping(value = "/getSubscription/{subscriptionId}" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@ResponseBody
|
||||
Subscription getSubscription(String subscriptionId) throws BrokerException;
|
||||
Subscription getSubscription(@PathVariable("subscriptionId") String subscriptionId) throws BrokerException;
|
||||
|
||||
|
||||
@RequestMapping(value = "/getDnetTopics" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
|
|
|
@ -7,7 +7,6 @@ import eu.dnetlib.repo.manager.shared.BrokerException;
|
|||
import eu.dnetlib.repo.manager.shared.Term;
|
||||
import eu.dnetlib.repo.manager.shared.Tuple;
|
||||
import eu.dnetlib.repo.manager.shared.broker.*;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -22,8 +21,6 @@ import org.springframework.stereotype.Component;
|
|||
import org.springframework.util.LinkedMultiValueMap;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.client.RestClientException;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
import org.springframework.web.util.UriComponents;
|
||||
|
@ -86,24 +83,24 @@ public class BrokerApiImpl implements BrokerApi {
|
|||
|
||||
|
||||
@Override
|
||||
public DatasourcesBroker getDatasourcesOfUser(@RequestParam("user")
|
||||
@ApiParam(value = "User email", required = true) String user,
|
||||
@RequestParam("includeShared")
|
||||
@ApiParam(value = "Include shared datasources", required = true , defaultValue = "false") String includeShared,
|
||||
@RequestParam("includeByOthers")
|
||||
@ApiParam(value = "Include datasources of other", required = true,defaultValue = "false") String includeByOthers) throws JSONException {
|
||||
|
||||
public DatasourcesBroker getDatasourcesOfUser(String params) throws JSONException {
|
||||
JSONObject json_params = new JSONObject(params);
|
||||
DatasourcesBroker ret = new DatasourcesBroker();
|
||||
|
||||
String userEmail = json_params.getString("userEmail");
|
||||
boolean includeShared = Boolean.parseBoolean( json_params.getString("includeShared") );
|
||||
boolean includeByOthers = Boolean.parseBoolean( json_params.getString("includeByOthers") );
|
||||
|
||||
try {
|
||||
ret.setDatasourcesOfUser(getDatasourcesOfUserType(getRepositoriesOfUser(user)));
|
||||
//TODO fix bug when values are true
|
||||
if (Boolean.parseBoolean(includeShared)) {
|
||||
ret.setDatasourcesOfUser(getDatasourcesOfUserType(getRepositoriesOfUser(userEmail)));
|
||||
if (includeShared) {
|
||||
//TODO whatever nikonas was saying
|
||||
List<String> sharedDatasourceIds = new ArrayList<String>();
|
||||
ret.setSharedDatasources(getDatasourcesOfUserType(getRepositoriesByIds(sharedDatasourceIds)));
|
||||
}
|
||||
|
||||
if (Boolean.parseBoolean(includeByOthers)) {
|
||||
ret.setDatasourcesOfOthers(getDatasourcesOfUserType(getRepositoriesOfUser(user)));
|
||||
if (includeByOthers) {
|
||||
ret.setDatasourcesOfOthers(getDatasourcesOfUserType(getRepositoriesOfUser(userEmail)));
|
||||
}
|
||||
} catch (BrokerException e) {
|
||||
e.printStackTrace();
|
||||
|
@ -135,21 +132,31 @@ public class BrokerApiImpl implements BrokerApi {
|
|||
}
|
||||
|
||||
@Override
|
||||
public EventsPage advancedShowEvents(@PathVariable("page") String page,
|
||||
@PathVariable("size") String size,
|
||||
@RequestBody AdvQueryObject advQueryObject) throws BrokerException, JSONException ,IOException {
|
||||
public EventsPage advancedShowEvents(String params) throws BrokerException, JSONException ,IOException {
|
||||
JSONObject json_params = new JSONObject(params);
|
||||
|
||||
String page = json_params.getString("page");
|
||||
String pagesize = json_params.getString("pagesize");
|
||||
String json_advQueryObject = json_params.getString("advQueryObject");
|
||||
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
AdvQueryObject advQueryObject = mapper.readValue(json_advQueryObject, AdvQueryObject.class);
|
||||
|
||||
final String service = "/events/{page}/{pageSize}";
|
||||
|
||||
Map<String, Long> uriParams = new HashMap<>();
|
||||
uriParams.put("page", Long.parseLong(page));
|
||||
uriParams.put("pageSize", Long.parseLong(size));
|
||||
uriParams.put("pageSize", Long.parseLong(pagesize));
|
||||
|
||||
UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(openairePath + service);
|
||||
|
||||
MultiValueMap<String, String> headers = new LinkedMultiValueMap<>();
|
||||
headers.add("Content-Type", "application/json");
|
||||
|
||||
advQueryObject.setPage(Long.parseLong(page));
|
||||
HttpEntity<AdvQueryObject> entity = new HttpEntity<>(advQueryObject, httpHeaders);
|
||||
|
||||
HttpEntity<AdvQueryObject> entity = new HttpEntity<>(advQueryObject, headers);
|
||||
|
||||
ResponseEntity<EventsPage> resp;
|
||||
try {
|
||||
resp = restTemplate.exchange(
|
||||
|
@ -216,22 +223,27 @@ public class BrokerApiImpl implements BrokerApi {
|
|||
}
|
||||
|
||||
@Override
|
||||
public EventsPage showEvents(@RequestParam("datasourceName") String datasourceName,
|
||||
@RequestParam("topic") String topic,
|
||||
@RequestParam("page") String page,
|
||||
@RequestParam("size") String size) throws BrokerException, JSONException {
|
||||
public EventsPage showEvents(String params) throws BrokerException, JSONException {
|
||||
|
||||
final String service = "/events";
|
||||
JSONObject json_params = new JSONObject(params);
|
||||
|
||||
String datasourceName = json_params.getString("datasourceName");
|
||||
String topic = json_params.getString("topic");
|
||||
String page = json_params.getString("page");
|
||||
|
||||
final String service = "/showEvents";
|
||||
|
||||
//build the uri params
|
||||
UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(openairePath + service)
|
||||
.queryParam("ds", datasourceName)
|
||||
.queryParam("topic", topic)
|
||||
.path("/{page}/{size}/");
|
||||
.queryParam("page", page);
|
||||
|
||||
ResponseEntity<EventsPage> resp;
|
||||
try {
|
||||
//communicate with endpoint
|
||||
resp = restTemplate.exchange(
|
||||
builder.build().expand(page, size).encode().toUri(),
|
||||
builder.build().encode().toUri(),
|
||||
HttpMethod.GET,
|
||||
null,
|
||||
new ParameterizedTypeReference<EventsPage>() {
|
||||
|
@ -243,17 +255,18 @@ public class BrokerApiImpl implements BrokerApi {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Map<String, List<SimpleSubscriptionDesc>> getSimpleSubscriptionsOfUser(@PathVariable("userEmail") String userEmail)
|
||||
throws BrokerException {
|
||||
public Map<String, List<SimpleSubscriptionDesc>> getSimpleSubscriptionsOfUser(@PathVariable("userEmail") String userEmail) throws BrokerException {
|
||||
|
||||
final String service = "/subscriptions";
|
||||
|
||||
//build the uri params
|
||||
UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(openairePath + service)
|
||||
.queryParam("email", userEmail);
|
||||
|
||||
LOGGER.debug(builder.build().encode().toUri());
|
||||
//create new template engine
|
||||
ResponseEntity<Map<String, List<SimpleSubscriptionDesc>>> resp;
|
||||
try {
|
||||
//communicate with endpoint
|
||||
resp = restTemplate.exchange(
|
||||
builder.build().encode().toUri(),
|
||||
HttpMethod.GET,
|
||||
|
@ -268,7 +281,7 @@ public class BrokerApiImpl implements BrokerApi {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Subscription subscribe(@RequestBody OpenaireSubscription obj) throws BrokerException {
|
||||
public Subscription subscribe(OpenaireSubscription obj) throws BrokerException {
|
||||
final String service = "/subscribe";
|
||||
|
||||
//build the uri params
|
||||
|
|
|
@ -13,17 +13,17 @@ import org.springframework.web.bind.annotation.*;
|
|||
@Api(description = "Monitor API", tags = {"monitor"})
|
||||
public interface MonitorApi {
|
||||
|
||||
@RequestMapping(value = "/getJobsOfUser" , method = RequestMethod.GET,
|
||||
@RequestMapping(value = "/getJobsOfUser" , method = RequestMethod.GET,consumes = MediaType.APPLICATION_JSON_VALUE,
|
||||
produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@ResponseBody
|
||||
JobsOfUser getJobsOfUser(String user,
|
||||
String jobType,
|
||||
String offset,
|
||||
String limit,
|
||||
String dateFrom,
|
||||
String dateTo,
|
||||
String validationStatus,
|
||||
String includeJobsTotal) throws JSONException, ValidatorServiceException;
|
||||
JobsOfUser getJobsOfUser(@RequestBody String user,
|
||||
@RequestBody String jobType,
|
||||
@RequestBody String offset,
|
||||
@RequestBody String limit,
|
||||
@RequestBody String dateFrom,
|
||||
@RequestBody String dateTo,
|
||||
@RequestBody String validationStatus,
|
||||
@RequestBody String includeJobsTotal) throws JSONException, ValidatorServiceException;
|
||||
|
||||
@RequestMapping(value = "/getJobsOfUserPerValidationStatus" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@ResponseBody
|
||||
|
|
|
@ -3,15 +3,13 @@ package eu.dnetlib.repo.manager.service.controllers;
|
|||
import eu.dnetlib.api.functionality.ValidatorService;
|
||||
import eu.dnetlib.api.functionality.ValidatorServiceException;
|
||||
import eu.dnetlib.domain.functionality.validator.StoredJob;
|
||||
import eu.dnetlib.repo.manager.shared.Constants;
|
||||
import eu.dnetlib.repo.manager.shared.JobsOfUser;
|
||||
import eu.dnetlib.repo.manager.shared.Constants;
|
||||
import gr.uoa.di.driver.util.ServiceLocator;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.json.JSONException;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@Component
|
||||
|
@ -37,21 +35,18 @@ public class MonitorApiImpl implements MonitorApi {
|
|||
.getLogger(MonitorApiImpl.class);
|
||||
|
||||
@Override
|
||||
public JobsOfUser getJobsOfUser(@RequestParam("user") @ApiParam(value = "User email", required = true) String user,
|
||||
@RequestParam(value = "jobType", required = false)
|
||||
@ApiParam(value = "Equals to filter job type on validation history page") String jobType,
|
||||
@RequestParam("offset") @ApiParam(value = "Page number", required = true) String offset,
|
||||
@RequestParam(value = "limit", required = false,defaultValue = "10") @ApiParam(value = "Null value") String limit,
|
||||
@RequestParam(value = "dateFrom", required = false) @ApiParam(value = "Null value") String dateFrom,
|
||||
@RequestParam(value = "dateTo", required = false) @ApiParam(value = "Null value") String dateTo,
|
||||
@RequestParam("validationStatus") @ApiParam(value = "Equals to filter validation jobs", required = true) String validationStatus,
|
||||
@RequestParam("includeJobsTotal") @ApiParam(value = "Always true", required = true) String includeJobsTotal) throws JSONException, ValidatorServiceException {
|
||||
public JobsOfUser getJobsOfUser(@ApiParam(value = "User email", required = true) String user,
|
||||
@ApiParam(value = "Equals to filter job type on validation history page", required = true) String jobType,
|
||||
@ApiParam(value = "Page number", required = true) String offset,
|
||||
@ApiParam(value = "Null value", required = true) String limit,
|
||||
@ApiParam(value = "Null value", required = true) String dateFrom,
|
||||
@ApiParam(value = "Null value", required = true) String dateTo,
|
||||
@ApiParam(value = "Equals to filter validation jobs", required = true) String validationStatus,
|
||||
@ApiParam(value = "Always true", required = true) String includeJobsTotal) throws JSONException, ValidatorServiceException {
|
||||
|
||||
LOGGER.debug("Getting jobs of user : " + user);
|
||||
LOGGER.debug(user + "/" + jobType + "/" + offset + "/" + dateFrom + "/" + dateTo + "/" + validationStatus + "/" + includeJobsTotal);
|
||||
JobsOfUser retJobs = new JobsOfUser();
|
||||
LOGGER.debug("Size fo jobs list -> " + getValidationService().getStoredJobsNew(user, jobType, Integer.parseInt(offset),
|
||||
Integer.parseInt(limit), dateFrom, dateTo, validationStatus));
|
||||
retJobs.setJobs(getValidationService().getStoredJobsNew(user, jobType, Integer.parseInt(offset),
|
||||
Integer.parseInt(limit), dateFrom, dateTo, validationStatus));
|
||||
if (Boolean.parseBoolean(includeJobsTotal)) {
|
||||
|
|
|
@ -19,16 +19,16 @@ public interface PiWikApi {
|
|||
PiwikInfo getPiwikSiteForRepo(String repositoryId);
|
||||
|
||||
@RequestMapping(value = "/savePiwikInfo" , method = RequestMethod.POST,produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
PiwikInfo savePiwikInfo( PiwikInfo piwikInfo);
|
||||
PiwikInfo savePiwikInfo(@RequestBody PiwikInfo piwikInfo);
|
||||
|
||||
@RequestMapping(value = "/getPiwikSitesForRepos" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
List<PiwikInfo> getPiwikSitesForRepos();
|
||||
|
||||
@RequestMapping(value = "/approvePiwikSite/{repositoryId}" , method = RequestMethod.GET)
|
||||
@RequestMapping(value = "/approvePiwikSite/{repositoryId}" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@ResponseBody
|
||||
void approvePiwikSite(String repositoryId);
|
||||
|
||||
@RequestMapping(value = "/getOpenaireId/{repositoryId}" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@RequestMapping(value = "/getOpenaireId/{repositoryid}" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@ResponseBody
|
||||
String getOpenaireId(String repositoryid);
|
||||
}
|
||||
|
|
|
@ -9,7 +9,6 @@ import org.springframework.jdbc.core.JdbcTemplate;
|
|||
import org.springframework.jdbc.core.RowMapper;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.sql.DataSource;
|
||||
|
@ -53,7 +52,7 @@ public class PiWikApiImpl implements PiWikApi{
|
|||
}
|
||||
|
||||
@Override
|
||||
public PiwikInfo savePiwikInfo(@RequestBody PiwikInfo piwikInfo) {
|
||||
public PiwikInfo savePiwikInfo(PiwikInfo piwikInfo) {
|
||||
JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
|
||||
jdbcTemplate.update(INSERT_PIWIK_INFO, new Object[]{piwikInfo.getRepositoryId(), piwikInfo.getSiteId(), piwikInfo.getRequestorName(),
|
||||
piwikInfo.getRequestorEmail(), piwikInfo.isValidated(), piwikInfo.getRepositoryName(), piwikInfo.getCountry(), piwikInfo.getAuthenticationToken()},
|
||||
|
@ -78,16 +77,14 @@ public class PiWikApiImpl implements PiWikApi{
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getOpenaireId(@PathVariable("repositoryId") String repositoryId) {
|
||||
LOGGER.debug("Getting openaire id for repository: " + repositoryId);
|
||||
public String getOpenaireId(@PathVariable("repositoryId") String repositoryid) {
|
||||
try {
|
||||
if (repositoryId != null && repositoryId.contains("::")) {
|
||||
return repositoryId.split("::")[0] + "::" + MD5.encrypt2Hex(repositoryId.split("::")[1]);
|
||||
}
|
||||
if (repositoryid != null && repositoryid.contains("::"))
|
||||
return repositoryid.split("::")[0] + "::" + MD5.encrypt2Hex(repositoryid.split("::")[1]);
|
||||
else
|
||||
return null;
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
LOGGER.debug(e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -102,7 +102,7 @@ public interface RepositoryApi {
|
|||
@RequestMapping(value = "/updateEnglishName", method = RequestMethod.POST,
|
||||
produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@ResponseBody
|
||||
String updateEnglishName(String id,String officialName, String englishName);
|
||||
String updateEnglishName(String id, String englishName);
|
||||
|
||||
@RequestMapping(value = "/updateLatitude", method = RequestMethod.POST,
|
||||
produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
|
|
|
@ -1,13 +1,11 @@
|
|||
package eu.dnetlib.repo.manager.service.controllers;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import eu.dnetlib.domain.data.Repository;
|
||||
import eu.dnetlib.domain.data.RepositoryInterface;
|
||||
import eu.dnetlib.domain.enabling.Vocabulary;
|
||||
import eu.dnetlib.repo.manager.service.utils.Converter;
|
||||
import eu.dnetlib.repo.manager.service.utils.RequestFilter;
|
||||
import eu.dnetlib.repo.manager.shared.*;
|
||||
import gr.uoa.di.driver.enabling.vocabulary.VocabularyLoader;
|
||||
import org.apache.commons.codec.digest.DigestUtils;
|
||||
|
@ -18,7 +16,10 @@ import org.json.JSONObject;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.core.ParameterizedTypeReference;
|
||||
import org.springframework.http.*;
|
||||
import org.springframework.http.HttpEntity;
|
||||
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.stereotype.Component;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
|
@ -30,6 +31,7 @@ import org.springframework.web.util.UriComponents;
|
|||
import org.springframework.web.util.UriComponentsBuilder;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.ws.rs.QueryParam;
|
||||
import java.sql.Timestamp;
|
||||
import java.text.Normalizer;
|
||||
import java.util.*;
|
||||
|
@ -150,7 +152,6 @@ public class RepositoryApiImpl implements RepositoryApi {
|
|||
LOGGER.debug("Getting repositories by country!");
|
||||
int page = 0;
|
||||
int size = 100;
|
||||
List<Repository> resultSet = new ArrayList<>();
|
||||
|
||||
String countryCode = countriesMap.get(country);
|
||||
String filterKey = "UNKNOWN";
|
||||
|
@ -164,12 +165,17 @@ public class RepositoryApiImpl implements RepositoryApi {
|
|||
|
||||
LOGGER.debug("Country code equals : " + countryCode);
|
||||
LOGGER.debug("Filter mode equals : " + filterKey);
|
||||
UriComponents uriComponents = searchDatasource(String.valueOf(page),String.valueOf(size));
|
||||
RequestFilter requestFilter = new RequestFilter();
|
||||
requestFilter.setCountry(countryCode);
|
||||
UriComponents uriComponents = UriComponentsBuilder
|
||||
.fromHttpUrl(baseAddress + "/ds/search/country/")
|
||||
.path("/{page}/{size}/")
|
||||
.queryParam("country", countryCode)
|
||||
.queryParam("managed", managed)
|
||||
.build().expand(page, size).encode();
|
||||
|
||||
String rs = restTemplate.postForObject(uriComponents.toUri(),requestFilter, String.class);
|
||||
String rs = restTemplate.getForObject(uriComponents.toUri(), String.class);
|
||||
JSONArray jsonArray = (JSONArray) new JSONObject(rs).get("datasourceInfo");
|
||||
|
||||
List<Repository> resultSet = new ArrayList<>();
|
||||
while (jsonArray.length() > 0 ) {
|
||||
List<Repository> rep = Converter.jsonToRepositoryList(new JSONObject(rs));
|
||||
|
||||
|
@ -177,9 +183,13 @@ public class RepositoryApiImpl implements RepositoryApi {
|
|||
resultSet.addAll(repos);
|
||||
|
||||
page += 1;
|
||||
uriComponents = searchDatasource(String.valueOf(page),String.valueOf(size));
|
||||
|
||||
rs = restTemplate.postForObject(uriComponents.toUri(),requestFilter, String.class);
|
||||
uriComponents = UriComponentsBuilder
|
||||
.fromHttpUrl(baseAddress + "/ds/search/country/")
|
||||
.path("/{page}/{size}/")
|
||||
.queryParam("country", countryCode)
|
||||
.queryParam("managed", managed)
|
||||
.build().expand(page, size).encode();
|
||||
rs = restTemplate.getForObject(uriComponents.toUri(), String.class);
|
||||
jsonArray = (JSONArray) new JSONObject(rs).get("datasourceInfo");
|
||||
}
|
||||
for (Repository r : resultSet)
|
||||
|
@ -199,7 +209,7 @@ public class RepositoryApiImpl implements RepositoryApi {
|
|||
|
||||
List<Repository> reps = new ArrayList<>();
|
||||
for (Repository r : rs) {
|
||||
if (r.getCollectedFrom() != null && r.getCollectedFrom().equals(mode))
|
||||
if (r.getCollectedFrom().equals(mode))
|
||||
reps.add(r);
|
||||
}
|
||||
return reps;
|
||||
|
@ -211,11 +221,13 @@ public class RepositoryApiImpl implements RepositoryApi {
|
|||
@PathVariable("size") String size) throws JSONException {
|
||||
|
||||
LOGGER.debug("Retreiving repositories of user : " + userEmail );
|
||||
UriComponents uriComponents = searchDatasource(page,size);
|
||||
RequestFilter requestFilter = new RequestFilter();
|
||||
requestFilter.setRegisteredby(userEmail);
|
||||
String rs = restTemplate.postForObject(uriComponents.toUri(),requestFilter, String.class);
|
||||
UriComponents uriComponents = UriComponentsBuilder
|
||||
.fromHttpUrl(baseAddress + "/ds/search/registeredby/")
|
||||
.path("/{page}/{size}/")
|
||||
.queryParam("registeredBy", userEmail)
|
||||
.build().expand(page, size).encode();
|
||||
|
||||
String rs = restTemplate.getForObject(uriComponents.toUri(), String.class);
|
||||
List<Repository> repos = Converter.jsonToRepositoryList(new JSONObject(rs));
|
||||
for (Repository r : repos)
|
||||
this.getRepositoryInfo(r);
|
||||
|
@ -226,13 +238,13 @@ public class RepositoryApiImpl implements RepositoryApi {
|
|||
@Override
|
||||
public Repository getRepositoryById(@PathVariable("id") String id) throws JSONException {
|
||||
|
||||
LOGGER.debug("Retreiving repositories with id : " + id );
|
||||
UriComponents uriComponents = searchDatasource("0","100");
|
||||
RequestFilter requestFilter = new RequestFilter();
|
||||
requestFilter.setId(id);
|
||||
String rs = restTemplate.postForObject(uriComponents.toUri(),requestFilter, String.class);
|
||||
JSONArray jsonArray = (JSONArray) new JSONObject(rs).get("datasourceInfo");
|
||||
Repository repo = Converter.jsonToRepositoryObject(jsonArray.getJSONObject(0));
|
||||
UriComponents uriComponents = UriComponentsBuilder
|
||||
.fromHttpUrl(baseAddress + "/ds/get/")
|
||||
.path("/{id}/")
|
||||
.build().expand(id).encode();
|
||||
|
||||
String rs = restTemplate.getForObject(uriComponents.toUri(), String.class);
|
||||
Repository repo = Converter.jsonToRepositoryObject(new JSONObject(rs));
|
||||
if (repo != null)
|
||||
getRepositoryInfo(repo);
|
||||
return repo;
|
||||
|
@ -242,20 +254,20 @@ public class RepositoryApiImpl implements RepositoryApi {
|
|||
@Override
|
||||
public Aggregations getRepositoryAggregations(@PathVariable("id") String id) throws JSONException {
|
||||
|
||||
LOGGER.debug("Retreiving aggregations for repository with id : " + id );
|
||||
UriComponents uriComponents = searchDatasource("0","100");
|
||||
RequestFilter requestFilter = new RequestFilter();
|
||||
requestFilter.setId(id);
|
||||
String rs = restTemplate.postForObject(uriComponents.toUri(),requestFilter, String.class);
|
||||
UriComponents uriComponents = UriComponentsBuilder
|
||||
.fromHttpUrl(baseAddress + "/ds/get/")
|
||||
.path("/{id}/")
|
||||
.build().expand(id).encode();
|
||||
|
||||
String rs = restTemplate.getForObject(uriComponents.toUri(), String.class);
|
||||
JSONObject repository = new JSONObject(rs);
|
||||
|
||||
Aggregations aggregations = new Aggregations();
|
||||
|
||||
try {
|
||||
LOGGER.debug(repository.getJSONArray("datasourceInfo").getJSONObject(0));
|
||||
aggregations.setAggregationHistory(Converter.getAggregationHistoryFromJson(repository.getJSONArray("datasourceInfo").getJSONObject(0)));
|
||||
aggregations.setLastCollection(Converter.getLastCollectionFromJson(repository.getJSONArray("datasourceInfo").getJSONObject(0)));
|
||||
aggregations.setLastTransformation(Converter.getLastTransformationFromJson(repository.getJSONArray("datasourceInfo").getJSONObject(0)));
|
||||
aggregations.setAggregationHistory(Converter.getAggregationHistoryFromJson(repository));
|
||||
aggregations.setLastCollection(Converter.getLastCollectionFromJson(repository));
|
||||
aggregations.setLastTransformation(Converter.getLastTransformationFromJson(repository));
|
||||
return aggregations;
|
||||
} catch (JSONException e) {
|
||||
LOGGER.debug("JSON aggregation exception ", e);
|
||||
|
@ -268,13 +280,13 @@ public class RepositoryApiImpl implements RepositoryApi {
|
|||
public List<Repository> getRepositoriesByName(@PathVariable("name") String name,
|
||||
@PathVariable("page") String page,
|
||||
@PathVariable("size") String size) throws JSONException {
|
||||
UriComponents uriComponents = UriComponentsBuilder
|
||||
.fromHttpUrl(baseAddress + "/ds/search/name/")
|
||||
.path("/{page}/{size}")
|
||||
.queryParam("name", name)
|
||||
.build().expand(page, size).encode();
|
||||
|
||||
LOGGER.debug("Retreiving repositories with official name : " + name );
|
||||
UriComponents uriComponents = searchDatasource("0","100");
|
||||
RequestFilter requestFilter = new RequestFilter();
|
||||
requestFilter.setOfficialname(name);
|
||||
String rs = restTemplate.postForObject(uriComponents.toUri(),requestFilter, String.class);
|
||||
|
||||
String rs = restTemplate.getForObject(uriComponents.toUri(), String.class);
|
||||
List<Repository> repos = Converter.jsonToRepositoryList(new JSONObject(rs));
|
||||
for (Repository r : repos)
|
||||
getRepositoryInfo(r);
|
||||
|
@ -290,7 +302,7 @@ public class RepositoryApiImpl implements RepositoryApi {
|
|||
.build().expand(id).encode();
|
||||
|
||||
String rs = restTemplate.getForObject(uriComponents.toUri(), String.class);
|
||||
return Converter.jsonToRepositoryInterfaceList(new JSONObject(rs));
|
||||
return Converter.jsonToRepositoryInterfaceList(new JSONArray(rs));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -350,7 +362,7 @@ public class RepositoryApiImpl implements RepositoryApi {
|
|||
|
||||
private void updateRepository(Repository repository) {
|
||||
this.updateRegisteredByValue(repository.getId(),repository.getRegisteredBy());
|
||||
this.updateEnglishName(repository.getId(),repository.getOfficialName(),repository.getEnglishName());
|
||||
this.updateEnglishName(repository.getId(),repository.getEnglishName());
|
||||
this.updateLogoUrl(repository.getId(),repository.getLogoUrl());
|
||||
this.updateTimezone(repository.getId(), String.valueOf(repository.getTimezone()));
|
||||
//TODO update datasource type
|
||||
|
@ -563,13 +575,11 @@ public class RepositoryApiImpl implements RepositoryApi {
|
|||
|
||||
@Override
|
||||
public String updateEnglishName(@RequestParam(value = "id") String id,
|
||||
@RequestParam(value = "officialName") String officialName,
|
||||
@RequestParam(value = "englishname") String englishName) {
|
||||
|
||||
UriComponents uriComponents = UriComponentsBuilder
|
||||
.fromHttpUrl(baseAddress + "/ds/name/")
|
||||
.fromHttpUrl(baseAddress + "/ds/englishname/")
|
||||
.queryParam("dsId",id)
|
||||
.queryParam("officialname",officialName)
|
||||
.queryParam("englishname",englishName)
|
||||
.build().encode();
|
||||
return restTemplate.postForObject(uriComponents.toUri(), null,String.class);
|
||||
|
@ -657,18 +667,15 @@ public class RepositoryApiImpl implements RepositoryApi {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<String> getUrlsOfUserRepos(@PathVariable("user_email") String userEmail,
|
||||
public List<String> getUrlsOfUserRepos(@PathVariable("user_email") String user_email,
|
||||
@PathVariable("page") String page,
|
||||
@PathVariable("size") String size) throws JSONException {
|
||||
UriComponents uriComponents = UriComponentsBuilder
|
||||
.fromHttpUrl(baseAddress + "/api/baseurl/")
|
||||
.path("/{page}/{size}")
|
||||
.queryParam("userEmail",user_email)
|
||||
.build().expand(page,size).encode();
|
||||
|
||||
|
||||
RequestFilter requestFilter = new RequestFilter();
|
||||
requestFilter.setRegisteredby(userEmail);
|
||||
return Arrays.asList(restTemplate.postForObject(uriComponents.toUri(),requestFilter, String[].class));
|
||||
return Arrays.asList(restTemplate.getForObject(uriComponents.toUri(), String[].class));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -813,15 +820,5 @@ public class RepositoryApiImpl implements RepositoryApi {
|
|||
return null;
|
||||
}
|
||||
|
||||
private UriComponents searchDatasource(String page,String size){
|
||||
|
||||
return UriComponentsBuilder
|
||||
.fromHttpUrl(baseAddress + "/ds/search/")
|
||||
.path("/{page}/{size}/")
|
||||
.queryParam("requestSortBy","id")
|
||||
.queryParam("order","ASCENDING")
|
||||
.build().expand(page, size).encode();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -21,11 +21,11 @@ public interface ValidatorApi {
|
|||
|
||||
@RequestMapping(value = "/submitJobForValidation",method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE )
|
||||
@ResponseBody
|
||||
void submitJobForValidation(JobForValidation jobForValidation);
|
||||
void submitJobForValidation(@RequestBody JobForValidation jobForValidation);
|
||||
|
||||
@RequestMapping(value = "/reSubmitJobForValidation/{jobId}",method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE )
|
||||
@RequestMapping(value = "/reSubmitJobForValidation/",method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE )
|
||||
@ResponseBody
|
||||
void reSubmitJobForValidation(String jobId) throws JSONException;
|
||||
void reSubmitJobForValidation(@RequestBody String jobId) throws JSONException;
|
||||
|
||||
@RequestMapping(value = "/getRuleSets/{mode}" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@ResponseBody
|
||||
|
@ -33,9 +33,9 @@ public interface ValidatorApi {
|
|||
|
||||
@RequestMapping(value = "/getSetsOfRepository" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@ResponseBody
|
||||
List<String> getSetsOfRepository(String url);
|
||||
List<String> getSetsOfRepository(@RequestBody String url);
|
||||
|
||||
@RequestMapping(value = "/identifyRepository" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@RequestMapping(value = "/identifyRepository/{url}" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@ResponseBody
|
||||
boolean identifyRepo(String url);
|
||||
|
||||
|
@ -45,20 +45,15 @@ public interface ValidatorApi {
|
|||
|
||||
@RequestMapping(value = "/getStoredJobsNew" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@ResponseBody
|
||||
List<StoredJob> getStoredJobsNew(String user,
|
||||
String jobType,
|
||||
String offset,
|
||||
String limit,
|
||||
String dateFrom,
|
||||
String dateTo,
|
||||
String validationStatus) throws ValidatorServiceException;
|
||||
List<StoredJob> getStoredJobsNew(String user, String jobType, Integer offset, Integer limit, String dateFrom,
|
||||
String dateTo, String validationStatus) throws ValidatorServiceException;
|
||||
|
||||
|
||||
@RequestMapping(value = "/getStoredJobsTotalNumberNew" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@ResponseBody
|
||||
int getStoredJobsTotalNumberNew(String user, String jobType, String validationStatus) throws ValidatorServiceException;
|
||||
|
||||
@RequestMapping(value = "/getInterfaceInformation/" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@RequestMapping(value = "/getInterfaceInformation/{baseUrl}" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@ResponseBody
|
||||
InterfaceInformation getInterfaceInformation(String baseUrl) throws ValidationServiceException;
|
||||
}
|
||||
|
|
|
@ -13,14 +13,11 @@ import eu.dnetlib.repo.manager.shared.Constants;
|
|||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import eu.dnetlib.api.functionality.ValidatorService;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.json.JSONException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.Resource;
|
||||
|
@ -82,7 +79,7 @@ public class ValidatorApiImpl implements ValidatorApi{
|
|||
}
|
||||
|
||||
@Override
|
||||
public void submitJobForValidation(@RequestBody JobForValidation jobForValidation) {
|
||||
public void submitJobForValidation(JobForValidation jobForValidation) {
|
||||
LOGGER.debug("Submit job for validation with id : " + jobForValidation.getDatasourceId());
|
||||
try {
|
||||
this.getValidationService().submitValidationJob(jobForValidation);
|
||||
|
@ -92,7 +89,7 @@ public class ValidatorApiImpl implements ValidatorApi{
|
|||
}
|
||||
|
||||
@Override
|
||||
public void reSubmitJobForValidation(@PathVariable("jobId") String jobId) throws JSONException {
|
||||
public void reSubmitJobForValidation(String jobId) throws JSONException {
|
||||
LOGGER.debug("Resubmit validation job with id : " + jobId);
|
||||
StoredJob job = monitorApi.getJobSummary(jobId,"all");
|
||||
Set<Integer> contentRules = new HashSet<Integer>();
|
||||
|
@ -127,7 +124,7 @@ public class ValidatorApiImpl implements ValidatorApi{
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<String> getSetsOfRepository(@RequestParam(value = "url", required = true) String url) {
|
||||
public List<String> getSetsOfRepository(@PathVariable("url") String url) {
|
||||
LOGGER.debug("Getting sets of repository with url : " + url);
|
||||
try {
|
||||
return OaiTools.getSetsOfRepo(url);
|
||||
|
@ -138,7 +135,7 @@ public class ValidatorApiImpl implements ValidatorApi{
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean identifyRepo(@RequestParam(value = "url", required = true) String url) {
|
||||
public boolean identifyRepo(@PathVariable("url") String url) {
|
||||
LOGGER.debug("Identify repository with url : " + url);
|
||||
try {
|
||||
return OaiTools.identifyRepository(url);
|
||||
|
@ -168,16 +165,9 @@ public class ValidatorApiImpl implements ValidatorApi{
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<StoredJob> getStoredJobsNew(@RequestParam("user") @ApiParam(value = "User email", required = true) String user,
|
||||
@RequestParam(value = "jobType", required = false)
|
||||
@ApiParam(value = "Equals to filter job type on validation history page") String jobType,
|
||||
@RequestParam("offset") @ApiParam(value = "Page number", required = true) String offset,
|
||||
@RequestParam(value = "limit", required = false,defaultValue = "10") @ApiParam(value = "Null value") String limit,
|
||||
@RequestParam(value = "dateFrom", required = false) @ApiParam(value = "Null value") String dateFrom,
|
||||
@RequestParam(value = "dateTo", required = false) @ApiParam(value = "Null value") String dateTo,
|
||||
@RequestParam("validationStatus") @ApiParam(value = "Equals to filter validation jobs", required = true) String validationStatus
|
||||
) throws ValidatorServiceException {
|
||||
return getValidationService().getStoredJobsNew(user, jobType, Integer.parseInt(offset), Integer.parseInt(limit), dateFrom, dateTo, validationStatus);
|
||||
public List<StoredJob> getStoredJobsNew(String user, String jobType, Integer offset, Integer limit, String dateFrom,
|
||||
String dateTo, String validationStatus) throws ValidatorServiceException {
|
||||
return getValidationService().getStoredJobsNew(user, jobType, offset, limit, dateFrom, dateTo, validationStatus);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -186,7 +176,7 @@ public class ValidatorApiImpl implements ValidatorApi{
|
|||
}
|
||||
|
||||
@Override
|
||||
public InterfaceInformation getInterfaceInformation(@RequestParam(value = "baseUrl", required = true) String baseUrl) throws ValidationServiceException {
|
||||
public InterfaceInformation getInterfaceInformation(@PathVariable("baseUrl") String baseUrl) throws ValidationServiceException {
|
||||
try {
|
||||
LOGGER.debug("Getting interface information with url: " + baseUrl);
|
||||
InterfaceInformation interfaceInformation = new InterfaceInformation();
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package eu.dnetlib.repo.manager.service.utils;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import eu.dnetlib.domain.data.Repository;
|
||||
import eu.dnetlib.domain.data.RepositoryInterface;
|
||||
|
@ -22,7 +21,9 @@ public class Converter {
|
|||
public static Repository jsonToRepositoryObject(JSONObject repositoryObject) throws JSONException {
|
||||
|
||||
Repository repository = new Repository();
|
||||
|
||||
|
||||
|
||||
LOGGER.debug("datasource response -> " + repositoryObject);
|
||||
JSONObject datasource = repositoryObject.getJSONObject("datasource");
|
||||
|
||||
if( datasource.equals(null))
|
||||
|
@ -30,18 +31,18 @@ public class Converter {
|
|||
|
||||
repository.setActivationId(datasource.get("activationId").toString());
|
||||
repository.setAggregator(datasource.get("aggregator").toString());
|
||||
// repository.setCertificates(datasource.get("certificates").toString());
|
||||
// repository.setCitationGuidelineUrl(datasource.get("citationguidelineurl").toString());
|
||||
repository.setCertificates(datasource.get("certificates").toString());
|
||||
repository.setCitationGuidelineUrl(datasource.get("citationguidelineurl").toString());
|
||||
repository.setCollectedFrom( datasource.get("collectedfrom").toString());
|
||||
|
||||
repository.setContactEmail(datasource.get("contactemail").toString());
|
||||
if(repository.getContactEmail().equals("null"))
|
||||
repository.setContactEmail("");
|
||||
|
||||
// repository.setDatabaseAccessRestriction(datasource.get("databaseaccessrestriction").toString());
|
||||
// repository.setDatabaseAccessType(datasource.get("databaseaccesstype").toString());
|
||||
// repository.setDataUploadRestriction(datasource.get("datauploadrestriction").toString());
|
||||
// repository.setDataUploadType(datasource.get("datauploadtype").toString());
|
||||
repository.setDatabaseAccessRestriction(datasource.get("databaseaccessrestriction").toString());
|
||||
repository.setDatabaseAccessType(datasource.get("databaseaccesstype").toString());
|
||||
repository.setDataUploadRestriction(datasource.get("datauploadrestriction").toString());
|
||||
repository.setDataUploadType(datasource.get("datauploadtype").toString());
|
||||
repository.setDateOfCollection(convertStringToDate( datasource.get("dateofcollection").toString()));
|
||||
repository.setDateOfValidation(convertStringToDate( datasource.get("dateofvalidation").toString()));
|
||||
|
||||
|
@ -68,42 +69,39 @@ public class Converter {
|
|||
|
||||
repository.setLongitude(toDouble(datasource.get("longitude").toString()));
|
||||
//datasource.get("managed");
|
||||
// repository.setMissionStatementUrl(datasource.get("missionstatementurl").toString());
|
||||
repository.setMissionStatementUrl(datasource.get("missionstatementurl").toString());
|
||||
repository.setNamespacePrefix(datasource.get("namespaceprefix").toString());
|
||||
// repository.setOdContentTypes(datasource.get("od_contenttypes").toString());
|
||||
repository.setOdContentTypes(datasource.get("od_contenttypes").toString());
|
||||
repository.setOfficialName(datasource.get("officialname").toString());
|
||||
if(repository.getOfficialName().equals("null"))
|
||||
repository.setOfficialName("");
|
||||
|
||||
// repository.setPidSystems(datasource.get("pidsystems").toString());
|
||||
repository.setPidSystems(datasource.get("pidsystems").toString());
|
||||
//datasource.get("platform");
|
||||
// repository.setProvenanceActionClass( datasource.get("provenanceaction").toString());
|
||||
// repository.setQualityManagementKind(datasource.get("qualitymanagementkind").toString());
|
||||
repository.setProvenanceActionClass( datasource.get("provenanceaction").toString());
|
||||
repository.setQualityManagementKind(datasource.get("qualitymanagementkind").toString());
|
||||
repository.setRegisteredBy(datasource.get("registeredby").toString());
|
||||
|
||||
if(Objects.equals(repository.getRegisteredBy(),"null"))
|
||||
repository.setRegistered(true);
|
||||
|
||||
// repository.setReleaseEndDate(convertStringToDate(datasource.get("releaseenddate").toString()));
|
||||
// repository.setReleaseStartDate(convertStringToDate(datasource.get("releasestartdate").toString()));
|
||||
// repository.setServiceProvider(Boolean.valueOf(datasource.get("serviceprovider").toString()));
|
||||
repository.setReleaseEndDate(convertStringToDate(datasource.get("releaseenddate").toString()));
|
||||
repository.setReleaseStartDate(convertStringToDate(datasource.get("releasestartdate").toString()));
|
||||
repository.setServiceProvider(Boolean.valueOf(datasource.get("serviceprovider").toString()));
|
||||
//datasource.get("subjects");
|
||||
Double timezone = toDouble(datasource.get("timezone").toString());
|
||||
repository.setTimezone(timezone!=null?timezone:0.0);
|
||||
repository.setTypology(datasource.get("platform").toString());
|
||||
// repository.setVersioning(Boolean.valueOf(datasource.get("versioning").toString()));
|
||||
repository.setVersioning(Boolean.valueOf(datasource.get("versioning").toString()));
|
||||
repository.setWebsiteUrl(datasource.get("websiteurl").toString());
|
||||
repository.setDatasourceClass(datasource.get("typology").toString());
|
||||
|
||||
//TODO change organization to list
|
||||
JSONArray organizations = ((JSONArray)datasource.get("organizations"));
|
||||
if(organizations.length() != 0) {
|
||||
repository.setOrganization(((JSONArray) datasource.get("organizations")).getJSONObject(0).get("legalname").toString());
|
||||
String countryCode = ((JSONArray) datasource.get("organizations")).getJSONObject(0).get("country").toString();
|
||||
repository.setCountryCode(countryCode);
|
||||
}
|
||||
repository.setOrganization( ((JSONArray)datasource.get("organizations")).getJSONObject(0).get("legalname").toString());
|
||||
String countryCode = ((JSONArray)datasource.get("organizations")).getJSONObject(0).get("country").toString();
|
||||
repository.setCountryCode(countryCode);
|
||||
|
||||
|
||||
|
||||
String collectedFrom = datasource.get("collectedfrom").toString();
|
||||
//TODO check data consistency
|
||||
String type = "UNKNOWN";
|
||||
|
@ -114,7 +112,10 @@ public class Converter {
|
|||
} else if (collectedFrom.equalsIgnoreCase("infrastruct_::openaire")) {
|
||||
type = "journal";
|
||||
}
|
||||
|
||||
repository.setDatasourceType(type);
|
||||
|
||||
|
||||
return repository;
|
||||
}
|
||||
|
||||
|
@ -159,10 +160,9 @@ public class Converter {
|
|||
return resultSet;
|
||||
}
|
||||
|
||||
public static List<RepositoryInterface> jsonToRepositoryInterfaceList(JSONObject json) throws JSONException {
|
||||
public static List<RepositoryInterface> jsonToRepositoryInterfaceList(JSONArray rs) throws JSONException {
|
||||
|
||||
List<RepositoryInterface> resultSet = new ArrayList<>();
|
||||
JSONArray rs = json.getJSONArray("api");
|
||||
for(int i=0;i<rs.length();i++)
|
||||
resultSet.add(jsonToRepositoryInterfaceObject( rs.getJSONObject(i)) );
|
||||
return resultSet;
|
||||
|
@ -175,11 +175,11 @@ public class Converter {
|
|||
repositoryInterface.setBaseUrl(repositoryInterfaceObject.get("baseurl").toString());
|
||||
repositoryInterface.setContentDescription(repositoryInterfaceObject.get("contentdescription").toString());
|
||||
repositoryInterface.setId(repositoryInterfaceObject.get("id").toString());
|
||||
// repositoryInterface.setMetadataIdentifierPath(repositoryInterfaceObject.get("metadataIdentifierPath").toString());
|
||||
repositoryInterface.setMetadataIdentifierPath(repositoryInterfaceObject.get("metadataIdentifierPath").toString());
|
||||
repositoryInterface.setAccessProtocol(repositoryInterfaceObject.get("protocol").toString());
|
||||
repositoryInterface.setTypology(repositoryInterfaceObject.get("typology").toString());
|
||||
repositoryInterface.setDesiredCompatibilityLevel(repositoryInterfaceObject.get("compatibility").toString());
|
||||
//repositoryInterface.setActive(Boolean.parseBoolean(repositoryInterfaceObject.get("active").toString()));
|
||||
repositoryInterface.setActive(Boolean.parseBoolean(repositoryInterfaceObject.get("active").toString()));
|
||||
repositoryInterface.setRemovable(Boolean.parseBoolean(repositoryInterfaceObject.get("removable").toString()));
|
||||
repositoryInterface.setCompliance(repositoryInterfaceObject.get("compatibility").toString());
|
||||
|
||||
|
@ -187,7 +187,7 @@ public class Converter {
|
|||
Map<String, String> extraFields = new HashMap<>();
|
||||
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
JSONArray apiparams = repositoryInterfaceObject.getJSONArray("apiParams");
|
||||
JSONArray apiparams = repositoryInterfaceObject.getJSONArray("apiparam");
|
||||
|
||||
for(int i=0;i<apiparams.length();i++)
|
||||
accessParams.put(apiparams.getJSONObject(i).getString("param"),apiparams.getJSONObject(i).getString("value"));
|
||||
|
@ -302,13 +302,19 @@ public class Converter {
|
|||
return list;
|
||||
}
|
||||
|
||||
public static List<AggregationDetails> getAggregationHistoryFromJson(JSONObject datasourceInfo) throws JSONException {
|
||||
public static List<AggregationDetails> getAggregationHistoryFromJson(JSONObject repositoryObject) throws JSONException {
|
||||
|
||||
|
||||
if(datasourceInfo.get("aggregationHistory").toString().equals("[]"))
|
||||
/* if( repositoryObject.get("aggregationHistory").toString().equals("[]") ||
|
||||
repositoryObject.get("aggregationHistory")!= null)
|
||||
return null;*/
|
||||
if(repositoryObject.get("aggregationHistory").toString().equals("[]"))
|
||||
return null;
|
||||
|
||||
JSONArray rs = new JSONArray(datasourceInfo.get("aggregationHistory").toString());
|
||||
|
||||
JSONArray rs = new JSONArray(repositoryObject.get("aggregationHistory").toString());
|
||||
|
||||
LOGGER.debug(rs.length());
|
||||
|
||||
List<AggregationDetails> aggregationDetailsList = new ArrayList<>();
|
||||
for(int i=0;i<rs.length();i++)
|
||||
aggregationDetailsList.add(jsonToAggregationDetails(rs.getJSONObject(i)));
|
||||
|
@ -327,20 +333,20 @@ public class Converter {
|
|||
return aggregationDetails;
|
||||
}
|
||||
|
||||
public static AggregationDetails getLastCollectionFromJson(JSONObject datasourceInfo) throws JSONException {
|
||||
public static AggregationDetails getLastCollectionFromJson(JSONObject repositoryObject) throws JSONException {
|
||||
|
||||
if( datasourceInfo.get("lastCollection").equals(null))
|
||||
if( repositoryObject.get("lastCollection").equals(null))
|
||||
return null;
|
||||
|
||||
return jsonToAggregationDetails(datasourceInfo.getJSONObject("lastCollection"));
|
||||
return jsonToAggregationDetails(repositoryObject.getJSONObject("lastCollection"));
|
||||
}
|
||||
|
||||
public static AggregationDetails getLastTransformationFromJson(JSONObject datasourceInfo) throws JSONException {
|
||||
public static AggregationDetails getLastTransformationFromJson(JSONObject repositoryObject) throws JSONException {
|
||||
|
||||
if( datasourceInfo.get("lastTransformation").equals(null))
|
||||
if( repositoryObject.get("lastTransformation").equals(null))
|
||||
return null;
|
||||
|
||||
return jsonToAggregationDetails(datasourceInfo.getJSONObject("lastTransformation"));
|
||||
return jsonToAggregationDetails(repositoryObject.getJSONObject("lastTransformation"));
|
||||
}
|
||||
|
||||
public static List<Timezone> toTimezones(List<String> timezones) {
|
||||
|
|
|
@ -95,6 +95,4 @@ public class Subscription implements IsSerializable {
|
|||
public void setConditionsAsList(List<MapConditions> conditionsAsList) {
|
||||
this.conditionsAsList = conditionsAsList;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -36,6 +36,8 @@ services.broker.openaire = openaireBroker
|
|||
configurationFileClassPath=classpath:application-context.xml
|
||||
|
||||
api.baseAddress=https://dev-openaire.d4science.org/openaire
|
||||
#api.baseAddress=http://beta.services.openaire.eu:8080/openaire/
|
||||
|
||||
|
||||
service.repository-rest-api.baseUrl = http://localhost:8080
|
||||
|
||||
|
@ -98,11 +100,11 @@ services.repomanager.analyticsURL = http://analytics.openaire.eu/addsite.php?
|
|||
|
||||
topic_types.url = https://beta.services.openaire.eu/provision/mvc/vocabularies/dnet:topic_types.json
|
||||
|
||||
oidc.issuer = https://aai.openminted.eu/oidc/
|
||||
oidc.id = 24e83176-1312-4ba3-bc0b-ffeebea1603e
|
||||
oidc.secret = U_gLOupYu2trYIOwfxGgZkkZoOHG_zGfaViOUsXcZ7qVQuF1rcJeQYKIDX1TY3z27CIoHaqq9ht2rmAiUmBRYQ
|
||||
webapp.home = http://localhost:8380/repomanager-service/openid_connect_login
|
||||
webapp.front=http://localhost:8380/
|
||||
#oidc.issuer = https://aai.openminted.eu/oidc/
|
||||
#oidc.id = 24e83176-1312-4ba3-bc0b-ffeebea1603e
|
||||
#oidc.secret = U_gLOupYu2trYIOwfxGgZkkZoOHG_zGfaViOUsXcZ7qVQuF1rcJeQYKIDX1TY3z27CIoHaqq9ht2rmAiUmBRYQ
|
||||
#webapp.home = http://localhost:8380/repomanager-service/openid_connect_login
|
||||
#webapp.front=http://localhost:8380/
|
||||
|
||||
redis.host = 83.212.101.85
|
||||
#redis.port = 6379
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
<import resource="classpath*:/gr/uoa/di/driver/app/springContext-commons.xml"/>
|
||||
<import resource="classpath*:/gr/uoa/di/driver/app/springContext-registrator.xml"/>
|
||||
|
||||
<!--<import resource="classpath*:/eu/dnetlib/repos/springContext-repos-dms-cached.xml"/>-->
|
||||
<import resource="classpath*:/eu/dnetlib/repos/springContext-repos-dms-cached.xml"/>
|
||||
<context:property-placeholder location="classpath*:/eu/**/application.properties" />
|
||||
|
||||
<bean class="eu.dnetlib.repo.manager.service.config.CascadingPropertyLoader" id="propertyLoader">
|
||||
|
|
|
@ -5,28 +5,6 @@
|
|||
http://xmlns.jcp.org/xml/ns/javaee "
|
||||
version="3.1">
|
||||
|
||||
<filter>
|
||||
<filter-name>CorsFilter</filter-name>
|
||||
<filter-class>org.apache.catalina.filters.CorsFilter</filter-class>
|
||||
<init-param>
|
||||
<param-name>cors.allowed.origins</param-name>
|
||||
<param-value>*</param-value>
|
||||
</init-param>
|
||||
<init-param>
|
||||
<param-name>cors.allowed.headers</param-name>
|
||||
<param-value>Content-Type,X-Requested-With,accept,authorization,Origin,Access-Control-Request-Method,Access-Control-Request-Headers</param-value>
|
||||
</init-param>
|
||||
<init-param>
|
||||
<param-name>cors.allowed.methods</param-name>
|
||||
<param-value>GET, POST, PUT, DELETE, OPTIONS, HEAD</param-value>
|
||||
</init-param>
|
||||
</filter>
|
||||
|
||||
<filter-mapping>
|
||||
<filter-name>CorsFilter</filter-name>
|
||||
<url-pattern>/*</url-pattern>
|
||||
</filter-mapping>
|
||||
|
||||
<context-param>
|
||||
<param-name>log4jConfigLocation</param-name>
|
||||
<param-value>/WEB-INF/log4j.properties</param-value>
|
||||
|
|
Loading…
Reference in New Issue