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