- Code optimization and polishing.

- Improve error-checking and exception-handling.
This commit is contained in:
Lampros Smyrnaios 2023-01-13 12:20:06 +02:00
parent f136488b0e
commit eaa4083b04
16 changed files with 248 additions and 268 deletions

View File

@ -5,6 +5,5 @@
## Install and run: ## Install and run:
- Run **git clone** and then **cd uoa-repository-manager-service**. - Run **git clone** and then **cd uoa-repository-manager-service**.
- Provide all not-set or redacted configurations, inside the **src/main/resources/application.properties** file. - Provide all not-set or redacted configurations, inside the **src/main/resources/application.properties** file.
- Execute the **installAndRun.sh** script which installs and runs the app. - Build the app with: `mvn clean install -s <settings-file>`
- If you want to just run the app, then run the script with the argument "1": **./installAndRun.sh 1** - Run the app with: `java -jar ./target/uoa-repository-manager-service.jar`
- If you want to just install the app, then run the script with the argument "2": **./installAndRun.sh 2**

View File

@ -94,5 +94,4 @@ public class DashboardController {
return new BrokerSummary(brokerService.getSimpleSubscriptionsOfUser(((OIDCAuthenticationToken) SecurityContextHolder.getContext().getAuthentication()).getUserInfo().getEmail()), brokerService.getTopicsForDatasource(datasourceName)); return new BrokerSummary(brokerService.getSimpleSubscriptionsOfUser(((OIDCAuthenticationToken) SecurityContextHolder.getContext().getAuthentication()).getUserInfo().getEmail()), brokerService.getTopicsForDatasource(datasourceName));
} }
} }

View File

@ -75,6 +75,7 @@ public class PiWikController {
results.setResults(returning); results.setResults(returning);
return results; return results;
} }
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "from", dataType = "number", paramType = "query"), @ApiImplicitParam(name = "from", dataType = "number", paramType = "query"),
@ApiImplicitParam(name = "quantity", dataType = "number", paramType = "query"), @ApiImplicitParam(name = "quantity", dataType = "number", paramType = "query"),
@ -102,20 +103,17 @@ public class PiWikController {
sb.append(" Repository ID , Repository name, Country, Site ID, Authentication token, Creation date, Requestor full name, Requestor email, Validated, Validation date, Comment \n"); sb.append(" Repository ID , Repository name, Country, Site ID, Authentication token, Creation date, Requestor full name, Requestor email, Validated, Validation date, Comment \n");
for(PiwikInfo piwikInfo : returning){ for(PiwikInfo piwikInfo : returning){
sb.append( sb.append(piwikInfo.getRepositoryId() == null ? "," : piwikInfo.getRepositoryId() + ",")
(piwikInfo.getRepositoryId() == null ? "," : piwikInfo.getRepositoryId()+ ",")+ .append(piwikInfo.getRepositoryName() == null ? "," : piwikInfo.getRepositoryName() + ",")
(piwikInfo.getRepositoryName() == null ? "," : piwikInfo.getRepositoryName()+ ",")+ .append(piwikInfo.getCountry() == null ? "," : piwikInfo.getCountry() + ",")
(piwikInfo.getCountry() == null ? "," : piwikInfo.getCountry()+ ",")+ .append(piwikInfo.getSiteId() == null ? "," : piwikInfo.getSiteId() + ",")
(piwikInfo.getSiteId() == null ? "," : piwikInfo.getSiteId()+ ",") + .append(piwikInfo.getAuthenticationToken() == null ? "," : piwikInfo.getAuthenticationToken() + ",")
(piwikInfo.getAuthenticationToken() == null ? "," : piwikInfo.getAuthenticationToken()+ ",")+ .append(piwikInfo.getCreationDate() == null ? "," : piwikInfo.getCreationDate().toString() + ",")
(piwikInfo.getCreationDate() == null ? "," : piwikInfo.getCreationDate().toString()+ ",") + .append(piwikInfo.getRequestorName() == null ? "," : piwikInfo.getRequestorName() + ",")
(piwikInfo.getRequestorName() == null ? "," : piwikInfo.getRequestorName()+ ",") + .append(piwikInfo.getRequestorEmail() == null ? "," : piwikInfo.getRequestorEmail() + ",")
(piwikInfo.getRequestorEmail() == null ? "," : piwikInfo.getRequestorEmail()+ ",")+ .append(piwikInfo.isValidated()).append(",")
piwikInfo.isValidated() + "," + .append(piwikInfo.getValidationDate() == null ? "," : piwikInfo.getValidationDate().toString() + ",")
(piwikInfo.getValidationDate() == null ? "," : piwikInfo.getValidationDate().toString()+ ",") + .append(piwikInfo.getComment() == null ? "\n" : piwikInfo.getComment() + "\n");
(piwikInfo.getComment() == null ? "\n" : piwikInfo.getComment()+ "\n")
);
} }
writer.write(sb.toString()); writer.write(sb.toString());
@ -140,7 +138,6 @@ public class PiWikController {
strDate); strDate);
response.setHeader(headerKey, headerValue); response.setHeader(headerKey, headerValue);
return new FileSystemResource(p.toFile()); return new FileSystemResource(p.toFile());
} }

View File

@ -1,12 +1,10 @@
package eu.dnetlib.repo.manager.service; package eu.dnetlib.repo.manager.service;
import com.fasterxml.jackson.databind.ObjectMapper;
import eu.dnetlib.enabling.datasources.common.AggregationInfo; import eu.dnetlib.enabling.datasources.common.AggregationInfo;
import eu.dnetlib.repo.manager.domain.AggregationHistoryResponse; import eu.dnetlib.repo.manager.domain.AggregationHistoryResponse;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
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;
import org.springframework.web.util.UriComponentsBuilder; import org.springframework.web.util.UriComponentsBuilder;

View File

