moved some classes into the model module

This commit is contained in:
Michele Artini 2023-03-31 14:53:52 +02:00
parent fabcbaf511
commit ecb5ffca5a
82 changed files with 447 additions and 248 deletions

View File

@ -26,6 +26,11 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-cache</artifactId>
</dependency>
<dependency>
<groupId>eu.dnetlib.dhp</groupId>
<artifactId>dnet-exporter-model</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>eu.dnetlib</groupId>
<artifactId>cnr-rmi-api</artifactId>
@ -120,11 +125,12 @@
<version>3.4.2</version>
</dependency>
<dependency>
<!--<dependency>
<groupId>eu.dnetlib</groupId>
<artifactId>dnet-datasource-manager-common</artifactId>
<version>[2.0.1,3.0.0)</version>
</dependency>
-->
<dependency>
<groupId>org.springframework.boot</groupId>

View File

@ -16,10 +16,10 @@ import org.springframework.web.bind.annotation.ResponseStatus;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import eu.dnetlib.enabling.datasources.common.DsmException;
import eu.dnetlib.enabling.datasources.common.DsmForbiddenException;
import eu.dnetlib.enabling.datasources.common.DsmNotFoundException;
import eu.dnetlib.openaire.dsm.domain.Response;
import eu.dnetlib.openaire.exporter.exceptions.DsmException;
import eu.dnetlib.openaire.exporter.exceptions.DsmForbiddenException;
import eu.dnetlib.openaire.exporter.exceptions.DsmNotFoundException;
import eu.dnetlib.openaire.exporter.model.dsm.Response;
/**
* Created by claudio on 18/07/2017.

View File

@ -4,9 +4,9 @@ import java.io.IOException;
import java.util.List;
import java.util.Map;
import eu.dnetlib.enabling.datasources.common.DsmException;
import eu.dnetlib.openaire.context.Context;
import eu.dnetlib.openaire.dsm.dao.utils.IndexDsInfo;
import eu.dnetlib.openaire.exporter.exceptions.DsmException;
import eu.dnetlib.openaire.exporter.model.context.Context;
public interface ISClient {

View File

@ -28,13 +28,13 @@ import com.google.common.escape.Escaper;
import com.google.common.xml.XmlEscapers;
import eu.dnetlib.DnetOpenaireExporterProperties;
import eu.dnetlib.enabling.datasources.common.DsmException;
import eu.dnetlib.enabling.datasources.common.DsmRuntimeException;
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpException;
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService;
import eu.dnetlib.openaire.context.Context;
import eu.dnetlib.openaire.context.ContextMappingUtils;
import eu.dnetlib.openaire.dsm.dao.utils.IndexDsInfo;
import eu.dnetlib.openaire.exporter.exceptions.DsmException;
import eu.dnetlib.openaire.exporter.exceptions.DsmRuntimeException;
import eu.dnetlib.openaire.exporter.model.context.Context;
/**
* Created by claudio on 20/10/2016.
@ -105,20 +105,18 @@ public class ISClientImpl implements ISClient {
}
}
@Override
@CacheEvict(value = {
"context-cache", "context-cache-funder"
}, allEntries = true)
public void updateContextParam(final String id, final String name, final String value, boolean toEscape) {
public void updateContextParam(final String id, final String name, final String value, final boolean toEscape) {
if (getSize(id, name) > 0) {
try {
_quickSeachProfile(getXQuery(id, name, value, toEscape));
} catch (final ISLookUpException e) {
throw new DsmRuntimeException(String.format("unable to update context param [id: %s, name: %s, value: %s]", id, name, value), e);
}
}
else{
} else {
try {
_quickSeachProfile(getInsertXQuery(id, name, value, toEscape));
} catch (final ISLookUpException e) {
@ -126,14 +124,15 @@ public class ISClientImpl implements ISClient {
}
}
}
private int getSize(String id, String name) {
private int getSize(final String id, final String name) {
int size = 0;
try {
size = _quickSeachProfile(String.format("for $x in collection('/db/DRIVER/ContextDSResources/ContextDSResourceType') where $x//context[@id='%s']/param[@name='%s'] return $x", id, name)).size();
} catch (ISLookUpException e) {
size = _quickSeachProfile(String
.format("for $x in collection('/db/DRIVER/ContextDSResources/ContextDSResourceType') where $x//context[@id='%s']/param[@name='%s'] return $x", id, name))
.size();
} catch (final ISLookUpException e) {
throw new DsmRuntimeException("unable to execute search query", e);
}
return size;
@ -222,13 +221,13 @@ public class ISClientImpl implements ISClient {
/// HELPERS
private String getInsertXQuery(final String id, final String paramName, final String paramValue, final boolean toEscape) {
String value;
if(toEscape)
if (toEscape) {
value = escape(XmlEscapers.xmlContentEscaper(), paramValue);
else
} else {
value = paramValue;
}
if (StringUtils.isNotBlank(value)) {
return String.format("update insert <param name='%s'>%s</param> into collection('/db/DRIVER/ContextDSResources/ContextDSResourceType')" +
"/RESOURCE_PROFILE/BODY/CONFIGURATION/context[./@id = '%s']", paramName, value, id);
@ -240,8 +239,9 @@ public class ISClientImpl implements ISClient {
private String getXQuery(final String id, final String name, final String paramValue, final boolean toEscape) {
String value = paramValue;
if (toEscape)
if (toEscape) {
value = escape(XmlEscapers.xmlContentEscaper(), paramValue);
}
if (StringUtils.isNotBlank(value)) {
return String.format("update replace collection('/db/DRIVER/ContextDSResources/ContextDSResourceType')" +
@ -255,7 +255,8 @@ public class ISClientImpl implements ISClient {
// private String getXQueryNoEscape(final String id, final String name, final String value) {
// if (StringUtils.isNotBlank(value)) {
// return String.format("update replace collection('/db/DRIVER/ContextDSResources/ContextDSResourceType')" +
// "/RESOURCE_PROFILE/BODY/CONFIGURATION/context[./@id = '%s']/param[./@name = '%s'] with <param name='%s'>%s</param>", id, name, name, value);
// "/RESOURCE_PROFILE/BODY/CONFIGURATION/context[./@id = '%s']/param[./@name = '%s'] with <param name='%s'>%s</param>", id, name, name,
// value);
// } else {
// return String.format("update replace collection('/db/DRIVER/ContextDSResources/ContextDSResourceType')" +
// "/RESOURCE_PROFILE/BODY/CONFIGURATION/context[./@id = '%s']/param[./@name = '%s'] with <param name='%s'/>", id, name, name);

View File

@ -10,7 +10,18 @@ import static eu.dnetlib.openaire.common.ExporterConstants.W;
import java.util.List;
import eu.dnetlib.openaire.community.selectioncriteria.SelectionCriteria;
import eu.dnetlib.openaire.exporter.exceptions.CommunityException;
import eu.dnetlib.openaire.exporter.exceptions.CommunityNotFoundException;
import eu.dnetlib.openaire.exporter.model.community.CommunityContentprovider;
import eu.dnetlib.openaire.exporter.model.community.CommunityDetails;
import eu.dnetlib.openaire.exporter.model.community.CommunityOpenAIRECommunities;
import eu.dnetlib.openaire.exporter.model.community.CommunityOrganization;
import eu.dnetlib.openaire.exporter.model.community.CommunityProject;
import eu.dnetlib.openaire.exporter.model.community.CommunitySummary;
import eu.dnetlib.openaire.exporter.model.community.CommunityWritableProperties;
import eu.dnetlib.openaire.exporter.model.community.CommunityZenodoCommunity;
import eu.dnetlib.openaire.exporter.model.community.selectioncriteria.SelectionCriteria;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.web.bind.annotation.CrossOrigin;

View File

@ -4,7 +4,19 @@ import java.util.*;
import java.util.stream.Collectors;
import com.google.gson.Gson;
import eu.dnetlib.openaire.community.selectioncriteria.SelectionCriteria;
import eu.dnetlib.openaire.exporter.exceptions.CommunityException;
import eu.dnetlib.openaire.exporter.exceptions.CommunityNotFoundException;
import eu.dnetlib.openaire.exporter.model.community.CommunityContentprovider;
import eu.dnetlib.openaire.exporter.model.community.CommunityDetails;
import eu.dnetlib.openaire.exporter.model.community.CommunityOpenAIRECommunities;
import eu.dnetlib.openaire.exporter.model.community.CommunityOrganization;
import eu.dnetlib.openaire.exporter.model.community.CommunityProject;
import eu.dnetlib.openaire.exporter.model.community.CommunitySummary;
import eu.dnetlib.openaire.exporter.model.community.CommunityWritableProperties;
import eu.dnetlib.openaire.exporter.model.community.CommunityZenodoCommunity;
import eu.dnetlib.openaire.exporter.model.community.selectioncriteria.SelectionCriteria;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

View File

@ -3,6 +3,9 @@ package eu.dnetlib.openaire.community;
import java.util.Map;
import java.util.Set;
import eu.dnetlib.openaire.exporter.exceptions.CommunityException;
import eu.dnetlib.openaire.exporter.exceptions.CommunityNotFoundException;
public interface CommunityClient {
Map<String, Set<String>> getInverseZenodoCommunityMap() throws CommunityException, CommunityNotFoundException;

View File

@ -8,6 +8,11 @@ import org.springframework.cache.annotation.Cacheable;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import eu.dnetlib.openaire.exporter.exceptions.CommunityException;
import eu.dnetlib.openaire.exporter.exceptions.CommunityNotFoundException;
import eu.dnetlib.openaire.exporter.model.community.CommunitySummary;
import eu.dnetlib.openaire.exporter.model.community.CommunityZenodoCommunity;
import java.util.*;
@Component

View File

@ -4,11 +4,21 @@ import com.google.common.base.Joiner;
import com.google.common.collect.Lists;
import com.google.gson.Gson;
import eu.dnetlib.openaire.common.ISClient;
import eu.dnetlib.openaire.community.selectioncriteria.SelectionCriteria;
import eu.dnetlib.openaire.context.Category;
import eu.dnetlib.openaire.context.Concept;
import eu.dnetlib.openaire.context.Context;
import eu.dnetlib.openaire.context.Param;
import eu.dnetlib.openaire.exporter.exceptions.CommunityException;
import eu.dnetlib.openaire.exporter.exceptions.CommunityNotFoundException;
import eu.dnetlib.openaire.exporter.model.community.CommunityContentprovider;
import eu.dnetlib.openaire.exporter.model.community.CommunityDetails;
import eu.dnetlib.openaire.exporter.model.community.CommunityOrganization;
import eu.dnetlib.openaire.exporter.model.community.CommunityProject;
import eu.dnetlib.openaire.exporter.model.community.CommunitySummary;
import eu.dnetlib.openaire.exporter.model.community.CommunityWritableProperties;
import eu.dnetlib.openaire.exporter.model.community.CommunityZenodoCommunity;
import eu.dnetlib.openaire.exporter.model.community.selectioncriteria.SelectionCriteria;
import eu.dnetlib.openaire.exporter.model.context.Category;
import eu.dnetlib.openaire.exporter.model.context.Concept;
import eu.dnetlib.openaire.exporter.model.context.Context;
import eu.dnetlib.openaire.exporter.model.context.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

View File

@ -7,10 +7,19 @@ import java.util.stream.Stream;
import com.google.common.escape.Escaper;
import com.google.common.xml.XmlEscapers;
import eu.dnetlib.openaire.community.selectioncriteria.SelectionCriteria;
import eu.dnetlib.openaire.context.Concept;
import eu.dnetlib.openaire.context.Context;
import eu.dnetlib.openaire.context.Param;
import eu.dnetlib.openaire.exporter.model.community.CommunityContentprovider;
import eu.dnetlib.openaire.exporter.model.community.CommunityDetails;
import eu.dnetlib.openaire.exporter.model.community.CommunityOrganization;
import eu.dnetlib.openaire.exporter.model.community.CommunityProject;
import eu.dnetlib.openaire.exporter.model.community.CommunityStatus;
import eu.dnetlib.openaire.exporter.model.community.CommunitySummary;
import eu.dnetlib.openaire.exporter.model.community.CommunityZenodoCommunity;
import eu.dnetlib.openaire.exporter.model.community.selectioncriteria.SelectionCriteria;
import eu.dnetlib.openaire.exporter.model.context.Concept;
import eu.dnetlib.openaire.exporter.model.context.Context;
import eu.dnetlib.openaire.exporter.model.context.Param;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

View File

@ -12,6 +12,10 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import eu.dnetlib.openaire.exporter.exceptions.ContextException;
import eu.dnetlib.openaire.exporter.model.context.CategorySummary;
import eu.dnetlib.openaire.exporter.model.context.ConceptSummary;
import eu.dnetlib.openaire.exporter.model.context.ContextSummary;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;

View File

@ -15,6 +15,13 @@ import com.google.common.base.Splitter;
import com.google.common.collect.Lists;
import eu.dnetlib.openaire.common.ISClient;
import eu.dnetlib.openaire.exporter.exceptions.ContextException;
import eu.dnetlib.openaire.exporter.model.context.Category;
import eu.dnetlib.openaire.exporter.model.context.CategorySummary;
import eu.dnetlib.openaire.exporter.model.context.Concept;
import eu.dnetlib.openaire.exporter.model.context.ConceptSummary;
import eu.dnetlib.openaire.exporter.model.context.Context;
import eu.dnetlib.openaire.exporter.model.context.ContextSummary;
@Component
@ConditionalOnProperty(value = "openaire.exporter.enable.context", havingValue = "true")

View File

@ -20,7 +20,11 @@ import org.dom4j.Node;
import com.google.common.base.Functions;
import com.google.common.collect.Lists;
import eu.dnetlib.openaire.funders.domain.FunderDetails;
import eu.dnetlib.openaire.exporter.model.context.Category;
import eu.dnetlib.openaire.exporter.model.context.Concept;
import eu.dnetlib.openaire.exporter.model.context.Context;
import eu.dnetlib.openaire.exporter.model.context.Param;
import eu.dnetlib.openaire.exporter.model.funders.FunderDetails;
public class ContextMappingUtils {

View File

@ -24,9 +24,6 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import eu.dnetlib.enabling.datasources.common.DsmException;
import eu.dnetlib.enabling.datasources.common.DsmForbiddenException;
import eu.dnetlib.enabling.datasources.common.DsmNotFoundException;
import eu.dnetlib.openaire.common.AbstractExporterController;
import eu.dnetlib.openaire.common.OperationManager;
import eu.dnetlib.openaire.dsm.domain.AggregationHistoryResponseV1;
@ -41,8 +38,11 @@ import eu.dnetlib.openaire.dsm.domain.RegisteredDatasourceInfo;
import eu.dnetlib.openaire.dsm.domain.RequestFilter;
import eu.dnetlib.openaire.dsm.domain.RequestSort;
import eu.dnetlib.openaire.dsm.domain.RequestSortOrder;
import eu.dnetlib.openaire.dsm.domain.SimpleResponse;
import eu.dnetlib.openaire.vocabularies.Country;
import eu.dnetlib.openaire.exporter.exceptions.DsmException;
import eu.dnetlib.openaire.exporter.exceptions.DsmForbiddenException;
import eu.dnetlib.openaire.exporter.exceptions.DsmNotFoundException;
import eu.dnetlib.openaire.exporter.model.dsm.SimpleResponse;
import eu.dnetlib.openaire.exporter.model.vocabularies.Country;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;

View File

@ -15,12 +15,12 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import eu.dnetlib.enabling.datasources.common.DsmException;
import eu.dnetlib.openaire.common.AbstractExporterController;
import eu.dnetlib.openaire.dsm.dao.ResponseUtils;
import eu.dnetlib.openaire.dsm.domain.AggregationHistoryResponseV2;
import eu.dnetlib.openaire.dsm.domain.SimpleDatasourceInfo;
import eu.dnetlib.openaire.dsm.domain.SimpleResponse;
import eu.dnetlib.openaire.exporter.exceptions.DsmException;
import eu.dnetlib.openaire.exporter.model.dsm.SimpleResponse;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;

View File

@ -30,9 +30,6 @@ import org.springframework.jdbc.core.RowMapper;
import org.springframework.stereotype.Component;
import eu.dnetlib.enabling.datasources.common.AggregationInfo;
import eu.dnetlib.enabling.datasources.common.DsmException;
import eu.dnetlib.enabling.datasources.common.DsmForbiddenException;
import eu.dnetlib.enabling.datasources.common.DsmNotFoundException;
import eu.dnetlib.openaire.common.ISClient;
import eu.dnetlib.openaire.community.CommunityClient;
import eu.dnetlib.openaire.dsm.dao.DatasourceDao;
@ -55,11 +52,14 @@ import eu.dnetlib.openaire.dsm.domain.RequestFilter;
import eu.dnetlib.openaire.dsm.domain.RequestSort;
import eu.dnetlib.openaire.dsm.domain.RequestSortOrder;
import eu.dnetlib.openaire.dsm.domain.SimpleDatasourceInfo;
import eu.dnetlib.openaire.dsm.domain.SimpleResponse;
import eu.dnetlib.openaire.dsm.domain.db.ApiDbEntry;
import eu.dnetlib.openaire.dsm.domain.db.DatasourceDbEntry;
import eu.dnetlib.openaire.dsm.domain.db.IdentityDbEntry;
import eu.dnetlib.openaire.vocabularies.Country;
import eu.dnetlib.openaire.exporter.exceptions.DsmException;
import eu.dnetlib.openaire.exporter.exceptions.DsmForbiddenException;
import eu.dnetlib.openaire.exporter.exceptions.DsmNotFoundException;
import eu.dnetlib.openaire.exporter.model.dsm.SimpleResponse;
import eu.dnetlib.openaire.exporter.model.vocabularies.Country;
@Component
@ConditionalOnProperty(value = "openaire.exporter.enable.dsm", havingValue = "true")

View File

@ -5,13 +5,11 @@ import java.util.List;
import org.springframework.data.domain.Page;
import eu.dnetlib.enabling.datasources.common.Api;
import eu.dnetlib.enabling.datasources.common.Datasource;
import eu.dnetlib.enabling.datasources.common.DatasourceManagerCommon;
import eu.dnetlib.enabling.datasources.common.DsmException;
import eu.dnetlib.openaire.dsm.domain.RequestFilter;
import eu.dnetlib.openaire.dsm.domain.RequestSort;
import eu.dnetlib.openaire.dsm.domain.RequestSortOrder;
import eu.dnetlib.openaire.vocabularies.Country;
import eu.dnetlib.openaire.exporter.exceptions.DsmException;
import eu.dnetlib.openaire.exporter.model.vocabularies.Country;
public interface DatasourceDao<DS extends Datasource<?, ?, ?>, API extends Api<?>> extends DatasourceManagerCommon<DS, API> {

View File

@ -30,9 +30,6 @@ import org.springframework.transaction.annotation.Transactional;
import com.google.common.collect.Lists;
import eu.dnetlib.DnetOpenaireExporterProperties;
import eu.dnetlib.enabling.datasources.common.DsmException;
import eu.dnetlib.enabling.datasources.common.DsmForbiddenException;
import eu.dnetlib.enabling.datasources.common.DsmNotFoundException;
import eu.dnetlib.openaire.dsm.domain.RequestFilter;
import eu.dnetlib.openaire.dsm.domain.RequestSort;
import eu.dnetlib.openaire.dsm.domain.RequestSortOrder;
@ -40,8 +37,11 @@ import eu.dnetlib.openaire.dsm.domain.db.ApiDbEntry;
import eu.dnetlib.openaire.dsm.domain.db.ApiParamDbEntry;
import eu.dnetlib.openaire.dsm.domain.db.DatasourceApiDbEntry;
import eu.dnetlib.openaire.dsm.domain.db.DatasourceDbEntry;
import eu.dnetlib.openaire.vocabularies.Country;
import eu.dnetlib.openaire.vocabularies.Vocabulary;
import eu.dnetlib.openaire.exporter.exceptions.DsmException;
import eu.dnetlib.openaire.exporter.exceptions.DsmForbiddenException;
import eu.dnetlib.openaire.exporter.exceptions.DsmNotFoundException;
import eu.dnetlib.openaire.exporter.model.vocabularies.Country;
import eu.dnetlib.openaire.exporter.model.vocabularies.Vocabulary;
/**
* Created by claudio on 20/10/2016.

View File

@ -2,9 +2,9 @@ package eu.dnetlib.openaire.dsm.dao;
import java.util.Queue;
import eu.dnetlib.enabling.datasources.common.DsmException;
import eu.dnetlib.openaire.dsm.dao.utils.IndexDsInfo;
import eu.dnetlib.openaire.dsm.dao.utils.IndexRecordsInfo;
import eu.dnetlib.openaire.exporter.exceptions.DsmException;
public interface DatasourceIndexClient {
@ -12,6 +12,4 @@ public interface DatasourceIndexClient {
String getLastIndexingDate(final IndexDsInfo info) throws DsmException;
}

View File

@ -5,19 +5,15 @@ import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Queue;
import java.util.concurrent.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import com.google.common.util.concurrent.*;
import eu.dnetlib.DnetOpenaireExporterProperties;
import eu.dnetlib.enabling.datasources.common.DsmException;
import eu.dnetlib.miscutils.functional.hash.Hashing;
import eu.dnetlib.openaire.dsm.dao.utils.DsmMappingUtils;
import eu.dnetlib.openaire.dsm.dao.utils.IndexDsInfo;
import eu.dnetlib.openaire.dsm.dao.utils.IndexRecordsInfo;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateFormatUtils;
import org.apache.commons.logging.Log;
@ -33,6 +29,21 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Component;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListeningExecutorService;
import com.google.common.util.concurrent.MoreExecutors;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import eu.dnetlib.DnetOpenaireExporterProperties;
import eu.dnetlib.miscutils.functional.hash.Hashing;
import eu.dnetlib.openaire.dsm.dao.utils.DsmMappingUtils;
import eu.dnetlib.openaire.dsm.dao.utils.IndexDsInfo;
import eu.dnetlib.openaire.dsm.dao.utils.IndexRecordsInfo;
import eu.dnetlib.openaire.exporter.exceptions.DsmException;
/**
* Created by claudio on 20/10/2016.
*/
@ -54,8 +65,7 @@ public class DatasourceIndexClientImpl implements DatasourceIndexClient {
@PostConstruct
public void init() {
executor = MoreExecutors.listeningDecorator(
new ScheduledThreadPoolExecutor(5,
executor = MoreExecutors.listeningDecorator(new ScheduledThreadPoolExecutor(5,
new ThreadFactoryBuilder().setNameFormat("datasource-index-client-%d").build()));
}
@ -64,7 +74,7 @@ public class DatasourceIndexClientImpl implements DatasourceIndexClient {
indexClientMap.forEach((name, client) -> {
try {
client.close();
} catch (IOException e) {
} catch (final IOException e) {
log.warn(String.format("unable to gracefully shutdown client for index %s", name));
}
});
@ -78,9 +88,7 @@ public class DatasourceIndexClientImpl implements DatasourceIndexClient {
final CountDownLatch latch = new CountDownLatch(2);
final IndexRecordsInfo indexRecordInfo = new IndexRecordsInfo();
Futures.addCallback(
executor.submit(() -> setDateAndTotal(dsId, collectedFrom, indexClient)),
new FutureCallback<IndexRecordsInfo>() {
Futures.addCallback(executor.submit(() -> setDateAndTotal(dsId, collectedFrom, indexClient)), new FutureCallback<IndexRecordsInfo>() {
@Override
public void onSuccess(final IndexRecordsInfo info) {
@ -97,9 +105,7 @@ public class DatasourceIndexClientImpl implements DatasourceIndexClient {
}
}, executor);
Futures.addCallback(
executor.submit(() -> setFunded(dsId, collectedFrom, indexClient)),
new FutureCallback<Long>() {
Futures.addCallback(executor.submit(() -> setFunded(dsId, collectedFrom, indexClient)), new FutureCallback<Long>() {
@Override
public void onSuccess(final Long numFound) {
@ -143,7 +149,7 @@ public class DatasourceIndexClientImpl implements DatasourceIndexClient {
log.debug(String.format("query: %s", query));
try {
return indexClient.query(new SolrQuery(query).setRows(0)).getResults().getNumFound();
} catch (Throwable e) {
} catch (final Throwable e) {
throw new DsmException(HttpStatus.INTERNAL_SERVER_ERROR.value(), String.format("Error querying index for funded results '%s'", dsId), e);
}
}
@ -168,7 +174,7 @@ public class DatasourceIndexClientImpl implements DatasourceIndexClient {
return new IndexRecordsInfo()
.setDate(getDate(doc))
.setTotal(rsp.getResults().getNumFound());
} catch (Throwable e) {
} catch (final Throwable e) {
throw new DsmException(HttpStatus.INTERNAL_SERVER_ERROR.value(), String.format("Error querying index for date and total '%s'", dsId), e);
}
}
@ -176,8 +182,10 @@ public class DatasourceIndexClientImpl implements DatasourceIndexClient {
@SuppressWarnings("unchecked")
private String getDate(final SolrDocument doc) throws DsmException {
final List<Date> dsversion = (List<Date>) doc.get(DSVERSION);
if (dsversion == null || dsversion.isEmpty()) { throw new DsmException(HttpStatus.INTERNAL_SERVER_ERROR.value(),
String.format("cannot find %s in matched solr document", DSVERSION)); }
if (dsversion == null || dsversion.isEmpty()) {
throw new DsmException(HttpStatus.INTERNAL_SERVER_ERROR.value(),
String.format("cannot find %s in matched solr document", DSVERSION));
}
final Date date = Iterables.getLast(dsversion);
return DateFormatUtils.format(date, DsmMappingUtils.DATE_FORMAT);

View File

@ -16,13 +16,13 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.data.jpa.domain.Specification;
import eu.dnetlib.enabling.datasources.common.DsmRuntimeException;
import eu.dnetlib.openaire.dsm.domain.FilterName;
import eu.dnetlib.openaire.dsm.domain.RequestFilter;
import eu.dnetlib.openaire.dsm.domain.RequestSort;
import eu.dnetlib.openaire.dsm.domain.RequestSortOrder;
import eu.dnetlib.openaire.dsm.domain.db.DatasourceApiDbEntry;
import eu.dnetlib.openaire.dsm.domain.db.DatasourceDbEntry;
import eu.dnetlib.openaire.exporter.exceptions.DsmRuntimeException;
public class DatasourceSpecs {

View File

@ -2,9 +2,8 @@ package eu.dnetlib.openaire.dsm.dao;
import java.util.List;
import eu.dnetlib.enabling.datasources.common.AggregationInfo;
import eu.dnetlib.enabling.datasources.common.DsmException;
import eu.dnetlib.openaire.dsm.domain.AggregationInfoV1;
import eu.dnetlib.openaire.exporter.exceptions.DsmException;
public interface MongoLoggerClient {

View File

@ -43,7 +43,6 @@ import eu.dnetlib.DnetOpenaireExporterProperties;
import eu.dnetlib.DnetOpenaireExporterProperties.Datasource;
import eu.dnetlib.enabling.datasources.common.AggregationInfo;
import eu.dnetlib.enabling.datasources.common.AggregationStage;
import eu.dnetlib.enabling.datasources.common.DsmException;
import eu.dnetlib.miscutils.datetime.DateUtils;
import eu.dnetlib.openaire.common.Utils;
import eu.dnetlib.openaire.dsm.dao.utils.DsmMappingUtils;
@ -53,6 +52,7 @@ import eu.dnetlib.openaire.dsm.domain.CollectionInfoV2;
import eu.dnetlib.openaire.dsm.domain.CollectionMode;
import eu.dnetlib.openaire.dsm.domain.TransformationInfoV1;
import eu.dnetlib.openaire.dsm.domain.TransformationInfoV2;
import eu.dnetlib.openaire.exporter.exceptions.DsmException;
import eu.dnetlib.openaire.info.JdbcInfoDao;
/**

View File

@ -1,6 +1,6 @@
package eu.dnetlib.openaire.dsm.dao;
import eu.dnetlib.enabling.datasources.common.DsmException;
import eu.dnetlib.openaire.exporter.exceptions.DsmException;
public interface ObjectStoreClient {

View File

@ -1,8 +1,5 @@
package eu.dnetlib.openaire.dsm.dao;
import eu.dnetlib.data.objectstore.rmi.ObjectStoreService;
import eu.dnetlib.data.objectstore.rmi.ObjectStoreServiceException;
import eu.dnetlib.enabling.datasources.common.DsmException;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@ -10,6 +7,10 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.stereotype.Component;
import eu.dnetlib.data.objectstore.rmi.ObjectStoreService;
import eu.dnetlib.data.objectstore.rmi.ObjectStoreServiceException;
import eu.dnetlib.openaire.exporter.exceptions.DsmException;
@Component
@ConditionalOnProperty(value = "openaire.exporter.enable.dsm", havingValue = "true")
public class ObjectStoreClientImpl implements ObjectStoreClient {
@ -22,14 +23,12 @@ public class ObjectStoreClientImpl implements ObjectStoreClient {
@Override
public Long getObjectStoreSize(final String objectStoreId) throws DsmException {
log.debug("get size for objectStore " + objectStoreId);
if (StringUtils.isBlank(objectStoreId)) {
return 0L;
}
if (StringUtils.isBlank(objectStoreId)) { return 0L; }
try {
final long size = objectStoreService.getSize(objectStoreId);
log.debug("got objectStore size: " + size);
return size;
} catch (ObjectStoreServiceException e) {
} catch (final ObjectStoreServiceException e) {
throw new DsmException("unable to get size for objectStore " + objectStoreId);
}
}

View File

@ -13,8 +13,8 @@ import eu.dnetlib.openaire.dsm.domain.DatasourceInfo;
import eu.dnetlib.openaire.dsm.domain.DatasourceSearchResponse;
import eu.dnetlib.openaire.dsm.domain.DatasourceSnippetExtended;
import eu.dnetlib.openaire.dsm.domain.DatasourceSnippetResponse;
import eu.dnetlib.openaire.dsm.domain.Header;
import eu.dnetlib.openaire.dsm.domain.SimpleResponse;
import eu.dnetlib.openaire.exporter.model.dsm.Header;
import eu.dnetlib.openaire.exporter.model.dsm.SimpleResponse;
public class ResponseUtils {

View File

@ -1,7 +1,6 @@
package eu.dnetlib.openaire.dsm.dao;
import eu.dnetlib.enabling.datasources.common.DsmException;
import eu.dnetlib.openaire.vocabularies.Vocabulary;
import eu.dnetlib.openaire.exporter.exceptions.DsmException;
public interface VocabularyClient {

View File

@ -2,7 +2,8 @@ package eu.dnetlib.openaire.dsm.dao;
import eu.dnetlib.DnetOpenaireExporterProperties;
import eu.dnetlib.enabling.datasources.common.DsmException;
import eu.dnetlib.openaire.vocabularies.Vocabulary;
import eu.dnetlib.openaire.exporter.model.vocabularies.Vocabulary;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;

View File

@ -4,6 +4,8 @@ import java.util.List;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import eu.dnetlib.openaire.exporter.model.dsm.Response;
@JsonAutoDetect
@Deprecated
public class AggregationHistoryResponseV1 extends Response {

View File

@ -5,6 +5,7 @@ import java.util.List;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import eu.dnetlib.enabling.datasources.common.AggregationInfo;
import eu.dnetlib.openaire.exporter.model.dsm.Response;
@JsonAutoDetect
public class AggregationHistoryResponseV2 extends Response {

View File

@ -4,6 +4,7 @@ import java.util.List;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import eu.dnetlib.openaire.exporter.model.dsm.Response;
import io.swagger.v3.oas.annotations.media.Schema;

View File

@ -4,6 +4,8 @@ import java.util.List;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import eu.dnetlib.openaire.exporter.model.dsm.Response;
@JsonAutoDetect
public class DatasourceDetailResponse extends Response {

View File

@ -5,6 +5,8 @@ import java.util.List;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.google.common.collect.Lists;
import eu.dnetlib.openaire.exporter.model.dsm.Response;
@JsonAutoDetect
public class DatasourceResponse<T> extends Response {

View File

@ -4,6 +4,8 @@ import java.util.List;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import eu.dnetlib.openaire.exporter.model.dsm.Response;
@JsonAutoDetect
public class DatasourceSearchResponse extends Response {

View File

@ -4,6 +4,8 @@ import java.util.List;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import eu.dnetlib.openaire.exporter.model.dsm.Response;
@JsonAutoDetect
public class DatasourceSnippetResponse extends Response {

View File

@ -1,8 +1,11 @@
package eu.dnetlib.openaire.funders.domain;
package eu.dnetlib.openaire.funders;
import java.io.StringReader;
import java.util.stream.Collectors;
import eu.dnetlib.openaire.exporter.model.funders.ExtendedFunderDetails;
import eu.dnetlib.openaire.exporter.model.funders.FunderDetails;
import eu.dnetlib.openaire.exporter.model.funders.FundingStream;
import eu.dnetlib.openaire.funders.domain.db.FunderDbEntry;
import eu.dnetlib.openaire.funders.domain.db.FundingPathDbEntry;
import org.dom4j.Document;

View File

@ -8,9 +8,9 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Component;
import eu.dnetlib.openaire.funders.domain.ConversionUtils;
import eu.dnetlib.openaire.funders.domain.ExtendedFunderDetails;
import eu.dnetlib.openaire.funders.domain.FunderDetails;
import eu.dnetlib.openaire.exporter.exceptions.FundersApiException;
import eu.dnetlib.openaire.exporter.model.funders.ExtendedFunderDetails;
import eu.dnetlib.openaire.exporter.model.funders.FunderDetails;
@Component
@ConditionalOnProperty(value = "openaire.exporter.enable.funders", havingValue = "true")

View File

@ -13,8 +13,9 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import eu.dnetlib.openaire.common.AbstractExporterController;
import eu.dnetlib.openaire.funders.domain.ExtendedFunderDetails;
import eu.dnetlib.openaire.funders.domain.FunderDetails;
import eu.dnetlib.openaire.exporter.exceptions.FundersApiException;
import eu.dnetlib.openaire.exporter.model.funders.ExtendedFunderDetails;
import eu.dnetlib.openaire.exporter.model.funders.FunderDetails;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;

View File

@ -19,6 +19,8 @@ import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.http.MediaType;
import org.springframework.test.web.servlet.MockMvc;
import eu.dnetlib.openaire.exporter.model.community.CommunitySummary;
/**
* Created by Alessia Bardi on 2019-04-04.
*

View File

@ -2,6 +2,10 @@ package eu.dnetlib.openaire.community.selectioncriteria;
import com.google.gson.Gson;
import eu.dnetlib.data.bulktag.selectioncriteria.Selection;
import eu.dnetlib.openaire.exporter.model.community.selectioncriteria.Constraint;
import eu.dnetlib.openaire.exporter.model.community.selectioncriteria.Constraints;
import eu.dnetlib.openaire.exporter.model.community.selectioncriteria.SelectionCriteria;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;

View File

@ -13,6 +13,8 @@ import org.junit.jupiter.api.Test;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import eu.dnetlib.openaire.exporter.model.context.Context;
/**
* Created by Alessia Bardi on 2019-04-04.
*

View File

@ -23,7 +23,7 @@ import eu.dnetlib.enabling.datasources.common.DsmException;
import eu.dnetlib.openaire.dsm.dao.utils.DsmMappingUtils;
import eu.dnetlib.openaire.dsm.domain.DatasourceDetails;
import eu.dnetlib.openaire.dsm.domain.db.DatasourceDbEntry;
import eu.dnetlib.openaire.vocabularies.Country;
import eu.dnetlib.openaire.exporter.model.vocabularies.Country;
@SpringBootTest
@WebMvcTest(DsmApiController.class)

View File

@ -14,9 +14,9 @@ import org.junit.jupiter.api.Test;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import eu.dnetlib.openaire.context.Context;
import eu.dnetlib.openaire.context.ContextMappingUtils;
import eu.dnetlib.openaire.funders.domain.FunderDetails;
import eu.dnetlib.openaire.exporter.model.context.Context;
import eu.dnetlib.openaire.exporter.model.funders.FunderDetails;
public class FunderContextClientTest {

View File

@ -0,0 +1,16 @@
DsmApiControllerV2
SimpleDatasourceInfo
AggregationHistoryResponseV2
DsmApiController
DatasourceDetailResponse
AggregationHistoryResponseV1
DatasourceSnippetResponse
RegisteredDatasourceInfo
ApiDetailsResponse
DatasourceDetails
DatasourceDetailsWithApis
DatasourceDetailsUpdate
ApiDetails
RequestFilter

View File

@ -24,6 +24,12 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-common</artifactId>
<version>1.6.10</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>

View File

@ -1,13 +1,7 @@
package eu.dnetlib.openaire.community;
package eu.dnetlib.openaire.exporter.exceptions;
import java.io.IOException;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ResponseStatus;
@ResponseBody
@ResponseStatus(value = HttpStatus.INTERNAL_SERVER_ERROR)
public class CommunityException extends Exception {
/**

View File

@ -1,11 +1,5 @@
package eu.dnetlib.openaire.community;
package eu.dnetlib.openaire.exporter.exceptions;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ResponseStatus;
@ResponseBody
@ResponseStatus(value = HttpStatus.NOT_FOUND)
public class CommunityNotFoundException extends Exception {
/**

View File

@ -1,13 +1,7 @@
package eu.dnetlib.openaire.context;
package eu.dnetlib.openaire.exporter.exceptions;
import java.io.IOException;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ResponseStatus;
@ResponseBody
@ResponseStatus(value = HttpStatus.INTERNAL_SERVER_ERROR)
public class ContextException extends Exception {
/**

View File

@ -1,11 +1,5 @@
package eu.dnetlib.openaire.context;
package eu.dnetlib.openaire.exporter.exceptions;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ResponseStatus;
@ResponseBody
@ResponseStatus(value = HttpStatus.NOT_FOUND)
public class ContextNotFoundException extends Exception {
/**

View File

@ -0,0 +1,36 @@
package eu.dnetlib.openaire.exporter.exceptions;
public class DsmException extends Exception {
private static final long serialVersionUID = -8173126561260106405L;
private int code;
public DsmException(final int code, final String msg) {
super(msg);
this.code = code;
}
public DsmException(final int code, final Throwable e) {
super(e);
this.code = code;
}
public DsmException(final int code, final String msg, final Throwable e) {
super(msg, e);
this.code = code;
}
public DsmException(final String msg) {
this(500, msg);
}
public int getCode() {
return code;
}
public void setCode(final int code) {
this.code = code;
}
}

View File

@ -0,0 +1,23 @@
package eu.dnetlib.openaire.exporter.exceptions;
public class DsmForbiddenException extends DsmException {
private static final long serialVersionUID = -6538032715005339181L;
public DsmForbiddenException(final int code, final String msg) {
super(code, msg);
}
public DsmForbiddenException(final int code, final Throwable e) {
super(code, e);
}
public DsmForbiddenException(final int code, final String msg, final Throwable e) {
super(code, msg, e);
}
public DsmForbiddenException(final String msg) {
this(403, msg);
}
}

View File

@ -0,0 +1,23 @@
package eu.dnetlib.openaire.exporter.exceptions;
public class DsmNotFoundException extends DsmException {
private static final long serialVersionUID = 1327980530652540728L;
public DsmNotFoundException(final int code, final String msg) {
super(code, msg);
}
public DsmNotFoundException(final int code, final Throwable e) {
super(code, e);
}
public DsmNotFoundException(final int code, final String msg, final Throwable e) {
super(code, msg, e);
}
public DsmNotFoundException(final String msg) {
this(404, msg);
}
}

View File

@ -0,0 +1,23 @@
package eu.dnetlib.openaire.exporter.exceptions;
public class DsmRuntimeException extends RuntimeException {
private static final long serialVersionUID = 6755159618210324144L;
public DsmRuntimeException() {
super();
}
public DsmRuntimeException(final String message, final Throwable cause) {
super(message, cause);
}
public DsmRuntimeException(final String message) {
super(message);
}
public DsmRuntimeException(final Throwable cause) {
super(cause);
}
}

View File

@ -1,4 +1,4 @@
package eu.dnetlib.openaire.funders;
package eu.dnetlib.openaire.exporter.exceptions;
public class FundersApiException extends Exception {

View File

@ -1,11 +1,12 @@
package eu.dnetlib.openaire.community;
package eu.dnetlib.openaire.exporter.model.community;
import javax.validation.constraints.NotNull;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.google.gson.Gson;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import eu.dnetlib.openaire.community.selectioncriteria.SelectionCriteria;
import eu.dnetlib.openaire.exporter.model.community.selectioncriteria.SelectionCriteria;
import io.swagger.v3.oas.annotations.media.Schema;
@JsonAutoDetect
@ -90,7 +91,11 @@ public class CommunityContentprovider {
public String toJson() {
if (selectioncriteria == null) { return ""; }
return new Gson().toJson(selectioncriteria);
try {
return new ObjectMapper().writeValueAsString(selectioncriteria);
} catch (final JsonProcessingException e) {
throw new RuntimeException(e);
}
}
public String toXML() {

View File

@ -1,11 +1,11 @@
package eu.dnetlib.openaire.community;
package eu.dnetlib.openaire.exporter.model.community;
import java.util.Date;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import eu.dnetlib.openaire.community.selectioncriteria.SelectionCriteria;
import eu.dnetlib.openaire.exporter.model.community.selectioncriteria.SelectionCriteria;
import io.swagger.v3.oas.annotations.media.Schema;
@JsonAutoDetect
@ -29,7 +29,6 @@ public class CommunityDetails extends CommunitySummary {
@Schema(description = "list of advanced criteria to associate results to this community")
private SelectionCriteria advancedConstraint;
public CommunityDetails() {}
public CommunityDetails(final CommunitySummary summary) {
@ -68,7 +67,7 @@ public class CommunityDetails extends CommunitySummary {
return fos;
}
public void setFos(List<String> fos) {
public void setFos(final List<String> fos) {
this.fos = fos;
}
@ -76,7 +75,7 @@ public class CommunityDetails extends CommunitySummary {
return sdg;
}
public void setSdg(List<String> sdg) {
public void setSdg(final List<String> sdg) {
this.sdg = sdg;
}
@ -84,7 +83,7 @@ public class CommunityDetails extends CommunitySummary {
return advancedConstraint;
}
public void setAdvancedConstraint(SelectionCriteria advancedConstraint) {
public void setAdvancedConstraint(final SelectionCriteria advancedConstraint) {
this.advancedConstraint = advancedConstraint;
}
}

View File

@ -1,4 +1,4 @@
package eu.dnetlib.openaire.community;
package eu.dnetlib.openaire.exporter.model.community;
import java.util.ArrayList;
import java.util.List;

View File

@ -1,4 +1,4 @@
package eu.dnetlib.openaire.community;
package eu.dnetlib.openaire.exporter.model.community;
import javax.validation.constraints.NotNull;

View File

@ -1,4 +1,4 @@
package eu.dnetlib.openaire.community;
package eu.dnetlib.openaire.exporter.model.community;
import com.fasterxml.jackson.annotation.JsonAutoDetect;

View File

@ -1,4 +1,4 @@
package eu.dnetlib.openaire.community;
package eu.dnetlib.openaire.exporter.model.community;
import com.fasterxml.jackson.annotation.JsonAutoDetect;

View File

@ -1,4 +1,4 @@
package eu.dnetlib.openaire.community;
package eu.dnetlib.openaire.exporter.model.community;
import java.util.Date;

View File

@ -1,14 +1,12 @@
package eu.dnetlib.openaire.community;
package eu.dnetlib.openaire.exporter.model.community;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import eu.dnetlib.openaire.community.selectioncriteria.SelectionCriteria;
import eu.dnetlib.openaire.exporter.model.community.selectioncriteria.SelectionCriteria;
import io.swagger.v3.oas.annotations.media.Schema;
import javax.persistence.criteria.Selection;
@JsonAutoDetect
public class CommunityWritableProperties {
@ -36,7 +34,6 @@ public class CommunityWritableProperties {
@Schema(description = "Advanced constraint for the association of results to the community")
private SelectionCriteria advancedConstraint;
@Schema(description = "status of the community, drives its visibility")
private CommunityStatus status;
@ -62,7 +59,7 @@ public class CommunityWritableProperties {
return fos;
}
public void setFos(List<String> fos) {
public void setFos(final List<String> fos) {
this.fos = fos;
}
@ -70,7 +67,7 @@ public class CommunityWritableProperties {
return sdg;
}
public void setSdg(List<String> sdg) {
public void setSdg(final List<String> sdg) {
this.sdg = sdg;
}
@ -78,7 +75,7 @@ public class CommunityWritableProperties {
return advancedConstraint;
}
public void setAdvancedConstraint(SelectionCriteria advancedConstraint) {
public void setAdvancedConstraint(final SelectionCriteria advancedConstraint) {
this.advancedConstraint = advancedConstraint;
}

View File

@ -1,4 +1,4 @@
package eu.dnetlib.openaire.community;
package eu.dnetlib.openaire.exporter.model.community;
import javax.validation.constraints.NotNull;

View File

@ -1,4 +1,4 @@
package eu.dnetlib.openaire.community.selectioncriteria;
package eu.dnetlib.openaire.exporter.model.community.selectioncriteria;
import java.io.Serializable;

View File

@ -1,4 +1,4 @@
package eu.dnetlib.openaire.community.selectioncriteria;
package eu.dnetlib.openaire.exporter.model.community.selectioncriteria;
import java.io.Serializable;
import java.util.List;

View File

@ -1,10 +1,11 @@
package eu.dnetlib.openaire.community.selectioncriteria;
package eu.dnetlib.openaire.exporter.model.community.selectioncriteria;
import java.io.Serializable;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.google.gson.Gson;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
@JsonAutoDetect
public class SelectionCriteria implements Serializable {
@ -27,7 +28,11 @@ public class SelectionCriteria implements Serializable {
}
public static SelectionCriteria fromJson(final String json) {
return new Gson().fromJson(json, SelectionCriteria.class);
try {
return new ObjectMapper().readValue(json, SelectionCriteria.class);
} catch (final JsonProcessingException e) {
throw new RuntimeException(e);
}
}
}
}

View File

@ -1,4 +1,4 @@
package eu.dnetlib.openaire.context;
package eu.dnetlib.openaire.exporter.model.context;
import java.util.List;
import java.util.Map;

View File

@ -1,4 +1,4 @@
package eu.dnetlib.openaire.context;
package eu.dnetlib.openaire.exporter.model.context;
public class CategorySummary {

View File

@ -1,4 +1,4 @@
package eu.dnetlib.openaire.context;
package eu.dnetlib.openaire.exporter.model.context;
import java.util.List;
import java.util.Map;

View File

@ -1,4 +1,4 @@
package eu.dnetlib.openaire.context;
package eu.dnetlib.openaire.exporter.model.context;
import java.util.List;

View File

@ -1,4 +1,4 @@
package eu.dnetlib.openaire.context;
package eu.dnetlib.openaire.exporter.model.context;
import java.util.Date;
import java.util.List;
@ -44,8 +44,6 @@ public class Context {
return categories;
}
public Context setId(final String id) {
this.id = id;
return this;
@ -66,17 +64,15 @@ public class Context {
return this;
}
public Date getLastUpdateDate() {
return lastUpdateDate;
}
public Context setLastUpdateDate(Date lastUpdateDate) {
public Context setLastUpdateDate(final Date lastUpdateDate) {
this.lastUpdateDate = lastUpdateDate;
return this;
}
public Context setParams(final Map<String, List<Param>> params) {
this.params = params;
return this;
@ -88,4 +84,3 @@ public class Context {
}
}

View File

@ -1,4 +1,4 @@
package eu.dnetlib.openaire.context;
package eu.dnetlib.openaire.exporter.model.context;
public class ContextSummary {

View File

@ -1,4 +1,4 @@
package eu.dnetlib.openaire.context;
package eu.dnetlib.openaire.exporter.model.context;
public class Param {

View File

@ -1,13 +1,14 @@
package eu.dnetlib.openaire.dsm.domain;
package eu.dnetlib.openaire.exporter.model.dsm;
import java.util.LinkedList;
import java.util.List;
import java.util.Queue;
import java.util.stream.Collectors;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.google.common.collect.Lists;
import com.google.gson.GsonBuilder;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
@JsonAutoDetect
public class Header {
@ -22,10 +23,8 @@ public class Header {
private int statusCode;
private List<String> errors = Lists.newArrayList();
@JsonIgnore
private Queue<Throwable> exceptions = Lists.newLinkedList();
private Queue<Throwable> exceptions = new LinkedList<>();
public static Header newInsance() {
return new Header();
@ -93,13 +92,12 @@ public class Header {
.collect(Collectors.toList());
}
public Header setErrors(final List<String> errors) {
this.errors = errors;
return this;
}
public String toJson() {
return new GsonBuilder().setPrettyPrinting().create().toJson(this);
try {
return new ObjectMapper().writerWithDefaultPrettyPrinter().writeValueAsString(this);
} catch (final JsonProcessingException e) {
throw new RuntimeException(e);
}
}
}

View File

@ -1,4 +1,4 @@
package eu.dnetlib.openaire.dsm.domain;
package eu.dnetlib.openaire.exporter.model.dsm;
import com.fasterxml.jackson.annotation.JsonAutoDetect;

View File

@ -1,4 +1,4 @@
package eu.dnetlib.openaire.dsm.domain;
package eu.dnetlib.openaire.exporter.model.dsm;
import java.util.List;

View File

@ -1,4 +1,4 @@
package eu.dnetlib.openaire.funders.domain;
package eu.dnetlib.openaire.exporter.model.funders;
import java.util.List;
@ -31,4 +31,3 @@ public class ExtendedFunderDetails extends FunderDetails {
}
}

View File

@ -1,4 +1,4 @@
package eu.dnetlib.openaire.funders.domain;
package eu.dnetlib.openaire.exporter.model.funders;
import java.util.Date;

View File

@ -1,4 +1,4 @@
package eu.dnetlib.openaire.funders.domain;
package eu.dnetlib.openaire.exporter.model.funders;
public class FundingStream {

View File

@ -1,4 +1,4 @@
package eu.dnetlib.openaire.vocabularies;
package eu.dnetlib.openaire.exporter.model.vocabularies;
/**
* Created by claudio on 15/09/2017.

View File

@ -1,4 +1,4 @@
package eu.dnetlib.openaire.vocabularies;
package eu.dnetlib.openaire.exporter.model.vocabularies;
/**
* Created by claudio on 15/09/2017.

View File

@ -1,4 +1,4 @@
package eu.dnetlib.openaire.vocabularies;
package eu.dnetlib.openaire.exporter.model.vocabularies;
import java.util.List;
import java.util.Map;