@ -26,7 +26,10 @@ import javax.annotation.PostConstruct;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.net.URL; import java.net.URL;
import java.util.*; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service("brokerService") @Service("brokerService")
public class BrokerServiceImpl implements BrokerService { public class BrokerServiceImpl implements BrokerService {
@ -47,7 +50,7 @@ public class BrokerServiceImpl implements BrokerService {
private HttpHeaders httpHeaders; private HttpHeaders httpHeaders;
private HashMap<String, Term> topics = new HashMap<String, Term>(); private HashMap<String, Term> topics = new HashMap<>();
@PostConstruct @PostConstruct
private void initDnetTopicsMap() { private void initDnetTopicsMap() {
@ -120,7 +123,7 @@ public class BrokerServiceImpl implements BrokerService {
@Override @Override
public EventsPage advancedShowEvents(String page, public EventsPage advancedShowEvents(String page,
String size, String size,
AdvQueryObject advQueryObject) throws BrokerException, JSONException, IOException { AdvQueryObject advQueryObject) throws BrokerException {
final String service = "/events/{page}/{pageSize}"; final String service = "/events/{page}/{pageSize}";
@ -155,7 +158,7 @@ public class BrokerServiceImpl implements BrokerService {
for (RepositorySnippet repo : repositories) { for (RepositorySnippet repo : repositories) {
BrowseEntry temp = new BrowseEntry(); BrowseEntry temp = new BrowseEntry();
temp.setValue(repo.getOfficialname()); temp.setValue(repo.getOfficialname());
temp.setSize(new Long(0)); temp.setSize(0L);
for (BrowseEntry e : getTopicsForDatasource(repo.getOfficialname())) { for (BrowseEntry e : getTopicsForDatasource(repo.getOfficialname())) {
temp.setSize(temp.getSize() + e.getSize()); temp.setSize(temp.getSize() + e.getSize());
} }
@ -164,12 +167,7 @@ public class BrokerServiceImpl implements BrokerService {
} }
// sort the collection by the second field of the tuple which is size // sort the collection by the second field of the tuple which is size
Collections.sort(entries, new Comparator<Tuple<BrowseEntry, String>>() { entries.sort((e1, e2) -> (int) (e2.getFirst().getSize() - e1.getFirst().getSize()));
@Override
public int compare(Tuple<BrowseEntry, String> e1, Tuple<BrowseEntry, String> e2) {
return (int) (e2.getFirst().getSize().longValue() - e1.getFirst().getSize().longValue());
}
});
long stop = System.currentTimeMillis(); long stop = System.currentTimeMillis();
System.out.println("getDatasourcesOfUserType returned in " + (stop - start) + "ms "); System.out.println("getDatasourcesOfUserType returned in " + (stop - start) + "ms ");

View File

@ -769,6 +769,6 @@ public class EmailUtilsImpl implements EmailUtils {
user = ((OIDCAuthenticationToken) authentication).getUserInfo().getName(); user = ((OIDCAuthenticationToken) authentication).getUserInfo().getName();
} catch (NullPointerException ex) {} } catch (NullPointerException ex) {}
} }
return user; return user; // It may be just "user". TODO - Wouldn't be better if it was null?
} }
} }

View File

@ -1,10 +1,6 @@
package eu.dnetlib.repo.manager.service; package eu.dnetlib.repo.manager.service;
import com.fasterxml.jackson.core.JsonFactory;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.jsontype.BasicPolymorphicTypeValidator;
import com.fasterxml.jackson.databind.jsontype.PolymorphicTypeValidator;
import com.google.gson.JsonArray; import com.google.gson.JsonArray;
import com.google.gson.JsonElement; import com.google.gson.JsonElement;
import com.google.gson.JsonObject; import com.google.gson.JsonObject;
@ -12,7 +8,6 @@ import eu.dnetlib.api.functionality.ValidatorServiceException;
import eu.dnetlib.domain.enabling.Vocabulary; import eu.dnetlib.domain.enabling.Vocabulary;
import eu.dnetlib.domain.functionality.validator.JobForValidation; import eu.dnetlib.domain.functionality.validator.JobForValidation;
import eu.dnetlib.repo.manager.domain.*; import eu.dnetlib.repo.manager.domain.*;
import eu.dnetlib.repo.manager.domain.broker.BrowseEntry;
import eu.dnetlib.repo.manager.domain.dto.Role; import eu.dnetlib.repo.manager.domain.dto.Role;
import eu.dnetlib.repo.manager.domain.dto.User; import eu.dnetlib.repo.manager.domain.dto.User;
import eu.dnetlib.repo.manager.exception.BrokerException; import eu.dnetlib.repo.manager.exception.BrokerException;
@ -153,8 +148,6 @@ public class RepositoryServiceImpl implements RepositoryService {
countriesMap.put(c.getName(), c.getCode()); countriesMap.put(c.getName(), c.getCode());
inverseCountriesMap.put(c.getCode(), c.getName()); inverseCountriesMap.put(c.getCode(), c.getName());
} }
} }
@Override @Override
@ -185,11 +178,13 @@ public class RepositoryServiceImpl implements RepositoryService {
for (String repoId : ids) { for (String repoId : ids) {
requestFilter.setId(repoId); requestFilter.setId(repoId);
List<Repository> rs = restTemplate.postForObject(uriComponents.toUri(), requestFilter, List.class); List rs = restTemplate.postForObject(uriComponents.toUri(), requestFilter, List.class);
// repos.addAll(converter.toRepositoryList(new JSONObject(rs))); // repos.addAll(converter.toRepositoryList(new JSONObject(rs)));
} }
// TODO - "repos" is EMPTY!!
for (Repository r : repos) for (Repository r : repos)
r.setPiwikInfo(piWikService.getPiwikSiteForRepo(r.getId())); r.setPiwikInfo(piWikService.getPiwikSiteForRepo(r.getId()));
return repos; return repos;
@ -219,6 +214,10 @@ public class RepositoryServiceImpl implements RepositoryService {
requestFilter.setId(repoId); requestFilter.setId(repoId);
DatasourceResponse rs = restTemplate.postForObject(uriComponents.toUri(), requestFilter, DatasourceResponse.class); DatasourceResponse rs = restTemplate.postForObject(uriComponents.toUri(), requestFilter, DatasourceResponse.class);
if ( rs == null ) {
logger.error("The \"DatasourceResponse\" is null!");
return null;
}
resultSet.addAll(objectMapper.readValue(objectMapper.writeValueAsString(rs.getDatasourceInfo()), resultSet.addAll(objectMapper.readValue(objectMapper.writeValueAsString(rs.getDatasourceInfo()),
objectMapper.getTypeFactory().constructCollectionType(List.class, RepositorySnippet.class))); objectMapper.getTypeFactory().constructCollectionType(List.class, RepositorySnippet.class)));
@ -262,6 +261,11 @@ public class RepositoryServiceImpl implements RepositoryService {
requestFilter.setEoscDatasourceType(filterKey); requestFilter.setEoscDatasourceType(filterKey);
String rs = restTemplate.postForObject(uriComponents.toUri(), requestFilter, String.class); String rs = restTemplate.postForObject(uriComponents.toUri(), requestFilter, String.class);
if ( rs == null ) {
logger.error("The result is null!");
return null;
}
JSONArray jsonArray = (JSONArray) new JSONObject(rs).get("datasourceInfo"); JSONArray jsonArray = (JSONArray) new JSONObject(rs).get("datasourceInfo");
while (jsonArray.length() > 0) { while (jsonArray.length() > 0) {
@ -270,6 +274,11 @@ public class RepositoryServiceImpl implements RepositoryService {
page += 1; page += 1;
uriComponents = searchSnipperDatasource(String.valueOf(page), String.valueOf(size)); uriComponents = searchSnipperDatasource(String.valueOf(page), String.valueOf(size));
rs = restTemplate.postForObject(uriComponents.toUri(), requestFilter, String.class); rs = restTemplate.postForObject(uriComponents.toUri(), requestFilter, String.class);
if ( rs == null ) {
logger.error("The result is null!");
break;
}
jsonArray = (JSONArray) new JSONObject(rs).get("datasourceInfo"); jsonArray = (JSONArray) new JSONObject(rs).get("datasourceInfo");
} }
return resultSet; return resultSet;
@ -313,7 +322,7 @@ public class RepositoryServiceImpl implements RepositoryService {
} }
@Override @Override
public int getTotalRegisteredRepositories() { public int getTotalRegisteredRepositories() throws NullPointerException {
UriComponents uriComponents = UriComponentsBuilder UriComponents uriComponents = UriComponentsBuilder
.fromHttpUrl(baseAddress + "/ds/countregistered") .fromHttpUrl(baseAddress + "/ds/countregistered")
.queryParam("fromDate", "1900-01-01") .queryParam("fromDate", "1900-01-01")
@ -377,6 +386,11 @@ public class RepositoryServiceImpl implements RepositoryService {
requestFilter.setId(id); requestFilter.setId(id);
String rs = restTemplate.postForObject(uriComponents.toUri(), requestFilter, String.class); String rs = restTemplate.postForObject(uriComponents.toUri(), requestFilter, String.class);
if ( rs == null ) {
logger.error("The result is null!");
return null;
}
JSONArray jsonArray = (JSONArray) new JSONObject(rs).get("datasourceInfo"); JSONArray jsonArray = (JSONArray) new JSONObject(rs).get("datasourceInfo");
if (jsonArray.length() == 0) if (jsonArray.length() == 0)
@ -399,7 +413,12 @@ public class RepositoryServiceImpl implements RepositoryService {
// JSONArray jsonArray = (JSONArray) new JSONObject(rs).get("datasourceInfo"); // JSONArray jsonArray = (JSONArray) new JSONObject(rs).get("datasourceInfo");
DatasourceResponse response; DatasourceResponse response;
response = (DatasourceResponse) restTemplate.postForObject(uriComponents.toUri(), requestFilter, DatasourceResponse.class); response = restTemplate.postForObject(uriComponents.toUri(), requestFilter, DatasourceResponse.class);
if ( response == null ) {
logger.error("The response is null!");
return null;
}
List<DatasourceDetails> datasources = response.getDatasourceInfo(); List<DatasourceDetails> datasources = response.getDatasourceInfo();
if (datasources.size() == 0) if (datasources.size() == 0)
throw new ResourceNotFoundException(); throw new ResourceNotFoundException();
@ -540,7 +559,7 @@ public class RepositoryServiceImpl implements RepositoryService {
// logger.debug("JSON to add(update) -> " + json_repository); // logger.debug("JSON to add(update) -> " + json_repository);
HttpEntity<Repository> httpEntity = new HttpEntity<>(repository, httpHeaders); // TODO: check if it works (Repository contains extra fields) HttpEntity<Repository> httpEntity = new HttpEntity<>(repository, httpHeaders); // TODO: check if it works (Repository contains extra fields)
ResponseEntity responseEntity = restTemplate.exchange(uriComponents.toUri(), HttpMethod.POST, httpEntity, ResponseEntity.class); ResponseEntity<ResponseEntity> responseEntity = restTemplate.exchange(uriComponents.toUri(), HttpMethod.POST, httpEntity, ResponseEntity.class);
if (responseEntity.getStatusCode().equals(HttpStatus.OK)) { if (responseEntity.getStatusCode().equals(HttpStatus.OK)) {
try { try {
@ -570,7 +589,7 @@ public class RepositoryServiceImpl implements RepositoryService {
// logger.debug("JSON to update -> " + json_repository); // logger.debug("JSON to update -> " + json_repository);
HttpEntity<Repository> httpEntity = new HttpEntity<>(repository, httpHeaders); HttpEntity<Repository> httpEntity = new HttpEntity<>(repository, httpHeaders);
ResponseEntity responseEntity = restTemplate.exchange(uriComponents.toUri(), HttpMethod.POST, httpEntity, ResponseEntity.class); ResponseEntity<ResponseEntity> responseEntity = restTemplate.exchange(uriComponents.toUri(), HttpMethod.POST, httpEntity, ResponseEntity.class);
if (responseEntity.getStatusCode().equals(HttpStatus.OK)) { if (responseEntity.getStatusCode().equals(HttpStatus.OK)) {
try { try {
@ -602,7 +621,7 @@ public class RepositoryServiceImpl implements RepositoryService {
.encode(); .encode();
// String json_repository = converter.toJson(repository); // String json_repository = converter.toJson(repository);
HttpEntity<Repository> httpEntity = new HttpEntity<>(repository, httpHeaders); HttpEntity<Repository> httpEntity = new HttpEntity<>(repository, httpHeaders);
ResponseEntity responseEntity = restTemplate.exchange(uriComponents.toUri(), HttpMethod.POST, httpEntity, ResponseEntity.class); ResponseEntity<ResponseEntity> responseEntity = restTemplate.exchange(uriComponents.toUri(), HttpMethod.POST, httpEntity, ResponseEntity.class);
if (responseEntity.getStatusCode().equals(HttpStatus.OK)) { if (responseEntity.getStatusCode().equals(HttpStatus.OK)) {
try { try {

View File

@ -83,28 +83,7 @@ public class StatsServiceImpl implements StatsService {
" oaftype exact datasource and " + " oaftype exact datasource and " +
" datasourcetypename exact Data Repository "; " datasourcetypename exact Data Repository ";
UriComponents uriComponents = UriComponentsBuilder return getMetadataTotals(url);
.fromHttpUrl(url)
.queryParam("page",0)
.queryParam("size",0)
.queryParam("format","json")
.build().encode();
try {
ResponseEntity<Map> rs = restTemplate.exchange(uriComponents.toUri(), HttpMethod.GET, null, Map.class);
Map metadata = (Map) ((Map<?, ?>) Objects.requireNonNull(rs.getBody())).get("meta");
if ( metadata == null ) {
logger.error("The metadata was null!");
return null;
}
return String.valueOf(metadata.get("total"));
} catch ( RestClientException rce ) {
logger.error(rce.getMessage());
return null;
} catch ( Exception e ) {
logger.error("", e);
return null;
}
} }
@ -116,28 +95,7 @@ public class StatsServiceImpl implements StatsService {
" ( datasourcetypename exact Institutional Repository " + " ( datasourcetypename exact Institutional Repository " +
" or datasourcetypename exact Publication Repository )"; " or datasourcetypename exact Publication Repository )";
UriComponents uriComponents = UriComponentsBuilder return getMetadataTotals(url);
.fromHttpUrl(url)
.queryParam("page", 0)
.queryParam("size", 0)
.queryParam("format", "json")
.build().encode();
try {
ResponseEntity<Map> rs = restTemplate.exchange(uriComponents.toUri(), HttpMethod.GET, null, Map.class);
Map metadata = (Map) ((Map<?, ?>) Objects.requireNonNull(rs.getBody())).get("meta");
if ( metadata == null ) {
logger.error("The metadata was null!");
return null;
}
return String.valueOf(metadata.get("total"));
} catch ( RestClientException rce ) {
logger.error(rce.getMessage());
return null;
} catch ( Exception e ) {
logger.error("", e);
return null;
}
} }
@ -148,28 +106,7 @@ public class StatsServiceImpl implements StatsService {
" oaftype exact datasource and " + " oaftype exact datasource and " +
" datasourcetypename exact Journal"; " datasourcetypename exact Journal";
UriComponents uriComponents = UriComponentsBuilder return getMetadataTotals(url);
.fromHttpUrl(url)
.queryParam("page", 0)
.queryParam("size", 0)
.queryParam("format", "json")
.build().encode();
try {
ResponseEntity<Map> rs = restTemplate.exchange(uriComponents.toUri(), HttpMethod.GET, null, Map.class);
Map metadata = (Map) ((Map<?, ?>) Objects.requireNonNull(rs.getBody())).get("meta");
if ( metadata == null ) {
logger.error("The metadata was null!");
return null;
}
return String.valueOf(metadata.get("total"));
} catch ( RestClientException rce ) {
logger.error(rce.getMessage());
return null;
} catch ( Exception e ) {
logger.error("", e);
return null;
}
} }
@ -177,28 +114,7 @@ public class StatsServiceImpl implements StatsService {
{ {
String url = baseAddress + "/publications/count"; String url = baseAddress + "/publications/count";
UriComponents uriComponents = UriComponentsBuilder return getCommonStats(url);
.fromHttpUrl(url)
.queryParam("page", 0)
.queryParam("size", 0)
.queryParam("format", "json")
.build().encode();
try {
ResponseEntity<Map> rs = restTemplate.exchange(uriComponents.toUri(), HttpMethod.GET, null, Map.class);
Map metadata = (Map<?, ?>) rs.getBody();
if ( metadata == null ) {
logger.error("The metadata was null!");
return null;
}
return String.valueOf(metadata.get("total"));
} catch ( RestClientException rce ) {
logger.error(rce.getMessage());
return null;
} catch ( Exception e ) {
logger.error("", e);
return null;
}
} }
@ -206,28 +122,7 @@ public class StatsServiceImpl implements StatsService {
{ {
String url = baseAddress + "/datasets/count"; String url = baseAddress + "/datasets/count";
UriComponents uriComponents = UriComponentsBuilder return getCommonStats(url);
.fromHttpUrl(url)
.queryParam("page", 0)
.queryParam("size", 0)
.queryParam("format", "json")
.build().encode();
try {
ResponseEntity<Map> rs = restTemplate.exchange(uriComponents.toUri(), HttpMethod.GET, null, Map.class);
Map metadata = (Map<?, ?>) rs.getBody();
if ( metadata == null ) {
logger.error("The metadata was null!");
return null;
}
return String.valueOf(metadata.get("total"));
} catch ( RestClientException rce ) {
logger.error(rce.getMessage());
return null;
} catch ( Exception e ) {
logger.error("", e);
return null;
}
} }
@ -235,28 +130,7 @@ public class StatsServiceImpl implements StatsService {
{ {
String url = baseAddress + "/software/count"; String url = baseAddress + "/software/count";
UriComponents uriComponents = UriComponentsBuilder return getCommonStats(url);
.fromHttpUrl(url)
.queryParam("page", 0)
.queryParam("size", 0)
.queryParam("format", "json")
.build().encode();
try {
ResponseEntity<Map> rs = restTemplate.exchange(uriComponents.toUri(), HttpMethod.GET, null, Map.class);
Map metadata = (Map<?, ?>) rs.getBody();
if ( metadata == null ) {
logger.error("The metadata was null!");
return null;
}
return String.valueOf(metadata.get("total"));
} catch ( RestClientException rce ) {
logger.error(rce.getMessage());
return null;
} catch ( Exception e ) {
logger.error("", e);
return null;
}
} }
@ -297,17 +171,70 @@ public class StatsServiceImpl implements StatsService {
try { try {
ResponseEntity<Map> rs = restTemplate.exchange(uriComponents.toUri(), HttpMethod.GET, null, Map.class); ResponseEntity<Map> rs = restTemplate.exchange(uriComponents.toUri(), HttpMethod.GET, null, Map.class);
Map metadata = (Map) ((Map<?, ?>) Objects.requireNonNull(rs.getBody())).get("totals"); Map statsTotals = (Map) ((Map<?, ?>) Objects.requireNonNull(rs.getBody())).get("totals");
if ( metadata == null ) { if ( statsTotals == null ) {
logger.error("The metadata was null!"); logger.error("The statsTotals was null!");
return null; return null;
} }
// TODO - Will we ever need the following lines?
// String rs = restTemplate.getForObject(uriComponents.toUri(), String.class); // String rs = restTemplate.getForObject(uriComponents.toUri(), String.class);
// JSONObject resultSet = new JSONObject(rs); // JSONObject resultSet = new JSONObject(rs);
// JSONObject totals = resultSet.getJSONObject("totals"); // JSONObject totals = resultSet.getJSONObject("totals");
return (Integer) metadata.get("events"); return (Integer) statsTotals.get("events");
} catch ( RestClientException rce ) {
logger.error(rce.getMessage());
return null;
} catch ( Exception e ) {
logger.error("", e);
return null;
}
}
private String getMetadataTotals(String url) {
UriComponents uriComponents = UriComponentsBuilder
.fromHttpUrl(url)
.queryParam("page", 0)
.queryParam("size", 0)
.queryParam("format", "json")
.build().encode();
try {
ResponseEntity<Map> rs = restTemplate.exchange(uriComponents.toUri(), HttpMethod.GET, null, Map.class);
Map metadata = (Map) ((Map<?, ?>) Objects.requireNonNull(rs.getBody())).get("meta");
if ( metadata == null ) {
logger.error("The metadata was null!");
return null;
}
return String.valueOf(metadata.get("total"));
} catch ( RestClientException rce ) {
logger.error(rce.getMessage());
return null;
} catch ( Exception e ) {
logger.error("", e);
return null;
}
}
private String getCommonStats(String url) {
UriComponents uriComponents = UriComponentsBuilder
.fromHttpUrl(url)
.queryParam("page", 0)
.queryParam("size", 0)
.queryParam("format", "json")
.build().encode();
try {
ResponseEntity<Map> rs = restTemplate.exchange(uriComponents.toUri(), HttpMethod.GET, null, Map.class);
Map stats = (Map<?, ?>) rs.getBody();
if ( stats == null ) {
logger.error("The stats was null!");
return null;
}
return String.valueOf(stats.get("total"));
} catch ( RestClientException rce ) { } catch ( RestClientException rce ) {
logger.error(rce.getMessage()); logger.error(rce.getMessage());
return null; return null;

View File

@ -1,14 +1,17 @@
package eu.dnetlib.repo.manager.service; package eu.dnetlib.repo.manager.service;
import eu.dnetlib.usagestats.sushilite.domain.Customer;
import eu.dnetlib.usagestats.sushilite.domain.ReportItem; import eu.dnetlib.usagestats.sushilite.domain.ReportItem;
import eu.dnetlib.usagestats.sushilite.domain.ReportResponseWrapper; import eu.dnetlib.usagestats.sushilite.domain.ReportResponseWrapper;
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.HttpMethod; import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.web.client.RestClientException;
import org.springframework.web.client.RestTemplate; import org.springframework.web.client.RestTemplate;
import org.springframework.web.util.UriComponentsBuilder; import org.springframework.web.util.UriComponentsBuilder;
@ -40,62 +43,79 @@ public class SushiliteServiceImpl implements SushiliteService {
String Granularity, String Granularity,
String Pretty) { String Pretty) {
//build the uri params //build the uri params
UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(this.usagestatsSushiliteEndpoint + "GetReport/") UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(this.usagestatsSushiliteEndpoint + "GetReport/")
.queryParam("Report", Report) .queryParam("Report", Report)
.queryParam("Release", Release) .queryParam("Release", Release)
.queryParam("RequestorID", RequestorID) .queryParam("RequestorID", RequestorID)
.queryParam("BeginDate", BeginDate) .queryParam("BeginDate", BeginDate)
.queryParam("EndDate", EndDate) .queryParam("EndDate", EndDate)
.queryParam("RepositoryIdentifier", RepositoryIdentifier) .queryParam("RepositoryIdentifier", RepositoryIdentifier)
.queryParam("ItemIdentifier", ItemIdentifier) .queryParam("ItemIdentifier", ItemIdentifier)
.queryParam("ItemDataType", ItemDataType) .queryParam("ItemDataType", ItemDataType)
.queryParam("Granularity", Granularity) .queryParam("Granularity", Granularity)
.queryParam("Pretty", Pretty); .queryParam("Pretty", Pretty);
//create new template engine //create new restTemplate engine
RestTemplate template = new RestTemplate(); RestTemplate restTemplate = new RestTemplate();
template.getMessageConverters().add(new MappingJackson2HttpMessageConverter()); restTemplate.getMessageConverters().add(new MappingJackson2HttpMessageConverter());
ResponseEntity<ReportResponseWrapper> resp; ResponseEntity<ReportResponseWrapper> resp;
try {
//communicate with endpoint //communicate with endpoint
resp = template.exchange( resp = restTemplate.exchange(
builder.build().encode().toUri(), builder.build().encode().toUri(),
HttpMethod.GET, HttpMethod.GET,
null, null,
new ParameterizedTypeReference<ReportResponseWrapper>() { new ParameterizedTypeReference<ReportResponseWrapper>() {});
}); } catch (RestClientException rce) {
logger.error("", rce);
return null;
}
// check remote api's response // check remote api's response
System.out.println("sushi responded status " + resp.getStatusCode()); HttpStatus httpStatus = resp.getStatusCode();
if ( httpStatus != HttpStatus.OK ) {
logger.warn("Sushi cannot give us data! Responded status: " + httpStatus);
return null;
}
// get the items corresponding to the requested page ReportResponseWrapper reportResponseWrapper = resp.getBody();
List<ReportItem> requestedItemList = new ArrayList<>(); if ( reportResponseWrapper == null ) {
if (resp.getBody().getReportResponse().getReportWrapper().getReport().getCustomer().getReportItems() != null) { logger.error("The \"reportResponseWrapper\" for sushi was null!");
try { return null;
int totalItems = resp.getBody().getReportResponse().getReportWrapper().getReport().getCustomer().getReportItems().size(); }
int size = Integer.parseInt(pageSize);
int offset = Integer.parseInt(page)*size;
if (offset < totalItems ) { // get the items corresponding to the requested page
int upperIndex = offset+size; List<ReportItem> requestedItemList = new ArrayList<>();
if (upperIndex > totalItems) {
upperIndex = totalItems; Customer customer = reportResponseWrapper.getReportResponse().getReportWrapper().getReport().getCustomer();
} List<ReportItem> allReportItems = customer.getReportItems();
requestedItemList = resp.getBody().getReportResponse().getReportWrapper().getReport().getCustomer().getReportItems().subList(offset,upperIndex);
if ( allReportItems != null) {
try {
int totalItems = allReportItems.size();
int size = Integer.parseInt(pageSize);
int offset = (Integer.parseInt(page) * size);
if (offset < totalItems ) {
int upperIndex = (offset + size);
if (upperIndex > totalItems) {
upperIndex = totalItems;
} }
} catch (NumberFormatException e) { requestedItemList = allReportItems.subList(offset, upperIndex);
logger.debug("Exception on getReportResults - trying to cast strings to integers", e);
//emailUtils.reportException(e);
throw e;
} }
} catch (NumberFormatException e) {
logger.debug("Exception on getReportResults - trying to cast strings to integers", e);
//emailUtils.reportException(e);
throw e;
} }
}
ReportResponseWrapper newReportResponse = resp.getBody(); customer.setReportItems(requestedItemList); // Setting the reportItems to the "customer"-reference, updates the "reportResponseWrapper" object.
newReportResponse.getReportResponse().getReportWrapper().getReport().getCustomer().setReportItems(requestedItemList);
return newReportResponse; return reportResponseWrapper;
} }
} }

View File

@ -98,11 +98,7 @@ public class RegistryCalls implements AaiRegistryService {
try { try {
OIDCAuthenticationToken authentication = (OIDCAuthenticationToken) SecurityContextHolder.getContext().getAuthentication(); OIDCAuthenticationToken authentication = (OIDCAuthenticationToken) SecurityContextHolder.getContext().getAuthentication();
String sub = authentication.getUserInfo().getSub(); String sub = authentication.getUserInfo().getSub();
Map<String, String> params = new HashMap<>(); return getCoPersonIdByIdentifier(sub);
params.put("coid", coid);
params.put("search.identifier", sub);
JsonElement response = httpUtils.get("co_people.json", params);
return (response != null) ? response.getAsJsonObject().get("CoPeople").getAsJsonArray().get(0).getAsJsonObject().get("Id").getAsInt() : null;
} catch (Exception e) { } catch (Exception e) {
logger.error("Get User info: An error occurred ", e); logger.error("Get User info: An error occurred ", e);
return null; return null;
@ -296,9 +292,11 @@ public class RegistryCalls implements AaiRegistryService {
JsonArray infos = getUserEmailByCouId(couId, false); JsonArray infos = getUserEmailByCouId(couId, false);
infos.forEach(info -> { infos.forEach(info -> {
JsonObject jsonInfo = info.getAsJsonObject();
User user = new User(); User user = new User();
user.setEmail(jsonInfo.get("email").getAsString());
// TODO: should add firstname and lastname and sub of user // TODO: should add firstname and lastname and sub of user
user.setEmail(info.getAsJsonObject().get("email").getAsString());
users.add(user); users.add(user);
}); });
@ -316,9 +314,10 @@ public class RegistryCalls implements AaiRegistryService {
JsonArray infos = (response != null) ? response.getAsJsonObject().get("Names").getAsJsonArray() : new JsonArray(); JsonArray infos = (response != null) ? response.getAsJsonObject().get("Names").getAsJsonArray() : new JsonArray();
JsonArray names = new JsonArray(); JsonArray names = new JsonArray();
infos.forEach(info -> { infos.forEach(info -> {
JsonObject jsonInfo = info.getAsJsonObject();
JsonObject user = new JsonObject(); JsonObject user = new JsonObject();
user.addProperty("name", info.getAsJsonObject().get("Given").getAsString() + " " + info.getAsJsonObject().get("Family").getAsString()); user.addProperty("name", jsonInfo.get("Given").getAsString() + " " + jsonInfo.get("Family").getAsString());
user.addProperty("memberSince", info.getAsJsonObject().get("Created").getAsString()); user.addProperty("memberSince", jsonInfo.get("Created").getAsString());
names.add(user); names.add(user);
}); });
return names; return names;
@ -335,9 +334,10 @@ public class RegistryCalls implements AaiRegistryService {
JsonArray infos = (response != null) ? response.getAsJsonObject().get("Identifiers").getAsJsonArray() : new JsonArray(); JsonArray infos = (response != null) ? response.getAsJsonObject().get("Identifiers").getAsJsonArray() : new JsonArray();
JsonArray emails = new JsonArray(); JsonArray emails = new JsonArray();
infos.forEach(info -> { infos.forEach(info -> {
JsonObject jsonInfo = info.getAsJsonObject();
JsonObject user = new JsonObject(); JsonObject user = new JsonObject();
user.addProperty("id", info.getAsJsonObject().get("Identifier").getAsString()); user.addProperty("id", jsonInfo.get("Identifier").getAsString());
user.addProperty("memberSince", info.getAsJsonObject().get("Created").getAsString()); user.addProperty("memberSince", jsonInfo.get("Created").getAsString());
emails.add(user); emails.add(user);
}); });
return emails; return emails;
@ -380,7 +380,11 @@ public class RegistryCalls implements AaiRegistryService {
params.put("copersonid", coPersonId.toString()); params.put("copersonid", coPersonId.toString());
JsonElement response = httpUtils.get("names.json", params); JsonElement response = httpUtils.get("names.json", params);
JsonObject info = (response != null) ? response.getAsJsonObject().get("Names").getAsJsonArray().get(0).getAsJsonObject() : null; JsonObject info = (response != null) ? response.getAsJsonObject().get("Names").getAsJsonArray().get(0).getAsJsonObject() : null;
return (info != null) ? info.getAsJsonObject().get("Given").getAsString() + " " + info.getAsJsonObject().get("Family").getAsString() : null; if ( info != null ) {
JsonObject jsonInfo = info.getAsJsonObject();
return jsonInfo.get("Given").getAsString() + " " + jsonInfo.get("Family").getAsString();
} else
return null;
} }
@Override @Override
@ -427,8 +431,9 @@ public class RegistryCalls implements AaiRegistryService {
int total = couIds.size(); int total = couIds.size();
for (JsonElement cou : cous) { for (JsonElement cou : cous) {
if (count < total) { if (count < total) {
if (idNameMap.containsKey(cou.getAsJsonObject().get("Id").getAsInt())) { JsonObject jsonCou = cou.getAsJsonObject();
idNameMap.put(cou.getAsJsonObject().get("Id").getAsInt(), cou.getAsJsonObject().get("Name").getAsString()); if (idNameMap.containsKey(jsonCou.get("Id").getAsInt())) {
idNameMap.put(jsonCou.get("Id").getAsInt(), jsonCou.get("Name").getAsString());
count++; count++;
} }
} else { } else {

View File

@ -2,10 +2,12 @@ package eu.dnetlib.repo.manager.service.security;
import com.google.gson.JsonArray; import com.google.gson.JsonArray;
import com.google.gson.JsonElement; import com.google.gson.JsonElement;
import com.nimbusds.jose.util.StandardCharset;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority; import org.springframework.security.core.authority.SimpleGrantedAuthority;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder; import java.net.URLDecoder;
import java.util.*; import java.util.*;
import java.util.regex.Matcher; import java.util.regex.Matcher;
@ -25,22 +27,24 @@ public class AuthoritiesMapper {
return authorities; return authorities;
} }
public static List<String> entitlementRoles(JsonArray entitlements) { public static List<String> entitlementRoles(JsonArray entitlements) throws UnsupportedEncodingException {
List<String> roles = new ArrayList<>(); List<String> roles = new ArrayList<>();
if (entitlements != null) { if (entitlements != null) {
for (JsonElement obj : entitlements) { for (JsonElement obj : entitlements) {
Matcher matcher = ENTITLEMENT_REGEX.matcher(obj.getAsString()); Matcher matcher = ENTITLEMENT_REGEX.matcher(obj.getAsString());
if (matcher.find()) { if (matcher.find()) {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
if (matcher.group(1) != null && matcher.group(1).length() > 0) { String group1 = matcher.group(1);
sb.append(matcher.group(1)); if (group1 != null && group1.length() > 0) {
sb.append(group1);
} }
if (matcher.group(2).length() > 0) { String group2 = matcher.group(2);
if (group2.length() > 0) {
sb.append(":"); sb.append(":");
sb.append(matcher.group(2)); sb.append(group2);
} }
String role = sb.toString().replace("+", " "); String role = sb.toString().replace("+", " ");
roles.add(URLDecoder.decode(role)); roles.add(URLDecoder.decode(role, StandardCharset.UTF_8.name()));
} }
} }
} }
@ -53,15 +57,17 @@ public class AuthoritiesMapper {
Matcher matcher = ENTITLEMENT_REGEX.matcher(obj.getAsString()); Matcher matcher = ENTITLEMENT_REGEX.matcher(obj.getAsString());
if (matcher.find()) { if (matcher.find()) {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
if (matcher.group(1) != null && matcher.group(1).length() > 0) { String group1 = matcher.group(1);
sb.append(matcher.group(1).replace("+-+", "_").replaceAll("[+.]", "_").toUpperCase()); if (group1 != null && group1.length() > 0) {
sb.append(group1.replace("+-+", "_").replaceAll("[+.]", "_").toUpperCase());
} }
if (matcher.group(2).length() > 0) { String group2 = matcher.group(2);
if (group2.length() > 0) {
sb.append("_"); sb.append("_");
if (matcher.group(2).equals("admins")) { if (group2.equals("admins")) {
sb.append("MANAGER"); sb.append("MANAGER");
} else { } else {
sb.append(matcher.group(2).toUpperCase()); sb.append(group2.toUpperCase());
} }
} }
authorities.add(new SimpleGrantedAuthority(sb.toString())); authorities.add(new SimpleGrantedAuthority(sb.toString()));

View File

@ -28,11 +28,11 @@ public class AuthoritiesUpdater extends HttpSessionSecurityContextRepository {
public void update(String id, Update update) { public void update(String id, Update update) {
if (sessions != null) { if (sessions != null) {
Map<String, Session> map = sessions. Map map = sessions.findByIndexNameAndIndexValue(FindByIndexNameSessionRepository.PRINCIPAL_NAME_INDEX_NAME, id);
findByIndexNameAndIndexValue(FindByIndexNameSessionRepository.PRINCIPAL_NAME_INDEX_NAME, id);
if (map != null) { if (map != null) {
logger.debug(map.values().toArray().length); logger.debug(map.values().toArray().length);
for (Session session : map.values()) { for ( Object sessionObject : map.values()) {
Session session = (Session) sessionObject;
logger.debug(session.getId()); logger.debug(session.getId());
if (!session.isExpired()) { if (!session.isExpired()) {
SecurityContext securityContext = session.getAttribute(SPRING_SECURITY_CONTEXT_KEY); SecurityContext securityContext = session.getAttribute(SPRING_SECURITY_CONTEXT_KEY);

View File

@ -50,7 +50,7 @@ public class Converter {
return resultSet; return resultSet;
} }
public List<RepositoryInterface> toRepositoryInterfaceList(List<ApiDetails> apiDetailsList) throws JSONException { public List<RepositoryInterface> toRepositoryInterfaceList(List<ApiDetails> apiDetailsList) {
List<RepositoryInterface> resultSet = new ArrayList<>(); List<RepositoryInterface> resultSet = new ArrayList<>();

View File

@ -3,6 +3,7 @@ package eu.dnetlib.repo.manager.utils;
import eu.dnetlib.domain.functionality.validator.JobResultEntry; import eu.dnetlib.domain.functionality.validator.JobResultEntry;
import eu.dnetlib.domain.functionality.validator.StoredJob; import eu.dnetlib.domain.functionality.validator.StoredJob;
import org.eurocris.openaire.cris.validator.model.Job; import org.eurocris.openaire.cris.validator.model.Job;
import org.eurocris.openaire.cris.validator.model.Rule;
import org.eurocris.openaire.cris.validator.model.RuleResults; import org.eurocris.openaire.cris.validator.model.RuleResults;
import java.text.DateFormat; import java.text.DateFormat;
@ -20,14 +21,17 @@ public class CrisValidatorUtils {
StoredJob sj = new StoredJob(); StoredJob sj = new StoredJob();
sj.setId(job.getId().hashCode()); sj.setId(job.getId().hashCode());
sj.setValidationStatus(job.getStatus()); sj.setValidationStatus(job.getStatus());
if (job.getDateFinished() != null) {
sj.setEnded(DATE_FORMATTER.format(job.getDateFinished())); Date dateFinished = job.getDateFinished();
sj.setDuration(DURATION_FORMATTER.format(new Date(job.getDateFinished().getTime() - job.getDateStarted().getTime()))); Date dateStarted = job.getDateStarted();
if ( dateFinished != null ) {
sj.setEnded(DATE_FORMATTER.format(dateFinished));
sj.setDuration(DURATION_FORMATTER.format(new Date(dateFinished.getTime() - dateStarted.getTime())));
} else { } else {
sj.setEnded("-"); sj.setEnded("-");
sj.setDuration("-"); sj.setDuration("-");
} }
sj.setStarted(DATE_FORMATTER.format(job.getDateStarted())); sj.setStarted(DATE_FORMATTER.format(dateStarted));
sj.setUserEmail(job.getUser()); sj.setUserEmail(job.getUser());
sj.setCris(true); sj.setCris(true);
@ -56,21 +60,24 @@ public class CrisValidatorUtils {
public static List<JobResultEntry> crisResultsToJobEntries(Job crisJob) { public static List<JobResultEntry> crisResultsToJobEntries(Job crisJob) {
List<JobResultEntry> jobResultEntries = new ArrayList<>(); List<JobResultEntry> jobResultEntries = new ArrayList<>();
for (RuleResults ruleResults : crisJob.getRuleResults()) { for (RuleResults ruleResults : crisJob.getRuleResults()) {
Rule rule = ruleResults.getRule();
JobResultEntry jobResultEntry = new JobResultEntry(); JobResultEntry jobResultEntry = new JobResultEntry();
jobResultEntry.setName(ruleResults.getRule().getName()); jobResultEntry.setName(rule.getName());
jobResultEntry.setRuleId(ruleResults.getRule().getId()); jobResultEntry.setRuleId(rule.getId());
jobResultEntry.setDescription(ruleResults.getRule().getDescription()); jobResultEntry.setDescription(rule.getDescription());
jobResultEntry.setMandatory(true); jobResultEntry.setMandatory(true);
jobResultEntry.setWeight(Math.round(ruleResults.getRule().getWeight())); jobResultEntry.setWeight(Math.round(rule.getWeight()));
jobResultEntry.setType(ruleResults.getRule().getType()); jobResultEntry.setType(rule.getType());
jobResultEntry.setHasErrors(false); jobResultEntry.setHasErrors(false);
if (ruleResults.getCount() == 0) { long countRuleResults = ruleResults.getCount();
if (countRuleResults == 0) {
jobResultEntry.setSuccesses("-"); jobResultEntry.setSuccesses("-");
} else { } else {
jobResultEntry.setSuccesses(ruleResults.getCount() - ruleResults.getFailed() + "/" + ruleResults.getCount()); jobResultEntry.setSuccesses(countRuleResults - ruleResults.getFailed() + "/" + countRuleResults);
} }
if (ruleResults.getErrorMessages() != null && !ruleResults.getErrorMessages().isEmpty()) { List<String> errorMessages = ruleResults.getErrorMessages();
jobResultEntry.setErrors(ruleResults.getErrorMessages()); if (errorMessages != null && !errorMessages.isEmpty()) {
jobResultEntry.setErrors(errorMessages);
jobResultEntry.setHasErrors(true); jobResultEntry.setHasErrors(true);
} }
jobResultEntries.add(jobResultEntry); jobResultEntries.add(jobResultEntry);

View File

@ -85,12 +85,17 @@ public class HttpUtils {
} }
private JsonElement getResponseEntityAsJsonElement(ResponseEntity<String> responseEntity) { private JsonElement getResponseEntityAsJsonElement(ResponseEntity<String> responseEntity) {
if (responseEntity != null && responseEntity.getBody() != null) {
logger.debug(responseEntity.getBody()); if ( responseEntity == null )
return null;
String responseBody = responseEntity.getBody();
if ( responseBody != null ) {
logger.debug(responseBody);
try { try {
return new JsonParser().parse(responseEntity.getBody()); return new JsonParser().parse(responseBody);
} catch (Exception e) { } catch (Exception e) {
logger.warn("Could not parse response body", e); logger.warn("Could not parse response body", e); // Will return null.
} }
} }
return null; return null;

View File

@ -1,4 +1,4 @@
package eu.dnetlib.repo.manager.controllers; package eu.dnetlib.repo.manager.utils;
import eu.dnetlib.repo.manager.exception.EndPointException; import eu.dnetlib.repo.manager.exception.EndPointException;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;