From e751759de9a3a223cbf3ee35bac44686169259c0 Mon Sep 17 00:00:00 2001 From: "miriam.baglioni" Date: Mon, 26 Sep 2022 12:15:39 +0200 Subject: [PATCH 01/19] [CommunityAPIExtention] adding FOS , SDG and advancedCriteria to the summary. Adding the possibility to add and remove list of projects from the profiles --- .../community/CommunityApiController.java | 133 +++++++++++++ .../openaire/community/CommunityApiCore.java | 174 ++++++++++++++---- .../community/CommunityConstants.java | 3 + .../openaire/community/CommunityDetails.java | 34 ++++ .../community/CommunityMappingUtils.java | 9 + .../CommunityWritableProperties.java | 37 ++++ 6 files changed, 351 insertions(+), 39 deletions(-) diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityApiController.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityApiController.java index c8c6af9a..75ad8fd8 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityApiController.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityApiController.java @@ -133,6 +133,44 @@ public class CommunityApiController { communityApiCore.removeCommunityProject(id, projectId); } + @RequestMapping(value = "/community/{id}/projectList", produces = { + "application/json" + }, method = RequestMethod.POST) + @Operation(summary = "associate a list of project to the community", + description = "associate a list of project to the community", tags = { + C_PJ, W + }) + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "OK"), + @ApiResponse(responseCode = "404", description = "not found"), + @ApiResponse(responseCode = "500", description = "unexpected error") + }) + public List addCommunityProjectList( + @PathVariable final String id, + @RequestBody final List projectList) throws CommunityException, CommunityNotFoundException { + + return communityApiCore.addCommunityProjectList(id, projectList); + } + + @RequestMapping(value = "/community/{id}/projectList", produces = { + "application/json" + }, method = RequestMethod.DELETE) + @Operation(summary = "remove a list of projects from the community", + description = "remove a list of projects from the community", tags = { + C_PJ, W + }) + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "OK"), + @ApiResponse(responseCode = "404", description = "not found"), + @ApiResponse(responseCode = "500", description = "unexpected error") + }) + public void deleteCommunityProjectList( + @PathVariable final String id, + @RequestBody final List projectIdList) throws CommunityException, CommunityNotFoundException { + + communityApiCore.removeCommunityProjectList(id, projectIdList); + } + @RequestMapping(value = "/community/{id}/contentproviders", produces = { "application/json" }, method = RequestMethod.GET) @@ -273,6 +311,101 @@ public class CommunityApiController { return communityApiCore.removeCommunitySubjects(id, subjects); } + @RequestMapping(value = "/community/{id}/fos", produces = { "application/json" }, method = RequestMethod.POST) + @Operation( + summary = "associate a fos to the community", + description = "associate a fos to the community", + tags = { C, W }) + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "OK"), + @ApiResponse(responseCode = "404", description = "not found"), + @ApiResponse(responseCode = "500", description = "unexpected error") }) + public CommunityDetails addCommunityFOS( + @PathVariable final String id, + @RequestBody final List subjects) throws CommunityException, CommunityNotFoundException { + + return communityApiCore.addCommunityFOS(id, subjects); + } + + @RequestMapping(value = "/community/{id}/fos", produces = { "application/json" }, method = RequestMethod.DELETE) + @Operation( + summary = "remove fos from a community", + description = "remove fos from a community", + tags = { C, W }) + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "OK"), + @ApiResponse(responseCode = "404", description = "not found"), + @ApiResponse(responseCode = "500", description = "unexpected error") }) + public CommunityDetails removeCommunityFOS( + @PathVariable final String id, + @RequestBody final List subjects) throws CommunityException, CommunityNotFoundException { + + return communityApiCore.removeCommunityFOS(id, subjects); + } + + + @RequestMapping(value = "/community/{id}/sdg", produces = { "application/json" }, method = RequestMethod.POST) + @Operation( + summary = "associate a sdg to the community", + description = "associate a sdg to the community", + tags = { C, W }) + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "OK"), + @ApiResponse(responseCode = "404", description = "not found"), + @ApiResponse(responseCode = "500", description = "unexpected error") }) + public CommunityDetails addCommunitySDG( + @PathVariable final String id, + @RequestBody final List subjects) throws CommunityException, CommunityNotFoundException { + + return communityApiCore.addCommunitySDG(id, subjects); + } + + @RequestMapping(value = "/community/{id}/sdg", produces = { "application/json" }, method = RequestMethod.DELETE) + @Operation( + summary = "remove sdg from a community", + description = "remove sdg from a community", + tags = { C, W }) + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "OK"), + @ApiResponse(responseCode = "404", description = "not found"), + @ApiResponse(responseCode = "500", description = "unexpected error") }) + public CommunityDetails removeCommunitySDG( + @PathVariable final String id, + @RequestBody final List subjects) throws CommunityException, CommunityNotFoundException { + + return communityApiCore.removeCommunitySDG(id, subjects); + } + + @RequestMapping(value = "/community/{id}/advancedConstraint", produces = { "application/json" }, method = RequestMethod.POST) + @Operation( + summary = "the set of constraints to be used to extend the association between result and community", + description = "the set of constraints to be used to extend the association between result and community", + tags = { C, W }) + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "OK"), + @ApiResponse(responseCode = "404", description = "not found"), + @ApiResponse(responseCode = "500", description = "unexpected error") }) + public CommunityDetails addAdvancedConstraint( + @PathVariable final String id, + @RequestBody final String advancedConstraint) throws CommunityException, CommunityNotFoundException { + + return communityApiCore.addCommunityAdvancedConstraint(id, advancedConstraint); + } + + @RequestMapping(value = "/community/{id}/advancedConstraint", produces = { "application/json" }, method = RequestMethod.DELETE) + @Operation( + summary = "remove the constraints to extend the association result community from a community", + description = "remove the constraints to extend the association result community from a community", + tags = { C, W }) + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "OK"), + @ApiResponse(responseCode = "404", description = "not found"), + @ApiResponse(responseCode = "500", description = "unexpected error") }) + public CommunityDetails removeAdvancedConstraint( + @PathVariable final String id) throws CommunityException, CommunityNotFoundException { + + return communityApiCore.removeCommunityAdvancedConstraint(id); + } @RequestMapping(value = "/community/{id}/zenodocommunities", produces = { "application/json" diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityApiCore.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityApiCore.java index bc8c2c18..a07d8ea7 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityApiCore.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityApiCore.java @@ -1,35 +1,6 @@ package eu.dnetlib.openaire.community; -import static eu.dnetlib.openaire.community.CommunityConstants.CCONTENTPROVIDER_NAME; -import static eu.dnetlib.openaire.community.CommunityConstants.CCONTENTPROVIDER_OFFICIALNAME; -import static eu.dnetlib.openaire.community.CommunityConstants.CCONTENTPROVIDER_SELCRITERIA; -import static eu.dnetlib.openaire.community.CommunityConstants.CLABEL; -import static eu.dnetlib.openaire.community.CommunityConstants.CONTENTPROVIDERS_ID_SUFFIX; -import static eu.dnetlib.openaire.community.CommunityConstants.CORGANIZATION_LOGOURL; -import static eu.dnetlib.openaire.community.CommunityConstants.CORGANIZATION_NAME; -import static eu.dnetlib.openaire.community.CommunityConstants.CORGANIZATION_WEBSITEURL; -import static eu.dnetlib.openaire.community.CommunityConstants.CPROFILE_SUBJECT; -import static eu.dnetlib.openaire.community.CommunityConstants.CPROJECT_ACRONYM; -import static eu.dnetlib.openaire.community.CommunityConstants.CPROJECT_FULLNAME; -import static eu.dnetlib.openaire.community.CommunityConstants.CPROJECT_FUNDER; -import static eu.dnetlib.openaire.community.CommunityConstants.CPROJECT_NUMBER; -import static eu.dnetlib.openaire.community.CommunityConstants.CSUMMARY_DESCRIPTION; -import static eu.dnetlib.openaire.community.CommunityConstants.CSUMMARY_LOGOURL; -import static eu.dnetlib.openaire.community.CommunityConstants.CSUMMARY_NAME; -import static eu.dnetlib.openaire.community.CommunityConstants.CSUMMARY_STATUS; -import static eu.dnetlib.openaire.community.CommunityConstants.CSUMMARY_ZENODOC; -import static eu.dnetlib.openaire.community.CommunityConstants.CSV_DELIMITER; -import static eu.dnetlib.openaire.community.CommunityConstants.ID_SEPARATOR; -import static eu.dnetlib.openaire.community.CommunityConstants.OPENAIRE_ID; -import static eu.dnetlib.openaire.community.CommunityConstants.ORGANIZATION_ID_SUFFIX; -import static eu.dnetlib.openaire.community.CommunityConstants.PROJECTS_ID_SUFFIX; -import static eu.dnetlib.openaire.community.CommunityConstants.ZENODOCOMMUNITY_ID_SUFFIX; - -import java.util.Base64; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.TreeMap; +import java.util.*; import java.util.stream.Collectors; import org.apache.commons.lang3.StringUtils; @@ -47,6 +18,8 @@ import com.google.common.collect.Sets; import eu.dnetlib.openaire.common.ISClient; +import static eu.dnetlib.openaire.community.CommunityConstants.*; + @Component @ConditionalOnProperty(value = "openaire.exporter.enable.community", havingValue = "true") public class CommunityApiCore {// implements CommunityClient{ @@ -99,6 +72,18 @@ public class CommunityApiCore {// implements CommunityClient{ if (details.getSubjects() != null) { isClient.updateContextParam(id, CPROFILE_SUBJECT, Joiner.on(CSV_DELIMITER).join(details.getSubjects())); + } + if (details.getFos() != null) { + isClient.updateContextParam(id, CPROFILE_FOS, Joiner.on(CSV_DELIMITER).join(details.getFos())); + + } + if (details.getSdg() != null) { + isClient.updateContextParam(id, CPROFILE_SDG, Joiner.on(CSV_DELIMITER).join(details.getSdg())); + + } + if (details.getAdvancedConstraint() != null) { + isClient.updateContextParam(id, CPROFILE_ADVANCED_CONSTRAINT, details.getAdvancedConstraint()); + } if (details.getMainZenodoCommunity() != null) { isClient.updateContextParam(id, CSUMMARY_ZENODOC, details.getMainZenodoCommunity()); @@ -117,40 +102,63 @@ public class CommunityApiCore {// implements CommunityClient{ throw new CommunityException("parameters 'id' and project.communityId must be coherent"); } - final TreeMap projects = getCommunityProjectMap(id); - final String project_id = project.getId(); + return updateProject(id, project); - if (project_id != null && projects.keySet().contains(Integer.valueOf(project_id))) { + } + + private CommunityProject updateProject(String id, CommunityProject project) throws CommunityException, CommunityNotFoundException { + final TreeMap projects = getCommunityProjectMap(id); + String project_id = project.getId(); + + if (project_id != null && projects.keySet().contains(Integer.valueOf(project_id))){ if (project.getName() != null) { isClient.updateConceptParam(id + PROJECTS_ID_SUFFIX + ID_SEPARATOR + project_id, CPROJECT_FULLNAME, project.getName()); } - if (project.getAcronym() != null) { + if(project.getAcronym()!= null){ isClient.updateConceptParam(id + PROJECTS_ID_SUFFIX + ID_SEPARATOR + project_id, CPROJECT_ACRONYM, project.getAcronym()); } - if (project.getOpenaireId() != null) { + if (project.getOpenaireId() != null){ isClient.updateConceptParam(id + PROJECTS_ID_SUFFIX + ID_SEPARATOR + project_id, OPENAIRE_ID, project.getOpenaireId()); } - if (project.getFunder() != null) { + if (project.getFunder() != null){ isClient.updateConceptParam(id + PROJECTS_ID_SUFFIX + ID_SEPARATOR + project_id, CPROJECT_FUNDER, project.getFunder()); } - if (project.getGrantId() != null) { + if(project.getGrantId() != null){ isClient.updateConceptParam(id + PROJECTS_ID_SUFFIX + ID_SEPARATOR + project_id, CPROJECT_NUMBER, project.getGrantId()); } - } else { + }else { project.setId(nextId(projects != null && !projects.isEmpty() ? projects.lastKey() : 0)); isClient.addConcept(id, id + PROJECTS_ID_SUFFIX, CommunityMappingUtils.asProjectXML(id, project)); } - cc.updateProject(id, project); + cc.updateProject(id, project ); return project; } + public List addCommunityProjectList(final String id, final List projectList) throws CommunityException, CommunityNotFoundException { + if(projectList == null || projectList.size() == 0){ + throw new CommunityException("parameter 'projectList' must be present and should contain at least one project"); + } + if (!StringUtils.equalsIgnoreCase(id, projectList.get(0).getCommunityId())) { + throw new CommunityException("parameters 'id' and project.communityId must be coherent"); + } + + List projects = new ArrayList(); + + for(CommunityProject project : projectList){ + projects.add(updateProject(id, project)); + } + + + return projects; + } + private String nextId(final Integer id) { return String.valueOf(id + 1); } @@ -164,6 +172,12 @@ public class CommunityApiCore {// implements CommunityClient{ cc.removeFromCategory(id, PROJECTS_ID_SUFFIX, String.valueOf(projectId)); } + public void removeCommunityProjectList(final String id, final List projectIdList) throws CommunityException, CommunityNotFoundException { + for(Integer projectId: projectIdList){ + removeCommunityProject(id, projectId); + } + } + public List getCommunityContentproviders(final String id) throws CommunityException, CommunityNotFoundException { cc.getCommunity(id); // ensure the community exists. return cc.getCommunityInfo(id, CONTENTPROVIDERS_ID_SUFFIX, c -> CommunityMappingUtils.asCommunityDataprovider(id, c)); @@ -258,6 +272,88 @@ public class CommunityApiCore {// implements CommunityClient{ return cd; } + public CommunityDetails addCommunityFOS(final String id, final List foss) throws CommunityException, CommunityNotFoundException { + + final CommunityDetails cd = new CommunityDetails(); + + final Set current = Sets.newHashSet(cc.getCommunity(id).getFos()); + + current.addAll(foss); + + cd.setFos(Lists.newArrayList(current)); + + setCommunity(id, CommunityWritableProperties.fromDetails(cd)); + + return cd; + } + + public CommunityDetails removeCommunityFOS(final String id, final List foss) throws CommunityException, CommunityNotFoundException { + + final CommunityDetails cd = new CommunityDetails(); + + final Set current = Sets.newHashSet(cc.getCommunity(id).getFos()); + + current.removeAll(foss); + + cd.setFos(Lists.newArrayList(current)); + + setCommunity(id, CommunityWritableProperties.fromDetails(cd)); + + return cd; + } + + public CommunityDetails addCommunitySDG(final String id, final List sdgs) throws CommunityException, CommunityNotFoundException { + + final CommunityDetails cd = new CommunityDetails(); + + final Set current = Sets.newHashSet(cc.getCommunity(id).getSdg()); + + current.addAll(sdgs); + + cd.setFos(Lists.newArrayList(current)); + + setCommunity(id, CommunityWritableProperties.fromDetails(cd)); + + return cd; + } + + public CommunityDetails removeCommunitySDG(final String id, final List sdgs) throws CommunityException, CommunityNotFoundException { + + final CommunityDetails cd = new CommunityDetails(); + + final Set current = Sets.newHashSet(cc.getCommunity(id).getSdg()); + + current.removeAll(sdgs); + + cd.setFos(Lists.newArrayList(current)); + + setCommunity(id, CommunityWritableProperties.fromDetails(cd)); + + return cd; + } + + public CommunityDetails addCommunityAdvancedConstraint(final String id, final String advancedCosntraint) throws CommunityException, CommunityNotFoundException { + + final CommunityDetails cd = cc.getCommunity(id); + + cd.setAdvancedConstraint(advancedCosntraint); + + setCommunity(id, CommunityWritableProperties.fromDetails(cd)); + + return cd; + } + + public CommunityDetails removeCommunityAdvancedConstraint(final String id) throws CommunityException, CommunityNotFoundException { + + final CommunityDetails cd = cc.getCommunity(id); + + cd.setAdvancedConstraint(null); + + setCommunity(id, CommunityWritableProperties.fromDetails(cd)); + + return cd; + } + @CacheEvict(value = "community-cache", allEntries = true) public void removeCommunityZenodoCommunity(final String id, final Integer zenodoCommId) throws CommunityException, CommunityNotFoundException { diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityConstants.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityConstants.java index 9ac100f9..8c11cebf 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityConstants.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityConstants.java @@ -32,6 +32,9 @@ public class CommunityConstants { // community profile public final static String CPROFILE_SUBJECT = "subject"; public final static String CPROFILE_CREATIONDATE = "creationdate"; + public final static String CPROFILE_FOS = "fos"; + public final static String CPROFILE_SDG = "sdg"; + public final static String CPROFILE_ADVANCED_CONSTRAINT = "advancedConstraint"; // community project public final static String CPROJECT_FUNDER = "funder"; diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityDetails.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityDetails.java index 2632267c..712c3702 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityDetails.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityDetails.java @@ -19,6 +19,16 @@ public class CommunityDetails extends CommunitySummary { @Schema(description = "list of subjects (keywords) that characterise this community") private List subjects; + @Schema(description = "list of fos that characterise this community") + private List fos; + + @Schema(description = "list of sdg that characterise this community") + private List sdg; + + @Schema(description = "list of advanced criteria to associate results to this community") + private String advancedConstraint; + + public CommunityDetails() {} public CommunityDetails(final CommunitySummary summary) { @@ -52,4 +62,28 @@ public class CommunityDetails extends CommunitySummary { public void setLastUpdateDate(final Date lastUpdateDate) { this.lastUpdateDate = lastUpdateDate; } + + public List getFos() { + return fos; + } + + public void setFos(List fos) { + this.fos = fos; + } + + public List getSdg() { + return sdg; + } + + public void setSdg(List sdg) { + this.sdg = sdg; + } + + public String getAdvancedConstraint() { + return advancedConstraint; + } + + public void setAdvancedConstraint(String advancedConstraint) { + this.advancedConstraint = advancedConstraint; + } } diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityMappingUtils.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityMappingUtils.java index 271c1cbe..a54bd368 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityMappingUtils.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityMappingUtils.java @@ -62,6 +62,15 @@ public class CommunityMappingUtils { if (params.containsKey(CPROFILE_SUBJECT)) { p.setSubjects(splitValues(asValues(params.get(CPROFILE_SUBJECT)), CSV_DELIMITER)); } + if (params.containsKey(CPROFILE_FOS)) { + p.setFos(splitValues(asValues(params.get(CPROFILE_FOS)), CSV_DELIMITER)); + } + if (params.containsKey(CPROFILE_SDG)) { + p.setSdg(splitValues(asValues(params.get(CPROFILE_SDG)), CSV_DELIMITER)); + } + if (params.containsKey(CPROFILE_ADVANCED_CONSTRAINT)) { + p.setAdvancedConstraint(asCsv(params.get(CPROFILE_ADVANCED_CONSTRAINT))); + } if (params.containsKey(CPROFILE_CREATIONDATE)){ try { p.setCreationDate(org.apache.commons.lang3.time.DateUtils.parseDate(asCsv(params.get(CPROFILE_CREATIONDATE)), pattern)); diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityWritableProperties.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityWritableProperties.java index ac9723d6..1be9ed90 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityWritableProperties.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityWritableProperties.java @@ -24,6 +24,16 @@ public class CommunityWritableProperties { @Schema(description = "list of subjects (keywords) that characterise this community") private List subjects; + @Schema(description = "list of fos that characterise this community") + private List fos; + + @Schema(description = "list of sdg that characterise this community") + private List sdg; + + @Schema(description = "Advanced constraint for the association of results to the community") + private String advancedConstraint; + + @Schema(description = "status of the community, drives its visibility") private CommunityStatus status; @@ -39,9 +49,36 @@ public class CommunityWritableProperties { p.setSubjects(details.getSubjects()); p.setStatus(details.getStatus()); p.setMainZenodoCommunity(details.getZenodoCommunity()); + p.setFos(details.getFos()); + p.setSdg(details.getSdg()); + p.setAdvancedConstraint(details.getAdvancedConstraint()); return p; } + public List getFos() { + return fos; + } + + public void setFos(List fos) { + this.fos = fos; + } + + public List getSdg() { + return sdg; + } + + public void setSdg(List sdg) { + this.sdg = sdg; + } + + public String getAdvancedConstraint() { + return advancedConstraint; + } + + public void setAdvancedConstraint(String advancedConstraint) { + this.advancedConstraint = advancedConstraint; + } + public String getName() { return name; } From 3549fdebf9eb4db580f91f0d40514075daf643b1 Mon Sep 17 00:00:00 2001 From: "miriam.baglioni" Date: Mon, 26 Sep 2022 19:06:51 +0200 Subject: [PATCH 02/19] [CommunityAPIExtention] fixed issues --- .../eu/dnetlib/openaire/common/ISClient.java | 2 ++ .../dnetlib/openaire/common/ISClientImpl.java | 22 +++++++++++++++++++ .../community/CommunityApiController.java | 3 ++- .../openaire/community/CommunityApiCore.java | 18 ++++++++------- .../openaire/community/CommunityCommon.java | 19 ++++++++++++++++ .../openaire/community/CommunityDetails.java | 7 +++--- .../community/CommunityMappingUtils.java | 2 +- .../CommunityWritableProperties.java | 9 +++++--- .../src/main/resources/application.properties | 2 +- .../src/main/resources/global.properties | 16 +++++++++----- 10 files changed, 78 insertions(+), 22 deletions(-) diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/common/ISClient.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/common/ISClient.java index 01752de5..6a048867 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/common/ISClient.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/common/ISClient.java @@ -22,6 +22,8 @@ public interface ISClient { void updateContextParam(String id, String name, String value); + void updateContextParamNoEscape(String id, String name, String value); + void updateContextAttribute(String id, String name, String value); void addConcept(String id, String categoryId, String data); diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/common/ISClientImpl.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/common/ISClientImpl.java index 3bb72c60..960d437d 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/common/ISClientImpl.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/common/ISClientImpl.java @@ -117,6 +117,18 @@ public class ISClientImpl implements ISClient { } } + @Override + @CacheEvict(value = { + "context-cache", "context-cache-funder" + }, allEntries = true) + public void updateContextParamNoEscape(final String id, final String name, final String value) { + try { + _quickSeachProfile(getXQueryNoEscape(id, name, value)); + } catch (final ISLookUpException e) { + throw new DsmRuntimeException(String.format("unable update context param [id: %s, name: %s, value: %s]", id, name, value), e); + } + } + @Override @CacheEvict(value = { "context-cache", "context-cache-funder" @@ -211,6 +223,16 @@ 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 %s", 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 ", id, name, name); + } + } + private String getConceptXQuery(final String id, final String name, final String value) { final Escaper esc = XmlEscapers.xmlContentEscaper(); if (StringUtils.isNotBlank(value)) { diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityApiController.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityApiController.java index 75ad8fd8..bde3672d 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityApiController.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityApiController.java @@ -10,6 +10,7 @@ import static eu.dnetlib.openaire.common.ExporterConstants.W; import java.util.List; +import eu.dnetlib.openaire.community.selectioncriteria.SelectionCriteria; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.web.bind.annotation.CrossOrigin; @@ -387,7 +388,7 @@ public class CommunityApiController { @ApiResponse(responseCode = "500", description = "unexpected error") }) public CommunityDetails addAdvancedConstraint( @PathVariable final String id, - @RequestBody final String advancedConstraint) throws CommunityException, CommunityNotFoundException { + @RequestBody final SelectionCriteria advancedConstraint) throws CommunityException, CommunityNotFoundException { return communityApiCore.addCommunityAdvancedConstraint(id, advancedConstraint); } diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityApiCore.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityApiCore.java index a07d8ea7..473b84a1 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityApiCore.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityApiCore.java @@ -3,6 +3,8 @@ package eu.dnetlib.openaire.community; import java.util.*; import java.util.stream.Collectors; +import com.google.gson.Gson; +import eu.dnetlib.openaire.community.selectioncriteria.SelectionCriteria; import org.apache.commons.lang3.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -82,7 +84,7 @@ public class CommunityApiCore {// implements CommunityClient{ } if (details.getAdvancedConstraint() != null) { - isClient.updateContextParam(id, CPROFILE_ADVANCED_CONSTRAINT, details.getAdvancedConstraint()); + isClient.updateContextParamNoEscape(id, CPROFILE_ADVANCED_CONSTRAINT, ""); } if (details.getMainZenodoCommunity() != null) { @@ -310,7 +312,7 @@ public class CommunityApiCore {// implements CommunityClient{ current.addAll(sdgs); - cd.setFos(Lists.newArrayList(current)); + cd.setSdg(Lists.newArrayList(current)); setCommunity(id, CommunityWritableProperties.fromDetails(cd)); @@ -325,16 +327,16 @@ public class CommunityApiCore {// implements CommunityClient{ current.removeAll(sdgs); - cd.setFos(Lists.newArrayList(current)); + cd.setSdg(Lists.newArrayList(current)); setCommunity(id, CommunityWritableProperties.fromDetails(cd)); return cd; } - public CommunityDetails addCommunityAdvancedConstraint(final String id, final String advancedCosntraint) throws CommunityException, CommunityNotFoundException { + public CommunityDetails addCommunityAdvancedConstraint(final String id, final SelectionCriteria advancedCosntraint) throws CommunityException, CommunityNotFoundException { - final CommunityDetails cd = cc.getCommunity(id); + final CommunityDetails cd = new CommunityDetails(); cd.setAdvancedConstraint(advancedCosntraint); @@ -345,9 +347,9 @@ public class CommunityApiCore {// implements CommunityClient{ public CommunityDetails removeCommunityAdvancedConstraint(final String id) throws CommunityException, CommunityNotFoundException { - final CommunityDetails cd = cc.getCommunity(id); - - cd.setAdvancedConstraint(null); + final CommunityDetails cd = new CommunityDetails(); + SelectionCriteria sl = new SelectionCriteria(); + cd.setAdvancedConstraint(sl); setCommunity(id, CommunityWritableProperties.fromDetails(cd)); diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityCommon.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityCommon.java index fde84333..52d4dd40 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityCommon.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityCommon.java @@ -2,7 +2,9 @@ package eu.dnetlib.openaire.community; 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; @@ -199,6 +201,23 @@ public class CommunityCommon { .setValue(Joiner.on(CSV_DELIMITER) .join(community.getSubjects())))); } + if(community.getFos() != null){ + context.getParams() + .replace(CPROFILE_FOS, Arrays.asList(new Param().setName(CPROFILE_FOS) + .setValue(Joiner.on(CSV_DELIMITER) + .join(community.getFos())))); + } + if(community.getSdg() != null){ + context.getParams() + .replace(CPROFILE_SDG, Arrays.asList(new Param().setName(CPROFILE_SDG) + .setValue(Joiner.on(CSV_DELIMITER) + .join(community.getSdg())))); + } + if (community.getAdvancedConstraint() != null) { + context.getParams() + .replace(CPROFILE_ADVANCED_CONSTRAINT, Arrays.asList(new Param() + .setName(CPROFILE_ADVANCED_CONSTRAINT).setValue(new Gson().toJson(community.getAdvancedConstraint())))); + } if(community.getMainZenodoCommunity() != null){ context.getParams() .replace(CSUMMARY_ZENODOC, Arrays.asList(new Param() diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityDetails.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityDetails.java index 712c3702..7625582a 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityDetails.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityDetails.java @@ -5,6 +5,7 @@ import java.util.List; import com.fasterxml.jackson.annotation.JsonAutoDetect; +import eu.dnetlib.openaire.community.selectioncriteria.SelectionCriteria; import io.swagger.v3.oas.annotations.media.Schema; @JsonAutoDetect @@ -26,7 +27,7 @@ public class CommunityDetails extends CommunitySummary { private List sdg; @Schema(description = "list of advanced criteria to associate results to this community") - private String advancedConstraint; + private SelectionCriteria advancedConstraint; public CommunityDetails() {} @@ -79,11 +80,11 @@ public class CommunityDetails extends CommunitySummary { this.sdg = sdg; } - public String getAdvancedConstraint() { + public SelectionCriteria getAdvancedConstraint() { return advancedConstraint; } - public void setAdvancedConstraint(String advancedConstraint) { + public void setAdvancedConstraint(SelectionCriteria advancedConstraint) { this.advancedConstraint = advancedConstraint; } } diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityMappingUtils.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityMappingUtils.java index a54bd368..24ce0262 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityMappingUtils.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityMappingUtils.java @@ -69,7 +69,7 @@ public class CommunityMappingUtils { p.setSdg(splitValues(asValues(params.get(CPROFILE_SDG)), CSV_DELIMITER)); } if (params.containsKey(CPROFILE_ADVANCED_CONSTRAINT)) { - p.setAdvancedConstraint(asCsv(params.get(CPROFILE_ADVANCED_CONSTRAINT))); + p.setAdvancedConstraint(SelectionCriteria.fromJson(asCsv(params.get(CPROFILE_ADVANCED_CONSTRAINT)))); } if (params.containsKey(CPROFILE_CREATIONDATE)){ try { diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityWritableProperties.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityWritableProperties.java index 1be9ed90..db6d3e5e 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityWritableProperties.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityWritableProperties.java @@ -4,8 +4,11 @@ import java.util.List; import com.fasterxml.jackson.annotation.JsonAutoDetect; +import eu.dnetlib.openaire.community.selectioncriteria.SelectionCriteria; import io.swagger.v3.oas.annotations.media.Schema; +import javax.persistence.criteria.Selection; + @JsonAutoDetect public class CommunityWritableProperties { @@ -31,7 +34,7 @@ public class CommunityWritableProperties { private List sdg; @Schema(description = "Advanced constraint for the association of results to the community") - private String advancedConstraint; + private SelectionCriteria advancedConstraint; @Schema(description = "status of the community, drives its visibility") @@ -71,11 +74,11 @@ public class CommunityWritableProperties { this.sdg = sdg; } - public String getAdvancedConstraint() { + public SelectionCriteria getAdvancedConstraint() { return advancedConstraint; } - public void setAdvancedConstraint(String advancedConstraint) { + public void setAdvancedConstraint(SelectionCriteria advancedConstraint) { this.advancedConstraint = advancedConstraint; } diff --git a/apps/dnet-exporter-api/src/main/resources/application.properties b/apps/dnet-exporter-api/src/main/resources/application.properties index bde38f76..340eb274 100644 --- a/apps/dnet-exporter-api/src/main/resources/application.properties +++ b/apps/dnet-exporter-api/src/main/resources/application.properties @@ -22,7 +22,7 @@ management.endpoints.web.base-path = / management.endpoints.web.path-mapping.prometheus = metrics management.endpoints.web.path-mapping.health = health - +apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityApiController.java # ENABLE / DISABLE CONTROLLERS openaire.exporter.enable.dsm = true openaire.exporter.enable.community = true diff --git a/apps/dnet-exporter-api/src/main/resources/global.properties b/apps/dnet-exporter-api/src/main/resources/global.properties index 82988336..6b026841 100644 --- a/apps/dnet-exporter-api/src/main/resources/global.properties +++ b/apps/dnet-exporter-api/src/main/resources/global.properties @@ -1,7 +1,12 @@ -services.is.host = localhost -services.is.port = 8280 -services.is.protocol = http -services.is.context = app +#services.is.host = localhost +services.is.host = dev-openaire.d4science.org +#services.is.port = 8280 +services.is.port = 443 +#services.is.protocol = http +services.is.protocol = https +#services.is.context = app +services.is.context = is +#services.is.baseurl = ${services.is.protocol}://${services.is.host}:${services.is.port}/${services.is.context}/services services.is.baseurl = ${services.is.protocol}://${services.is.host}:${services.is.port}/${services.is.context}/services openaire.exporter.isLookupUrl = ${services.is.baseurl}/isLookUp @@ -15,7 +20,8 @@ openaire.exporter.cxfClientConnectTimeout = 60000 openaire.exporter.cxfClientReceiveTimeout = 120000 # JDBC -openaire.exporter.jdbc.url = jdbc:postgresql://localhost:5432/dnet_openaireplus +#openaire.exporter.jdbc.url = jdbc:postgresql://localhost:5432/dnet_openaireplus +openaire.exporter.jdbc.url = jdbc:postgresql://localhost:5432/dev_openaire_8280 openaire.exporter.jdbc.user = dnetapi openaire.exporter.jdbc.pwd = dnetPwd openaire.exporter.jdbc.minIdle = 1 From 2a937cc4aed8cefe09bc5207e9dd42fc337ca184 Mon Sep 17 00:00:00 2001 From: "miriam.baglioni" Date: Tue, 27 Sep 2022 16:06:31 +0200 Subject: [PATCH 03/19] [CommunityAPIExtention] added bulk deletion and addition for datasouces. Added the possibility to insert a pram in the cntext if it is not already present. Useful not to be forced to modify all the profiles by hand to insert new params for fos, sdg and advancedContraints --- .../eu/dnetlib/openaire/common/ISClient.java | 4 +- .../dnetlib/openaire/common/ISClientImpl.java | 79 +++++++++++++------ .../community/CommunityApiController.java | 38 +++++++++ .../openaire/community/CommunityApiCore.java | 77 +++++++++++++----- .../openaire/community/CommunityCommon.java | 21 +++++ 5 files changed, 172 insertions(+), 47 deletions(-) diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/common/ISClient.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/common/ISClient.java index 6a048867..d4ed2f32 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/common/ISClient.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/common/ISClient.java @@ -20,9 +20,7 @@ public interface ISClient { Map getContextMap(final List type) throws IOException; - void updateContextParam(String id, String name, String value); - - void updateContextParamNoEscape(String id, String name, String value); + void updateContextParam(String id, String name, String value, boolean toEscape); void updateContextAttribute(String id, String name, String value); diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/common/ISClientImpl.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/common/ISClientImpl.java index 960d437d..67397331 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/common/ISClientImpl.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/common/ISClientImpl.java @@ -105,28 +105,38 @@ 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) { - try { - _quickSeachProfile(getXQuery(id, name, value)); - } catch (final ISLookUpException e) { - throw new DsmRuntimeException(String.format("unable update context param [id: %s, name: %s, value: %s]", id, name, value), e); + public void updateContextParam(final String id, final String name, final String value, 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{ + try { + _quickSeachProfile(getInsertXQuery(id, name, value,toEscape)); + } catch (final ISLookUpException e) { + throw new DsmRuntimeException(String.format("unable to insert context param [id: %s, name: %s, value: %s]", id, name, value), e); + } + } + + } - @Override - @CacheEvict(value = { - "context-cache", "context-cache-funder" - }, allEntries = true) - public void updateContextParamNoEscape(final String id, final String name, final String value) { + private int getSize(String id, String name) { + int size = 0; try { - _quickSeachProfile(getXQueryNoEscape(id, name, value)); - } catch (final ISLookUpException e) { - throw new DsmRuntimeException(String.format("unable update context param [id: %s, name: %s, value: %s]", id, name, value), 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 (ISLookUpException e) { + throw new DsmRuntimeException("unable to execute search query", e); } + return size; } @Override @@ -212,26 +222,45 @@ public class ISClientImpl implements ISClient { /// HELPERS - private String getXQuery(final String id, final String name, final String value) { - final Escaper esc = XmlEscapers.xmlContentEscaper(); + + private String getInsertXQuery(final String id, final String paramName, final String paramValue, final boolean toEscape) { + String value; + if(toEscape) + value = escape(XmlEscapers.xmlContentEscaper(), paramValue); + else + value = paramValue; + if (StringUtils.isNotBlank(value)) { + return String.format("update insert %s into collection('/db/DRIVER/ContextDSResources/ContextDSResourceType')" + + "/RESOURCE_PROFILE/BODY/CONFIGURATION/context[./@id = '%s']", paramName, value, id); + } else { + return String.format("update insert into collection('/db/DRIVER/ContextDSResources/ContextDSResourceType')" + + "/RESOURCE_PROFILE/BODY/CONFIGURATION/context[./@id = '%s']", paramName, id); + } + } + + private String getXQuery(final String id, final String name, final String paramValue, final boolean toEscape) { + String value = paramValue; + if (toEscape) + value = escape(XmlEscapers.xmlContentEscaper(), paramValue); + 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 %s", id, name, name, escape(esc, value)); + "/RESOURCE_PROFILE/BODY/CONFIGURATION/context[./@id = '%s']/param[./@name = '%s'] with %s", 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 ", id, name, name); } } - 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 %s", 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 ", id, name, name); - } - } +// 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 %s", 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 ", id, name, name); +// } +// } private String getConceptXQuery(final String id, final String name, final String value) { final Escaper esc = XmlEscapers.xmlContentEscaper(); diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityApiController.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityApiController.java index bde3672d..6bc357eb 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityApiController.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityApiController.java @@ -223,6 +223,44 @@ public class CommunityApiController { communityApiCore.removeCommunityContentProvider(id, contentproviderId); } + @RequestMapping(value = "/community/{id}/contentprovidersList", produces = { + "application/json" + }, method = RequestMethod.POST) + @Operation(summary = "associate a list of content providers to the community", + description = "associate a list of content providers to the community", tags = { + C_PJ, W + }) + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "OK"), + @ApiResponse(responseCode = "404", description = "not found"), + @ApiResponse(responseCode = "500", description = "unexpected error") + }) + public List addCommunityContentProvidersList( + @PathVariable final String id, + @RequestBody final List contentprovidersList) throws CommunityException, CommunityNotFoundException { + + return communityApiCore.addCommunityContentProvidersList(id, contentprovidersList); + } + + @RequestMapping(value = "/community/{id}/projectList", produces = { + "application/json" + }, method = RequestMethod.DELETE) + @Operation(summary = "remove a list of content providers from the community", + description = "remove a list of content providers from the community", tags = { + C_PJ, W + }) + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "OK"), + @ApiResponse(responseCode = "404", description = "not found"), + @ApiResponse(responseCode = "500", description = "unexpected error") + }) + public void deleteCommunityContentProvidersList( + @PathVariable final String id, + @RequestBody final List contentProviderIdList) throws CommunityException, CommunityNotFoundException { + + communityApiCore.removeCommunityContentProviderList(id, contentProviderIdList); + } + // ADDING CODE FOR COMMUNITY ORGANIZATIONS @RequestMapping(value = "/community/{id}/organizations", produces = { diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityApiCore.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityApiCore.java index 473b84a1..09cb2a28 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityApiCore.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityApiCore.java @@ -47,6 +47,13 @@ public class CommunityApiCore {// implements CommunityClient{ } + private void removeAdvancedConstraint(String id) throws CommunityNotFoundException, CommunityException { + cc.getCommunity(id); + isClient.updateContextParam(id, CPROFILE_ADVANCED_CONSTRAINT, "", false); + cc.removeAdvancedConstraint(id); + + } + public void setCommunity(final String id, final CommunityWritableProperties details) throws CommunityException, CommunityNotFoundException { cc.getCommunity(id); // ensure the community exists. @@ -56,39 +63,39 @@ public class CommunityApiCore {// implements CommunityClient{ } if (details.getName() != null) { - isClient.updateContextParam(id, CSUMMARY_NAME, details.getName()); + isClient.updateContextParam(id, CSUMMARY_NAME, details.getName(), true); } if (details.getDescription() != null) { - isClient.updateContextParam(id, CSUMMARY_DESCRIPTION, details.getDescription()); + isClient.updateContextParam(id, CSUMMARY_DESCRIPTION, details.getDescription(), true); } if (details.getLogoUrl() != null) { - isClient.updateContextParam(id, CSUMMARY_LOGOURL, details.getLogoUrl()); + isClient.updateContextParam(id, CSUMMARY_LOGOURL, details.getLogoUrl(), true); } if (details.getStatus() != null) { - isClient.updateContextParam(id, CSUMMARY_STATUS, details.getStatus().name()); + isClient.updateContextParam(id, CSUMMARY_STATUS, details.getStatus().name(), true); } if (details.getSubjects() != null) { - isClient.updateContextParam(id, CPROFILE_SUBJECT, Joiner.on(CSV_DELIMITER).join(details.getSubjects())); + isClient.updateContextParam(id, CPROFILE_SUBJECT, Joiner.on(CSV_DELIMITER).join(details.getSubjects()), true); } if (details.getFos() != null) { - isClient.updateContextParam(id, CPROFILE_FOS, Joiner.on(CSV_DELIMITER).join(details.getFos())); + isClient.updateContextParam(id, CPROFILE_FOS, Joiner.on(CSV_DELIMITER).join(details.getFos()), true); } if (details.getSdg() != null) { - isClient.updateContextParam(id, CPROFILE_SDG, Joiner.on(CSV_DELIMITER).join(details.getSdg())); + isClient.updateContextParam(id, CPROFILE_SDG, Joiner.on(CSV_DELIMITER).join(details.getSdg()), true); } if (details.getAdvancedConstraint() != null) { - isClient.updateContextParamNoEscape(id, CPROFILE_ADVANCED_CONSTRAINT, ""); + isClient.updateContextParam(id, CPROFILE_ADVANCED_CONSTRAINT, "", false); } if (details.getMainZenodoCommunity() != null) { - isClient.updateContextParam(id, CSUMMARY_ZENODOC, details.getMainZenodoCommunity()); + isClient.updateContextParam(id, CSUMMARY_ZENODOC, details.getMainZenodoCommunity(), true); } cc.updateCommunity(id, details); @@ -190,6 +197,10 @@ public class CommunityApiCore {// implements CommunityClient{ log.info("content provider to add " + cp.toString()); if (!StringUtils.equalsIgnoreCase(id, cp.getCommunityId())) { throw new CommunityException("parameters 'id' and cp.communityId must be coherent"); } + return updateContentprovider(id, cp); + } + + private CommunityContentprovider updateContentprovider(String id, CommunityContentprovider cp) throws CommunityException, CommunityNotFoundException { final TreeMap cps = getCommunityContentproviderMap(id); final String concept_id = cp.getId(); if (concept_id != null && cps.keySet().contains(Integer.valueOf(concept_id))) { @@ -225,6 +236,30 @@ public class CommunityApiCore {// implements CommunityClient{ cc.removeFromCategory(id, CONTENTPROVIDERS_ID_SUFFIX, String.valueOf(contentproviderId)); } + public List addCommunityContentProvidersList(String id, List contentprovidersList) throws CommunityException, CommunityNotFoundException { + if(contentprovidersList == null || contentprovidersList.size() == 0){ + throw new CommunityException("parameter 'contentprovidersList' must be present and should contain at least one content provider"); + } + if (!StringUtils.equalsIgnoreCase(id, contentprovidersList.get(0).getCommunityId())) { + throw new CommunityException("parameters 'id' and contentprovider.communityId must be coherent"); + } + + List contentproviders = new ArrayList(); + + for(CommunityContentprovider contentProvider : contentprovidersList){ + contentproviders.add(updateContentprovider(id, contentProvider)); + } + + + return contentproviders; + } + + public void removeCommunityContentProviderList(final String id, final List contentProviderIdList) throws CommunityException, CommunityNotFoundException { + for(Integer contentProviderId: contentProviderIdList){ + removeCommunityContentProvider(id, contentProviderId); + } + } + public void removeCommunityOrganization(final String id, final Integer organizationId) throws CommunityException, CommunityNotFoundException { final Map organizations = getCommunityOrganizationMap(id); if (!organizations.containsKey(organizationId)) { @@ -278,7 +313,10 @@ public class CommunityApiCore {// implements CommunityClient{ final CommunityDetails cd = new CommunityDetails(); - final Set current = Sets.newHashSet(cc.getCommunity(id).getFos()); + final Set current = Sets.newHashSet(); + if(Optional.ofNullable(cc.getCommunity(id).getFos()).isPresent()){ + current.addAll(cc.getCommunity(id).getFos()); + } current.addAll(foss); @@ -307,8 +345,10 @@ public class CommunityApiCore {// implements CommunityClient{ public CommunityDetails addCommunitySDG(final String id, final List sdgs) throws CommunityException, CommunityNotFoundException { final CommunityDetails cd = new CommunityDetails(); - - final Set current = Sets.newHashSet(cc.getCommunity(id).getSdg()); + final Set current = Sets.newHashSet(); + if(Optional.ofNullable(cc.getCommunity(id).getSdg()).isPresent()){ + current.addAll(cc.getCommunity(id).getSdg()); + } current.addAll(sdgs); @@ -345,17 +385,15 @@ public class CommunityApiCore {// implements CommunityClient{ return cd; } - public CommunityDetails removeCommunityAdvancedConstraint(final String id) throws CommunityException, CommunityNotFoundException { + public CommunityDetails removeCommunityAdvancedConstraint(final String id) throws CommunityNotFoundException, CommunityException { - final CommunityDetails cd = new CommunityDetails(); - SelectionCriteria sl = new SelectionCriteria(); - cd.setAdvancedConstraint(sl); + removeAdvancedConstraint(id); - setCommunity(id, CommunityWritableProperties.fromDetails(cd)); - - return cd; + return new CommunityDetails(); } + + @CacheEvict(value = "community-cache", allEntries = true) public void removeCommunityZenodoCommunity(final String id, final Integer zenodoCommId) throws CommunityException, CommunityNotFoundException { @@ -463,4 +501,5 @@ public class CommunityApiCore {// implements CommunityClient{ return organization; } + } diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityCommon.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityCommon.java index 52d4dd40..d23bc881 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityCommon.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityCommon.java @@ -168,6 +168,13 @@ public class CommunityCommon { } + public void removeAdvancedConstraint(String id) throws CommunityException { + final Context context = getContextMap().get(id); + context.getParams() + .replace(CPROFILE_ADVANCED_CONSTRAINT, Arrays.asList(new Param() + .setName(CPROFILE_ADVANCED_CONSTRAINT).setValue(null))); + } + public void updateCommunity(String id, CommunityWritableProperties community) throws CommunityException { final Context context = getContextMap().get(id); @@ -202,21 +209,35 @@ public class CommunityCommon { .join(community.getSubjects())))); } if(community.getFos() != null){ + if (context.getParams().containsKey(CPROFILE_FOS)) context.getParams() .replace(CPROFILE_FOS, Arrays.asList(new Param().setName(CPROFILE_FOS) .setValue(Joiner.on(CSV_DELIMITER) .join(community.getFos())))); + else + context.getParams().put(CPROFILE_FOS, Arrays.asList(new Param().setName(CPROFILE_FOS) + .setValue(Joiner.on(CSV_DELIMITER) + .join(community.getFos())))); } if(community.getSdg() != null){ + if(context.getParams().containsKey(CPROFILE_SDG)) context.getParams() .replace(CPROFILE_SDG, Arrays.asList(new Param().setName(CPROFILE_SDG) .setValue(Joiner.on(CSV_DELIMITER) .join(community.getSdg())))); + else + context.getParams().put(CPROFILE_SDG, Arrays.asList(new Param().setName(CPROFILE_SDG) + .setValue(Joiner.on(CSV_DELIMITER) + .join(community.getSdg())))); } if (community.getAdvancedConstraint() != null) { + if(context.getParams().containsKey(CPROFILE_ADVANCED_CONSTRAINT)) context.getParams() .replace(CPROFILE_ADVANCED_CONSTRAINT, Arrays.asList(new Param() .setName(CPROFILE_ADVANCED_CONSTRAINT).setValue(new Gson().toJson(community.getAdvancedConstraint())))); + else + context.getParams().put(CPROFILE_ADVANCED_CONSTRAINT, Arrays.asList(new Param() + .setName(CPROFILE_ADVANCED_CONSTRAINT).setValue(new Gson().toJson(community.getAdvancedConstraint())))); } if(community.getMainZenodoCommunity() != null){ context.getParams() From 50b2468a13690f10f979b43f3db0c268aae14490 Mon Sep 17 00:00:00 2001 From: "miriam.baglioni" Date: Mon, 19 Dec 2022 12:45:13 +0100 Subject: [PATCH 04/19] [CommunityAPIextention]- --- .../eu/dnetlib/openaire/community/CommunityApiController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityApiController.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityApiController.java index 6bc357eb..c5207180 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityApiController.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityApiController.java @@ -242,7 +242,7 @@ public class CommunityApiController { return communityApiCore.addCommunityContentProvidersList(id, contentprovidersList); } - @RequestMapping(value = "/community/{id}/projectList", produces = { + @RequestMapping(value = "/community/{id}/contentprovidersList", produces = { "application/json" }, method = RequestMethod.DELETE) @Operation(summary = "remove a list of content providers from the community", From c376ef9b6cf41f373c55b8939f912c73a9a8c0b7 Mon Sep 17 00:00:00 2001 From: Sandro La Bruzzo Date: Tue, 20 Dec 2022 11:12:12 +0100 Subject: [PATCH 05/19] implemented required param --- .../api/controller/ScholixControllerV1.java | 5 ++-- .../api/controller/ScholixControllerV2.java | 28 +++++++++++++------ .../src/main/resources/application.properties | 2 +- 3 files changed, 23 insertions(+), 12 deletions(-) diff --git a/apps/scholexplorer-api/src/main/java/eu/dnetlib/scholix/api/controller/ScholixControllerV1.java b/apps/scholexplorer-api/src/main/java/eu/dnetlib/scholix/api/controller/ScholixControllerV1.java index 050fc086..d51228a2 100644 --- a/apps/scholexplorer-api/src/main/java/eu/dnetlib/scholix/api/controller/ScholixControllerV1.java +++ b/apps/scholexplorer-api/src/main/java/eu/dnetlib/scholix/api/controller/ScholixControllerV1.java @@ -36,8 +36,9 @@ public class ScholixControllerV1 extends AbstractDnetController { @GetMapping("/linksFromPublisher") @Timed(value = "scholix.v1.linksFromPublisher", description = "Time taken to return links on Version 1.0 of Scholix collected from a publisher") public List linksFromPublisher( - @Parameter(in = ParameterIn.QUERY, description = "Filter Scholix relationships collected from a publisher", required = true) final String publisher, - @Parameter(in = ParameterIn.QUERY, description = "The page number") @RequestParam(required = false) final Integer page) throws ScholixException { + + @Parameter(in = ParameterIn.QUERY, description = "Filter Scholix relationships collected from a publisher", required = true) final String publisher, + @Parameter(in = ParameterIn.QUERY, description = "The page number") @RequestParam(required = false) final Integer page) throws ScholixException { final int currentPage = page != null ? page : 0; diff --git a/apps/scholexplorer-api/src/main/java/eu/dnetlib/scholix/api/controller/ScholixControllerV2.java b/apps/scholexplorer-api/src/main/java/eu/dnetlib/scholix/api/controller/ScholixControllerV2.java index 469af54d..f3b21bce 100644 --- a/apps/scholexplorer-api/src/main/java/eu/dnetlib/scholix/api/controller/ScholixControllerV2.java +++ b/apps/scholexplorer-api/src/main/java/eu/dnetlib/scholix/api/controller/ScholixControllerV2.java @@ -8,6 +8,7 @@ import org.apache.commons.lang3.tuple.Pair; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import eu.dnetlib.common.controller.AbstractDnetController; @@ -34,15 +35,24 @@ public class ScholixControllerV2 extends AbstractDnetController { @Operation(summary = "Get Scholix Links") @GetMapping("/Links") public PageResultType links( - @Parameter(in = ParameterIn.QUERY, description = "Filter Scholix relationships collected from a LinkProvider") final String linkProvider, - @Parameter(in = ParameterIn.QUERY, description = "Filter Scholix relationships having a target pid") final String targetPid, - @Parameter(in = ParameterIn.QUERY, description = "Filter Scholix relationships having a target pid type") final String targetPidType, - @Parameter(in = ParameterIn.QUERY, description = "Filter Scholix relationships having a target published in a Publisher named targetPublisher") final String targetPublisher, - @Parameter(in = ParameterIn.QUERY, description = "Filter Scholix relationships having a target type (literature, dataset, unknown)") final String targetType, - @Parameter(in = ParameterIn.QUERY, description = "Filter Scholix relationships having a source pid") final String sourcePid, - @Parameter(in = ParameterIn.QUERY, description = "Filter Scholix relationships having a source pid type") final String sourcePidType, - @Parameter(in = ParameterIn.QUERY, description = "Filter Scholix relationships having a source published in a Publisher named sourcePublisher") final String sourcePublisher, - @Parameter(in = ParameterIn.QUERY, description = "Filter Scholix relationships having a source type (literature, dataset, unknown)") final String sourceType, + @RequestParam(required = false) + @Parameter(in = ParameterIn.QUERY, description = "Filter Scholix relationships collected from a LinkProvider") final String linkProvider, + @RequestParam(required = false) + @Parameter(in = ParameterIn.QUERY, description = "Filter Scholix relationships having a target pid") final String targetPid, + @RequestParam(required = false) + @Parameter(in = ParameterIn.QUERY, description = "Filter Scholix relationships having a target pid type") final String targetPidType, + @RequestParam(required = false) + @Parameter(in = ParameterIn.QUERY, description = "Filter Scholix relationships having a target published in a Publisher named targetPublisher") final String targetPublisher, + @RequestParam(required = false) + @Parameter(in = ParameterIn.QUERY, description = "Filter Scholix relationships having a target type (literature, dataset, unknown)") final String targetType, + @RequestParam(required = false) + @Parameter(in = ParameterIn.QUERY, description = "Filter Scholix relationships having a source pid") final String sourcePid, + @RequestParam(required = false) + @Parameter(in = ParameterIn.QUERY, description = "Filter Scholix relationships having a source pid type") final String sourcePidType, + @RequestParam(required = false) + @Parameter(in = ParameterIn.QUERY, description = "Filter Scholix relationships having a source published in a Publisher named sourcePublisher") final String sourcePublisher, + @RequestParam(required = false) + @Parameter(in = ParameterIn.QUERY, description = "Filter Scholix relationships having a source type (literature, dataset, unknown)") final String sourceType, // @Parameter(in = ParameterIn.QUERY, // description = "Filter scholix Links having collected after this date") String harvestedAfter, @Parameter(in = ParameterIn.QUERY, description = "select page of result") final Integer page) throws Exception { diff --git a/apps/scholexplorer-api/src/main/resources/application.properties b/apps/scholexplorer-api/src/main/resources/application.properties index 60bb6bfc..7e8989e0 100644 --- a/apps/scholexplorer-api/src/main/resources/application.properties +++ b/apps/scholexplorer-api/src/main/resources/application.properties @@ -27,7 +27,7 @@ management.metrics.distribution.percentiles.http.server.requests=0.5, 0.9, 0.95, #scholix.elastic.clusterNodes = 10.19.65.51:9200,10.19.65.52:9200,10.19.65.53:9200,10.19.65.54:9200 scholix.elastic.clusterNodes = localhost:9200 -scholix.elastic.indexName = dli_scholix +scholix.elastic.indexName = dli_shadow_scholix scholix.elastic.socketTimeout = 60000 scholix.elastic.connectionTimeout= 60000 From f47fbe9de989a4aed609149f7180135362441164 Mon Sep 17 00:00:00 2001 From: Sandro La Bruzzo Date: Tue, 20 Dec 2022 11:13:14 +0100 Subject: [PATCH 06/19] [maven-release-plugin] prepare release dnet-applications-3.3.3 --- apps/bioschemas-api/pom.xml | 2 +- apps/dhp-broker-application/pom.xml | 2 +- apps/dhp-broker-public-application/pom.xml | 2 +- apps/dhp-mdstore-manager/pom.xml | 2 +- apps/dnet-exporter-api/pom.xml | 2 +- apps/dnet-orgs-database-application/pom.xml | 2 +- apps/pom.xml | 2 +- apps/scholexplorer-api/pom.xml | 2 +- cmd-line-apps/dhp-broker-client/pom.xml | 2 +- cmd-line-apps/pom.xml | 2 +- libs/dnet-apps-common/pom.xml | 2 +- libs/dnet-broker-apps-common/pom.xml | 2 +- libs/dnet-openaire-broker-common/pom.xml | 2 +- libs/pom.xml | 2 +- pom.xml | 4 ++-- 15 files changed, 16 insertions(+), 16 deletions(-) diff --git a/apps/bioschemas-api/pom.xml b/apps/bioschemas-api/pom.xml index 8310774b..ea18aa99 100644 --- a/apps/bioschemas-api/pom.xml +++ b/apps/bioschemas-api/pom.xml @@ -3,7 +3,7 @@ eu.dnetlib.dhp apps - 3.3.3-SNAPSHOT + 3.3.3 ../pom.xml diff --git a/apps/dhp-broker-application/pom.xml b/apps/dhp-broker-application/pom.xml index 931b0c70..d199e1fc 100644 --- a/apps/dhp-broker-application/pom.xml +++ b/apps/dhp-broker-application/pom.xml @@ -4,7 +4,7 @@ eu.dnetlib.dhp apps - 3.3.3-SNAPSHOT + 3.3.3 ../pom.xml diff --git a/apps/dhp-broker-public-application/pom.xml b/apps/dhp-broker-public-application/pom.xml index 3420d26b..0c8aeaa4 100644 --- a/apps/dhp-broker-public-application/pom.xml +++ b/apps/dhp-broker-public-application/pom.xml @@ -4,7 +4,7 @@ eu.dnetlib.dhp apps - 3.3.3-SNAPSHOT + 3.3.3 ../pom.xml diff --git a/apps/dhp-mdstore-manager/pom.xml b/apps/dhp-mdstore-manager/pom.xml index cc28e3a5..1a138728 100644 --- a/apps/dhp-mdstore-manager/pom.xml +++ b/apps/dhp-mdstore-manager/pom.xml @@ -4,7 +4,7 @@ eu.dnetlib.dhp apps - 3.3.3-SNAPSHOT + 3.3.3 ../pom.xml diff --git a/apps/dnet-exporter-api/pom.xml b/apps/dnet-exporter-api/pom.xml index f80aa74a..0b8583b5 100644 --- a/apps/dnet-exporter-api/pom.xml +++ b/apps/dnet-exporter-api/pom.xml @@ -3,7 +3,7 @@ eu.dnetlib.dhp apps - 3.3.3-SNAPSHOT + 3.3.3 ../ diff --git a/apps/dnet-orgs-database-application/pom.xml b/apps/dnet-orgs-database-application/pom.xml index 026fa11d..87ebb2d9 100644 --- a/apps/dnet-orgs-database-application/pom.xml +++ b/apps/dnet-orgs-database-application/pom.xml @@ -4,7 +4,7 @@ eu.dnetlib.dhp apps - 3.3.3-SNAPSHOT + 3.3.3 ../ diff --git a/apps/pom.xml b/apps/pom.xml index 2a316999..ee901885 100644 --- a/apps/pom.xml +++ b/apps/pom.xml @@ -3,7 +3,7 @@ eu.dnetlib.dhp dnet-applications - 3.3.3-SNAPSHOT + 3.3.3 ../pom.xml diff --git a/apps/scholexplorer-api/pom.xml b/apps/scholexplorer-api/pom.xml index 682cfb91..bd89360f 100644 --- a/apps/scholexplorer-api/pom.xml +++ b/apps/scholexplorer-api/pom.xml @@ -3,7 +3,7 @@ eu.dnetlib.dhp apps - 3.3.3-SNAPSHOT + 3.3.3 ../pom.xml diff --git a/cmd-line-apps/dhp-broker-client/pom.xml b/cmd-line-apps/dhp-broker-client/pom.xml index 50f5df8c..74cc633d 100644 --- a/cmd-line-apps/dhp-broker-client/pom.xml +++ b/cmd-line-apps/dhp-broker-client/pom.xml @@ -4,7 +4,7 @@ eu.dnetlib.dhp cmd-line-apps - 3.3.3-SNAPSHOT + 3.3.3 ../ diff --git a/cmd-line-apps/pom.xml b/cmd-line-apps/pom.xml index c766a841..4555cf66 100644 --- a/cmd-line-apps/pom.xml +++ b/cmd-line-apps/pom.xml @@ -3,7 +3,7 @@ eu.dnetlib.dhp dnet-applications - 3.3.3-SNAPSHOT + 3.3.3 ../ diff --git a/libs/dnet-apps-common/pom.xml b/libs/dnet-apps-common/pom.xml index 6c80155e..aa00d950 100644 --- a/libs/dnet-apps-common/pom.xml +++ b/libs/dnet-apps-common/pom.xml @@ -4,7 +4,7 @@ eu.dnetlib.dhp libs - 3.3.3-SNAPSHOT + 3.3.3 ../ diff --git a/libs/dnet-broker-apps-common/pom.xml b/libs/dnet-broker-apps-common/pom.xml index a1ef64b4..32145799 100644 --- a/libs/dnet-broker-apps-common/pom.xml +++ b/libs/dnet-broker-apps-common/pom.xml @@ -4,7 +4,7 @@ eu.dnetlib.dhp libs - 3.3.3-SNAPSHOT + 3.3.3 ../ diff --git a/libs/dnet-openaire-broker-common/pom.xml b/libs/dnet-openaire-broker-common/pom.xml index 56c420f3..81900263 100644 --- a/libs/dnet-openaire-broker-common/pom.xml +++ b/libs/dnet-openaire-broker-common/pom.xml @@ -3,7 +3,7 @@ eu.dnetlib.dhp libs - 3.3.3-SNAPSHOT + 3.3.3 ../ diff --git a/libs/pom.xml b/libs/pom.xml index 067c9d35..f8e8d6da 100644 --- a/libs/pom.xml +++ b/libs/pom.xml @@ -4,7 +4,7 @@ eu.dnetlib.dhp dnet-applications - 3.3.3-SNAPSHOT + 3.3.3 ../ diff --git a/pom.xml b/pom.xml index b7839b62..0d791604 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ 4.0.0 eu.dnetlib.dhp dnet-applications - 3.3.3-SNAPSHOT + 3.3.3 pom @@ -44,7 +44,7 @@ scm:git:gitea@code-repo.d4science.org:D-Net/dnet-applications.git scm:git:gitea@code-repo.d4science.org:D-Net/dnet-applications.git https://code-repo.d4science.org/D-Net/dnet-applications/ - HEAD + dnet-applications-3.3.3 This module is the root descriptor for the dnet-applications project From bd18376339f560d6480f88d23053422df327c4e5 Mon Sep 17 00:00:00 2001 From: Sandro La Bruzzo Date: Tue, 20 Dec 2022 11:13:19 +0100 Subject: [PATCH 07/19] [maven-release-plugin] prepare for next development iteration --- apps/bioschemas-api/pom.xml | 2 +- apps/dhp-broker-application/pom.xml | 2 +- apps/dhp-broker-public-application/pom.xml | 2 +- apps/dhp-mdstore-manager/pom.xml | 2 +- apps/dnet-exporter-api/pom.xml | 2 +- apps/dnet-orgs-database-application/pom.xml | 2 +- apps/pom.xml | 2 +- apps/scholexplorer-api/pom.xml | 2 +- cmd-line-apps/dhp-broker-client/pom.xml | 2 +- cmd-line-apps/pom.xml | 2 +- libs/dnet-apps-common/pom.xml | 2 +- libs/dnet-broker-apps-common/pom.xml | 2 +- libs/dnet-openaire-broker-common/pom.xml | 2 +- libs/pom.xml | 2 +- pom.xml | 4 ++-- 15 files changed, 16 insertions(+), 16 deletions(-) diff --git a/apps/bioschemas-api/pom.xml b/apps/bioschemas-api/pom.xml index ea18aa99..a1e0b415 100644 --- a/apps/bioschemas-api/pom.xml +++ b/apps/bioschemas-api/pom.xml @@ -3,7 +3,7 @@ eu.dnetlib.dhp apps - 3.3.3 + 3.3.4-SNAPSHOT ../pom.xml diff --git a/apps/dhp-broker-application/pom.xml b/apps/dhp-broker-application/pom.xml index d199e1fc..5467c9f9 100644 --- a/apps/dhp-broker-application/pom.xml +++ b/apps/dhp-broker-application/pom.xml @@ -4,7 +4,7 @@ eu.dnetlib.dhp apps - 3.3.3 + 3.3.4-SNAPSHOT ../pom.xml diff --git a/apps/dhp-broker-public-application/pom.xml b/apps/dhp-broker-public-application/pom.xml index 0c8aeaa4..e381f9f8 100644 --- a/apps/dhp-broker-public-application/pom.xml +++ b/apps/dhp-broker-public-application/pom.xml @@ -4,7 +4,7 @@ eu.dnetlib.dhp apps - 3.3.3 + 3.3.4-SNAPSHOT ../pom.xml diff --git a/apps/dhp-mdstore-manager/pom.xml b/apps/dhp-mdstore-manager/pom.xml index 1a138728..90bfa89c 100644 --- a/apps/dhp-mdstore-manager/pom.xml +++ b/apps/dhp-mdstore-manager/pom.xml @@ -4,7 +4,7 @@ eu.dnetlib.dhp apps - 3.3.3 + 3.3.4-SNAPSHOT ../pom.xml diff --git a/apps/dnet-exporter-api/pom.xml b/apps/dnet-exporter-api/pom.xml index 0b8583b5..b4fa6397 100644 --- a/apps/dnet-exporter-api/pom.xml +++ b/apps/dnet-exporter-api/pom.xml @@ -3,7 +3,7 @@ eu.dnetlib.dhp apps - 3.3.3 + 3.3.4-SNAPSHOT ../ diff --git a/apps/dnet-orgs-database-application/pom.xml b/apps/dnet-orgs-database-application/pom.xml index 87ebb2d9..ab5b9c4d 100644 --- a/apps/dnet-orgs-database-application/pom.xml +++ b/apps/dnet-orgs-database-application/pom.xml @@ -4,7 +4,7 @@ eu.dnetlib.dhp apps - 3.3.3 + 3.3.4-SNAPSHOT ../ diff --git a/apps/pom.xml b/apps/pom.xml index ee901885..18df266f 100644 --- a/apps/pom.xml +++ b/apps/pom.xml @@ -3,7 +3,7 @@ eu.dnetlib.dhp dnet-applications - 3.3.3 + 3.3.4-SNAPSHOT ../pom.xml diff --git a/apps/scholexplorer-api/pom.xml b/apps/scholexplorer-api/pom.xml index bd89360f..e95632f8 100644 --- a/apps/scholexplorer-api/pom.xml +++ b/apps/scholexplorer-api/pom.xml @@ -3,7 +3,7 @@ eu.dnetlib.dhp apps - 3.3.3 + 3.3.4-SNAPSHOT ../pom.xml diff --git a/cmd-line-apps/dhp-broker-client/pom.xml b/cmd-line-apps/dhp-broker-client/pom.xml index 74cc633d..12536b76 100644 --- a/cmd-line-apps/dhp-broker-client/pom.xml +++ b/cmd-line-apps/dhp-broker-client/pom.xml @@ -4,7 +4,7 @@ eu.dnetlib.dhp cmd-line-apps - 3.3.3 + 3.3.4-SNAPSHOT ../ diff --git a/cmd-line-apps/pom.xml b/cmd-line-apps/pom.xml index 4555cf66..3c752659 100644 --- a/cmd-line-apps/pom.xml +++ b/cmd-line-apps/pom.xml @@ -3,7 +3,7 @@ eu.dnetlib.dhp dnet-applications - 3.3.3 + 3.3.4-SNAPSHOT ../ diff --git a/libs/dnet-apps-common/pom.xml b/libs/dnet-apps-common/pom.xml index aa00d950..53e1d2be 100644 --- a/libs/dnet-apps-common/pom.xml +++ b/libs/dnet-apps-common/pom.xml @@ -4,7 +4,7 @@ eu.dnetlib.dhp libs - 3.3.3 + 3.3.4-SNAPSHOT ../ diff --git a/libs/dnet-broker-apps-common/pom.xml b/libs/dnet-broker-apps-common/pom.xml index 32145799..e7ac5f64 100644 --- a/libs/dnet-broker-apps-common/pom.xml +++ b/libs/dnet-broker-apps-common/pom.xml @@ -4,7 +4,7 @@ eu.dnetlib.dhp libs - 3.3.3 + 3.3.4-SNAPSHOT ../ diff --git a/libs/dnet-openaire-broker-common/pom.xml b/libs/dnet-openaire-broker-common/pom.xml index 81900263..da367339 100644 --- a/libs/dnet-openaire-broker-common/pom.xml +++ b/libs/dnet-openaire-broker-common/pom.xml @@ -3,7 +3,7 @@ eu.dnetlib.dhp libs - 3.3.3 + 3.3.4-SNAPSHOT ../ diff --git a/libs/pom.xml b/libs/pom.xml index f8e8d6da..1873ecbe 100644 --- a/libs/pom.xml +++ b/libs/pom.xml @@ -4,7 +4,7 @@ eu.dnetlib.dhp dnet-applications - 3.3.3 + 3.3.4-SNAPSHOT ../ diff --git a/pom.xml b/pom.xml index 0d791604..416b6e31 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ 4.0.0 eu.dnetlib.dhp dnet-applications - 3.3.3 + 3.3.4-SNAPSHOT pom @@ -44,7 +44,7 @@ scm:git:gitea@code-repo.d4science.org:D-Net/dnet-applications.git scm:git:gitea@code-repo.d4science.org:D-Net/dnet-applications.git https://code-repo.d4science.org/D-Net/dnet-applications/ - dnet-applications-3.3.3 + HEAD This module is the root descriptor for the dnet-applications project From bea45412c3fa83b73ee54762084b9f60ac771662 Mon Sep 17 00:00:00 2001 From: Claudio Atzori Date: Thu, 19 Jan 2023 14:37:02 +0100 Subject: [PATCH 08/19] added license file --- LICENSE | 661 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 661 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..2def0e88 --- /dev/null +++ b/LICENSE @@ -0,0 +1,661 @@ + GNU AFFERO GENERAL PUBLIC LICENSE + Version 3, 19 November 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU Affero General Public License is a free, copyleft license for +software and other kinds of works, specifically designed to ensure +cooperation with the community in the case of network server software. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +our General Public Licenses are intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + Developers that use our General Public Licenses protect your rights +with two steps: (1) assert copyright on the software, and (2) offer +you this License which gives you legal permission to copy, distribute +and/or modify the software. + + A secondary benefit of defending all users' freedom is that +improvements made in alternate versions of the program, if they +receive widespread use, become available for other developers to +incorporate. Many developers of free software are heartened and +encouraged by the resulting cooperation. However, in the case of +software used on network servers, this result may fail to come about. +The GNU General Public License permits making a modified version and +letting the public access it on a server without ever releasing its +source code to the public. + + The GNU Affero General Public License is designed specifically to +ensure that, in such cases, the modified source code becomes available +to the community. It requires the operator of a network server to +provide the source code of the modified version running there to the +users of that server. Therefore, public use of a modified version, on +a publicly accessible server, gives the public access to the source +code of the modified version. + + An older license, called the Affero General Public License and +published by Affero, was designed to accomplish similar goals. This is +a different license, not a version of the Affero GPL, but Affero has +released a new version of the Affero GPL which permits relicensing under +this license. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU Affero General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Remote Network Interaction; Use with the GNU General Public License. + + Notwithstanding any other provision of this License, if you modify the +Program, your modified version must prominently offer all users +interacting with it remotely through a computer network (if your version +supports such interaction) an opportunity to receive the Corresponding +Source of your version by providing access to the Corresponding Source +from a network server at no charge, through some standard or customary +means of facilitating copying of software. This Corresponding Source +shall include the Corresponding Source for any work covered by version 3 +of the GNU General Public License that is incorporated pursuant to the +following paragraph. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the work with which it is combined will remain governed by version +3 of the GNU General Public License. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU Affero General Public License from time to time. Such new versions +will be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU Affero General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU Affero General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU Affero General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If your software can interact with users remotely through a computer +network, you should also make sure that it provides a way for users to +get its source. For example, if your program is a web application, its +interface could display a "Source" link that leads users to an archive +of the code. There are many ways you could offer source, and different +solutions will be better for different programs; see section 13 for the +specific requirements. + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU AGPL, see +. \ No newline at end of file From 3dc121045cee2cb1b9f5e3c46c6a6e0d3bd6a89a Mon Sep 17 00:00:00 2001 From: "michele.artini" Date: Mon, 23 Jan 2023 10:27:07 +0100 Subject: [PATCH 09/19] api for wf history V2 --- .../main/java/eu/dnetlib/CacheCustomizer.java | 27 +-- .../openaire/dsm/DsmApiController.java | 8 +- .../openaire/dsm/DsmApiControllerV2.java | 18 ++ .../java/eu/dnetlib/openaire/dsm/DsmCore.java | 18 +- .../openaire/dsm/dao/MongoLoggerClient.java | 11 +- .../dsm/dao/MongoLoggerClientImpl.java | 171 +++++++++++------- .../domain/AggregationHistoryResponseV1.java | 25 +++ ...java => AggregationHistoryResponseV2.java} | 4 +- .../dsm/domain/AggregationInfoV1.java | 15 ++ .../openaire/dsm/domain/CollectionInfoV1.java | 22 +++ ...lectionInfo.java => CollectionInfoV2.java} | 2 +- .../dsm/domain/TransformationInfoV1.java | 12 ++ ...ionInfo.java => TransformationInfoV2.java} | 2 +- 13 files changed, 238 insertions(+), 97 deletions(-) create mode 100644 apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/AggregationHistoryResponseV1.java rename apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/{AggregationHistoryResponse.java => AggregationHistoryResponseV2.java} (78%) create mode 100644 apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/AggregationInfoV1.java create mode 100644 apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/CollectionInfoV1.java rename apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/{CollectionInfo.java => CollectionInfoV2.java} (90%) create mode 100644 apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/TransformationInfoV1.java rename apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/{TransformationInfo.java => TransformationInfoV2.java} (79%) diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/CacheCustomizer.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/CacheCustomizer.java index cac25806..3ce44545 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/CacheCustomizer.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/CacheCustomizer.java @@ -1,29 +1,18 @@ package eu.dnetlib; +import static java.util.Arrays.asList; + import org.springframework.boot.autoconfigure.cache.CacheManagerCustomizer; import org.springframework.cache.concurrent.ConcurrentMapCacheManager; import org.springframework.stereotype.Component; -import static java.util.Arrays.asList; - @Component public class CacheCustomizer implements CacheManagerCustomizer { - @Override - public void customize(final ConcurrentMapCacheManager cacheManager) { - cacheManager.setCacheNames( - asList( - "fundingpath-ids", - "indexdsinfo-cache", - "objectstoreid-cache", - "context-cache", - "context-cache-funder", - "context-cache-community", - "dsm-aggregationhistory-cache", - "dsm-firstharvestdate-cache", - "vocabularies-cache", - "community-cache", - "info")); - } + @Override + public void customize(final ConcurrentMapCacheManager cacheManager) { + cacheManager + .setCacheNames(asList("fundingpath-ids", "indexdsinfo-cache", "objectstoreid-cache", "context-cache", "context-cache-funder", "context-cache-community", "dsm-aggregationhistory-cache-v1", "dsm-aggregationhistory-cache-v2", "dsm-firstharvestdate-cache", "vocabularies-cache", "community-cache", "info")); + } -} \ No newline at end of file +} diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/DsmApiController.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/DsmApiController.java index 180cf716..b93ea3ad 100755 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/DsmApiController.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/DsmApiController.java @@ -29,7 +29,7 @@ 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.AggregationHistoryResponse; +import eu.dnetlib.openaire.dsm.domain.AggregationHistoryResponseV1; import eu.dnetlib.openaire.dsm.domain.ApiDetails; import eu.dnetlib.openaire.dsm.domain.ApiDetailsResponse; import eu.dnetlib.openaire.dsm.domain.DatasourceDetailResponse; @@ -97,16 +97,16 @@ public class DsmApiController extends AbstractExporterController { @GetMapping(value = "/ds/aggregationhistory/{dsId}", produces = { "application/json" }) - @Operation(summary = "search datasources", description = "Returns list of Datasource details.", tags = { + @Operation(summary = "return aggregation hitory", description = "Returns the aggregation history of a datasource", tags = { DS, R }) @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "OK"), @ApiResponse(responseCode = "500", description = "unexpected error") }) - public AggregationHistoryResponse aggregationHistory(@PathVariable final String dsId) throws DsmException { + public AggregationHistoryResponseV1 aggregationHistory(@PathVariable final String dsId) throws DsmException { final StopWatch stop = StopWatch.createStarted(); - final AggregationHistoryResponse rsp = dsmCore.aggregationhistory(dsId); + final AggregationHistoryResponseV1 rsp = dsmCore.aggregationhistoryV1(dsId); return prepareResponse(0, rsp.getAggregationInfo().size(), stop, rsp); } diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/DsmApiControllerV2.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/DsmApiControllerV2.java index 356494e5..a612c043 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/DsmApiControllerV2.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/DsmApiControllerV2.java @@ -15,8 +15,10 @@ 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 io.swagger.v3.oas.annotations.Operation; @@ -83,4 +85,20 @@ public class DsmApiControllerV2 extends AbstractExporterController { return prepareResponse(1, list.size(), stop, rsp); } + @GetMapping(value = "/aggregationhistory/{dsId}", produces = { + "application/json" + }) + @Operation(summary = "Return history", description = "Returns the aggregation history of the datasources (it includes also the failures)", tags = { + DS, R + }) + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "OK"), + @ApiResponse(responseCode = "500", description = "unexpected error") + }) + public AggregationHistoryResponseV2 aggregationHistory(@PathVariable final String dsId) throws DsmException { + final StopWatch stop = StopWatch.createStarted(); + final AggregationHistoryResponseV2 rsp = dsmCore.aggregationhistoryV2(dsId); + return prepareResponse(0, rsp.getAggregationInfo().size(), stop, rsp); + } + } diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/DsmCore.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/DsmCore.java index 42911d5b..806de5d5 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/DsmCore.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/DsmCore.java @@ -40,7 +40,9 @@ import eu.dnetlib.openaire.dsm.dao.MongoLoggerClient; import eu.dnetlib.openaire.dsm.dao.ResponseUtils; import eu.dnetlib.openaire.dsm.dao.VocabularyClient; import eu.dnetlib.openaire.dsm.dao.utils.DsmMappingUtils; -import eu.dnetlib.openaire.dsm.domain.AggregationHistoryResponse; +import eu.dnetlib.openaire.dsm.domain.AggregationHistoryResponseV1; +import eu.dnetlib.openaire.dsm.domain.AggregationHistoryResponseV2; +import eu.dnetlib.openaire.dsm.domain.AggregationInfoV1; import eu.dnetlib.openaire.dsm.domain.ApiDetails; import eu.dnetlib.openaire.dsm.domain.ApiDetailsResponse; import eu.dnetlib.openaire.dsm.domain.DatasourceDetailResponse; @@ -313,9 +315,17 @@ public class DsmCore { } } - public AggregationHistoryResponse aggregationhistory(final String dsId) throws DsmException { - final List history = mongoLoggerClient.getAggregationHistory(dsId); - final AggregationHistoryResponse rsp = new AggregationHistoryResponse(history); + @Deprecated + public AggregationHistoryResponseV1 aggregationhistoryV1(final String dsId) throws DsmException { + final List history = mongoLoggerClient.getAggregationHistoryV1(dsId); + final AggregationHistoryResponseV1 rsp = new AggregationHistoryResponseV1(history); + rsp.setHeader(ResponseUtils.header(history.size())); + return rsp; + } + + public AggregationHistoryResponseV2 aggregationhistoryV2(final String dsId) throws DsmException { + final List history = mongoLoggerClient.getAggregationHistoryV2(dsId); + final AggregationHistoryResponseV2 rsp = new AggregationHistoryResponseV2(history); rsp.setHeader(ResponseUtils.header(history.size())); return rsp; diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/MongoLoggerClient.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/MongoLoggerClient.java index 511b6240..b68a9689 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/MongoLoggerClient.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/MongoLoggerClient.java @@ -1,13 +1,16 @@ package eu.dnetlib.openaire.dsm.dao; -import eu.dnetlib.enabling.datasources.common.AggregationInfo; -import eu.dnetlib.enabling.datasources.common.DsmException; - 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; + public interface MongoLoggerClient { - List getAggregationHistory(final String dsId) throws DsmException; + List getAggregationHistoryV1(final String dsId) throws DsmException; + + List getAggregationHistoryV2(final String dsId) throws DsmException; void dropCache(); diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/MongoLoggerClientImpl.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/MongoLoggerClientImpl.java index 279c3789..caf6b62d 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/MongoLoggerClientImpl.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/MongoLoggerClientImpl.java @@ -47,9 +47,12 @@ 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; -import eu.dnetlib.openaire.dsm.domain.CollectionInfo; +import eu.dnetlib.openaire.dsm.domain.AggregationInfoV1; +import eu.dnetlib.openaire.dsm.domain.CollectionInfoV1; +import eu.dnetlib.openaire.dsm.domain.CollectionInfoV2; import eu.dnetlib.openaire.dsm.domain.CollectionMode; -import eu.dnetlib.openaire.dsm.domain.TransformationInfo; +import eu.dnetlib.openaire.dsm.domain.TransformationInfoV1; +import eu.dnetlib.openaire.dsm.domain.TransformationInfoV2; import eu.dnetlib.openaire.info.JdbcInfoDao; /** @@ -71,10 +74,8 @@ public class MongoLoggerClientImpl implements MongoLoggerClient { private JdbcInfoDao jdbcInfoDao; private final static String LOADTIME = "loadtime"; - private final LoadingCache loadingCache = CacheBuilder.newBuilder() - .maximumSize(1) - .expireAfterWrite(60, TimeUnit.MINUTES) - .build(new CacheLoader() { + private final LoadingCache loadingCache = + CacheBuilder.newBuilder().maximumSize(1).expireAfterWrite(60, TimeUnit.MINUTES).build(new CacheLoader() { // The only cached value is associated to "loadtime" @Override @@ -90,18 +91,31 @@ public class MongoLoggerClientImpl implements MongoLoggerClient { private static MongoCollection collection = null; @Override - @Cacheable("dsm-aggregationhistory-cache") - public List getAggregationHistory(final String dsId) throws DsmException { + @Cacheable("dsm-aggregationhistory-cache-v1") + @Deprecated + public List getAggregationHistoryV1(final String dsId) throws DsmException { + return getAggregationHistory(dsId, queryForAggregationHistoryV1(dsId, "(collect|transform)"), getMapperV1()); + } + + @Override + @Cacheable("dsm-aggregationhistory-cache-v2") + public List getAggregationHistoryV2(final String dsId) throws DsmException { + return getAggregationHistory(dsId, queryForAggregationHistoryV2(dsId, "(collect|transform)"), getMapperV2()); + } + + private List getAggregationHistory(final String dsId, + final Bson queryForAggregationHistory, + final Function mapper) throws DsmException { log.warn(String.format("getAggregationHistory(dsId = %s): not using cache", dsId)); final Datasource conf = config.getDatasource(); try { - final FindIterable aggregationDocs = getCollection().find(queryForAggregationHistory(dsId, "(collect|transform)")) + final FindIterable aggregationDocs = getCollection().find(queryForAggregationHistory) .projection(fields) .limit(conf.getMongoQueryLimit()) .sort(dbo("system:startHumanDate", -1)); - final List aggregationInfos = Utils.stream(aggregationDocs.iterator()) - .map(getMapper()) + final List aggregationInfos = Utils.stream(aggregationDocs.iterator()) + .map(mapper) .filter(ai -> ai.getNumberOfRecords() >= 0 && StringUtils.isNotBlank(ai.getDate())) .collect(Collectors.toList()); @@ -134,69 +148,97 @@ public class MongoLoggerClientImpl implements MongoLoggerClient { @Override @CacheEvict(cacheNames = { - "dsm-aggregationhistory-cache", "dsm-firstharvestdate-cache" + "dsm-aggregationhistory-cache-v1", "dsm-aggregationhistory-cache-v2", "dsm-firstharvestdate-cache" }, allEntries = true) @Scheduled(fixedDelayString = "${openaire.exporter.cache.ttl}") public void dropCache() { log.debug("dropped dsManager aggregation history cache"); } - private Function getMapper() { - return new Function() { + @Deprecated + private Function getMapperV1() { + return d -> { - @Override - public AggregationInfo apply(final Document d) { + AggregationInfoV1 info = null; + final AggregationStage stage = AggregationStage.parse(d.getString("system:wfName")); + final boolean success = isCompletedSuccesfully(d); - AggregationInfo info = null; - final AggregationStage stage = AggregationStage.parse(d.getString("system:wfName")); - final boolean success = isCompletedSuccesfully(d); + switch (stage) { - switch (stage) { - - case COLLECT: - final CollectionInfo cInfo = new CollectionInfo(); - cInfo.setAggregationStage(stage); - cInfo.setCollectionMode(getCollectionMode(d)); - cInfo.setNumberOfRecords(success ? getNumberOfRecords(d) : 0); - cInfo.setDate(getDate(d)); - cInfo.setCompletedSuccessfully(success); - info = cInfo; - break; - case TRANSFORM: - final TransformationInfo tInfo = new TransformationInfo(); - tInfo.setAggregationStage(stage); - tInfo.setNumberOfRecords(success ? getNumberOfRecords(d) : 0); - tInfo.setDate(getDate(d)); - tInfo.setCompletedSuccessfully(success); - info = tInfo; - break; - } - return info; - } - - private CollectionMode getCollectionMode(final Document d) { - return Optional.ofNullable(d.getString("system:node:SELECT_MODE:selection")) - .map(CollectionMode::valueOf) - .orElseGet(() -> Optional.ofNullable(d.getString("collectionMode")) - .map(CollectionMode::valueOf) - .orElse(null)); - } - - private Integer getNumberOfRecords(final Document d) { - final String sinkSize = d.getString("mainlog:sinkSize"); - final String total = d.getString("mainlog:total"); - - if (StringUtils.isNotBlank(sinkSize)) { - return Ints.tryParse(sinkSize); - } else if (StringUtils.isNotBlank(total)) { - return Ints.tryParse(total); - } else { - return -1; - } + case COLLECT: + final CollectionInfoV1 cInfo = new CollectionInfoV1(); + cInfo.setAggregationStage(stage); + cInfo.setCollectionMode(getCollectionMode(d)); + cInfo.setNumberOfRecords(success ? getNumberOfRecords(d) : 0); + cInfo.setDate(getDate(d)); + cInfo.setCompletedSuccessfully(success); + info = cInfo; + break; + case TRANSFORM: + final TransformationInfoV1 tInfo = new TransformationInfoV1(); + tInfo.setAggregationStage(stage); + tInfo.setNumberOfRecords(success ? getNumberOfRecords(d) : 0); + tInfo.setDate(getDate(d)); + tInfo.setCompletedSuccessfully(success); + info = tInfo; + break; } + return info; }; } + private Function getMapperV2() { + return d -> { + + AggregationInfo info = null; + final AggregationStage stage = AggregationStage.parse(d.getString("system:wfName")); + final boolean success = isCompletedSuccesfully(d); + + switch (stage) { + + case COLLECT: + final CollectionInfoV2 cInfo = new CollectionInfoV2(); + cInfo.setAggregationStage(stage); + cInfo.setCollectionMode(getCollectionMode(d)); + cInfo.setNumberOfRecords(success ? getNumberOfRecords(d) : 0); + cInfo.setDate(getDate(d)); + cInfo.setCompletedSuccessfully(success); + info = cInfo; + break; + case TRANSFORM: + final TransformationInfoV2 tInfo = new TransformationInfoV2(); + tInfo.setAggregationStage(stage); + tInfo.setNumberOfRecords(success ? getNumberOfRecords(d) : 0); + tInfo.setDate(getDate(d)); + tInfo.setCompletedSuccessfully(success); + info = tInfo; + break; + } + return info; + }; + } + + private CollectionMode getCollectionMode(final Document d) { + return Optional.ofNullable(d.getString("system:node:SELECT_MODE:selection")) + .map(CollectionMode::valueOf) + .orElseGet(() -> Optional.ofNullable(d.getString("collectionMode")) + .map(CollectionMode::valueOf) + .orElse(null)); + } + + private Integer getNumberOfRecords(final Document d) { + final String sinkSize = d.getString("mainlog:sinkSize"); + final String total = d.getString("mainlog:total"); + + if (StringUtils.isNotBlank(sinkSize)) { + return Ints.tryParse(sinkSize); + } else if (StringUtils.isNotBlank(total)) { + return Ints.tryParse(total); + } else { + return -1; + } + } + private String getDate(final Document d) { final String dateString = d.getString("system:startHumanDate"); if (StringUtils.isBlank(dateString)) { return ""; } @@ -216,7 +258,12 @@ public class MongoLoggerClientImpl implements MongoLoggerClient { return new BasicDBObject(key, value); } - private Bson queryForAggregationHistory(final String dsId, final String pattern) { + @Deprecated + private Bson queryForAggregationHistoryV1(final String dsId, final String pattern) { + return and(eq("parentDatasourceId", dsId), eq("system:profileFamily", "aggregator"), eq("system:isCompletedSuccessfully", "true"), regex("system:wfName", pattern, "i")); + } + + private Bson queryForAggregationHistoryV2(final String dsId, final String pattern) { return and(eq("parentDatasourceId", dsId), eq("system:profileFamily", "aggregator"), regex("system:wfName", pattern, "i")); } diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/AggregationHistoryResponseV1.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/AggregationHistoryResponseV1.java new file mode 100644 index 00000000..9bc9e70d --- /dev/null +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/AggregationHistoryResponseV1.java @@ -0,0 +1,25 @@ +package eu.dnetlib.openaire.dsm.domain; + +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonAutoDetect; + +@JsonAutoDetect +@Deprecated +public class AggregationHistoryResponseV1 extends Response { + + private List aggregationInfo; + + public AggregationHistoryResponseV1(final List aggregationInfo) { + super(); + this.aggregationInfo = aggregationInfo; + } + + public List getAggregationInfo() { + return aggregationInfo; + } + + public void setAggregationInfo(final List aggregationInfo) { + this.aggregationInfo = aggregationInfo; + } +} diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/AggregationHistoryResponse.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/AggregationHistoryResponseV2.java similarity index 78% rename from apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/AggregationHistoryResponse.java rename to apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/AggregationHistoryResponseV2.java index e9a92bf0..e68eddc2 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/AggregationHistoryResponse.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/AggregationHistoryResponseV2.java @@ -7,11 +7,11 @@ import com.fasterxml.jackson.annotation.JsonAutoDetect; import eu.dnetlib.enabling.datasources.common.AggregationInfo; @JsonAutoDetect -public class AggregationHistoryResponse extends Response { +public class AggregationHistoryResponseV2 extends Response { private List aggregationInfo; - public AggregationHistoryResponse(final List aggregationInfo) { + public AggregationHistoryResponseV2(final List aggregationInfo) { super(); this.aggregationInfo = aggregationInfo; } diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/AggregationInfoV1.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/AggregationInfoV1.java new file mode 100644 index 00000000..d33ec120 --- /dev/null +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/AggregationInfoV1.java @@ -0,0 +1,15 @@ +package eu.dnetlib.openaire.dsm.domain; + +import com.fasterxml.jackson.annotation.JsonIgnore; + +import eu.dnetlib.enabling.datasources.common.AggregationInfo; + +public class AggregationInfoV1 extends AggregationInfo { + + @Override + @JsonIgnore + public boolean isCompletedSuccessfully() { + return super.isCompletedSuccessfully(); + } + +} diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/CollectionInfoV1.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/CollectionInfoV1.java new file mode 100644 index 00000000..34a8961d --- /dev/null +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/CollectionInfoV1.java @@ -0,0 +1,22 @@ +package eu.dnetlib.openaire.dsm.domain; + +import com.fasterxml.jackson.annotation.JsonAutoDetect; + +/** + * Created by claudio on 29/11/2016. + */ +@JsonAutoDetect +@Deprecated +public class CollectionInfoV1 extends AggregationInfoV1 { + + private CollectionMode collectionMode; + + public CollectionMode getCollectionMode() { + return collectionMode; + } + + public void setCollectionMode(final CollectionMode collectionMode) { + this.collectionMode = collectionMode; + } + +} diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/CollectionInfo.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/CollectionInfoV2.java similarity index 90% rename from apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/CollectionInfo.java rename to apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/CollectionInfoV2.java index 7c21cc3d..b1cba57d 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/CollectionInfo.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/CollectionInfoV2.java @@ -9,7 +9,7 @@ import io.swagger.v3.oas.annotations.media.Schema; * Created by claudio on 29/11/2016. */ @JsonAutoDetect -public class CollectionInfo extends AggregationInfo { +public class CollectionInfoV2 extends AggregationInfo { private CollectionMode collectionMode; diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/TransformationInfoV1.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/TransformationInfoV1.java new file mode 100644 index 00000000..d119964d --- /dev/null +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/TransformationInfoV1.java @@ -0,0 +1,12 @@ +package eu.dnetlib.openaire.dsm.domain; + +import com.fasterxml.jackson.annotation.JsonAutoDetect; + +/** + * Created by claudio on 29/11/2016. + */ +@JsonAutoDetect +@Deprecated +public class TransformationInfoV1 extends AggregationInfoV1 { + +} diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/TransformationInfo.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/TransformationInfoV2.java similarity index 79% rename from apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/TransformationInfo.java rename to apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/TransformationInfoV2.java index ec7cf05f..2d5a6fa4 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/TransformationInfo.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/TransformationInfoV2.java @@ -8,6 +8,6 @@ import eu.dnetlib.enabling.datasources.common.AggregationInfo; * Created by claudio on 29/11/2016. */ @JsonAutoDetect -public class TransformationInfo extends AggregationInfo { +public class TransformationInfoV2 extends AggregationInfo { } From f65a204f4344f59effcc8b05c974171af2f0bf10 Mon Sep 17 00:00:00 2001 From: "miriam.baglioni" Date: Thu, 30 Mar 2023 11:10:34 +0200 Subject: [PATCH 10/19] changed from sout to log.debug and adde comment to explain why the use of asCsv methos --- .../openaire/community/CommunityMappingUtils.java | 4 +++- .../src/main/resources/global.properties | 13 ++++--------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityMappingUtils.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityMappingUtils.java index 24ce0262..073f3b1c 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityMappingUtils.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityMappingUtils.java @@ -69,13 +69,15 @@ public class CommunityMappingUtils { p.setSdg(splitValues(asValues(params.get(CPROFILE_SDG)), CSV_DELIMITER)); } if (params.containsKey(CPROFILE_ADVANCED_CONSTRAINT)) { + //In the map the string is the serialization of the json representing the selection criteria so it is a valid json p.setAdvancedConstraint(SelectionCriteria.fromJson(asCsv(params.get(CPROFILE_ADVANCED_CONSTRAINT)))); + } if (params.containsKey(CPROFILE_CREATIONDATE)){ try { p.setCreationDate(org.apache.commons.lang3.time.DateUtils.parseDate(asCsv(params.get(CPROFILE_CREATIONDATE)), pattern)); }catch(ParseException e) { - e.printStackTrace(); + log.debug("Exception on date format: " + e.getMessage()); } } diff --git a/apps/dnet-exporter-api/src/main/resources/global.properties b/apps/dnet-exporter-api/src/main/resources/global.properties index 6b026841..c92fca73 100644 --- a/apps/dnet-exporter-api/src/main/resources/global.properties +++ b/apps/dnet-exporter-api/src/main/resources/global.properties @@ -1,12 +1,7 @@ -#services.is.host = localhost -services.is.host = dev-openaire.d4science.org -#services.is.port = 8280 -services.is.port = 443 -#services.is.protocol = http -services.is.protocol = https -#services.is.context = app -services.is.context = is -#services.is.baseurl = ${services.is.protocol}://${services.is.host}:${services.is.port}/${services.is.context}/services +services.is.host = localhost +services.is.port = 8280 +services.is.protocol = http +services.is.context = app services.is.baseurl = ${services.is.protocol}://${services.is.host}:${services.is.port}/${services.is.context}/services openaire.exporter.isLookupUrl = ${services.is.baseurl}/isLookUp From fabcbaf5118643d710e92c9cfe50c715643f29ae Mon Sep 17 00:00:00 2001 From: "michele.artini" Date: Fri, 31 Mar 2023 09:41:44 +0200 Subject: [PATCH 11/19] created common module --- libs/dnet-exporter-model/mvnw | 233 ++++++++++++++++++++++++++++++ libs/dnet-exporter-model/mvnw.cmd | 145 +++++++++++++++++++ libs/dnet-exporter-model/pom.xml | 35 +++++ libs/pom.xml | 1 + 4 files changed, 414 insertions(+) create mode 100755 libs/dnet-exporter-model/mvnw create mode 100644 libs/dnet-exporter-model/mvnw.cmd create mode 100644 libs/dnet-exporter-model/pom.xml diff --git a/libs/dnet-exporter-model/mvnw b/libs/dnet-exporter-model/mvnw new file mode 100755 index 00000000..a1ba1bf5 --- /dev/null +++ b/libs/dnet-exporter-model/mvnw @@ -0,0 +1,233 @@ +#!/bin/sh +# ---------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Maven2 Start Up Batch script +# +# Required ENV vars: +# ------------------ +# JAVA_HOME - location of a JDK home dir +# +# Optional ENV vars +# ----------------- +# M2_HOME - location of maven2's installed home dir +# MAVEN_OPTS - parameters passed to the Java VM when running Maven +# e.g. to debug Maven itself, use +# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +# MAVEN_SKIP_RC - flag to disable loading of mavenrc files +# ---------------------------------------------------------------------------- + +if [ -z "$MAVEN_SKIP_RC" ] ; then + + if [ -f /etc/mavenrc ] ; then + . /etc/mavenrc + fi + + if [ -f "$HOME/.mavenrc" ] ; then + . "$HOME/.mavenrc" + fi + +fi + +# OS specific support. $var _must_ be set to either true or false. +cygwin=false; +darwin=false; +mingw=false +case "`uname`" in + CYGWIN*) cygwin=true ;; + MINGW*) mingw=true;; + Darwin*) darwin=true + # + # Look for the Apple JDKs first to preserve the existing behaviour, and then look + # for the new JDKs provided by Oracle. + # + if [ -z "$JAVA_HOME" ] && [ -L /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK ] ; then + # + # Apple JDKs + # + export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home + fi + + if [ -z "$JAVA_HOME" ] && [ -L /System/Library/Java/JavaVirtualMachines/CurrentJDK ] ; then + # + # Apple JDKs + # + export JAVA_HOME=/System/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home + fi + + if [ -z "$JAVA_HOME" ] && [ -L "/Library/Java/JavaVirtualMachines/CurrentJDK" ] ; then + # + # Oracle JDKs + # + export JAVA_HOME=/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home + fi + + if [ -z "$JAVA_HOME" ] && [ -x "/usr/libexec/java_home" ]; then + # + # Apple JDKs + # + export JAVA_HOME=`/usr/libexec/java_home` + fi + ;; +esac + +if [ -z "$JAVA_HOME" ] ; then + if [ -r /etc/gentoo-release ] ; then + JAVA_HOME=`java-config --jre-home` + fi +fi + +if [ -z "$M2_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + saveddir=`pwd` + + M2_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + M2_HOME=`cd "$M2_HOME" && pwd` + + cd "$saveddir" + # echo Using m2 at $M2_HOME +fi + +# For Cygwin, ensure paths are in UNIX format before anything is touched +if $cygwin ; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --unix "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --unix "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --unix "$CLASSPATH"` +fi + +# For Migwn, ensure paths are in UNIX format before anything is touched +if $mingw ; then + [ -n "$M2_HOME" ] && + M2_HOME="`(cd "$M2_HOME"; pwd)`" + [ -n "$JAVA_HOME" ] && + JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" + # TODO classpath? +fi + +if [ -z "$JAVA_HOME" ]; then + javaExecutable="`which javac`" + if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then + # readlink(1) is not available as standard on Solaris 10. + readLink=`which readlink` + if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then + if $darwin ; then + javaHome="`dirname \"$javaExecutable\"`" + javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" + else + javaExecutable="`readlink -f \"$javaExecutable\"`" + fi + javaHome="`dirname \"$javaExecutable\"`" + javaHome=`expr "$javaHome" : '\(.*\)/bin'` + JAVA_HOME="$javaHome" + export JAVA_HOME + fi + fi +fi + +if [ -z "$JAVACMD" ] ; then + if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + else + JAVACMD="`which java`" + fi +fi + +if [ ! -x "$JAVACMD" ] ; then + echo "Error: JAVA_HOME is not defined correctly." >&2 + echo " We cannot execute $JAVACMD" >&2 + exit 1 +fi + +if [ -z "$JAVA_HOME" ] ; then + echo "Warning: JAVA_HOME environment variable is not set." +fi + +CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher + +# For Cygwin, switch paths to Windows format before running java +if $cygwin; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --path --windows "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --windows "$CLASSPATH"` +fi + +# traverses directory structure from process work directory to filesystem root +# first directory with .mvn subdirectory is considered project base directory +find_maven_basedir() { + local basedir=$(pwd) + local wdir=$(pwd) + while [ "$wdir" != '/' ] ; do + if [ -d "$wdir"/.mvn ] ; then + basedir=$wdir + break + fi + wdir=$(cd "$wdir/.."; pwd) + done + echo "${basedir}" +} + +# concatenates all lines of a file +concat_lines() { + if [ -f "$1" ]; then + echo "$(tr -s '\n' ' ' < "$1")" + fi +} + +export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-$(find_maven_basedir)} +MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" + +# Provide a "standardized" way to retrieve the CLI args that will +# work with both Windows and non-Windows executions. +MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" +export MAVEN_CMD_LINE_ARGS + +WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +exec "$JAVACMD" \ + $MAVEN_OPTS \ + -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ + "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ + ${WRAPPER_LAUNCHER} "$@" diff --git a/libs/dnet-exporter-model/mvnw.cmd b/libs/dnet-exporter-model/mvnw.cmd new file mode 100644 index 00000000..2b934e89 --- /dev/null +++ b/libs/dnet-exporter-model/mvnw.cmd @@ -0,0 +1,145 @@ +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Maven2 Start Up Batch script +@REM +@REM Required ENV vars: +@REM JAVA_HOME - location of a JDK home dir +@REM +@REM Optional ENV vars +@REM M2_HOME - location of maven2's installed home dir +@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands +@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending +@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven +@REM e.g. to debug Maven itself, use +@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files +@REM ---------------------------------------------------------------------------- + +@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' +@echo off +@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on' +@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% + +@REM set %HOME% to equivalent of $HOME +if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") + +@REM Execute a user defined script before this one +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre +@REM check for pre script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" +if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" +:skipRcPre + +@setlocal + +set ERROR_CODE=0 + +@REM To isolate internal variables from possible post scripts, we use another setlocal +@setlocal + +@REM ==== START VALIDATION ==== +if not "%JAVA_HOME%" == "" goto OkJHome + +echo. +echo Error: JAVA_HOME not found in your environment. >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +:OkJHome +if exist "%JAVA_HOME%\bin\java.exe" goto init + +echo. +echo Error: JAVA_HOME is set to an invalid directory. >&2 +echo JAVA_HOME = "%JAVA_HOME%" >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +@REM ==== END VALIDATION ==== + +:init + +set MAVEN_CMD_LINE_ARGS=%* + +@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". +@REM Fallback to current working directory if not found. + +set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% +IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir + +set EXEC_DIR=%CD% +set WDIR=%EXEC_DIR% +:findBaseDir +IF EXIST "%WDIR%"\.mvn goto baseDirFound +cd .. +IF "%WDIR%"=="%CD%" goto baseDirNotFound +set WDIR=%CD% +goto findBaseDir + +:baseDirFound +set MAVEN_PROJECTBASEDIR=%WDIR% +cd "%EXEC_DIR%" +goto endDetectBaseDir + +:baseDirNotFound +set MAVEN_PROJECTBASEDIR=%EXEC_DIR% +cd "%EXEC_DIR%" + +:endDetectBaseDir + +IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig + +@setlocal EnableExtensions EnableDelayedExpansion +for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a +@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% + +:endReadAdditionalConfig + +SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" + +set WRAPPER_JAR="".\.mvn\wrapper\maven-wrapper.jar"" +set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CMD_LINE_ARGS% +if ERRORLEVEL 1 goto error +goto end + +:error +set ERROR_CODE=1 + +:end +@endlocal & set ERROR_CODE=%ERROR_CODE% + +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost +@REM check for post script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" +if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" +:skipRcPost + +@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' +if "%MAVEN_BATCH_PAUSE%" == "on" pause + +if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% + +exit /B %ERROR_CODE% \ No newline at end of file diff --git a/libs/dnet-exporter-model/pom.xml b/libs/dnet-exporter-model/pom.xml new file mode 100644 index 00000000..17588ca1 --- /dev/null +++ b/libs/dnet-exporter-model/pom.xml @@ -0,0 +1,35 @@ + + + + + eu.dnetlib.dhp + libs + 3.3.4-SNAPSHOT + ../ + + + 4.0.0 + + dnet-exporter-model + jar + + dnet-exporter-model + Model classes for D-Net Exporter API + + + + + org.mockito + mockito-junit-jupiter + test + + + + org.springframework.boot + spring-boot-starter-test + test + + + + + diff --git a/libs/pom.xml b/libs/pom.xml index 1873ecbe..54599a55 100644 --- a/libs/pom.xml +++ b/libs/pom.xml @@ -14,6 +14,7 @@ dnet-apps-common + dnet-exporter-model dnet-openaire-broker-common dnet-broker-apps-common From ecb5ffca5a7c4327f332bda404621e75ba0ccfb0 Mon Sep 17 00:00:00 2001 From: "michele.artini" Date: Fri, 31 Mar 2023 14:53:52 +0200 Subject: [PATCH 12/19] moved some classes into the model module --- apps/dnet-exporter-api/pom.xml | 10 +- .../common/AbstractExporterController.java | 8 +- .../eu/dnetlib/openaire/common/ISClient.java | 4 +- .../dnetlib/openaire/common/ISClientImpl.java | 57 ++++---- .../community/CommunityApiController.java | 13 +- .../openaire/community/CommunityApiCore.java | 14 +- .../openaire/community/CommunityClient.java | 3 + .../community/CommunityClientImpl.java | 5 + .../openaire/community/CommunityCommon.java | 20 ++- .../community/CommunityMappingUtils.java | 17 ++- .../context/ContextApiController.java | 4 + .../openaire/context/ContextApiCore.java | 7 + .../openaire/context/ContextMappingUtils.java | 6 +- .../openaire/dsm/DsmApiController.java | 10 +- .../openaire/dsm/DsmApiControllerV2.java | 4 +- .../java/eu/dnetlib/openaire/dsm/DsmCore.java | 10 +- .../openaire/dsm/dao/DatasourceDao.java | 6 +- .../openaire/dsm/dao/DatasourceDaoImpl.java | 10 +- .../dsm/dao/DatasourceIndexClient.java | 4 +- .../dsm/dao/DatasourceIndexClientImpl.java | 122 ++++++++++-------- .../openaire/dsm/dao/DatasourceSpecs.java | 2 +- .../openaire/dsm/dao/MongoLoggerClient.java | 3 +- .../dsm/dao/MongoLoggerClientImpl.java | 2 +- .../openaire/dsm/dao/ObjectStoreClient.java | 2 +- .../dsm/dao/ObjectStoreClientImpl.java | 13 +- .../openaire/dsm/dao/ResponseUtils.java | 4 +- .../openaire/dsm/dao/VocabularyClient.java | 3 +- .../dsm/dao/VocabularyClientImpl.java | 3 +- .../domain/AggregationHistoryResponseV1.java | 2 + .../domain/AggregationHistoryResponseV2.java | 1 + .../dsm/domain/ApiDetailsResponse.java | 1 + .../dsm/domain/DatasourceDetailResponse.java | 2 + .../dsm/domain/DatasourceResponse.java | 2 + .../dsm/domain/DatasourceSearchResponse.java | 2 + .../dsm/domain/DatasourceSnippetResponse.java | 2 + .../funders/{domain => }/ConversionUtils.java | 5 +- .../dnetlib/openaire/funders/FunderDao.java | 6 +- .../funders/FundersApiController.java | 5 +- .../community/CommunityApiControllerTest.java | 2 + .../SelectionCriteriaTest.java | 4 + .../context/ContextMappingUtilsTest.java | 2 + .../dsm/DatasourceApiControllerTest.java | 2 +- .../funders/FunderContextClientTest.java | 4 +- libs/dnet-exporter-model/TODO.txt | 16 +++ libs/dnet-exporter-model/pom.xml | 6 + .../exceptions}/CommunityException.java | 8 +- .../CommunityNotFoundException.java | 8 +- .../exceptions}/ContextException.java | 8 +- .../exceptions}/ContextNotFoundException.java | 8 +- .../exporter/exceptions/DsmException.java | 36 ++++++ .../exceptions/DsmForbiddenException.java | 23 ++++ .../exceptions/DsmNotFoundException.java | 23 ++++ .../exceptions/DsmRuntimeException.java | 23 ++++ .../exceptions}/FundersApiException.java | 2 +- .../community/CommunityContentprovider.java | 13 +- .../model}/community/CommunityDetails.java | 11 +- .../CommunityOpenAIRECommunities.java | 2 +- .../community/CommunityOrganization.java | 2 +- .../model}/community/CommunityProject.java | 2 +- .../model}/community/CommunityStatus.java | 2 +- .../model}/community/CommunitySummary.java | 2 +- .../CommunityWritableProperties.java | 13 +- .../community/CommunityZenodoCommunity.java | 2 +- .../selectioncriteria/Constraint.java | 2 +- .../selectioncriteria/Constraints.java | 2 +- .../selectioncriteria/SelectionCriteria.java | 13 +- .../exporter/model}/context/Category.java | 2 +- .../model}/context/CategorySummary.java | 2 +- .../exporter/model}/context/Concept.java | 2 +- .../model}/context/ConceptSummary.java | 2 +- .../exporter/model}/context/Context.java | 9 +- .../model}/context/ContextSummary.java | 2 +- .../exporter/model}/context/Param.java | 2 +- .../openaire/exporter/model/dsm}/Header.java | 22 ++-- .../exporter/model/dsm}/Response.java | 2 +- .../exporter/model/dsm}/SimpleResponse.java | 2 +- .../model/funders}/ExtendedFunderDetails.java | 3 +- .../model/funders}/FunderDetails.java | 2 +- .../model/funders}/FundingStream.java | 2 +- .../exporter/model}/vocabularies/Country.java | 2 +- .../exporter/model}/vocabularies/Term.java | 2 +- .../model}/vocabularies/Vocabulary.java | 2 +- 82 files changed, 447 insertions(+), 248 deletions(-) rename apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/funders/{domain => }/ConversionUtils.java (91%) create mode 100644 libs/dnet-exporter-model/TODO.txt rename {apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community => libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/exceptions}/CommunityException.java (52%) rename {apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community => libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/exceptions}/CommunityNotFoundException.java (52%) rename {apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/context => libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/exceptions}/ContextException.java (51%) rename {apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/context => libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/exceptions}/ContextNotFoundException.java (51%) create mode 100644 libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/exceptions/DsmException.java create mode 100644 libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/exceptions/DsmForbiddenException.java create mode 100644 libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/exceptions/DsmNotFoundException.java create mode 100644 libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/exceptions/DsmRuntimeException.java rename {apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/funders => libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/exceptions}/FundersApiException.java (89%) rename {apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire => libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model}/community/CommunityContentprovider.java (84%) rename {apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire => libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model}/community/CommunityDetails.java (84%) rename {apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire => libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model}/community/CommunityOpenAIRECommunities.java (95%) rename {apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire => libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model}/community/CommunityOrganization.java (96%) rename {apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire => libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model}/community/CommunityProject.java (97%) rename {apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire => libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model}/community/CommunityStatus.java (87%) rename {apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire => libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model}/community/CommunitySummary.java (98%) rename {apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire => libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model}/community/CommunityWritableProperties.java (90%) rename {apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire => libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model}/community/CommunityZenodoCommunity.java (94%) rename {apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire => libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model}/community/selectioncriteria/Constraint.java (90%) rename {apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire => libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model}/community/selectioncriteria/Constraints.java (87%) rename {apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire => libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model}/community/selectioncriteria/SelectionCriteria.java (62%) rename {apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire => libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model}/context/Category.java (95%) rename {apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire => libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model}/context/CategorySummary.java (91%) rename {apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire => libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model}/context/Concept.java (95%) rename {apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire => libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model}/context/ConceptSummary.java (94%) rename {apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire => libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model}/context/Context.java (92%) rename {apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire => libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model}/context/ContextSummary.java (92%) rename {apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire => libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model}/context/Param.java (86%) rename {apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain => libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm}/Header.java (77%) rename {apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain => libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm}/Response.java (90%) rename {apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain => libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm}/SimpleResponse.java (87%) rename {apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/funders/domain => libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/funders}/ExtendedFunderDetails.java (93%) rename {apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/funders/domain => libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/funders}/FunderDetails.java (96%) rename {apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/funders/domain => libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/funders}/FundingStream.java (86%) rename {apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire => libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model}/vocabularies/Country.java (89%) rename {apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire => libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model}/vocabularies/Term.java (87%) rename {apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire => libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model}/vocabularies/Vocabulary.java (94%) diff --git a/apps/dnet-exporter-api/pom.xml b/apps/dnet-exporter-api/pom.xml index b4fa6397..b365bded 100644 --- a/apps/dnet-exporter-api/pom.xml +++ b/apps/dnet-exporter-api/pom.xml @@ -26,6 +26,11 @@ org.springframework.boot spring-boot-starter-cache + + eu.dnetlib.dhp + dnet-exporter-model + ${project.version} + eu.dnetlib cnr-rmi-api @@ -120,12 +125,13 @@ 3.4.2 - + + org.springframework.boot spring-boot-starter-test diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/common/AbstractExporterController.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/common/AbstractExporterController.java index 711b7eb2..026fbe4f 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/common/AbstractExporterController.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/common/AbstractExporterController.java @@ -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. diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/common/ISClient.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/common/ISClient.java index d4ed2f32..3ed78e44 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/common/ISClient.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/common/ISClient.java @@ -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 { diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/common/ISClientImpl.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/common/ISClientImpl.java index 67397331..4a0c628a 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/common/ISClientImpl.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/common/ISClientImpl.java @@ -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,35 +105,34 @@ 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) { - if(getSize(id, name) > 0){ + 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)); + _quickSeachProfile(getInsertXQuery(id, name, value, toEscape)); } catch (final ISLookUpException e) { throw new DsmRuntimeException(String.format("unable to insert context param [id: %s, name: %s, value: %s]", id, name, value), e); } } - } - 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,26 +221,27 @@ 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 %s into collection('/db/DRIVER/ContextDSResources/ContextDSResourceType')" + - "/RESOURCE_PROFILE/BODY/CONFIGURATION/context[./@id = '%s']", paramName, value, id); + "/RESOURCE_PROFILE/BODY/CONFIGURATION/context[./@id = '%s']", paramName, value, id); } else { return String.format("update insert into collection('/db/DRIVER/ContextDSResources/ContextDSResourceType')" + - "/RESOURCE_PROFILE/BODY/CONFIGURATION/context[./@id = '%s']", paramName, id); + "/RESOURCE_PROFILE/BODY/CONFIGURATION/context[./@id = '%s']", paramName, id); } } 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')" + @@ -252,15 +252,16 @@ 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 %s", 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 ", id, name, name); -// } -// } + // 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 %s", 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 ", id, name, name); + // } + // } private String getConceptXQuery(final String id, final String name, final String value) { final Escaper esc = XmlEscapers.xmlContentEscaper(); diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityApiController.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityApiController.java index c5207180..1a9782d9 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityApiController.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityApiController.java @@ -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; diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityApiCore.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityApiCore.java index 09cb2a28..3b855352 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityApiCore.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityApiCore.java @@ -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; diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityClient.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityClient.java index dbc18fc5..f0aae66c 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityClient.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityClient.java @@ -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> getInverseZenodoCommunityMap() throws CommunityException, CommunityNotFoundException; diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityClientImpl.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityClientImpl.java index 96ac59a6..b2ff7b78 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityClientImpl.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityClientImpl.java @@ -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 diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityCommon.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityCommon.java index d23bc881..96613c42 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityCommon.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityCommon.java @@ -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; diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityMappingUtils.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityMappingUtils.java index 073f3b1c..b5d9cae9 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityMappingUtils.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityMappingUtils.java @@ -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; diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/context/ContextApiController.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/context/ContextApiController.java index 98fdb46b..f8fcc9e9 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/context/ContextApiController.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/context/ContextApiController.java @@ -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; diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/context/ContextApiCore.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/context/ContextApiCore.java index 9cd2e859..f33712c8 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/context/ContextApiCore.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/context/ContextApiCore.java @@ -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") diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/context/ContextMappingUtils.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/context/ContextMappingUtils.java index c3537343..e7311c2a 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/context/ContextMappingUtils.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/context/ContextMappingUtils.java @@ -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 { diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/DsmApiController.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/DsmApiController.java index b93ea3ad..d08d2350 100755 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/DsmApiController.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/DsmApiController.java @@ -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; diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/DsmApiControllerV2.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/DsmApiControllerV2.java index a612c043..70977f45 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/DsmApiControllerV2.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/DsmApiControllerV2.java @@ -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; diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/DsmCore.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/DsmCore.java index 806de5d5..2cad2a0f 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/DsmCore.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/DsmCore.java @@ -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") diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/DatasourceDao.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/DatasourceDao.java index 5f40524d..b126bf13 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/DatasourceDao.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/DatasourceDao.java @@ -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, API extends Api> extends DatasourceManagerCommon { diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/DatasourceDaoImpl.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/DatasourceDaoImpl.java index 0f9cf5aa..7372d10e 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/DatasourceDaoImpl.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/DatasourceDaoImpl.java @@ -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. diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/DatasourceIndexClient.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/DatasourceIndexClient.java index 79d8e5e8..fd16995a 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/DatasourceIndexClient.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/DatasourceIndexClient.java @@ -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; - - } diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/DatasourceIndexClientImpl.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/DatasourceIndexClientImpl.java index 659c67a0..01cc9245 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/DatasourceIndexClientImpl.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/DatasourceIndexClientImpl.java @@ -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,9 +65,8 @@ public class DatasourceIndexClientImpl implements DatasourceIndexClient { @PostConstruct public void init() { - executor = MoreExecutors.listeningDecorator( - new ScheduledThreadPoolExecutor(5, - new ThreadFactoryBuilder().setNameFormat("datasource-index-client-%d").build())); + executor = MoreExecutors.listeningDecorator(new ScheduledThreadPoolExecutor(5, + new ThreadFactoryBuilder().setNameFormat("datasource-index-client-%d").build())); } @PreDestroy @@ -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,41 +88,37 @@ 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() { + Futures.addCallback(executor.submit(() -> setDateAndTotal(dsId, collectedFrom, indexClient)), new FutureCallback() { - @Override - public void onSuccess(final IndexRecordsInfo info) { - indexRecordInfo - .setTotal(info.getTotal()) - .setDate(info.getDate()); - latch.countDown(); - } + @Override + public void onSuccess(final IndexRecordsInfo info) { + indexRecordInfo + .setTotal(info.getTotal()) + .setDate(info.getDate()); + latch.countDown(); + } - @Override - public void onFailure(final Throwable e) { - errors.offer(e); - latch.countDown(); - } - }, executor); + @Override + public void onFailure(final Throwable e) { + errors.offer(e); + latch.countDown(); + } + }, executor); - Futures.addCallback( - executor.submit(() -> setFunded(dsId, collectedFrom, indexClient)), - new FutureCallback() { + Futures.addCallback(executor.submit(() -> setFunded(dsId, collectedFrom, indexClient)), new FutureCallback() { - @Override - public void onSuccess(final Long numFound) { - indexRecordInfo.setFunded(numFound); - latch.countDown(); - } + @Override + public void onSuccess(final Long numFound) { + indexRecordInfo.setFunded(numFound); + latch.countDown(); + } - @Override - public void onFailure(final Throwable e) { - errors.offer(e); - latch.countDown(); - } - }, executor); + @Override + public void onFailure(final Throwable e) { + errors.offer(e); + latch.countDown(); + } + }, executor); waitLatch(latch, errors, config.getRequestTimeout()); return indexRecordInfo; @@ -135,23 +141,23 @@ public class DatasourceIndexClientImpl implements DatasourceIndexClient { } private Long setFunded( - final String dsId, - final String collectedFrom, - final CloudSolrClient indexClient) throws DsmException { + final String dsId, + final String collectedFrom, + final CloudSolrClient indexClient) throws DsmException { final String query = - String.format("oaftype:result AND deletedbyinference:false AND collectedfromdatasourceid:\"%s\" AND relprojectid:*", collectedFrom); + String.format("oaftype:result AND deletedbyinference:false AND collectedfromdatasourceid:\"%s\" AND relprojectid:*", collectedFrom); 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); } } private IndexRecordsInfo setDateAndTotal( - final String dsId, - final String collectedFrom, - final CloudSolrClient indexClient) throws DsmException { + final String dsId, + final String collectedFrom, + final CloudSolrClient indexClient) throws DsmException { try { final String query = String.format("oaftype:result AND deletedbyinference:false AND collectedfromdatasourceid:\"%s\"", collectedFrom); log.debug(String.format("query: %s", query)); @@ -166,9 +172,9 @@ public class DatasourceIndexClientImpl implements DatasourceIndexClient { // query: %s", queryTotal)); // } return new IndexRecordsInfo() - .setDate(getDate(doc)) - .setTotal(rsp.getResults().getNumFound()); - } catch (Throwable e) { + .setDate(getDate(doc)) + .setTotal(rsp.getResults().getNumFound()); + } 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 dsversion = (List) 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); diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/DatasourceSpecs.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/DatasourceSpecs.java index ba110c16..8e22477c 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/DatasourceSpecs.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/DatasourceSpecs.java @@ -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 { diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/MongoLoggerClient.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/MongoLoggerClient.java index b68a9689..0a141057 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/MongoLoggerClient.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/MongoLoggerClient.java @@ -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 { diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/MongoLoggerClientImpl.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/MongoLoggerClientImpl.java index caf6b62d..48346f15 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/MongoLoggerClientImpl.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/MongoLoggerClientImpl.java @@ -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; /** diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/ObjectStoreClient.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/ObjectStoreClient.java index 131fa713..76f11741 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/ObjectStoreClient.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/ObjectStoreClient.java @@ -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 { diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/ObjectStoreClientImpl.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/ObjectStoreClientImpl.java index 78763134..d3f77dca 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/ObjectStoreClientImpl.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/ObjectStoreClientImpl.java @@ -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); } } diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/ResponseUtils.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/ResponseUtils.java index cdc4c581..941ee574 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/ResponseUtils.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/ResponseUtils.java @@ -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 { diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/VocabularyClient.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/VocabularyClient.java index 2ed99c55..c6ffe096 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/VocabularyClient.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/VocabularyClient.java @@ -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 { diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/VocabularyClientImpl.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/VocabularyClientImpl.java index 3a9ad1b8..fe2acfc8 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/VocabularyClientImpl.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/VocabularyClientImpl.java @@ -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; diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/AggregationHistoryResponseV1.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/AggregationHistoryResponseV1.java index 9bc9e70d..6ab84899 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/AggregationHistoryResponseV1.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/AggregationHistoryResponseV1.java @@ -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 { diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/AggregationHistoryResponseV2.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/AggregationHistoryResponseV2.java index e68eddc2..b13e35a4 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/AggregationHistoryResponseV2.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/AggregationHistoryResponseV2.java @@ -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 { diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/ApiDetailsResponse.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/ApiDetailsResponse.java index cecb20c1..b65f6e42 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/ApiDetailsResponse.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/ApiDetailsResponse.java @@ -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; diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/DatasourceDetailResponse.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/DatasourceDetailResponse.java index e59cb037..b011d889 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/DatasourceDetailResponse.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/DatasourceDetailResponse.java @@ -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 { diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/DatasourceResponse.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/DatasourceResponse.java index 9aba8b8a..255e89b4 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/DatasourceResponse.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/DatasourceResponse.java @@ -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 extends Response { diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/DatasourceSearchResponse.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/DatasourceSearchResponse.java index 2be76532..e8d3aacb 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/DatasourceSearchResponse.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/DatasourceSearchResponse.java @@ -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 { diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/DatasourceSnippetResponse.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/DatasourceSnippetResponse.java index 522d5653..ba84462b 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/DatasourceSnippetResponse.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/DatasourceSnippetResponse.java @@ -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 { diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/funders/domain/ConversionUtils.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/funders/ConversionUtils.java similarity index 91% rename from apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/funders/domain/ConversionUtils.java rename to apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/funders/ConversionUtils.java index 75aae566..be41be45 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/funders/domain/ConversionUtils.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/funders/ConversionUtils.java @@ -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; diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/funders/FunderDao.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/funders/FunderDao.java index 7c53b2c3..9c79afc5 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/funders/FunderDao.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/funders/FunderDao.java @@ -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") diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/funders/FundersApiController.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/funders/FundersApiController.java index f4e598b3..d1533826 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/funders/FundersApiController.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/funders/FundersApiController.java @@ -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; diff --git a/apps/dnet-exporter-api/src/test/java/eu/dnetlib/openaire/community/CommunityApiControllerTest.java b/apps/dnet-exporter-api/src/test/java/eu/dnetlib/openaire/community/CommunityApiControllerTest.java index 43974fd9..94d9ee7f 100644 --- a/apps/dnet-exporter-api/src/test/java/eu/dnetlib/openaire/community/CommunityApiControllerTest.java +++ b/apps/dnet-exporter-api/src/test/java/eu/dnetlib/openaire/community/CommunityApiControllerTest.java @@ -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. * diff --git a/apps/dnet-exporter-api/src/test/java/eu/dnetlib/openaire/community/selectioncriteria/SelectionCriteriaTest.java b/apps/dnet-exporter-api/src/test/java/eu/dnetlib/openaire/community/selectioncriteria/SelectionCriteriaTest.java index 0d9420ff..c034a636 100644 --- a/apps/dnet-exporter-api/src/test/java/eu/dnetlib/openaire/community/selectioncriteria/SelectionCriteriaTest.java +++ b/apps/dnet-exporter-api/src/test/java/eu/dnetlib/openaire/community/selectioncriteria/SelectionCriteriaTest.java @@ -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; diff --git a/apps/dnet-exporter-api/src/test/java/eu/dnetlib/openaire/context/ContextMappingUtilsTest.java b/apps/dnet-exporter-api/src/test/java/eu/dnetlib/openaire/context/ContextMappingUtilsTest.java index 3a30f10f..7ff98dec 100644 --- a/apps/dnet-exporter-api/src/test/java/eu/dnetlib/openaire/context/ContextMappingUtilsTest.java +++ b/apps/dnet-exporter-api/src/test/java/eu/dnetlib/openaire/context/ContextMappingUtilsTest.java @@ -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. * diff --git a/apps/dnet-exporter-api/src/test/java/eu/dnetlib/openaire/dsm/DatasourceApiControllerTest.java b/apps/dnet-exporter-api/src/test/java/eu/dnetlib/openaire/dsm/DatasourceApiControllerTest.java index 39a6875d..80cfe152 100644 --- a/apps/dnet-exporter-api/src/test/java/eu/dnetlib/openaire/dsm/DatasourceApiControllerTest.java +++ b/apps/dnet-exporter-api/src/test/java/eu/dnetlib/openaire/dsm/DatasourceApiControllerTest.java @@ -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) diff --git a/apps/dnet-exporter-api/src/test/java/eu/dnetlib/openaire/funders/FunderContextClientTest.java b/apps/dnet-exporter-api/src/test/java/eu/dnetlib/openaire/funders/FunderContextClientTest.java index 3e0ca5af..8869dba4 100644 --- a/apps/dnet-exporter-api/src/test/java/eu/dnetlib/openaire/funders/FunderContextClientTest.java +++ b/apps/dnet-exporter-api/src/test/java/eu/dnetlib/openaire/funders/FunderContextClientTest.java @@ -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 { diff --git a/libs/dnet-exporter-model/TODO.txt b/libs/dnet-exporter-model/TODO.txt new file mode 100644 index 00000000..c5253ee8 --- /dev/null +++ b/libs/dnet-exporter-model/TODO.txt @@ -0,0 +1,16 @@ + +DsmApiControllerV2 + SimpleDatasourceInfo + AggregationHistoryResponseV2 + +DsmApiController + DatasourceDetailResponse + AggregationHistoryResponseV1 + DatasourceSnippetResponse + RegisteredDatasourceInfo + ApiDetailsResponse + DatasourceDetails + DatasourceDetailsWithApis + DatasourceDetailsUpdate + ApiDetails + RequestFilter diff --git a/libs/dnet-exporter-model/pom.xml b/libs/dnet-exporter-model/pom.xml index 17588ca1..dc5e670b 100644 --- a/libs/dnet-exporter-model/pom.xml +++ b/libs/dnet-exporter-model/pom.xml @@ -23,6 +23,12 @@ mockito-junit-jupiter test + + + org.springdoc + springdoc-openapi-common + 1.6.10 + org.springframework.boot diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityException.java b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/exceptions/CommunityException.java similarity index 52% rename from apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityException.java rename to libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/exceptions/CommunityException.java index db2cc2bd..d9dd0592 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityException.java +++ b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/exceptions/CommunityException.java @@ -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 { /** diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityNotFoundException.java b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/exceptions/CommunityNotFoundException.java similarity index 52% rename from apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityNotFoundException.java rename to libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/exceptions/CommunityNotFoundException.java index 53eb016b..5f75fe14 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityNotFoundException.java +++ b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/exceptions/CommunityNotFoundException.java @@ -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 { /** diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/context/ContextException.java b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/exceptions/ContextException.java similarity index 51% rename from apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/context/ContextException.java rename to libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/exceptions/ContextException.java index 7d092b96..49794b93 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/context/ContextException.java +++ b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/exceptions/ContextException.java @@ -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 { /** diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/context/ContextNotFoundException.java b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/exceptions/ContextNotFoundException.java similarity index 51% rename from apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/context/ContextNotFoundException.java rename to libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/exceptions/ContextNotFoundException.java index ba87774c..06222c1f 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/context/ContextNotFoundException.java +++ b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/exceptions/ContextNotFoundException.java @@ -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 { /** diff --git a/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/exceptions/DsmException.java b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/exceptions/DsmException.java new file mode 100644 index 00000000..0ac3608b --- /dev/null +++ b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/exceptions/DsmException.java @@ -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; + } + +} diff --git a/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/exceptions/DsmForbiddenException.java b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/exceptions/DsmForbiddenException.java new file mode 100644 index 00000000..03a436aa --- /dev/null +++ b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/exceptions/DsmForbiddenException.java @@ -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); + } + +} diff --git a/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/exceptions/DsmNotFoundException.java b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/exceptions/DsmNotFoundException.java new file mode 100644 index 00000000..d9f01052 --- /dev/null +++ b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/exceptions/DsmNotFoundException.java @@ -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); + } + +} diff --git a/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/exceptions/DsmRuntimeException.java b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/exceptions/DsmRuntimeException.java new file mode 100644 index 00000000..e12894fe --- /dev/null +++ b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/exceptions/DsmRuntimeException.java @@ -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); + } + +} diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/funders/FundersApiException.java b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/exceptions/FundersApiException.java similarity index 89% rename from apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/funders/FundersApiException.java rename to libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/exceptions/FundersApiException.java index c8f2f024..e5e84260 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/funders/FundersApiException.java +++ b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/exceptions/FundersApiException.java @@ -1,4 +1,4 @@ -package eu.dnetlib.openaire.funders; +package eu.dnetlib.openaire.exporter.exceptions; public class FundersApiException extends Exception { diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityContentprovider.java b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/community/CommunityContentprovider.java similarity index 84% rename from apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityContentprovider.java rename to libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/community/CommunityContentprovider.java index f17df06f..f550d544 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityContentprovider.java +++ b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/community/CommunityContentprovider.java @@ -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() { diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityDetails.java b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/community/CommunityDetails.java similarity index 84% rename from apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityDetails.java rename to libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/community/CommunityDetails.java index 7625582a..40f6c8b9 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityDetails.java +++ b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/community/CommunityDetails.java @@ -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 fos) { + public void setFos(final List fos) { this.fos = fos; } @@ -76,7 +75,7 @@ public class CommunityDetails extends CommunitySummary { return sdg; } - public void setSdg(List sdg) { + public void setSdg(final List 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; } } diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityOpenAIRECommunities.java b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/community/CommunityOpenAIRECommunities.java similarity index 95% rename from apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityOpenAIRECommunities.java rename to libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/community/CommunityOpenAIRECommunities.java index 662f7b19..fc61c091 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityOpenAIRECommunities.java +++ b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/community/CommunityOpenAIRECommunities.java @@ -1,4 +1,4 @@ -package eu.dnetlib.openaire.community; +package eu.dnetlib.openaire.exporter.model.community; import java.util.ArrayList; import java.util.List; diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityOrganization.java b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/community/CommunityOrganization.java similarity index 96% rename from apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityOrganization.java rename to libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/community/CommunityOrganization.java index 32e4ec2f..14652277 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityOrganization.java +++ b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/community/CommunityOrganization.java @@ -1,4 +1,4 @@ -package eu.dnetlib.openaire.community; +package eu.dnetlib.openaire.exporter.model.community; import javax.validation.constraints.NotNull; diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityProject.java b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/community/CommunityProject.java similarity index 97% rename from apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityProject.java rename to libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/community/CommunityProject.java index 0a3b2800..a1833cd2 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityProject.java +++ b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/community/CommunityProject.java @@ -1,4 +1,4 @@ -package eu.dnetlib.openaire.community; +package eu.dnetlib.openaire.exporter.model.community; import com.fasterxml.jackson.annotation.JsonAutoDetect; diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityStatus.java b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/community/CommunityStatus.java similarity index 87% rename from apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityStatus.java rename to libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/community/CommunityStatus.java index 2213feb1..3c7b376a 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityStatus.java +++ b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/community/CommunityStatus.java @@ -1,4 +1,4 @@ -package eu.dnetlib.openaire.community; +package eu.dnetlib.openaire.exporter.model.community; import com.fasterxml.jackson.annotation.JsonAutoDetect; diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunitySummary.java b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/community/CommunitySummary.java similarity index 98% rename from apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunitySummary.java rename to libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/community/CommunitySummary.java index ff3ed2c7..16e072be 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunitySummary.java +++ b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/community/CommunitySummary.java @@ -1,4 +1,4 @@ -package eu.dnetlib.openaire.community; +package eu.dnetlib.openaire.exporter.model.community; import java.util.Date; diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityWritableProperties.java b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/community/CommunityWritableProperties.java similarity index 90% rename from apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityWritableProperties.java rename to libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/community/CommunityWritableProperties.java index db6d3e5e..934633a8 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityWritableProperties.java +++ b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/community/CommunityWritableProperties.java @@ -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 fos) { + public void setFos(final List fos) { this.fos = fos; } @@ -70,7 +67,7 @@ public class CommunityWritableProperties { return sdg; } - public void setSdg(List sdg) { + public void setSdg(final List 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; } diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityZenodoCommunity.java b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/community/CommunityZenodoCommunity.java similarity index 94% rename from apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityZenodoCommunity.java rename to libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/community/CommunityZenodoCommunity.java index 072faf29..4bae4957 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityZenodoCommunity.java +++ b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/community/CommunityZenodoCommunity.java @@ -1,4 +1,4 @@ -package eu.dnetlib.openaire.community; +package eu.dnetlib.openaire.exporter.model.community; import javax.validation.constraints.NotNull; diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/selectioncriteria/Constraint.java b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/community/selectioncriteria/Constraint.java similarity index 90% rename from apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/selectioncriteria/Constraint.java rename to libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/community/selectioncriteria/Constraint.java index 31c71535..830b7c9c 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/selectioncriteria/Constraint.java +++ b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/community/selectioncriteria/Constraint.java @@ -1,4 +1,4 @@ -package eu.dnetlib.openaire.community.selectioncriteria; +package eu.dnetlib.openaire.exporter.model.community.selectioncriteria; import java.io.Serializable; diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/selectioncriteria/Constraints.java b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/community/selectioncriteria/Constraints.java similarity index 87% rename from apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/selectioncriteria/Constraints.java rename to libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/community/selectioncriteria/Constraints.java index a899095f..393301e6 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/selectioncriteria/Constraints.java +++ b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/community/selectioncriteria/Constraints.java @@ -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; diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/selectioncriteria/SelectionCriteria.java b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/community/selectioncriteria/SelectionCriteria.java similarity index 62% rename from apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/selectioncriteria/SelectionCriteria.java rename to libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/community/selectioncriteria/SelectionCriteria.java index 0214e41a..f93c105a 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/selectioncriteria/SelectionCriteria.java +++ b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/community/selectioncriteria/SelectionCriteria.java @@ -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); + } } + } diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/context/Category.java b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/context/Category.java similarity index 95% rename from apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/context/Category.java rename to libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/context/Category.java index 1c029777..9cb3cdb4 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/context/Category.java +++ b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/context/Category.java @@ -1,4 +1,4 @@ -package eu.dnetlib.openaire.context; +package eu.dnetlib.openaire.exporter.model.context; import java.util.List; import java.util.Map; diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/context/CategorySummary.java b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/context/CategorySummary.java similarity index 91% rename from apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/context/CategorySummary.java rename to libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/context/CategorySummary.java index c2acb200..46d18321 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/context/CategorySummary.java +++ b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/context/CategorySummary.java @@ -1,4 +1,4 @@ -package eu.dnetlib.openaire.context; +package eu.dnetlib.openaire.exporter.model.context; public class CategorySummary { diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/context/Concept.java b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/context/Concept.java similarity index 95% rename from apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/context/Concept.java rename to libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/context/Concept.java index ddbcdec1..dd2e8f0e 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/context/Concept.java +++ b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/context/Concept.java @@ -1,4 +1,4 @@ -package eu.dnetlib.openaire.context; +package eu.dnetlib.openaire.exporter.model.context; import java.util.List; import java.util.Map; diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/context/ConceptSummary.java b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/context/ConceptSummary.java similarity index 94% rename from apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/context/ConceptSummary.java rename to libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/context/ConceptSummary.java index 58600836..85f5941d 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/context/ConceptSummary.java +++ b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/context/ConceptSummary.java @@ -1,4 +1,4 @@ -package eu.dnetlib.openaire.context; +package eu.dnetlib.openaire.exporter.model.context; import java.util.List; diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/context/Context.java b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/context/Context.java similarity index 92% rename from apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/context/Context.java rename to libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/context/Context.java index badc1ff1..ff9b42b7 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/context/Context.java +++ b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/context/Context.java @@ -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> params) { this.params = params; return this; @@ -88,4 +84,3 @@ public class Context { } } - diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/context/ContextSummary.java b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/context/ContextSummary.java similarity index 92% rename from apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/context/ContextSummary.java rename to libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/context/ContextSummary.java index 9e974a3d..0576dd8c 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/context/ContextSummary.java +++ b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/context/ContextSummary.java @@ -1,4 +1,4 @@ -package eu.dnetlib.openaire.context; +package eu.dnetlib.openaire.exporter.model.context; public class ContextSummary { diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/context/Param.java b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/context/Param.java similarity index 86% rename from apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/context/Param.java rename to libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/context/Param.java index e83a6fd2..071fb5cd 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/context/Param.java +++ b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/context/Param.java @@ -1,4 +1,4 @@ -package eu.dnetlib.openaire.context; +package eu.dnetlib.openaire.exporter.model.context; public class Param { diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/Header.java b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/Header.java similarity index 77% rename from apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/Header.java rename to libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/Header.java index 4db04905..4bcbfc9a 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/Header.java +++ b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/Header.java @@ -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 errors = Lists.newArrayList(); - @JsonIgnore - private Queue exceptions = Lists.newLinkedList(); + private Queue 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 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); + } } } diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/Response.java b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/Response.java similarity index 90% rename from apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/Response.java rename to libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/Response.java index abba2c54..662807da 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/Response.java +++ b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/Response.java @@ -1,4 +1,4 @@ -package eu.dnetlib.openaire.dsm.domain; +package eu.dnetlib.openaire.exporter.model.dsm; import com.fasterxml.jackson.annotation.JsonAutoDetect; diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/SimpleResponse.java b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/SimpleResponse.java similarity index 87% rename from apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/SimpleResponse.java rename to libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/SimpleResponse.java index 73381faf..6d9b3466 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/SimpleResponse.java +++ b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/SimpleResponse.java @@ -1,4 +1,4 @@ -package eu.dnetlib.openaire.dsm.domain; +package eu.dnetlib.openaire.exporter.model.dsm; import java.util.List; diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/funders/domain/ExtendedFunderDetails.java b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/funders/ExtendedFunderDetails.java similarity index 93% rename from apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/funders/domain/ExtendedFunderDetails.java rename to libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/funders/ExtendedFunderDetails.java index d6cc54d2..723feafb 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/funders/domain/ExtendedFunderDetails.java +++ b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/funders/ExtendedFunderDetails.java @@ -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 { } } - diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/funders/domain/FunderDetails.java b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/funders/FunderDetails.java similarity index 96% rename from apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/funders/domain/FunderDetails.java rename to libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/funders/FunderDetails.java index 04335b09..5180e193 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/funders/domain/FunderDetails.java +++ b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/funders/FunderDetails.java @@ -1,4 +1,4 @@ -package eu.dnetlib.openaire.funders.domain; +package eu.dnetlib.openaire.exporter.model.funders; import java.util.Date; diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/funders/domain/FundingStream.java b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/funders/FundingStream.java similarity index 86% rename from apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/funders/domain/FundingStream.java rename to libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/funders/FundingStream.java index 1efd0aa7..863a443b 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/funders/domain/FundingStream.java +++ b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/funders/FundingStream.java @@ -1,4 +1,4 @@ -package eu.dnetlib.openaire.funders.domain; +package eu.dnetlib.openaire.exporter.model.funders; public class FundingStream { diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/vocabularies/Country.java b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/vocabularies/Country.java similarity index 89% rename from apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/vocabularies/Country.java rename to libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/vocabularies/Country.java index 73c54763..3aff3c84 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/vocabularies/Country.java +++ b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/vocabularies/Country.java @@ -1,4 +1,4 @@ -package eu.dnetlib.openaire.vocabularies; +package eu.dnetlib.openaire.exporter.model.vocabularies; /** * Created by claudio on 15/09/2017. diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/vocabularies/Term.java b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/vocabularies/Term.java similarity index 87% rename from apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/vocabularies/Term.java rename to libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/vocabularies/Term.java index 30adc410..07b82a84 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/vocabularies/Term.java +++ b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/vocabularies/Term.java @@ -1,4 +1,4 @@ -package eu.dnetlib.openaire.vocabularies; +package eu.dnetlib.openaire.exporter.model.vocabularies; /** * Created by claudio on 15/09/2017. diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/vocabularies/Vocabulary.java b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/vocabularies/Vocabulary.java similarity index 94% rename from apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/vocabularies/Vocabulary.java rename to libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/vocabularies/Vocabulary.java index 54c6e090..67243420 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/vocabularies/Vocabulary.java +++ b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/vocabularies/Vocabulary.java @@ -1,4 +1,4 @@ -package eu.dnetlib.openaire.vocabularies; +package eu.dnetlib.openaire.exporter.model.vocabularies; import java.util.List; import java.util.Map; From 57d5496855cf0e1f75283ed2123091ed5cc33cbb Mon Sep 17 00:00:00 2001 From: "michele.artini" Date: Fri, 31 Mar 2023 16:13:52 +0200 Subject: [PATCH 13/19] moved some classes into the model module --- .../openaire/dsm/DsmApiController.java | 4 +- .../openaire/dsm/DsmApiControllerV2.java | 4 +- .../java/eu/dnetlib/openaire/dsm/DsmCore.java | 10 ++-- .../openaire/dsm/dao/MongoLoggerClient.java | 2 +- .../dsm/dao/MongoLoggerClientImpl.java | 12 ++-- .../openaire/dsm/dao/ResponseUtils.java | 4 +- .../dsm/dao/utils/DsmMappingUtils.java | 4 +- .../dsm/domain/DatasourceDetailResponse.java | 1 + .../dsm/domain/DatasourceDetailsUpdate.java | 1 + .../dsm/domain/DatasourceDetailsWithApis.java | 1 + .../dsm/domain/DatasourceSearchResponse.java | 1 + .../dsm/domain/DatasourceSnippetExtended.java | 1 + .../dsm/DatasourceApiControllerTest.java | 2 +- libs/dnet-exporter-model/TODO.txt | 8 --- libs/dnet-exporter-model/pom.xml | 17 ++++-- .../dsm}/AggregationHistoryResponseV1.java | 4 +- .../dsm}/AggregationHistoryResponseV2.java | 5 +- .../exporter/model/dsm/AggregationInfo.java | 56 +++++++++++++++++++ .../model/dsm}/AggregationInfoV1.java | 4 +- .../exporter/model/dsm/AggregationStage.java | 25 +++++++++ .../exporter/model/dsm}/CollectionInfoV1.java | 2 +- .../exporter/model/dsm}/CollectionInfoV2.java | 5 +- .../exporter/model/dsm}/CollectionMode.java | 2 +- .../model/dsm}/DatasourceDetails.java | 2 +- .../dsm}/DatasourceIgnoredProperties.java | 2 +- .../exporter/model/dsm}/DatasourceInfo.java | 3 +- .../model/dsm}/IdentitiesDetails.java | 2 +- .../model/dsm}/OrganizationDetails.java | 2 +- .../dsm}/OrganizationIgnoredProperties.java | 2 +- .../model/dsm}/SimpleDatasourceInfo.java | 2 +- .../model/dsm}/TransformationInfoV1.java | 2 +- .../model/dsm}/TransformationInfoV2.java | 4 +- 32 files changed, 133 insertions(+), 63 deletions(-) rename {apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain => libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm}/AggregationHistoryResponseV1.java (85%) rename {apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain => libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm}/AggregationHistoryResponseV2.java (77%) create mode 100644 libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/AggregationInfo.java rename {apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain => libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm}/AggregationInfoV1.java (68%) create mode 100644 libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/AggregationStage.java rename {apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain => libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm}/CollectionInfoV1.java (89%) rename {apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain => libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm}/CollectionInfoV2.java (72%) rename {apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain => libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm}/CollectionMode.java (78%) rename {apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain => libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm}/DatasourceDetails.java (99%) rename {apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain => libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm}/DatasourceIgnoredProperties.java (98%) rename {apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain => libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm}/DatasourceInfo.java (96%) rename {apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain => libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm}/IdentitiesDetails.java (90%) rename {apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain => libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm}/OrganizationDetails.java (96%) rename {apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain => libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm}/OrganizationIgnoredProperties.java (96%) rename {apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain => libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm}/SimpleDatasourceInfo.java (98%) rename {apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain => libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm}/TransformationInfoV1.java (80%) rename {apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain => libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm}/TransformationInfoV2.java (63%) diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/DsmApiController.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/DsmApiController.java index d08d2350..cf995d11 100755 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/DsmApiController.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/DsmApiController.java @@ -26,11 +26,9 @@ import org.springframework.web.bind.annotation.RestController; import eu.dnetlib.openaire.common.AbstractExporterController; import eu.dnetlib.openaire.common.OperationManager; -import eu.dnetlib.openaire.dsm.domain.AggregationHistoryResponseV1; import eu.dnetlib.openaire.dsm.domain.ApiDetails; import eu.dnetlib.openaire.dsm.domain.ApiDetailsResponse; import eu.dnetlib.openaire.dsm.domain.DatasourceDetailResponse; -import eu.dnetlib.openaire.dsm.domain.DatasourceDetails; import eu.dnetlib.openaire.dsm.domain.DatasourceDetailsUpdate; import eu.dnetlib.openaire.dsm.domain.DatasourceDetailsWithApis; import eu.dnetlib.openaire.dsm.domain.DatasourceSnippetResponse; @@ -41,6 +39,8 @@ import eu.dnetlib.openaire.dsm.domain.RequestSortOrder; 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.AggregationHistoryResponseV1; +import eu.dnetlib.openaire.exporter.model.dsm.DatasourceDetails; import eu.dnetlib.openaire.exporter.model.dsm.SimpleResponse; import eu.dnetlib.openaire.exporter.model.vocabularies.Country; import io.swagger.v3.oas.annotations.Operation; diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/DsmApiControllerV2.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/DsmApiControllerV2.java index 70977f45..68107164 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/DsmApiControllerV2.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/DsmApiControllerV2.java @@ -17,9 +17,9 @@ import org.springframework.web.bind.annotation.RestController; 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.exporter.exceptions.DsmException; +import eu.dnetlib.openaire.exporter.model.dsm.AggregationHistoryResponseV2; +import eu.dnetlib.openaire.exporter.model.dsm.SimpleDatasourceInfo; import eu.dnetlib.openaire.exporter.model.dsm.SimpleResponse; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.responses.ApiResponse; diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/DsmCore.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/DsmCore.java index 2cad2a0f..e17b5bb9 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/DsmCore.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/DsmCore.java @@ -37,13 +37,9 @@ import eu.dnetlib.openaire.dsm.dao.MongoLoggerClient; import eu.dnetlib.openaire.dsm.dao.ResponseUtils; import eu.dnetlib.openaire.dsm.dao.VocabularyClient; import eu.dnetlib.openaire.dsm.dao.utils.DsmMappingUtils; -import eu.dnetlib.openaire.dsm.domain.AggregationHistoryResponseV1; -import eu.dnetlib.openaire.dsm.domain.AggregationHistoryResponseV2; -import eu.dnetlib.openaire.dsm.domain.AggregationInfoV1; import eu.dnetlib.openaire.dsm.domain.ApiDetails; import eu.dnetlib.openaire.dsm.domain.ApiDetailsResponse; import eu.dnetlib.openaire.dsm.domain.DatasourceDetailResponse; -import eu.dnetlib.openaire.dsm.domain.DatasourceDetails; import eu.dnetlib.openaire.dsm.domain.DatasourceDetailsUpdate; import eu.dnetlib.openaire.dsm.domain.DatasourceDetailsWithApis; import eu.dnetlib.openaire.dsm.domain.DatasourceSnippetResponse; @@ -51,13 +47,17 @@ 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.SimpleDatasourceInfo; 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.exporter.exceptions.DsmException; import eu.dnetlib.openaire.exporter.exceptions.DsmForbiddenException; import eu.dnetlib.openaire.exporter.exceptions.DsmNotFoundException; +import eu.dnetlib.openaire.exporter.model.dsm.AggregationHistoryResponseV1; +import eu.dnetlib.openaire.exporter.model.dsm.AggregationHistoryResponseV2; +import eu.dnetlib.openaire.exporter.model.dsm.AggregationInfoV1; +import eu.dnetlib.openaire.exporter.model.dsm.DatasourceDetails; +import eu.dnetlib.openaire.exporter.model.dsm.SimpleDatasourceInfo; import eu.dnetlib.openaire.exporter.model.dsm.SimpleResponse; import eu.dnetlib.openaire.exporter.model.vocabularies.Country; diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/MongoLoggerClient.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/MongoLoggerClient.java index 0a141057..59d773ce 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/MongoLoggerClient.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/MongoLoggerClient.java @@ -2,8 +2,8 @@ package eu.dnetlib.openaire.dsm.dao; import java.util.List; -import eu.dnetlib.openaire.dsm.domain.AggregationInfoV1; import eu.dnetlib.openaire.exporter.exceptions.DsmException; +import eu.dnetlib.openaire.exporter.model.dsm.AggregationInfoV1; public interface MongoLoggerClient { diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/MongoLoggerClientImpl.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/MongoLoggerClientImpl.java index 48346f15..a176be01 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/MongoLoggerClientImpl.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/MongoLoggerClientImpl.java @@ -46,13 +46,13 @@ import eu.dnetlib.enabling.datasources.common.AggregationStage; import eu.dnetlib.miscutils.datetime.DateUtils; import eu.dnetlib.openaire.common.Utils; import eu.dnetlib.openaire.dsm.dao.utils.DsmMappingUtils; -import eu.dnetlib.openaire.dsm.domain.AggregationInfoV1; -import eu.dnetlib.openaire.dsm.domain.CollectionInfoV1; -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.exporter.model.dsm.AggregationInfoV1; +import eu.dnetlib.openaire.exporter.model.dsm.CollectionInfoV1; +import eu.dnetlib.openaire.exporter.model.dsm.CollectionInfoV2; +import eu.dnetlib.openaire.exporter.model.dsm.CollectionMode; +import eu.dnetlib.openaire.exporter.model.dsm.TransformationInfoV1; +import eu.dnetlib.openaire.exporter.model.dsm.TransformationInfoV2; import eu.dnetlib.openaire.info.JdbcInfoDao; /** diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/ResponseUtils.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/ResponseUtils.java index 941ee574..fa849ea0 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/ResponseUtils.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/ResponseUtils.java @@ -8,11 +8,11 @@ import com.google.common.collect.Lists; import eu.dnetlib.openaire.dsm.domain.ApiDetails; import eu.dnetlib.openaire.dsm.domain.ApiDetailsResponse; import eu.dnetlib.openaire.dsm.domain.DatasourceDetailResponse; -import eu.dnetlib.openaire.dsm.domain.DatasourceDetails; -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.exporter.model.dsm.DatasourceDetails; +import eu.dnetlib.openaire.exporter.model.dsm.DatasourceInfo; import eu.dnetlib.openaire.exporter.model.dsm.Header; import eu.dnetlib.openaire.exporter.model.dsm.SimpleResponse; diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/utils/DsmMappingUtils.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/utils/DsmMappingUtils.java index 7e6d80b2..3d3ee56d 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/utils/DsmMappingUtils.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/utils/DsmMappingUtils.java @@ -15,13 +15,13 @@ import com.fasterxml.jackson.databind.ObjectMapper; import eu.dnetlib.data.transform.xml.AbstractDNetXsltFunctions; import eu.dnetlib.openaire.dsm.domain.ApiDetails; -import eu.dnetlib.openaire.dsm.domain.DatasourceDetails; import eu.dnetlib.openaire.dsm.domain.DatasourceDetailsUpdate; import eu.dnetlib.openaire.dsm.domain.DatasourceSnippetExtended; -import eu.dnetlib.openaire.dsm.domain.OrganizationDetails; import eu.dnetlib.openaire.dsm.domain.db.ApiDbEntry; import eu.dnetlib.openaire.dsm.domain.db.DatasourceDbEntry; import eu.dnetlib.openaire.dsm.domain.db.OrganizationDbEntry; +import eu.dnetlib.openaire.exporter.model.dsm.DatasourceDetails; +import eu.dnetlib.openaire.exporter.model.dsm.OrganizationDetails; public class DsmMappingUtils { diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/DatasourceDetailResponse.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/DatasourceDetailResponse.java index b011d889..1d55a20d 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/DatasourceDetailResponse.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/DatasourceDetailResponse.java @@ -4,6 +4,7 @@ import java.util.List; import com.fasterxml.jackson.annotation.JsonAutoDetect; +import eu.dnetlib.openaire.exporter.model.dsm.DatasourceDetails; import eu.dnetlib.openaire.exporter.model.dsm.Response; @JsonAutoDetect diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/DatasourceDetailsUpdate.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/DatasourceDetailsUpdate.java index 750813bb..eef03063 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/DatasourceDetailsUpdate.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/DatasourceDetailsUpdate.java @@ -8,6 +8,7 @@ import javax.validation.constraints.NotBlank; import com.fasterxml.jackson.annotation.JsonAutoDetect; +import eu.dnetlib.openaire.exporter.model.dsm.IdentitiesDetails; import io.swagger.v3.oas.annotations.media.Schema; /** diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/DatasourceDetailsWithApis.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/DatasourceDetailsWithApis.java index 8e0c3d09..bf41287b 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/DatasourceDetailsWithApis.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/DatasourceDetailsWithApis.java @@ -5,6 +5,7 @@ import java.util.List; import com.fasterxml.jackson.annotation.JsonAutoDetect; +import eu.dnetlib.openaire.exporter.model.dsm.DatasourceDetails; import io.swagger.v3.oas.annotations.media.Schema; /** diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/DatasourceSearchResponse.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/DatasourceSearchResponse.java index e8d3aacb..5c31dab1 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/DatasourceSearchResponse.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/DatasourceSearchResponse.java @@ -4,6 +4,7 @@ import java.util.List; import com.fasterxml.jackson.annotation.JsonAutoDetect; +import eu.dnetlib.openaire.exporter.model.dsm.DatasourceInfo; import eu.dnetlib.openaire.exporter.model.dsm.Response; @JsonAutoDetect diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/DatasourceSnippetExtended.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/DatasourceSnippetExtended.java index 819fe307..3454f8e3 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/DatasourceSnippetExtended.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/DatasourceSnippetExtended.java @@ -8,6 +8,7 @@ import javax.validation.constraints.NotBlank; import com.fasterxml.jackson.annotation.JsonAutoDetect; +import eu.dnetlib.openaire.exporter.model.dsm.OrganizationDetails; import io.swagger.v3.oas.annotations.media.Schema; @JsonAutoDetect diff --git a/apps/dnet-exporter-api/src/test/java/eu/dnetlib/openaire/dsm/DatasourceApiControllerTest.java b/apps/dnet-exporter-api/src/test/java/eu/dnetlib/openaire/dsm/DatasourceApiControllerTest.java index 80cfe152..b5ede79a 100644 --- a/apps/dnet-exporter-api/src/test/java/eu/dnetlib/openaire/dsm/DatasourceApiControllerTest.java +++ b/apps/dnet-exporter-api/src/test/java/eu/dnetlib/openaire/dsm/DatasourceApiControllerTest.java @@ -21,8 +21,8 @@ import org.springframework.test.web.servlet.MockMvc; 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.exporter.model.dsm.DatasourceDetails; import eu.dnetlib.openaire.exporter.model.vocabularies.Country; @SpringBootTest diff --git a/libs/dnet-exporter-model/TODO.txt b/libs/dnet-exporter-model/TODO.txt index c5253ee8..aa4feea2 100644 --- a/libs/dnet-exporter-model/TODO.txt +++ b/libs/dnet-exporter-model/TODO.txt @@ -1,15 +1,7 @@ - -DsmApiControllerV2 - SimpleDatasourceInfo - AggregationHistoryResponseV2 - DsmApiController - DatasourceDetailResponse - AggregationHistoryResponseV1 DatasourceSnippetResponse RegisteredDatasourceInfo ApiDetailsResponse - DatasourceDetails DatasourceDetailsWithApis DatasourceDetailsUpdate ApiDetails diff --git a/libs/dnet-exporter-model/pom.xml b/libs/dnet-exporter-model/pom.xml index dc5e670b..970daafb 100644 --- a/libs/dnet-exporter-model/pom.xml +++ b/libs/dnet-exporter-model/pom.xml @@ -18,18 +18,23 @@ - - org.mockito - mockito-junit-jupiter - test - - org.springdoc springdoc-openapi-common 1.6.10 + + jakarta.persistence + jakarta.persistence-api + + + + org.mockito + mockito-junit-jupiter + test + + org.springframework.boot spring-boot-starter-test diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/AggregationHistoryResponseV1.java b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/AggregationHistoryResponseV1.java similarity index 85% rename from apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/AggregationHistoryResponseV1.java rename to libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/AggregationHistoryResponseV1.java index 6ab84899..84efaa3c 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/AggregationHistoryResponseV1.java +++ b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/AggregationHistoryResponseV1.java @@ -1,11 +1,9 @@ -package eu.dnetlib.openaire.dsm.domain; +package eu.dnetlib.openaire.exporter.model.dsm; 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 { diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/AggregationHistoryResponseV2.java b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/AggregationHistoryResponseV2.java similarity index 77% rename from apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/AggregationHistoryResponseV2.java rename to libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/AggregationHistoryResponseV2.java index b13e35a4..1a7779d1 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/AggregationHistoryResponseV2.java +++ b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/AggregationHistoryResponseV2.java @@ -1,12 +1,9 @@ -package eu.dnetlib.openaire.dsm.domain; +package eu.dnetlib.openaire.exporter.model.dsm; 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 { diff --git a/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/AggregationInfo.java b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/AggregationInfo.java new file mode 100644 index 00000000..a2d1b7b5 --- /dev/null +++ b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/AggregationInfo.java @@ -0,0 +1,56 @@ +package eu.dnetlib.openaire.exporter.model.dsm; + +public abstract class AggregationInfo { + + private int numberOfRecords; + + private String date; + + private AggregationStage aggregationStage; + + private boolean indexedVersion = false; + + private boolean completedSuccessfully = true; + + public AggregationInfo() {} + + public int getNumberOfRecords() { + return numberOfRecords; + } + + public void setNumberOfRecords(final int numberOfRecords) { + this.numberOfRecords = numberOfRecords; + } + + public String getDate() { + return date; + } + + public void setDate(final String date) { + this.date = date; + } + + public AggregationStage getAggregationStage() { + return aggregationStage; + } + + public void setAggregationStage(final AggregationStage aggregationStage) { + this.aggregationStage = aggregationStage; + } + + public boolean isIndexedVersion() { + return indexedVersion; + } + + public void setIndexedVersion(final boolean indexedVersion) { + this.indexedVersion = indexedVersion; + } + + public boolean isCompletedSuccessfully() { + return completedSuccessfully; + } + + public void setCompletedSuccessfully(final boolean completedSuccessfully) { + this.completedSuccessfully = completedSuccessfully; + } +} diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/AggregationInfoV1.java b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/AggregationInfoV1.java similarity index 68% rename from apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/AggregationInfoV1.java rename to libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/AggregationInfoV1.java index d33ec120..3d70cae7 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/AggregationInfoV1.java +++ b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/AggregationInfoV1.java @@ -1,9 +1,7 @@ -package eu.dnetlib.openaire.dsm.domain; +package eu.dnetlib.openaire.exporter.model.dsm; import com.fasterxml.jackson.annotation.JsonIgnore; -import eu.dnetlib.enabling.datasources.common.AggregationInfo; - public class AggregationInfoV1 extends AggregationInfo { @Override diff --git a/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/AggregationStage.java b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/AggregationStage.java new file mode 100644 index 00000000..e2a79bf7 --- /dev/null +++ b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/AggregationStage.java @@ -0,0 +1,25 @@ +package eu.dnetlib.openaire.exporter.model.dsm; + +public enum AggregationStage { + + COLLECT, + TRANSFORM; + + public static AggregationStage parse(final String s) { + switch (s) { + case "collect": + case "collection": + case "COLLECT": + case "COLLECTION": + return AggregationStage.COLLECT; + case "transform": + case "transformation": + case "TRANSFORM": + case "TRANSFORMATION": + case "transformDatasets": + case "transformPublications": + return AggregationStage.TRANSFORM; + } + throw new IllegalArgumentException("invalid AggregationStage: " + s); + } +} diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/CollectionInfoV1.java b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/CollectionInfoV1.java similarity index 89% rename from apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/CollectionInfoV1.java rename to libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/CollectionInfoV1.java index 34a8961d..6c15c896 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/CollectionInfoV1.java +++ b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/CollectionInfoV1.java @@ -1,4 +1,4 @@ -package eu.dnetlib.openaire.dsm.domain; +package eu.dnetlib.openaire.exporter.model.dsm; import com.fasterxml.jackson.annotation.JsonAutoDetect; diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/CollectionInfoV2.java b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/CollectionInfoV2.java similarity index 72% rename from apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/CollectionInfoV2.java rename to libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/CollectionInfoV2.java index b1cba57d..a9edb7a1 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/CollectionInfoV2.java +++ b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/CollectionInfoV2.java @@ -1,10 +1,7 @@ -package eu.dnetlib.openaire.dsm.domain; +package eu.dnetlib.openaire.exporter.model.dsm; import com.fasterxml.jackson.annotation.JsonAutoDetect; -import eu.dnetlib.enabling.datasources.common.AggregationInfo; -import io.swagger.v3.oas.annotations.media.Schema; - /** * Created by claudio on 29/11/2016. */ diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/CollectionMode.java b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/CollectionMode.java similarity index 78% rename from apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/CollectionMode.java rename to libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/CollectionMode.java index 5d8702d7..a2d972d9 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/CollectionMode.java +++ b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/CollectionMode.java @@ -1,4 +1,4 @@ -package eu.dnetlib.openaire.dsm.domain; +package eu.dnetlib.openaire.exporter.model.dsm; import com.fasterxml.jackson.annotation.JsonAutoDetect; diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/DatasourceDetails.java b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/DatasourceDetails.java similarity index 99% rename from apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/DatasourceDetails.java rename to libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/DatasourceDetails.java index 0d27e3bc..b9b31cdf 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/DatasourceDetails.java +++ b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/DatasourceDetails.java @@ -1,4 +1,4 @@ -package eu.dnetlib.openaire.dsm.domain; +package eu.dnetlib.openaire.exporter.model.dsm; import java.sql.Date; import java.util.Set; diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/DatasourceIgnoredProperties.java b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/DatasourceIgnoredProperties.java similarity index 98% rename from apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/DatasourceIgnoredProperties.java rename to libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/DatasourceIgnoredProperties.java index f00a734c..498d9144 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/DatasourceIgnoredProperties.java +++ b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/DatasourceIgnoredProperties.java @@ -1,4 +1,4 @@ -package eu.dnetlib.openaire.dsm.domain; +package eu.dnetlib.openaire.exporter.model.dsm; import java.sql.Date; diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/DatasourceInfo.java b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/DatasourceInfo.java similarity index 96% rename from apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/DatasourceInfo.java rename to libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/DatasourceInfo.java index 07399122..4b2a40ea 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/DatasourceInfo.java +++ b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/DatasourceInfo.java @@ -1,10 +1,9 @@ -package eu.dnetlib.openaire.dsm.domain; +package eu.dnetlib.openaire.exporter.model.dsm; import java.util.List; import com.fasterxml.jackson.annotation.JsonAutoDetect; -import eu.dnetlib.enabling.datasources.common.AggregationInfo; import io.swagger.v3.oas.annotations.media.Schema; @JsonAutoDetect diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/IdentitiesDetails.java b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/IdentitiesDetails.java similarity index 90% rename from apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/IdentitiesDetails.java rename to libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/IdentitiesDetails.java index 48cba1e9..7d1ccd33 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/IdentitiesDetails.java +++ b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/IdentitiesDetails.java @@ -1,4 +1,4 @@ -package eu.dnetlib.openaire.dsm.domain; +package eu.dnetlib.openaire.exporter.model.dsm; import com.fasterxml.jackson.annotation.JsonAutoDetect; diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/OrganizationDetails.java b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/OrganizationDetails.java similarity index 96% rename from apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/OrganizationDetails.java rename to libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/OrganizationDetails.java index 1abc52d4..0b7c92d2 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/OrganizationDetails.java +++ b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/OrganizationDetails.java @@ -1,4 +1,4 @@ -package eu.dnetlib.openaire.dsm.domain; +package eu.dnetlib.openaire.exporter.model.dsm; import javax.validation.constraints.NotBlank; diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/OrganizationIgnoredProperties.java b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/OrganizationIgnoredProperties.java similarity index 96% rename from apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/OrganizationIgnoredProperties.java rename to libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/OrganizationIgnoredProperties.java index 3212fb66..256c0de2 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/OrganizationIgnoredProperties.java +++ b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/OrganizationIgnoredProperties.java @@ -1,4 +1,4 @@ -package eu.dnetlib.openaire.dsm.domain; +package eu.dnetlib.openaire.exporter.model.dsm; import java.util.Date; import java.util.Set; diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/SimpleDatasourceInfo.java b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/SimpleDatasourceInfo.java similarity index 98% rename from apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/SimpleDatasourceInfo.java rename to libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/SimpleDatasourceInfo.java index 997f3894..9c9fc799 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/SimpleDatasourceInfo.java +++ b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/SimpleDatasourceInfo.java @@ -1,4 +1,4 @@ -package eu.dnetlib.openaire.dsm.domain; +package eu.dnetlib.openaire.exporter.model.dsm; import java.util.LinkedHashMap; import java.util.Map; diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/TransformationInfoV1.java b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/TransformationInfoV1.java similarity index 80% rename from apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/TransformationInfoV1.java rename to libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/TransformationInfoV1.java index d119964d..4990daec 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/TransformationInfoV1.java +++ b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/TransformationInfoV1.java @@ -1,4 +1,4 @@ -package eu.dnetlib.openaire.dsm.domain; +package eu.dnetlib.openaire.exporter.model.dsm; import com.fasterxml.jackson.annotation.JsonAutoDetect; diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/TransformationInfoV2.java b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/TransformationInfoV2.java similarity index 63% rename from apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/TransformationInfoV2.java rename to libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/TransformationInfoV2.java index 2d5a6fa4..df74986c 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/TransformationInfoV2.java +++ b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/TransformationInfoV2.java @@ -1,9 +1,7 @@ -package eu.dnetlib.openaire.dsm.domain; +package eu.dnetlib.openaire.exporter.model.dsm; import com.fasterxml.jackson.annotation.JsonAutoDetect; -import eu.dnetlib.enabling.datasources.common.AggregationInfo; - /** * Created by claudio on 29/11/2016. */ From a04e719a57599792d4a6c79bd80f73e4a5833594 Mon Sep 17 00:00:00 2001 From: "michele.artini" Date: Mon, 3 Apr 2023 08:33:39 +0200 Subject: [PATCH 14/19] moved some classes to new module --- .../java/eu/dnetlib/openaire/dsm/DsmApiController.java | 6 +++--- .../src/main/java/eu/dnetlib/openaire/dsm/DsmCore.java | 8 ++++---- .../java/eu/dnetlib/openaire/dsm/dao/DatasourceDao.java | 2 +- .../eu/dnetlib/openaire/dsm/dao/DatasourceDaoImpl.java | 2 +- .../java/eu/dnetlib/openaire/dsm/dao/DatasourceSpecs.java | 4 ++-- .../java/eu/dnetlib/openaire/dsm/dao/ResponseUtils.java | 4 ++-- .../dnetlib/openaire/dsm/dao/utils/DsmMappingUtils.java | 2 +- .../openaire/dsm/domain/DatasourceDetailsWithApis.java | 1 + .../openaire/dsm/dao/utils/DsmMappingUtilsTest.java | 2 +- libs/dnet-exporter-model/TODO.txt | 4 +--- .../dnetlib/openaire/exporter/model/dsm}/ApiDetails.java | 2 +- .../openaire/exporter/model/dsm}/ApiDetailsResponse.java | 6 +----- .../exporter/model/dsm}/ApiIgnoredProperties.java | 2 +- .../openaire/exporter/model/dsm}/ApiParamDetails.java | 2 +- .../dnetlib/openaire/exporter/model/dsm}/FilterName.java | 2 +- .../dnetlib/openaire/exporter/model/dsm}/FilterType.java | 2 +- .../openaire/exporter/model/dsm}/RequestFilter.java | 2 +- 17 files changed, 24 insertions(+), 29 deletions(-) rename {apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain => libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm}/ApiDetails.java (98%) rename {apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain => libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm}/ApiDetailsResponse.java (69%) rename {apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain => libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm}/ApiIgnoredProperties.java (96%) rename {apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain => libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm}/ApiParamDetails.java (87%) rename {apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain => libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm}/FilterName.java (95%) rename {apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain => libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm}/FilterType.java (59%) rename {apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain => libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm}/RequestFilter.java (89%) diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/DsmApiController.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/DsmApiController.java index cf995d11..b62f49e0 100755 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/DsmApiController.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/DsmApiController.java @@ -26,21 +26,21 @@ import org.springframework.web.bind.annotation.RestController; import eu.dnetlib.openaire.common.AbstractExporterController; import eu.dnetlib.openaire.common.OperationManager; -import eu.dnetlib.openaire.dsm.domain.ApiDetails; -import eu.dnetlib.openaire.dsm.domain.ApiDetailsResponse; import eu.dnetlib.openaire.dsm.domain.DatasourceDetailResponse; import eu.dnetlib.openaire.dsm.domain.DatasourceDetailsUpdate; import eu.dnetlib.openaire.dsm.domain.DatasourceDetailsWithApis; import eu.dnetlib.openaire.dsm.domain.DatasourceSnippetResponse; 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.exporter.exceptions.DsmException; import eu.dnetlib.openaire.exporter.exceptions.DsmForbiddenException; import eu.dnetlib.openaire.exporter.exceptions.DsmNotFoundException; import eu.dnetlib.openaire.exporter.model.dsm.AggregationHistoryResponseV1; +import eu.dnetlib.openaire.exporter.model.dsm.ApiDetails; +import eu.dnetlib.openaire.exporter.model.dsm.ApiDetailsResponse; import eu.dnetlib.openaire.exporter.model.dsm.DatasourceDetails; +import eu.dnetlib.openaire.exporter.model.dsm.RequestFilter; import eu.dnetlib.openaire.exporter.model.dsm.SimpleResponse; import eu.dnetlib.openaire.exporter.model.vocabularies.Country; import io.swagger.v3.oas.annotations.Operation; diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/DsmCore.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/DsmCore.java index e17b5bb9..68681b23 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/DsmCore.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/DsmCore.java @@ -29,7 +29,6 @@ import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.RowMapper; import org.springframework.stereotype.Component; -import eu.dnetlib.enabling.datasources.common.AggregationInfo; import eu.dnetlib.openaire.common.ISClient; import eu.dnetlib.openaire.community.CommunityClient; import eu.dnetlib.openaire.dsm.dao.DatasourceDao; @@ -37,14 +36,11 @@ import eu.dnetlib.openaire.dsm.dao.MongoLoggerClient; import eu.dnetlib.openaire.dsm.dao.ResponseUtils; import eu.dnetlib.openaire.dsm.dao.VocabularyClient; import eu.dnetlib.openaire.dsm.dao.utils.DsmMappingUtils; -import eu.dnetlib.openaire.dsm.domain.ApiDetails; -import eu.dnetlib.openaire.dsm.domain.ApiDetailsResponse; import eu.dnetlib.openaire.dsm.domain.DatasourceDetailResponse; import eu.dnetlib.openaire.dsm.domain.DatasourceDetailsUpdate; import eu.dnetlib.openaire.dsm.domain.DatasourceDetailsWithApis; import eu.dnetlib.openaire.dsm.domain.DatasourceSnippetResponse; 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.db.ApiDbEntry; @@ -55,8 +51,12 @@ import eu.dnetlib.openaire.exporter.exceptions.DsmForbiddenException; import eu.dnetlib.openaire.exporter.exceptions.DsmNotFoundException; import eu.dnetlib.openaire.exporter.model.dsm.AggregationHistoryResponseV1; import eu.dnetlib.openaire.exporter.model.dsm.AggregationHistoryResponseV2; +import eu.dnetlib.openaire.exporter.model.dsm.AggregationInfo; import eu.dnetlib.openaire.exporter.model.dsm.AggregationInfoV1; +import eu.dnetlib.openaire.exporter.model.dsm.ApiDetails; +import eu.dnetlib.openaire.exporter.model.dsm.ApiDetailsResponse; import eu.dnetlib.openaire.exporter.model.dsm.DatasourceDetails; +import eu.dnetlib.openaire.exporter.model.dsm.RequestFilter; import eu.dnetlib.openaire.exporter.model.dsm.SimpleDatasourceInfo; import eu.dnetlib.openaire.exporter.model.dsm.SimpleResponse; import eu.dnetlib.openaire.exporter.model.vocabularies.Country; diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/DatasourceDao.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/DatasourceDao.java index b126bf13..7ef08195 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/DatasourceDao.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/DatasourceDao.java @@ -5,10 +5,10 @@ import java.util.List; import org.springframework.data.domain.Page; import eu.dnetlib.enabling.datasources.common.Api; -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.exporter.exceptions.DsmException; +import eu.dnetlib.openaire.exporter.model.dsm.RequestFilter; import eu.dnetlib.openaire.exporter.model.vocabularies.Country; public interface DatasourceDao, API extends Api> extends DatasourceManagerCommon { diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/DatasourceDaoImpl.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/DatasourceDaoImpl.java index 7372d10e..d320901d 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/DatasourceDaoImpl.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/DatasourceDaoImpl.java @@ -30,7 +30,6 @@ import org.springframework.transaction.annotation.Transactional; import com.google.common.collect.Lists; import eu.dnetlib.DnetOpenaireExporterProperties; -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.ApiDbEntry; @@ -40,6 +39,7 @@ import eu.dnetlib.openaire.dsm.domain.db.DatasourceDbEntry; 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.RequestFilter; import eu.dnetlib.openaire.exporter.model.vocabularies.Country; import eu.dnetlib.openaire.exporter.model.vocabularies.Vocabulary; diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/DatasourceSpecs.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/DatasourceSpecs.java index 8e22477c..13a7e13d 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/DatasourceSpecs.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/DatasourceSpecs.java @@ -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.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; +import eu.dnetlib.openaire.exporter.model.dsm.FilterName; +import eu.dnetlib.openaire.exporter.model.dsm.RequestFilter; public class DatasourceSpecs { diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/ResponseUtils.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/ResponseUtils.java index fa849ea0..f3e20cc0 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/ResponseUtils.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/ResponseUtils.java @@ -5,12 +5,12 @@ import java.util.Queue; import com.google.common.collect.Lists; -import eu.dnetlib.openaire.dsm.domain.ApiDetails; -import eu.dnetlib.openaire.dsm.domain.ApiDetailsResponse; import eu.dnetlib.openaire.dsm.domain.DatasourceDetailResponse; 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.exporter.model.dsm.ApiDetails; +import eu.dnetlib.openaire.exporter.model.dsm.ApiDetailsResponse; import eu.dnetlib.openaire.exporter.model.dsm.DatasourceDetails; import eu.dnetlib.openaire.exporter.model.dsm.DatasourceInfo; import eu.dnetlib.openaire.exporter.model.dsm.Header; diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/utils/DsmMappingUtils.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/utils/DsmMappingUtils.java index 3d3ee56d..9335fc77 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/utils/DsmMappingUtils.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/utils/DsmMappingUtils.java @@ -14,12 +14,12 @@ import org.springframework.beans.BeanWrapperImpl; import com.fasterxml.jackson.databind.ObjectMapper; import eu.dnetlib.data.transform.xml.AbstractDNetXsltFunctions; -import eu.dnetlib.openaire.dsm.domain.ApiDetails; import eu.dnetlib.openaire.dsm.domain.DatasourceDetailsUpdate; import eu.dnetlib.openaire.dsm.domain.DatasourceSnippetExtended; import eu.dnetlib.openaire.dsm.domain.db.ApiDbEntry; import eu.dnetlib.openaire.dsm.domain.db.DatasourceDbEntry; import eu.dnetlib.openaire.dsm.domain.db.OrganizationDbEntry; +import eu.dnetlib.openaire.exporter.model.dsm.ApiDetails; import eu.dnetlib.openaire.exporter.model.dsm.DatasourceDetails; import eu.dnetlib.openaire.exporter.model.dsm.OrganizationDetails; diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/DatasourceDetailsWithApis.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/DatasourceDetailsWithApis.java index bf41287b..58df040d 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/DatasourceDetailsWithApis.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/DatasourceDetailsWithApis.java @@ -5,6 +5,7 @@ import java.util.List; import com.fasterxml.jackson.annotation.JsonAutoDetect; +import eu.dnetlib.openaire.exporter.model.dsm.ApiDetails; import eu.dnetlib.openaire.exporter.model.dsm.DatasourceDetails; import io.swagger.v3.oas.annotations.media.Schema; diff --git a/apps/dnet-exporter-api/src/test/java/eu/dnetlib/openaire/dsm/dao/utils/DsmMappingUtilsTest.java b/apps/dnet-exporter-api/src/test/java/eu/dnetlib/openaire/dsm/dao/utils/DsmMappingUtilsTest.java index eb11e14d..9b051d6d 100644 --- a/apps/dnet-exporter-api/src/test/java/eu/dnetlib/openaire/dsm/dao/utils/DsmMappingUtilsTest.java +++ b/apps/dnet-exporter-api/src/test/java/eu/dnetlib/openaire/dsm/dao/utils/DsmMappingUtilsTest.java @@ -5,8 +5,8 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import eu.dnetlib.openaire.dsm.domain.ApiDetails; import eu.dnetlib.openaire.dsm.domain.db.ApiDbEntry; +import eu.dnetlib.openaire.exporter.model.dsm.ApiDetails; class DsmMappingUtilsTest { diff --git a/libs/dnet-exporter-model/TODO.txt b/libs/dnet-exporter-model/TODO.txt index aa4feea2..8a879752 100644 --- a/libs/dnet-exporter-model/TODO.txt +++ b/libs/dnet-exporter-model/TODO.txt @@ -1,8 +1,6 @@ DsmApiController DatasourceSnippetResponse RegisteredDatasourceInfo - ApiDetailsResponse DatasourceDetailsWithApis DatasourceDetailsUpdate - ApiDetails - RequestFilter + diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/ApiDetails.java b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/ApiDetails.java similarity index 98% rename from apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/ApiDetails.java rename to libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/ApiDetails.java index 4768d9a0..917d2d1c 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/ApiDetails.java +++ b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/ApiDetails.java @@ -1,4 +1,4 @@ -package eu.dnetlib.openaire.dsm.domain; +package eu.dnetlib.openaire.exporter.model.dsm; import java.sql.Date; import java.util.Set; diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/ApiDetailsResponse.java b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/ApiDetailsResponse.java similarity index 69% rename from apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/ApiDetailsResponse.java rename to libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/ApiDetailsResponse.java index b65f6e42..38aa7a28 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/ApiDetailsResponse.java +++ b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/ApiDetailsResponse.java @@ -1,13 +1,9 @@ -package eu.dnetlib.openaire.dsm.domain; +package eu.dnetlib.openaire.exporter.model.dsm; 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; - - @JsonAutoDetect public class ApiDetailsResponse extends Response { diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/ApiIgnoredProperties.java b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/ApiIgnoredProperties.java similarity index 96% rename from apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/ApiIgnoredProperties.java rename to libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/ApiIgnoredProperties.java index d674f260..995c2e16 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/ApiIgnoredProperties.java +++ b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/ApiIgnoredProperties.java @@ -1,4 +1,4 @@ -package eu.dnetlib.openaire.dsm.domain; +package eu.dnetlib.openaire.exporter.model.dsm; import com.fasterxml.jackson.annotation.JsonIgnore; diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/ApiParamDetails.java b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/ApiParamDetails.java similarity index 87% rename from apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/ApiParamDetails.java rename to libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/ApiParamDetails.java index 158bd72a..3977a568 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/ApiParamDetails.java +++ b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/ApiParamDetails.java @@ -1,4 +1,4 @@ -package eu.dnetlib.openaire.dsm.domain; +package eu.dnetlib.openaire.exporter.model.dsm; public class ApiParamDetails { diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/FilterName.java b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/FilterName.java similarity index 95% rename from apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/FilterName.java rename to libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/FilterName.java index 2dbd67eb..2a7ab8a8 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/FilterName.java +++ b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/FilterName.java @@ -1,4 +1,4 @@ -package eu.dnetlib.openaire.dsm.domain; +package eu.dnetlib.openaire.exporter.model.dsm; import com.fasterxml.jackson.annotation.JsonAutoDetect; diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/FilterType.java b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/FilterType.java similarity index 59% rename from apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/FilterType.java rename to libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/FilterType.java index a028e350..70b4e7a0 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/FilterType.java +++ b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/FilterType.java @@ -1,4 +1,4 @@ -package eu.dnetlib.openaire.dsm.domain; +package eu.dnetlib.openaire.exporter.model.dsm; public enum FilterType { exact, diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/RequestFilter.java b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/RequestFilter.java similarity index 89% rename from apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/RequestFilter.java rename to libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/RequestFilter.java index fe160844..9edb5f71 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/RequestFilter.java +++ b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/RequestFilter.java @@ -1,4 +1,4 @@ -package eu.dnetlib.openaire.dsm.domain; +package eu.dnetlib.openaire.exporter.model.dsm; import java.util.HashMap; From ca382e6b6c8f46735f2de3fceb701a92a616d539 Mon Sep 17 00:00:00 2001 From: "michele.artini" Date: Mon, 3 Apr 2023 12:22:22 +0200 Subject: [PATCH 15/19] moved remaining classes --- apps/dnet-exporter-api/pom.xml | 3 +- .../common/AbstractExporterController.java | 22 +-- .../eu/dnetlib/openaire/common/ISClient.java | 5 +- .../dnetlib/openaire/common/ISClientImpl.java | 8 +- .../openaire/dsm/DsmApiController.java | 66 ++++--- .../openaire/dsm/DsmApiControllerV2.java | 4 +- .../java/eu/dnetlib/openaire/dsm/DsmCore.java | 175 +++++++++++------- .../openaire/dsm/dao/DatasourceDao.java | 13 +- .../openaire/dsm/dao/DatasourceDaoImpl.java | 44 ++--- .../dsm/dao/DatasourceIndexClient.java | 6 +- .../dsm/dao/DatasourceIndexClientImpl.java | 11 +- .../openaire/dsm/dao/DatasourceSpecs.java | 6 +- .../openaire/dsm/dao/MongoLoggerClient.java | 7 +- .../dsm/dao/MongoLoggerClientImpl.java | 14 +- .../openaire/dsm/dao/ObjectStoreClient.java | 4 +- .../dsm/dao/ObjectStoreClientImpl.java | 6 +- .../openaire/dsm/dao/ResponseUtils.java | 6 +- .../openaire/dsm/dao/VocabularyClient.java | 7 +- .../dsm/dao/VocabularyClientImpl.java | 18 +- .../dsm/dao/utils/DsmMappingUtils.java | 4 +- libs/dnet-exporter-model/TODO.txt | 6 - ...DsmException.java => DsmApiException.java} | 10 +- .../exceptions/DsmForbiddenException.java | 23 --- .../exceptions/DsmNotFoundException.java | 23 --- .../exceptions/DsmRuntimeException.java | 23 --- .../model/dsm}/DatasourceDetailResponse.java | 5 +- .../model/dsm}/DatasourceDetailsUpdate.java | 3 +- .../model/dsm}/DatasourceDetailsWithApis.java | 4 +- .../model/dsm}/DatasourceSnippetExtended.java | 3 +- .../model/dsm}/DatasourceSnippetResponse.java | 4 +- .../model/dsm}/RegisteredDatasourceInfo.java | 2 +- .../exporter/model/dsm}/RequestSort.java | 2 +- .../exporter/model/dsm}/RequestSortOrder.java | 2 +- 33 files changed, 229 insertions(+), 310 deletions(-) delete mode 100644 libs/dnet-exporter-model/TODO.txt rename libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/exceptions/{DsmException.java => DsmApiException.java} (56%) delete mode 100644 libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/exceptions/DsmForbiddenException.java delete mode 100644 libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/exceptions/DsmNotFoundException.java delete mode 100644 libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/exceptions/DsmRuntimeException.java rename {apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain => libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm}/DatasourceDetailResponse.java (77%) rename {apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain => libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm}/DatasourceDetailsUpdate.java (97%) rename {apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain => libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm}/DatasourceDetailsWithApis.java (82%) rename {apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain => libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm}/DatasourceSnippetExtended.java (97%) rename {apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain => libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm}/DatasourceSnippetResponse.java (85%) rename {apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain => libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm}/RegisteredDatasourceInfo.java (97%) rename {apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain => libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm}/RequestSort.java (76%) rename {apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain => libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm}/RequestSortOrder.java (73%) diff --git a/apps/dnet-exporter-api/pom.xml b/apps/dnet-exporter-api/pom.xml index b365bded..72ebd904 100644 --- a/apps/dnet-exporter-api/pom.xml +++ b/apps/dnet-exporter-api/pom.xml @@ -125,12 +125,11 @@ 3.4.2 - org.springframework.boot diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/common/AbstractExporterController.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/common/AbstractExporterController.java index 026fbe4f..486ee096 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/common/AbstractExporterController.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/common/AbstractExporterController.java @@ -16,9 +16,7 @@ import org.springframework.web.bind.annotation.ResponseStatus; import com.fasterxml.jackson.annotation.JsonAutoDetect; -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.exceptions.DsmApiException; import eu.dnetlib.openaire.exporter.model.dsm.Response; /** @@ -30,29 +28,13 @@ public abstract class AbstractExporterController { @ResponseBody @ExceptionHandler({ - DsmException.class + DsmApiException.class }) @ResponseStatus(value = HttpStatus.INTERNAL_SERVER_ERROR) public ErrorMessage handleDSMException(final Exception e) { return _handleError(e); } - @ResponseBody - @ExceptionHandler(DsmForbiddenException.class) - @ResponseStatus(value = HttpStatus.FORBIDDEN) - public ErrorMessage handleForbiddenException(final Exception e) { - return _handleError(e); - } - - @ResponseBody - @ExceptionHandler({ - DsmNotFoundException.class - }) - @ResponseStatus(value = HttpStatus.NOT_FOUND) - public ErrorMessage handleNotFoundException(final Exception e) { - return _handleError(e); - } - @ResponseBody @ExceptionHandler(MethodArgumentNotValidException.class) @ResponseStatus(HttpStatus.BAD_REQUEST) diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/common/ISClient.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/common/ISClient.java index 3ed78e44..b4b279a3 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/common/ISClient.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/common/ISClient.java @@ -5,14 +5,13 @@ import java.util.List; import java.util.Map; 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 { - IndexDsInfo calculateCurrentIndexDsInfo() throws DsmException; + IndexDsInfo calculateCurrentIndexDsInfo() throws Exception; - String getObjectStoreId(String dsId) throws DsmException; + String getObjectStoreId(String dsId) throws Exception; Map getFunderContextMap() throws IOException; diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/common/ISClientImpl.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/common/ISClientImpl.java index 4a0c628a..4636bdd8 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/common/ISClientImpl.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/common/ISClientImpl.java @@ -28,12 +28,12 @@ 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.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; /** @@ -52,7 +52,7 @@ public class ISClientImpl implements ISClient { @Override @Cacheable("indexdsinfo-cache") - public IndexDsInfo calculateCurrentIndexDsInfo() throws DsmException { + public IndexDsInfo calculateCurrentIndexDsInfo() throws Exception { log.warn("calculateCurrentIndexDsInfo(): not using cache"); final String[] arr; try { @@ -67,7 +67,7 @@ public class ISClientImpl implements ISClient { @Override @Cacheable("objectstoreid-cache") - public String getObjectStoreId(final String dsId) throws DsmException { + public String getObjectStoreId(final String dsId) throws Exception { log.warn(String.format("getObjectStoreId(%s): not using cache", dsId)); try { final String xqueryTemplate = _getQuery(config.getFindObjectStore()); diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/DsmApiController.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/DsmApiController.java index b62f49e0..2c98a229 100755 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/DsmApiController.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/DsmApiController.java @@ -26,21 +26,19 @@ import org.springframework.web.bind.annotation.RestController; import eu.dnetlib.openaire.common.AbstractExporterController; import eu.dnetlib.openaire.common.OperationManager; -import eu.dnetlib.openaire.dsm.domain.DatasourceDetailResponse; -import eu.dnetlib.openaire.dsm.domain.DatasourceDetailsUpdate; -import eu.dnetlib.openaire.dsm.domain.DatasourceDetailsWithApis; -import eu.dnetlib.openaire.dsm.domain.DatasourceSnippetResponse; -import eu.dnetlib.openaire.dsm.domain.RegisteredDatasourceInfo; -import eu.dnetlib.openaire.dsm.domain.RequestSort; -import eu.dnetlib.openaire.dsm.domain.RequestSortOrder; -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.exceptions.DsmApiException; import eu.dnetlib.openaire.exporter.model.dsm.AggregationHistoryResponseV1; import eu.dnetlib.openaire.exporter.model.dsm.ApiDetails; import eu.dnetlib.openaire.exporter.model.dsm.ApiDetailsResponse; +import eu.dnetlib.openaire.exporter.model.dsm.DatasourceDetailResponse; import eu.dnetlib.openaire.exporter.model.dsm.DatasourceDetails; +import eu.dnetlib.openaire.exporter.model.dsm.DatasourceDetailsUpdate; +import eu.dnetlib.openaire.exporter.model.dsm.DatasourceDetailsWithApis; +import eu.dnetlib.openaire.exporter.model.dsm.DatasourceSnippetResponse; +import eu.dnetlib.openaire.exporter.model.dsm.RegisteredDatasourceInfo; import eu.dnetlib.openaire.exporter.model.dsm.RequestFilter; +import eu.dnetlib.openaire.exporter.model.dsm.RequestSort; +import eu.dnetlib.openaire.exporter.model.dsm.RequestSortOrder; import eu.dnetlib.openaire.exporter.model.dsm.SimpleResponse; import eu.dnetlib.openaire.exporter.model.vocabularies.Country; import io.swagger.v3.oas.annotations.Operation; @@ -69,7 +67,7 @@ public class DsmApiController extends AbstractExporterController { @ApiResponse(responseCode = "200", description = "OK"), @ApiResponse(responseCode = "500", description = "unexpected error") }) - public List listCountries() throws DsmException { + public List listCountries() throws DsmApiException { return dsmCore.listCountries(); } @@ -88,7 +86,7 @@ public class DsmApiController extends AbstractExporterController { @RequestParam final RequestSortOrder order, @RequestBody final RequestFilter requestFilter, @PathVariable final int page, - @PathVariable final int size) throws DsmException { + @PathVariable final int size) throws DsmApiException { final StopWatch stop = StopWatch.createStarted(); final DatasourceDetailResponse rsp = dsmCore.searchDsDetails(requestSortBy, order, requestFilter, page, size); return prepareResponse(page, size, stop, rsp); @@ -104,7 +102,7 @@ public class DsmApiController extends AbstractExporterController { @ApiResponse(responseCode = "200", description = "OK"), @ApiResponse(responseCode = "500", description = "unexpected error") }) - public AggregationHistoryResponseV1 aggregationHistory(@PathVariable final String dsId) throws DsmException { + public AggregationHistoryResponseV1 aggregationHistory(@PathVariable final String dsId) throws DsmApiException { final StopWatch stop = StopWatch.createStarted(); final AggregationHistoryResponseV1 rsp = dsmCore.aggregationhistoryV1(dsId); return prepareResponse(0, rsp.getAggregationInfo().size(), stop, rsp); @@ -125,7 +123,7 @@ public class DsmApiController extends AbstractExporterController { @RequestParam final RequestSortOrder order, @RequestBody final RequestFilter requestFilter, @PathVariable final int page, - @PathVariable final int size) throws DsmException { + @PathVariable final int size) throws DsmApiException { final StopWatch stop = StopWatch.createStarted(); final DatasourceSnippetResponse rsp = dsmCore.searchSnippet(requestSortBy, order, requestFilter, page, size); return prepareResponse(page, size, stop, rsp); @@ -147,7 +145,7 @@ public class DsmApiController extends AbstractExporterController { @RequestParam final RequestSortOrder order, @RequestBody final RequestFilter requestFilter, @PathVariable final int page, - @PathVariable final int size) throws DsmException { + @PathVariable final int size) throws DsmApiException { final StopWatch stop = StopWatch.createStarted(); final DatasourceSnippetResponse rsp = dsmCore.searchRegistered(requestSortBy, order, requestFilter, page, size); return prepareResponse(page, size, stop, rsp); @@ -198,7 +196,7 @@ public class DsmApiController extends AbstractExporterController { @ApiResponse(responseCode = "500", description = "unexpected error") }) public ApiDetailsResponse getApi( - @PathVariable final String dsId) throws DsmException { + @PathVariable final String dsId) throws DsmApiException { final StopWatch stop = StopWatch.createStarted(); final ApiDetailsResponse rsp = dsmCore.getApis(dsId); @@ -218,7 +216,7 @@ public class DsmApiController extends AbstractExporterController { public List searchBaseUrls( @RequestBody final RequestFilter requestFilter, @PathVariable final int page, - @PathVariable final int size) throws DsmException { + @PathVariable final int size) throws DsmApiException { return dsmCore.findBaseURLs(requestFilter, page, size); } @@ -233,7 +231,7 @@ public class DsmApiController extends AbstractExporterController { @ApiResponse(responseCode = "403", description = "Api not removable"), @ApiResponse(responseCode = "500", description = "DSM Server error") }) - public void deleteApi(@PathVariable final String apiId) throws DsmForbiddenException, DsmNotFoundException { + public void deleteApi(@PathVariable final String apiId) throws DsmApiException { dsmCore.deleteApi(apiId); } @@ -247,7 +245,7 @@ public class DsmApiController extends AbstractExporterController { }) public void setManaged( @RequestParam final String id, - @RequestParam final boolean managed) throws DsmException { + @RequestParam final boolean managed) throws DsmApiException { dsmCore.setManaged(id, managed); } @@ -260,7 +258,7 @@ public class DsmApiController extends AbstractExporterController { @ApiResponse(responseCode = "200", description = "OK"), @ApiResponse(responseCode = "500", description = "unexpected error") }) - public boolean isManaged(@PathVariable final String id) throws DsmException { + public boolean isManaged(@PathVariable final String id) throws DsmApiException { return dsmCore.isManaged(id); } @@ -273,10 +271,10 @@ public class DsmApiController extends AbstractExporterController { @ApiResponse(responseCode = "400", description = "Malformed request"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - public void saveDs(@Valid @RequestBody final DatasourceDetails datasource) throws DsmException { + public void saveDs(@Valid @RequestBody final DatasourceDetails datasource) throws DsmApiException { if (dsmCore.exist(datasource)) { // TODO further check that the DS doesn't have any API - throw new DsmException(HttpStatus.SC_CONFLICT, String.format("cannot register, datasource already defined '%s'", datasource.getId())); + throw new DsmApiException(HttpStatus.SC_CONFLICT, String.format("cannot register, datasource already defined '%s'", datasource.getId())); } dsmCore.save(datasource); } @@ -290,10 +288,10 @@ public class DsmApiController extends AbstractExporterController { @ApiResponse(responseCode = "400", description = "Malformed request"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - public void saveDsWithApis(@Valid @RequestBody final DatasourceDetailsWithApis d) throws DsmException { - if (d.getDatasource() == null) { throw new DsmException(HttpStatus.SC_BAD_REQUEST, "Datasource field is null"); } + public void saveDsWithApis(@Valid @RequestBody final DatasourceDetailsWithApis d) throws DsmApiException { + if (d.getDatasource() == null) { throw new DsmApiException(HttpStatus.SC_BAD_REQUEST, "Datasource field is null"); } if (dsmCore.exist(d.getDatasource())) { // TODO further check that the DS doesn't have any API - throw new DsmException(HttpStatus.SC_CONFLICT, String.format("cannot register, datasource already defined '%s'", d.getDatasource().getId())); + throw new DsmApiException(HttpStatus.SC_CONFLICT, String.format("cannot register, datasource already defined '%s'", d.getDatasource().getId())); } dsmCore.save(d); } @@ -307,7 +305,7 @@ public class DsmApiController extends AbstractExporterController { @ApiResponse(responseCode = "500", description = "unexpected error") }) public void updateDatasource( - @RequestBody final DatasourceDetailsUpdate ds) throws DsmException, DsmNotFoundException { + @RequestBody final DatasourceDetailsUpdate ds) throws DsmApiException { dsmCore.updateDatasource(ds); } @@ -323,7 +321,7 @@ public class DsmApiController extends AbstractExporterController { public void updateBaseUrl( @RequestParam final String dsId, @RequestParam final String apiId, - @RequestParam final String baseUrl) throws DsmException { + @RequestParam final String baseUrl) throws DsmApiException { dsmCore.updateApiBaseurl(dsId, apiId, baseUrl); } @@ -340,7 +338,7 @@ public class DsmApiController extends AbstractExporterController { @RequestParam final String dsId, @RequestParam final String apiId, @RequestParam final String compliance, - @RequestParam(required = false, defaultValue = "false") final boolean override) throws DsmException { + @RequestParam(required = false, defaultValue = "false") final boolean override) throws DsmApiException { dsmCore.updateApiCompatibility(dsId, apiId, compliance, override); } @@ -356,7 +354,7 @@ public class DsmApiController extends AbstractExporterController { public void updateOaiSetl( @RequestParam final String dsId, @RequestParam final String apiId, - @RequestParam final String oaiSet) throws DsmException { + @RequestParam final String oaiSet) throws DsmApiException { dsmCore.updateApiOaiSet(dsId, apiId, oaiSet); } @@ -369,8 +367,8 @@ public class DsmApiController extends AbstractExporterController { @ApiResponse(responseCode = "200", description = "OK"), @ApiResponse(responseCode = "500", description = "unexpected error") }) - public void addApi(@RequestBody final ApiDetails api) throws DsmException { - if (StringUtils.isBlank(api.getDatasource())) { throw new DsmException(HttpStatus.SC_BAD_REQUEST, "missing datasource id"); } + public void addApi(@RequestBody final ApiDetails api) throws DsmApiException { + if (StringUtils.isBlank(api.getDatasource())) { throw new DsmApiException(HttpStatus.SC_BAD_REQUEST, "missing datasource id"); } dsmCore.addApi(api); } @@ -387,7 +385,7 @@ public class DsmApiController extends AbstractExporterController { @ApiResponse(responseCode = "200", description = "OK"), @ApiResponse(responseCode = "500", description = "unexpected error") }) - public int getOps() throws DsmException { + public int getOps() throws DsmApiException { return operationManager.getOpSize(); } @@ -399,7 +397,7 @@ public class DsmApiController extends AbstractExporterController { @ApiResponse(responseCode = "200", description = "OK"), @ApiResponse(responseCode = "500", description = "unexpected error") }) - public int killOps() throws DsmException { + public int killOps() throws DsmApiException { return operationManager.dropAll(); } @@ -411,7 +409,7 @@ public class DsmApiController extends AbstractExporterController { @ApiResponse(responseCode = "200", description = "OK"), @ApiResponse(responseCode = "500", description = "unexpected error") }) - public void dropCache() throws DsmException { + public void dropCache() throws DsmApiException { dsmCore.dropCaches(); } diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/DsmApiControllerV2.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/DsmApiControllerV2.java index 68107164..2f250a3c 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/DsmApiControllerV2.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/DsmApiControllerV2.java @@ -17,7 +17,7 @@ import org.springframework.web.bind.annotation.RestController; import eu.dnetlib.openaire.common.AbstractExporterController; import eu.dnetlib.openaire.dsm.dao.ResponseUtils; -import eu.dnetlib.openaire.exporter.exceptions.DsmException; +import eu.dnetlib.openaire.exporter.exceptions.DsmApiException; import eu.dnetlib.openaire.exporter.model.dsm.AggregationHistoryResponseV2; import eu.dnetlib.openaire.exporter.model.dsm.SimpleDatasourceInfo; import eu.dnetlib.openaire.exporter.model.dsm.SimpleResponse; @@ -95,7 +95,7 @@ public class DsmApiControllerV2 extends AbstractExporterController { @ApiResponse(responseCode = "200", description = "OK"), @ApiResponse(responseCode = "500", description = "unexpected error") }) - public AggregationHistoryResponseV2 aggregationHistory(@PathVariable final String dsId) throws DsmException { + public AggregationHistoryResponseV2 aggregationHistory(@PathVariable final String dsId) throws DsmApiException { final StopWatch stop = StopWatch.createStarted(); final AggregationHistoryResponseV2 rsp = dsmCore.aggregationhistoryV2(dsId); return prepareResponse(0, rsp.getAggregationInfo().size(), stop, rsp); diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/DsmCore.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/DsmCore.java index 68681b23..c3ba1a8b 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/DsmCore.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/DsmCore.java @@ -9,6 +9,7 @@ import java.nio.charset.Charset; import java.util.Collection; import java.util.HashSet; import java.util.List; +import java.util.Objects; import java.util.Set; import java.util.function.Function; import java.util.stream.Collectors; @@ -29,37 +30,42 @@ import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.RowMapper; import org.springframework.stereotype.Component; +import com.google.common.collect.Lists; + +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.CountryTermRepository; import eu.dnetlib.openaire.dsm.dao.DatasourceDao; import eu.dnetlib.openaire.dsm.dao.MongoLoggerClient; import eu.dnetlib.openaire.dsm.dao.ResponseUtils; import eu.dnetlib.openaire.dsm.dao.VocabularyClient; import eu.dnetlib.openaire.dsm.dao.utils.DsmMappingUtils; -import eu.dnetlib.openaire.dsm.domain.DatasourceDetailResponse; -import eu.dnetlib.openaire.dsm.domain.DatasourceDetailsUpdate; -import eu.dnetlib.openaire.dsm.domain.DatasourceDetailsWithApis; -import eu.dnetlib.openaire.dsm.domain.DatasourceSnippetResponse; -import eu.dnetlib.openaire.dsm.domain.RegisteredDatasourceInfo; -import eu.dnetlib.openaire.dsm.domain.RequestSort; -import eu.dnetlib.openaire.dsm.domain.RequestSortOrder; 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.exporter.exceptions.DsmException; -import eu.dnetlib.openaire.exporter.exceptions.DsmForbiddenException; -import eu.dnetlib.openaire.exporter.exceptions.DsmNotFoundException; +import eu.dnetlib.openaire.exporter.exceptions.DsmApiException; import eu.dnetlib.openaire.exporter.model.dsm.AggregationHistoryResponseV1; import eu.dnetlib.openaire.exporter.model.dsm.AggregationHistoryResponseV2; import eu.dnetlib.openaire.exporter.model.dsm.AggregationInfo; import eu.dnetlib.openaire.exporter.model.dsm.AggregationInfoV1; import eu.dnetlib.openaire.exporter.model.dsm.ApiDetails; import eu.dnetlib.openaire.exporter.model.dsm.ApiDetailsResponse; +import eu.dnetlib.openaire.exporter.model.dsm.DatasourceDetailResponse; import eu.dnetlib.openaire.exporter.model.dsm.DatasourceDetails; +import eu.dnetlib.openaire.exporter.model.dsm.DatasourceDetailsUpdate; +import eu.dnetlib.openaire.exporter.model.dsm.DatasourceDetailsWithApis; +import eu.dnetlib.openaire.exporter.model.dsm.DatasourceSnippetResponse; +import eu.dnetlib.openaire.exporter.model.dsm.RegisteredDatasourceInfo; import eu.dnetlib.openaire.exporter.model.dsm.RequestFilter; +import eu.dnetlib.openaire.exporter.model.dsm.RequestSort; +import eu.dnetlib.openaire.exporter.model.dsm.RequestSortOrder; import eu.dnetlib.openaire.exporter.model.dsm.SimpleDatasourceInfo; import eu.dnetlib.openaire.exporter.model.dsm.SimpleResponse; import eu.dnetlib.openaire.exporter.model.vocabularies.Country; +import eu.dnetlib.openaire.exporter.model.vocabularies.Vocabulary; @Component @ConditionalOnProperty(value = "openaire.exporter.enable.dsm", havingValue = "true") @@ -79,19 +85,24 @@ public class DsmCore { @Autowired private DatasourceDao dsDao; + @Autowired + private CountryTermRepository countryTermRepository; + @Autowired private JdbcTemplate jdbcTemplate; @Autowired private CommunityClient communityClient; - public List listCountries() throws DsmException { - try { - return dsDao.listCountries(); - } catch (final Throwable e) { - log.error("error listing countries", e); - throw e; - } + public List listCountries() throws DsmApiException { + final List countries = Lists.newArrayList(); + final Vocabulary v = vocabularyClient.getCountries(); + countries.addAll(countryTermRepository.findAll() + .stream() + .filter(Objects::nonNull) + .map(t -> new Country(t.getTerm(), v.getEnglishName(t.getTerm()))) + .collect(Collectors.toList())); + return countries; } public DatasourceDetailResponse searchDsDetails(final RequestSort requestSortBy, @@ -99,14 +110,14 @@ public class DsmCore { final RequestFilter requestFilter, final int page, final int size) - throws DsmException { + throws DsmApiException { try { final Page dsPage = dsDao.search(requestSortBy, order, requestFilter, page, size); return ResponseUtils.detailsResponse(dsPage.map(d -> asDetails(d)).getContent(), dsPage.getTotalElements()); - } catch (final Throwable e) { + } catch (final DsmException e) { log.error("error searching datasources", e); - throw e; + throw new DsmApiException(e.getCode(), "error searching datasources", e); } } @@ -115,13 +126,13 @@ public class DsmCore { final RequestFilter requestFilter, final int page, final int size) - throws DsmException { + throws DsmApiException { try { final Page dsPage = dsDao.search(requestSortBy, order, requestFilter, page, size); return ResponseUtils.snippetResponse(dsPage.map(DsmMappingUtils::asSnippetExtended).getContent(), dsPage.getTotalElements()); - } catch (final Throwable e) { + } catch (final DsmException e) { log.error("error searching datasources", e); - throw e; + throw new DsmApiException(e.getCode(), "error searching datasources", e); } } @@ -130,26 +141,26 @@ public class DsmCore { final RequestFilter requestFilter, final int page, final int size) - throws DsmException { + throws DsmApiException { try { final Page dsPage = dsDao.searchRegistered(requestSortBy, order, requestFilter, page, size); return ResponseUtils.snippetResponse(dsPage.map(DsmMappingUtils::asSnippetExtended).getContent(), dsPage.getTotalElements()); - } catch (final Throwable e) { + } catch (final DsmException e) { log.error("error searching datasources", e); - throw e; + throw new DsmApiException(e.getCode(), "error searching datasources", e); } } - public List findBaseURLs(final RequestFilter requestFilter, final int page, final int size) throws DsmException { + public List findBaseURLs(final RequestFilter requestFilter, final int page, final int size) throws DsmApiException { try { return dsDao.findApiBaseURLs(requestFilter, page, size); - } catch (final Throwable e) { + } catch (final DsmException e) { log.error("error searching datasource base urls", e); - throw e; + throw new DsmApiException(e.getCode(), "error searching datasource base urls", e); } } - public ApiDetailsResponse getApis(final String dsId) throws DsmException { + public ApiDetailsResponse getApis(final String dsId) throws DsmApiException { try { final DatasourceDbEntry ds = dsDao.getDs(dsId); final List apis = dsDao.getApis(dsId); @@ -159,37 +170,49 @@ public class DsmCore { .map(a -> a.setTypology(ds.getTypology())) .collect(Collectors.toList()); return ResponseUtils.apiResponse(api, api.size()); - } catch (final Throwable e) { + } catch (final DsmException e) { log.error(String.format("error searching datasource api %s", dsId), e); - throw e; + throw new DsmApiException(e.getCode(), String.format("error searching datasource api %s", dsId), e); } } - public void setManaged(final String dsId, final boolean managed) throws DsmException { + public void setManaged(final String dsId, final boolean managed) throws DsmApiException { log.info(String.format("updated ds '%s' managed with '%s'", dsId, managed)); - dsDao.setManaged(dsId, managed); + try { + dsDao.setManaged(dsId, managed); + } catch (final DsmException e) { + throw new DsmApiException(e.getCode(), e.getMessage(), e); + } } - public boolean isManaged(final String dsId) throws DsmException { - return dsDao.isManaged(dsId); + public boolean isManaged(final String dsId) throws DsmApiException { + try { + return dsDao.isManaged(dsId); + } catch (final DsmException e) { + throw new DsmApiException(e.getCode(), e.getMessage(), e); + } } - public boolean exist(final DatasourceDetails d) throws DsmException { - return dsDao.existDs(d.getId()); + public boolean exist(final DatasourceDetails d) throws DsmApiException { + try { + return dsDao.existDs(d.getId()); + } catch (final DsmException e) { + throw new DsmApiException(e.getCode(), e.getMessage(), e); + } } - public void save(final DatasourceDetails d) throws DsmException { + public void save(final DatasourceDetails d) throws DsmApiException { try { dsDao.saveDs(asDbEntry(d)); log.info("DS saved, " + d.getId()); - } catch (final Throwable e) { + } catch (final DsmException e) { log.error(ExceptionUtils.getStackTrace(e)); - throw e; + throw new DsmApiException(e.getCode(), e.getMessage(), e); } } @Transactional - public void save(final DatasourceDetailsWithApis d) throws DsmException { + public void save(final DatasourceDetailsWithApis d) throws DsmApiException { try { dsDao.saveDs(asDbEntry(d.getDatasource())); final List apis = d.getApis(); @@ -199,15 +222,13 @@ public class DsmCore { addApi(api); } } - } catch ( - - final Throwable e) { + } catch (final DsmException e) { log.error(ExceptionUtils.getStackTrace(e)); - throw e; + throw new DsmApiException(e.getCode(), e.getMessage(), e); } } - public void updateDatasource(final DatasourceDetailsUpdate d) throws DsmException, DsmNotFoundException { + public void updateDatasource(final DatasourceDetailsUpdate d) throws DsmApiException { try { // initialize with current values from DB final DatasourceDbEntry ds = dsDao.getDs(d.getId()); @@ -228,46 +249,72 @@ public class DsmCore { } dsDao.saveDs(ds); - } catch (final Throwable e) { + } catch (final DsmException e) { log.error(ExceptionUtils.getStackTrace(e)); - throw e; + throw new DsmApiException(e.getCode(), e.getMessage(), e); } } // TODO remove if unused - public void deleteDs(final String dsId) throws DsmException { + public void deleteDs(final String dsId) throws DsmApiException { log.info(String.format("deleted datasource '%s'", dsId)); - dsDao.deleteDs(dsId); + try { + dsDao.deleteDs(dsId); + } catch (final DsmException e) { + throw new DsmApiException(e.getCode(), e.getMessage(), e); + } } // API - public void updateApiOaiSet(final String dsId, final String apiId, final String oaiSet) throws DsmException { - dsDao.upsertApiOaiSet(apiId, oaiSet); + public void updateApiOaiSet(final String dsId, final String apiId, final String oaiSet) throws DsmApiException { + try { + dsDao.upsertApiOaiSet(apiId, oaiSet); + } catch (final DsmException e) { + throw new DsmApiException(e.getCode(), e.getMessage(), e); + } } - public void updateApiBaseurl(final String dsId, final String apiId, final String baseUrl) throws DsmException { + public void updateApiBaseurl(final String dsId, final String apiId, final String baseUrl) throws DsmApiException { log.info(String.format("updated api '%s' baseurl with '%s'", apiId, baseUrl)); - dsDao.updateApiBaseUrl(apiId, baseUrl); + try { + dsDao.updateApiBaseUrl(apiId, baseUrl); + } catch (final DsmException e) { + throw new DsmApiException(e.getCode(), e.getMessage(), e); + } } - public void updateApiCompatibility(final String dsId, final String apiId, final String compliance, final boolean override) throws DsmException { + public void updateApiCompatibility(final String dsId, final String apiId, final String compliance, final boolean override) throws DsmApiException { log.info(String.format("updated api '%s' compliance with '%s'", apiId, compliance)); - dsDao.updateCompliance(null, apiId, compliance, override); + try { + dsDao.updateCompliance(null, apiId, compliance, override); + } catch (final DsmException e) { + throw new DsmApiException(e.getCode(), e.getMessage(), e); + } } - public void addApi(final ApiDetails api) throws DsmException { + public void addApi(final ApiDetails api) throws DsmApiException { if (StringUtils.isBlank(api.getId())) { api.setId(createId(api)); log.info(String.format("missing api id, created '%s'", api.getId())); } - dsDao.addApi(asDbEntry(api)); - log.info("API saved, id: " + api.getId()); + try { + dsDao.addApi(asDbEntry(api)); + log.info("API saved, id: " + api.getId()); + } catch (final DsmException e) { + throw new DsmApiException(e.getCode(), e.getMessage(), e); + } } - public void deleteApi(final String apiId) throws DsmForbiddenException, DsmNotFoundException { + public void deleteApi(final String apiId) throws DsmApiException { // TODO handle the api removal in case of associated workflows. - dsDao.deleteApi(null, apiId); + try { + dsDao.deleteApi(null, apiId); + } catch (final DsmForbiddenException e) { + throw new DsmApiException(e.getCode(), e.getMessage(), e); + } catch (final DsmNotFoundException e) { + throw new DsmApiException(e.getCode(), e.getMessage(), e); + } } public void dropCaches() { @@ -316,14 +363,14 @@ public class DsmCore { } @Deprecated - public AggregationHistoryResponseV1 aggregationhistoryV1(final String dsId) throws DsmException { + public AggregationHistoryResponseV1 aggregationhistoryV1(final String dsId) throws DsmApiException { final List history = mongoLoggerClient.getAggregationHistoryV1(dsId); final AggregationHistoryResponseV1 rsp = new AggregationHistoryResponseV1(history); rsp.setHeader(ResponseUtils.header(history.size())); return rsp; } - public AggregationHistoryResponseV2 aggregationhistoryV2(final String dsId) throws DsmException { + public AggregationHistoryResponseV2 aggregationhistoryV2(final String dsId) throws DsmApiException { final List history = mongoLoggerClient.getAggregationHistoryV2(dsId); final AggregationHistoryResponseV2 rsp = new AggregationHistoryResponseV2(history); rsp.setHeader(ResponseUtils.header(history.size())); diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/DatasourceDao.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/DatasourceDao.java index 7ef08195..a0f2dce3 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/DatasourceDao.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/DatasourceDao.java @@ -5,18 +5,17 @@ import java.util.List; import org.springframework.data.domain.Page; import eu.dnetlib.enabling.datasources.common.Api; -import eu.dnetlib.openaire.dsm.domain.RequestSort; -import eu.dnetlib.openaire.dsm.domain.RequestSortOrder; -import eu.dnetlib.openaire.exporter.exceptions.DsmException; +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.exporter.model.dsm.RequestFilter; -import eu.dnetlib.openaire.exporter.model.vocabularies.Country; +import eu.dnetlib.openaire.exporter.model.dsm.RequestSort; +import eu.dnetlib.openaire.exporter.model.dsm.RequestSortOrder; public interface DatasourceDao, API extends Api> extends DatasourceManagerCommon { // DATASOURCE - List listCountries() throws DsmException; - boolean existDs(final String dsId) throws DsmException; Page search(RequestSort requestSortBy, RequestSortOrder order, RequestFilter requestFilter, int page, int size) throws DsmException; @@ -53,6 +52,4 @@ public interface DatasourceDao, API extends Api listCountries() throws DsmException { - final List countries = Lists.newArrayList(); - final Vocabulary v = vocabularyClient.getCountries(); - countries.addAll(countryTermRepository.findAll() - .stream() - .filter(Objects::nonNull) - .map(t -> new Country(t.getTerm(), v.getEnglishName(t.getTerm()))) - .collect(Collectors.toList())); - return countries; - } + // @Autowired + // private VocabularyClient vocabularyClient; @Override public Page search(final RequestSort requestSortBy, @@ -239,13 +221,11 @@ public class DatasourceDaoImpl implements DatasourceDao errors) throws DsmException; + IndexRecordsInfo getIndexInfo(final String dsId, final IndexDsInfo info, final Queue errors) throws DsmApiException; - String getLastIndexingDate(final IndexDsInfo info) throws DsmException; + String getLastIndexingDate(final IndexDsInfo info) throws DsmApiException; } diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/DatasourceIndexClientImpl.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/DatasourceIndexClientImpl.java index 01cc9245..aca12611 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/DatasourceIndexClientImpl.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/DatasourceIndexClientImpl.java @@ -38,11 +38,12 @@ import com.google.common.util.concurrent.MoreExecutors; import com.google.common.util.concurrent.ThreadFactoryBuilder; 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 eu.dnetlib.openaire.exporter.exceptions.DsmException; +import eu.dnetlib.openaire.exporter.exceptions.DsmApiException; /** * Created by claudio on 20/10/2016. @@ -81,7 +82,7 @@ public class DatasourceIndexClientImpl implements DatasourceIndexClient { } @Override - public IndexRecordsInfo getIndexInfo(final String dsId, final IndexDsInfo info, final Queue errors) throws DsmException { + public IndexRecordsInfo getIndexInfo(final String dsId, final IndexDsInfo info, final Queue errors) throws DsmApiException { try { final String collectedFrom = StringUtils.substringBefore(dsId, SEPARATOR) + SEPARATOR + Hashing.md5(StringUtils.substringAfter(dsId, SEPARATOR)); final CloudSolrClient indexClient = getIndexClient(info); @@ -123,12 +124,12 @@ public class DatasourceIndexClientImpl implements DatasourceIndexClient { waitLatch(latch, errors, config.getRequestTimeout()); return indexRecordInfo; } catch (final Throwable e) { - throw new DsmException(HttpStatus.INTERNAL_SERVER_ERROR.value(), String.format("error reading index info", dsId), e); + throw new DsmApiException(HttpStatus.INTERNAL_SERVER_ERROR.value(), String.format("error reading index info", dsId), e); } } @Override - public String getLastIndexingDate(final IndexDsInfo info) throws DsmException { + public String getLastIndexingDate(final IndexDsInfo info) throws DsmApiException { try { final SolrQuery query = new SolrQuery("oaftype:datasource").setRows(1); final QueryResponse rsp = getIndexClient(info).query(query); @@ -136,7 +137,7 @@ public class DatasourceIndexClientImpl implements DatasourceIndexClient { final String dsversion = doc.get("__dsversion").toString(); return StringUtils.substringBefore(dsversion, "T"); } catch (SolrServerException | IOException e) { - throw new DsmException(HttpStatus.INTERNAL_SERVER_ERROR.value(), "Error querying index DS profile: " + info, e); + throw new DsmApiException(HttpStatus.INTERNAL_SERVER_ERROR.value(), "Error querying index DS profile: " + info, e); } } diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/DatasourceSpecs.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/DatasourceSpecs.java index 13a7e13d..7d4e8819 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/DatasourceSpecs.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/DatasourceSpecs.java @@ -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.openaire.dsm.domain.RequestSort; -import eu.dnetlib.openaire.dsm.domain.RequestSortOrder; +import eu.dnetlib.enabling.datasources.common.DsmRuntimeException; import eu.dnetlib.openaire.dsm.domain.db.DatasourceApiDbEntry; import eu.dnetlib.openaire.dsm.domain.db.DatasourceDbEntry; -import eu.dnetlib.openaire.exporter.exceptions.DsmRuntimeException; import eu.dnetlib.openaire.exporter.model.dsm.FilterName; import eu.dnetlib.openaire.exporter.model.dsm.RequestFilter; +import eu.dnetlib.openaire.exporter.model.dsm.RequestSort; +import eu.dnetlib.openaire.exporter.model.dsm.RequestSortOrder; public class DatasourceSpecs { diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/MongoLoggerClient.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/MongoLoggerClient.java index 59d773ce..9553f7d6 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/MongoLoggerClient.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/MongoLoggerClient.java @@ -2,14 +2,15 @@ package eu.dnetlib.openaire.dsm.dao; import java.util.List; -import eu.dnetlib.openaire.exporter.exceptions.DsmException; +import eu.dnetlib.openaire.exporter.exceptions.DsmApiException; +import eu.dnetlib.openaire.exporter.model.dsm.AggregationInfo; import eu.dnetlib.openaire.exporter.model.dsm.AggregationInfoV1; public interface MongoLoggerClient { - List getAggregationHistoryV1(final String dsId) throws DsmException; + List getAggregationHistoryV1(final String dsId) throws DsmApiException; - List getAggregationHistoryV2(final String dsId) throws DsmException; + List getAggregationHistoryV2(final String dsId) throws DsmApiException; void dropCache(); diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/MongoLoggerClientImpl.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/MongoLoggerClientImpl.java index a176be01..3e3be8f2 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/MongoLoggerClientImpl.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/MongoLoggerClientImpl.java @@ -41,13 +41,13 @@ import com.mongodb.client.MongoCollection; 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.miscutils.datetime.DateUtils; import eu.dnetlib.openaire.common.Utils; import eu.dnetlib.openaire.dsm.dao.utils.DsmMappingUtils; -import eu.dnetlib.openaire.exporter.exceptions.DsmException; +import eu.dnetlib.openaire.exporter.exceptions.DsmApiException; +import eu.dnetlib.openaire.exporter.model.dsm.AggregationInfo; import eu.dnetlib.openaire.exporter.model.dsm.AggregationInfoV1; +import eu.dnetlib.openaire.exporter.model.dsm.AggregationStage; import eu.dnetlib.openaire.exporter.model.dsm.CollectionInfoV1; import eu.dnetlib.openaire.exporter.model.dsm.CollectionInfoV2; import eu.dnetlib.openaire.exporter.model.dsm.CollectionMode; @@ -93,19 +93,19 @@ public class MongoLoggerClientImpl implements MongoLoggerClient { @Override @Cacheable("dsm-aggregationhistory-cache-v1") @Deprecated - public List getAggregationHistoryV1(final String dsId) throws DsmException { + public List getAggregationHistoryV1(final String dsId) throws DsmApiException { return getAggregationHistory(dsId, queryForAggregationHistoryV1(dsId, "(collect|transform)"), getMapperV1()); } @Override @Cacheable("dsm-aggregationhistory-cache-v2") - public List getAggregationHistoryV2(final String dsId) throws DsmException { + public List getAggregationHistoryV2(final String dsId) throws DsmApiException { return getAggregationHistory(dsId, queryForAggregationHistoryV2(dsId, "(collect|transform)"), getMapperV2()); } private List getAggregationHistory(final String dsId, final Bson queryForAggregationHistory, - final Function mapper) throws DsmException { + final Function mapper) throws DsmApiException { log.warn(String.format("getAggregationHistory(dsId = %s): not using cache", dsId)); final Datasource conf = config.getDatasource(); try { @@ -132,7 +132,7 @@ public class MongoLoggerClientImpl implements MongoLoggerClient { return aggregationInfos; } catch (final Throwable e) { - throw new DsmException(HttpStatus.SC_INTERNAL_SERVER_ERROR, String.format("error reading aggregation history for '%s'", dsId), e); + throw new DsmApiException(HttpStatus.SC_INTERNAL_SERVER_ERROR, String.format("error reading aggregation history for '%s'", dsId), e); } } diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/ObjectStoreClient.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/ObjectStoreClient.java index 76f11741..510418a7 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/ObjectStoreClient.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/ObjectStoreClient.java @@ -1,9 +1,9 @@ package eu.dnetlib.openaire.dsm.dao; -import eu.dnetlib.openaire.exporter.exceptions.DsmException; +import eu.dnetlib.openaire.exporter.exceptions.DsmApiException; public interface ObjectStoreClient { - Long getObjectStoreSize(final String objectStoreId) throws DsmException; + Long getObjectStoreSize(final String objectStoreId) throws DsmApiException; } diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/ObjectStoreClientImpl.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/ObjectStoreClientImpl.java index d3f77dca..c6950d6e 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/ObjectStoreClientImpl.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/ObjectStoreClientImpl.java @@ -9,7 +9,7 @@ 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; +import eu.dnetlib.openaire.exporter.exceptions.DsmApiException; @Component @ConditionalOnProperty(value = "openaire.exporter.enable.dsm", havingValue = "true") @@ -21,7 +21,7 @@ public class ObjectStoreClientImpl implements ObjectStoreClient { private ObjectStoreService objectStoreService; @Override - public Long getObjectStoreSize(final String objectStoreId) throws DsmException { + public Long getObjectStoreSize(final String objectStoreId) throws DsmApiException { log.debug("get size for objectStore " + objectStoreId); if (StringUtils.isBlank(objectStoreId)) { return 0L; } try { @@ -29,7 +29,7 @@ public class ObjectStoreClientImpl implements ObjectStoreClient { log.debug("got objectStore size: " + size); return size; } catch (final ObjectStoreServiceException e) { - throw new DsmException("unable to get size for objectStore " + objectStoreId); + throw new DsmApiException("unable to get size for objectStore " + objectStoreId); } } diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/ResponseUtils.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/ResponseUtils.java index f3e20cc0..8672515a 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/ResponseUtils.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/ResponseUtils.java @@ -5,14 +5,14 @@ import java.util.Queue; import com.google.common.collect.Lists; -import eu.dnetlib.openaire.dsm.domain.DatasourceDetailResponse; 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.exporter.model.dsm.ApiDetails; import eu.dnetlib.openaire.exporter.model.dsm.ApiDetailsResponse; +import eu.dnetlib.openaire.exporter.model.dsm.DatasourceDetailResponse; import eu.dnetlib.openaire.exporter.model.dsm.DatasourceDetails; import eu.dnetlib.openaire.exporter.model.dsm.DatasourceInfo; +import eu.dnetlib.openaire.exporter.model.dsm.DatasourceSnippetExtended; +import eu.dnetlib.openaire.exporter.model.dsm.DatasourceSnippetResponse; import eu.dnetlib.openaire.exporter.model.dsm.Header; import eu.dnetlib.openaire.exporter.model.dsm.SimpleResponse; diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/VocabularyClient.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/VocabularyClient.java index c6ffe096..9fed2d01 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/VocabularyClient.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/VocabularyClient.java @@ -1,12 +1,13 @@ package eu.dnetlib.openaire.dsm.dao; -import eu.dnetlib.openaire.exporter.exceptions.DsmException; +import eu.dnetlib.openaire.exporter.exceptions.DsmApiException; +import eu.dnetlib.openaire.exporter.model.vocabularies.Vocabulary; public interface VocabularyClient { - Vocabulary getCountries() throws DsmException; + Vocabulary getCountries() throws DsmApiException; - Vocabulary getDatasourceTypologies() throws DsmException; + Vocabulary getDatasourceTypologies() throws DsmApiException; void dropCache(); diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/VocabularyClientImpl.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/VocabularyClientImpl.java index fe2acfc8..f3fbf35e 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/VocabularyClientImpl.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/VocabularyClientImpl.java @@ -1,9 +1,5 @@ package eu.dnetlib.openaire.dsm.dao; -import eu.dnetlib.DnetOpenaireExporterProperties; -import eu.dnetlib.enabling.datasources.common.DsmException; -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; @@ -14,6 +10,10 @@ import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; import org.springframework.web.client.RestTemplate; +import eu.dnetlib.DnetOpenaireExporterProperties; +import eu.dnetlib.openaire.exporter.exceptions.DsmApiException; +import eu.dnetlib.openaire.exporter.model.vocabularies.Vocabulary; + /** * Created by claudio on 15/09/2017. */ @@ -27,24 +27,22 @@ public class VocabularyClientImpl implements VocabularyClient { @Override @Cacheable("vocabularies-cache") - public Vocabulary getCountries() throws DsmException { + public Vocabulary getCountries() throws DsmApiException { return _getVocabulary(config.getVocabularies().getCountriesEndpoint(), Vocabulary.class); } @Override @Cacheable("vocabularies-cache") - public Vocabulary getDatasourceTypologies() throws DsmException { + public Vocabulary getDatasourceTypologies() throws DsmApiException { return _getVocabulary(config.getVocabularies().getDatasourceTypologiesEndpoint(), Vocabulary.class); } - private T _getVocabulary(final String endpoint, Class clazz) throws DsmException { + private T _getVocabulary(final String endpoint, final Class clazz) throws DsmApiException { final RestTemplate rt = new RestTemplate(); log.info("get vocabulary from " + endpoint); final ResponseEntity rsp = rt.getForEntity(endpoint, clazz); - if (!rsp.getStatusCode().is2xxSuccessful()) { - throw new DsmException(rsp.getStatusCodeValue(), "unable to read content from " + endpoint); - } + if (!rsp.getStatusCode().is2xxSuccessful()) { throw new DsmApiException(rsp.getStatusCodeValue(), "unable to read content from " + endpoint); } return rsp.getBody(); } diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/utils/DsmMappingUtils.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/utils/DsmMappingUtils.java index 9335fc77..cb8cd0bb 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/utils/DsmMappingUtils.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/dao/utils/DsmMappingUtils.java @@ -14,13 +14,13 @@ import org.springframework.beans.BeanWrapperImpl; import com.fasterxml.jackson.databind.ObjectMapper; import eu.dnetlib.data.transform.xml.AbstractDNetXsltFunctions; -import eu.dnetlib.openaire.dsm.domain.DatasourceDetailsUpdate; -import eu.dnetlib.openaire.dsm.domain.DatasourceSnippetExtended; import eu.dnetlib.openaire.dsm.domain.db.ApiDbEntry; import eu.dnetlib.openaire.dsm.domain.db.DatasourceDbEntry; import eu.dnetlib.openaire.dsm.domain.db.OrganizationDbEntry; import eu.dnetlib.openaire.exporter.model.dsm.ApiDetails; import eu.dnetlib.openaire.exporter.model.dsm.DatasourceDetails; +import eu.dnetlib.openaire.exporter.model.dsm.DatasourceDetailsUpdate; +import eu.dnetlib.openaire.exporter.model.dsm.DatasourceSnippetExtended; import eu.dnetlib.openaire.exporter.model.dsm.OrganizationDetails; public class DsmMappingUtils { diff --git a/libs/dnet-exporter-model/TODO.txt b/libs/dnet-exporter-model/TODO.txt deleted file mode 100644 index 8a879752..00000000 --- a/libs/dnet-exporter-model/TODO.txt +++ /dev/null @@ -1,6 +0,0 @@ -DsmApiController - DatasourceSnippetResponse - RegisteredDatasourceInfo - DatasourceDetailsWithApis - DatasourceDetailsUpdate - diff --git a/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/exceptions/DsmException.java b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/exceptions/DsmApiException.java similarity index 56% rename from libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/exceptions/DsmException.java rename to libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/exceptions/DsmApiException.java index 0ac3608b..79a3fba3 100644 --- a/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/exceptions/DsmException.java +++ b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/exceptions/DsmApiException.java @@ -1,27 +1,27 @@ package eu.dnetlib.openaire.exporter.exceptions; -public class DsmException extends Exception { +public class DsmApiException extends Exception { private static final long serialVersionUID = -8173126561260106405L; private int code; - public DsmException(final int code, final String msg) { + public DsmApiException(final int code, final String msg) { super(msg); this.code = code; } - public DsmException(final int code, final Throwable e) { + public DsmApiException(final int code, final Throwable e) { super(e); this.code = code; } - public DsmException(final int code, final String msg, final Throwable e) { + public DsmApiException(final int code, final String msg, final Throwable e) { super(msg, e); this.code = code; } - public DsmException(final String msg) { + public DsmApiException(final String msg) { this(500, msg); } diff --git a/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/exceptions/DsmForbiddenException.java b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/exceptions/DsmForbiddenException.java deleted file mode 100644 index 03a436aa..00000000 --- a/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/exceptions/DsmForbiddenException.java +++ /dev/null @@ -1,23 +0,0 @@ -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); - } - -} diff --git a/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/exceptions/DsmNotFoundException.java b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/exceptions/DsmNotFoundException.java deleted file mode 100644 index d9f01052..00000000 --- a/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/exceptions/DsmNotFoundException.java +++ /dev/null @@ -1,23 +0,0 @@ -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); - } - -} diff --git a/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/exceptions/DsmRuntimeException.java b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/exceptions/DsmRuntimeException.java deleted file mode 100644 index e12894fe..00000000 --- a/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/exceptions/DsmRuntimeException.java +++ /dev/null @@ -1,23 +0,0 @@ -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); - } - -} diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/DatasourceDetailResponse.java b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/DatasourceDetailResponse.java similarity index 77% rename from apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/DatasourceDetailResponse.java rename to libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/DatasourceDetailResponse.java index 1d55a20d..a91f0f11 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/DatasourceDetailResponse.java +++ b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/DatasourceDetailResponse.java @@ -1,12 +1,9 @@ -package eu.dnetlib.openaire.dsm.domain; +package eu.dnetlib.openaire.exporter.model.dsm; import java.util.List; import com.fasterxml.jackson.annotation.JsonAutoDetect; -import eu.dnetlib.openaire.exporter.model.dsm.DatasourceDetails; -import eu.dnetlib.openaire.exporter.model.dsm.Response; - @JsonAutoDetect public class DatasourceDetailResponse extends Response { diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/DatasourceDetailsUpdate.java b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/DatasourceDetailsUpdate.java similarity index 97% rename from apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/DatasourceDetailsUpdate.java rename to libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/DatasourceDetailsUpdate.java index eef03063..1894f84c 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/DatasourceDetailsUpdate.java +++ b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/DatasourceDetailsUpdate.java @@ -1,4 +1,4 @@ -package eu.dnetlib.openaire.dsm.domain; +package eu.dnetlib.openaire.exporter.model.dsm; import java.sql.Date; import java.util.Set; @@ -8,7 +8,6 @@ import javax.validation.constraints.NotBlank; import com.fasterxml.jackson.annotation.JsonAutoDetect; -import eu.dnetlib.openaire.exporter.model.dsm.IdentitiesDetails; import io.swagger.v3.oas.annotations.media.Schema; /** diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/DatasourceDetailsWithApis.java b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/DatasourceDetailsWithApis.java similarity index 82% rename from apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/DatasourceDetailsWithApis.java rename to libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/DatasourceDetailsWithApis.java index 58df040d..c451e449 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/DatasourceDetailsWithApis.java +++ b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/DatasourceDetailsWithApis.java @@ -1,12 +1,10 @@ -package eu.dnetlib.openaire.dsm.domain; +package eu.dnetlib.openaire.exporter.model.dsm; import java.util.ArrayList; import java.util.List; import com.fasterxml.jackson.annotation.JsonAutoDetect; -import eu.dnetlib.openaire.exporter.model.dsm.ApiDetails; -import eu.dnetlib.openaire.exporter.model.dsm.DatasourceDetails; import io.swagger.v3.oas.annotations.media.Schema; /** diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/DatasourceSnippetExtended.java b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/DatasourceSnippetExtended.java similarity index 97% rename from apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/DatasourceSnippetExtended.java rename to libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/DatasourceSnippetExtended.java index 3454f8e3..aefdc8f3 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/DatasourceSnippetExtended.java +++ b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/DatasourceSnippetExtended.java @@ -1,4 +1,4 @@ -package eu.dnetlib.openaire.dsm.domain; +package eu.dnetlib.openaire.exporter.model.dsm; import java.util.Date; import java.util.Set; @@ -8,7 +8,6 @@ import javax.validation.constraints.NotBlank; import com.fasterxml.jackson.annotation.JsonAutoDetect; -import eu.dnetlib.openaire.exporter.model.dsm.OrganizationDetails; import io.swagger.v3.oas.annotations.media.Schema; @JsonAutoDetect diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/DatasourceSnippetResponse.java b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/DatasourceSnippetResponse.java similarity index 85% rename from apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/DatasourceSnippetResponse.java rename to libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/DatasourceSnippetResponse.java index ba84462b..b5d28a21 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/DatasourceSnippetResponse.java +++ b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/DatasourceSnippetResponse.java @@ -1,11 +1,9 @@ -package eu.dnetlib.openaire.dsm.domain; +package eu.dnetlib.openaire.exporter.model.dsm; import java.util.List; import com.fasterxml.jackson.annotation.JsonAutoDetect; -import eu.dnetlib.openaire.exporter.model.dsm.Response; - @JsonAutoDetect public class DatasourceSnippetResponse extends Response { diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/RegisteredDatasourceInfo.java b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/RegisteredDatasourceInfo.java similarity index 97% rename from apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/RegisteredDatasourceInfo.java rename to libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/RegisteredDatasourceInfo.java index 5bd17cc2..9b0613c2 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/RegisteredDatasourceInfo.java +++ b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/RegisteredDatasourceInfo.java @@ -1,4 +1,4 @@ -package eu.dnetlib.openaire.dsm.domain; +package eu.dnetlib.openaire.exporter.model.dsm; public class RegisteredDatasourceInfo { diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/RequestSort.java b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/RequestSort.java similarity index 76% rename from apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/RequestSort.java rename to libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/RequestSort.java index bf0c0cbd..57adce9f 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/RequestSort.java +++ b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/RequestSort.java @@ -1,4 +1,4 @@ -package eu.dnetlib.openaire.dsm.domain; +package eu.dnetlib.openaire.exporter.model.dsm; import com.fasterxml.jackson.annotation.JsonAutoDetect; diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/RequestSortOrder.java b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/RequestSortOrder.java similarity index 73% rename from apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/RequestSortOrder.java rename to libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/RequestSortOrder.java index 2423a991..49b4f860 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/dsm/domain/RequestSortOrder.java +++ b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/model/dsm/RequestSortOrder.java @@ -1,4 +1,4 @@ -package eu.dnetlib.openaire.dsm.domain; +package eu.dnetlib.openaire.exporter.model.dsm; import com.fasterxml.jackson.annotation.JsonAutoDetect; From 785746a501e614db8e363b750315f3f903ef58f1 Mon Sep 17 00:00:00 2001 From: "michele.artini" Date: Wed, 12 Apr 2023 10:36:44 +0200 Subject: [PATCH 16/19] removed invali line --- apps/dnet-exporter-api/src/main/resources/application.properties | 1 - 1 file changed, 1 deletion(-) diff --git a/apps/dnet-exporter-api/src/main/resources/application.properties b/apps/dnet-exporter-api/src/main/resources/application.properties index 340eb274..9d1b9961 100644 --- a/apps/dnet-exporter-api/src/main/resources/application.properties +++ b/apps/dnet-exporter-api/src/main/resources/application.properties @@ -22,7 +22,6 @@ management.endpoints.web.base-path = / management.endpoints.web.path-mapping.prometheus = metrics management.endpoints.web.path-mapping.health = health -apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityApiController.java # ENABLE / DISABLE CONTROLLERS openaire.exporter.enable.dsm = true openaire.exporter.enable.community = true From f74626b71595836e4ecbd8098267ac10fda8cce7 Mon Sep 17 00:00:00 2001 From: "michele.artini" Date: Wed, 12 Apr 2023 12:00:57 +0200 Subject: [PATCH 17/19] update a property --- .../src/main/resources/application.properties | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/apps/dhp-broker-application/src/main/resources/application.properties b/apps/dhp-broker-application/src/main/resources/application.properties index 76eed4de..1da76b3c 100644 --- a/apps/dhp-broker-application/src/main/resources/application.properties +++ b/apps/dhp-broker-application/src/main/resources/application.properties @@ -51,10 +51,9 @@ lbs.mail.smtpUser = smtp-dnet lbs.mail.smtpPassword = hhr*7932 lbs.mail.message.template = classpath:/templates/dhp_openaire_mail.st lbs.mail.message.template.dashboard.baseUrl = https://provide.openaire.eu/content/notifications/ -lbs.mail.message.template.dashboard.helpdesk = https://www.openaire.eu/support/helpdesk +lbs.mail.message.template.dashboard.helpdesk = https://www.openaire.eu/helpdesk lbs.mail.message.template.publicApi = https://api.openaire.eu/broker - lbs.queues.maxReturnedValues = 1000 lbs.task.deleteOldEvents.cron = 0 0 4 1/1 * ? From da011a9228400262363ce645eb440a9568949671 Mon Sep 17 00:00:00 2001 From: "michele.artini" Date: Fri, 14 Apr 2023 08:24:13 +0200 Subject: [PATCH 18/19] [maven-release-plugin] prepare release dnet-applications-3.4.0 --- apps/bioschemas-api/pom.xml | 2 +- apps/dhp-broker-application/pom.xml | 2 +- apps/dhp-broker-public-application/pom.xml | 2 +- apps/dhp-mdstore-manager/pom.xml | 2 +- apps/dnet-exporter-api/pom.xml | 2 +- apps/dnet-orgs-database-application/pom.xml | 2 +- apps/pom.xml | 2 +- apps/scholexplorer-api/pom.xml | 2 +- cmd-line-apps/dhp-broker-client/pom.xml | 2 +- cmd-line-apps/pom.xml | 2 +- libs/dnet-apps-common/pom.xml | 2 +- libs/dnet-broker-apps-common/pom.xml | 2 +- libs/dnet-exporter-model/pom.xml | 2 +- libs/dnet-openaire-broker-common/pom.xml | 2 +- libs/pom.xml | 2 +- pom.xml | 4 ++-- 16 files changed, 17 insertions(+), 17 deletions(-) diff --git a/apps/bioschemas-api/pom.xml b/apps/bioschemas-api/pom.xml index a1e0b415..3a6b5e85 100644 --- a/apps/bioschemas-api/pom.xml +++ b/apps/bioschemas-api/pom.xml @@ -3,7 +3,7 @@ eu.dnetlib.dhp apps - 3.3.4-SNAPSHOT + 3.4.0 ../pom.xml diff --git a/apps/dhp-broker-application/pom.xml b/apps/dhp-broker-application/pom.xml index 5467c9f9..3ac9daf2 100644 --- a/apps/dhp-broker-application/pom.xml +++ b/apps/dhp-broker-application/pom.xml @@ -4,7 +4,7 @@ eu.dnetlib.dhp apps - 3.3.4-SNAPSHOT + 3.4.0 ../pom.xml diff --git a/apps/dhp-broker-public-application/pom.xml b/apps/dhp-broker-public-application/pom.xml index e381f9f8..1f062509 100644 --- a/apps/dhp-broker-public-application/pom.xml +++ b/apps/dhp-broker-public-application/pom.xml @@ -4,7 +4,7 @@ eu.dnetlib.dhp apps - 3.3.4-SNAPSHOT + 3.4.0 ../pom.xml diff --git a/apps/dhp-mdstore-manager/pom.xml b/apps/dhp-mdstore-manager/pom.xml index 90bfa89c..97b1aeba 100644 --- a/apps/dhp-mdstore-manager/pom.xml +++ b/apps/dhp-mdstore-manager/pom.xml @@ -4,7 +4,7 @@ eu.dnetlib.dhp apps - 3.3.4-SNAPSHOT + 3.4.0 ../pom.xml diff --git a/apps/dnet-exporter-api/pom.xml b/apps/dnet-exporter-api/pom.xml index 72ebd904..dc20e92d 100644 --- a/apps/dnet-exporter-api/pom.xml +++ b/apps/dnet-exporter-api/pom.xml @@ -3,7 +3,7 @@ eu.dnetlib.dhp apps - 3.3.4-SNAPSHOT + 3.4.0 ../ diff --git a/apps/dnet-orgs-database-application/pom.xml b/apps/dnet-orgs-database-application/pom.xml index ab5b9c4d..a49355ad 100644 --- a/apps/dnet-orgs-database-application/pom.xml +++ b/apps/dnet-orgs-database-application/pom.xml @@ -4,7 +4,7 @@ eu.dnetlib.dhp apps - 3.3.4-SNAPSHOT + 3.4.0 ../ diff --git a/apps/pom.xml b/apps/pom.xml index 18df266f..840b2b27 100644 --- a/apps/pom.xml +++ b/apps/pom.xml @@ -3,7 +3,7 @@ eu.dnetlib.dhp dnet-applications - 3.3.4-SNAPSHOT + 3.4.0 ../pom.xml diff --git a/apps/scholexplorer-api/pom.xml b/apps/scholexplorer-api/pom.xml index e95632f8..819799fc 100644 --- a/apps/scholexplorer-api/pom.xml +++ b/apps/scholexplorer-api/pom.xml @@ -3,7 +3,7 @@ eu.dnetlib.dhp apps - 3.3.4-SNAPSHOT + 3.4.0 ../pom.xml diff --git a/cmd-line-apps/dhp-broker-client/pom.xml b/cmd-line-apps/dhp-broker-client/pom.xml index 12536b76..dda5b29b 100644 --- a/cmd-line-apps/dhp-broker-client/pom.xml +++ b/cmd-line-apps/dhp-broker-client/pom.xml @@ -4,7 +4,7 @@ eu.dnetlib.dhp cmd-line-apps - 3.3.4-SNAPSHOT + 3.4.0 ../ diff --git a/cmd-line-apps/pom.xml b/cmd-line-apps/pom.xml index 3c752659..ca17f7e4 100644 --- a/cmd-line-apps/pom.xml +++ b/cmd-line-apps/pom.xml @@ -3,7 +3,7 @@ eu.dnetlib.dhp dnet-applications - 3.3.4-SNAPSHOT + 3.4.0 ../ diff --git a/libs/dnet-apps-common/pom.xml b/libs/dnet-apps-common/pom.xml index 53e1d2be..66bde7ed 100644 --- a/libs/dnet-apps-common/pom.xml +++ b/libs/dnet-apps-common/pom.xml @@ -4,7 +4,7 @@ eu.dnetlib.dhp libs - 3.3.4-SNAPSHOT + 3.4.0 ../ diff --git a/libs/dnet-broker-apps-common/pom.xml b/libs/dnet-broker-apps-common/pom.xml index e7ac5f64..eeae988a 100644 --- a/libs/dnet-broker-apps-common/pom.xml +++ b/libs/dnet-broker-apps-common/pom.xml @@ -4,7 +4,7 @@ eu.dnetlib.dhp libs - 3.3.4-SNAPSHOT + 3.4.0 ../ diff --git a/libs/dnet-exporter-model/pom.xml b/libs/dnet-exporter-model/pom.xml index 970daafb..6867ca77 100644 --- a/libs/dnet-exporter-model/pom.xml +++ b/libs/dnet-exporter-model/pom.xml @@ -4,7 +4,7 @@ eu.dnetlib.dhp libs - 3.3.4-SNAPSHOT + 3.4.0 ../ diff --git a/libs/dnet-openaire-broker-common/pom.xml b/libs/dnet-openaire-broker-common/pom.xml index da367339..823fa60a 100644 --- a/libs/dnet-openaire-broker-common/pom.xml +++ b/libs/dnet-openaire-broker-common/pom.xml @@ -3,7 +3,7 @@ eu.dnetlib.dhp libs - 3.3.4-SNAPSHOT + 3.4.0 ../ diff --git a/libs/pom.xml b/libs/pom.xml index 54599a55..f00abf1b 100644 --- a/libs/pom.xml +++ b/libs/pom.xml @@ -4,7 +4,7 @@ eu.dnetlib.dhp dnet-applications - 3.3.4-SNAPSHOT + 3.4.0 ../ diff --git a/pom.xml b/pom.xml index 416b6e31..256eeb81 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ 4.0.0 eu.dnetlib.dhp dnet-applications - 3.3.4-SNAPSHOT + 3.4.0 pom @@ -44,7 +44,7 @@ scm:git:gitea@code-repo.d4science.org:D-Net/dnet-applications.git scm:git:gitea@code-repo.d4science.org:D-Net/dnet-applications.git https://code-repo.d4science.org/D-Net/dnet-applications/ - HEAD + dnet-applications-3.4.0 This module is the root descriptor for the dnet-applications project From 48a6953af330a7da896d7c51d99106aaf93db9a4 Mon Sep 17 00:00:00 2001 From: "michele.artini" Date: Fri, 14 Apr 2023 08:24:16 +0200 Subject: [PATCH 19/19] [maven-release-plugin] prepare for next development iteration --- apps/bioschemas-api/pom.xml | 2 +- apps/dhp-broker-application/pom.xml | 2 +- apps/dhp-broker-public-application/pom.xml | 2 +- apps/dhp-mdstore-manager/pom.xml | 2 +- apps/dnet-exporter-api/pom.xml | 2 +- apps/dnet-orgs-database-application/pom.xml | 2 +- apps/pom.xml | 2 +- apps/scholexplorer-api/pom.xml | 2 +- cmd-line-apps/dhp-broker-client/pom.xml | 2 +- cmd-line-apps/pom.xml | 2 +- libs/dnet-apps-common/pom.xml | 2 +- libs/dnet-broker-apps-common/pom.xml | 2 +- libs/dnet-exporter-model/pom.xml | 2 +- libs/dnet-openaire-broker-common/pom.xml | 2 +- libs/pom.xml | 2 +- pom.xml | 4 ++-- 16 files changed, 17 insertions(+), 17 deletions(-) diff --git a/apps/bioschemas-api/pom.xml b/apps/bioschemas-api/pom.xml index 3a6b5e85..f6d844cc 100644 --- a/apps/bioschemas-api/pom.xml +++ b/apps/bioschemas-api/pom.xml @@ -3,7 +3,7 @@ eu.dnetlib.dhp apps - 3.4.0 + 3.4.1-SNAPSHOT ../pom.xml diff --git a/apps/dhp-broker-application/pom.xml b/apps/dhp-broker-application/pom.xml index 3ac9daf2..84e57c29 100644 --- a/apps/dhp-broker-application/pom.xml +++ b/apps/dhp-broker-application/pom.xml @@ -4,7 +4,7 @@ eu.dnetlib.dhp apps - 3.4.0 + 3.4.1-SNAPSHOT ../pom.xml diff --git a/apps/dhp-broker-public-application/pom.xml b/apps/dhp-broker-public-application/pom.xml index 1f062509..ea0717b0 100644 --- a/apps/dhp-broker-public-application/pom.xml +++ b/apps/dhp-broker-public-application/pom.xml @@ -4,7 +4,7 @@ eu.dnetlib.dhp apps - 3.4.0 + 3.4.1-SNAPSHOT ../pom.xml diff --git a/apps/dhp-mdstore-manager/pom.xml b/apps/dhp-mdstore-manager/pom.xml index 97b1aeba..1abe23b2 100644 --- a/apps/dhp-mdstore-manager/pom.xml +++ b/apps/dhp-mdstore-manager/pom.xml @@ -4,7 +4,7 @@ eu.dnetlib.dhp apps - 3.4.0 + 3.4.1-SNAPSHOT ../pom.xml diff --git a/apps/dnet-exporter-api/pom.xml b/apps/dnet-exporter-api/pom.xml index dc20e92d..5f60602c 100644 --- a/apps/dnet-exporter-api/pom.xml +++ b/apps/dnet-exporter-api/pom.xml @@ -3,7 +3,7 @@ eu.dnetlib.dhp apps - 3.4.0 + 3.4.1-SNAPSHOT ../ diff --git a/apps/dnet-orgs-database-application/pom.xml b/apps/dnet-orgs-database-application/pom.xml index a49355ad..703b6bec 100644 --- a/apps/dnet-orgs-database-application/pom.xml +++ b/apps/dnet-orgs-database-application/pom.xml @@ -4,7 +4,7 @@ eu.dnetlib.dhp apps - 3.4.0 + 3.4.1-SNAPSHOT ../ diff --git a/apps/pom.xml b/apps/pom.xml index 840b2b27..bf088418 100644 --- a/apps/pom.xml +++ b/apps/pom.xml @@ -3,7 +3,7 @@ eu.dnetlib.dhp dnet-applications - 3.4.0 + 3.4.1-SNAPSHOT ../pom.xml diff --git a/apps/scholexplorer-api/pom.xml b/apps/scholexplorer-api/pom.xml index 819799fc..4aa7814e 100644 --- a/apps/scholexplorer-api/pom.xml +++ b/apps/scholexplorer-api/pom.xml @@ -3,7 +3,7 @@ eu.dnetlib.dhp apps - 3.4.0 + 3.4.1-SNAPSHOT ../pom.xml diff --git a/cmd-line-apps/dhp-broker-client/pom.xml b/cmd-line-apps/dhp-broker-client/pom.xml index dda5b29b..8fbd1f4f 100644 --- a/cmd-line-apps/dhp-broker-client/pom.xml +++ b/cmd-line-apps/dhp-broker-client/pom.xml @@ -4,7 +4,7 @@ eu.dnetlib.dhp cmd-line-apps - 3.4.0 + 3.4.1-SNAPSHOT ../ diff --git a/cmd-line-apps/pom.xml b/cmd-line-apps/pom.xml index ca17f7e4..56649118 100644 --- a/cmd-line-apps/pom.xml +++ b/cmd-line-apps/pom.xml @@ -3,7 +3,7 @@ eu.dnetlib.dhp dnet-applications - 3.4.0 + 3.4.1-SNAPSHOT ../ diff --git a/libs/dnet-apps-common/pom.xml b/libs/dnet-apps-common/pom.xml index 66bde7ed..ff3b777b 100644 --- a/libs/dnet-apps-common/pom.xml +++ b/libs/dnet-apps-common/pom.xml @@ -4,7 +4,7 @@ eu.dnetlib.dhp libs - 3.4.0 + 3.4.1-SNAPSHOT ../ diff --git a/libs/dnet-broker-apps-common/pom.xml b/libs/dnet-broker-apps-common/pom.xml index eeae988a..743378db 100644 --- a/libs/dnet-broker-apps-common/pom.xml +++ b/libs/dnet-broker-apps-common/pom.xml @@ -4,7 +4,7 @@ eu.dnetlib.dhp libs - 3.4.0 + 3.4.1-SNAPSHOT ../ diff --git a/libs/dnet-exporter-model/pom.xml b/libs/dnet-exporter-model/pom.xml index 6867ca77..b58c8ca3 100644 --- a/libs/dnet-exporter-model/pom.xml +++ b/libs/dnet-exporter-model/pom.xml @@ -4,7 +4,7 @@ eu.dnetlib.dhp libs - 3.4.0 + 3.4.1-SNAPSHOT ../ diff --git a/libs/dnet-openaire-broker-common/pom.xml b/libs/dnet-openaire-broker-common/pom.xml index 823fa60a..66fd1796 100644 --- a/libs/dnet-openaire-broker-common/pom.xml +++ b/libs/dnet-openaire-broker-common/pom.xml @@ -3,7 +3,7 @@ eu.dnetlib.dhp libs - 3.4.0 + 3.4.1-SNAPSHOT ../ diff --git a/libs/pom.xml b/libs/pom.xml index f00abf1b..830ed931 100644 --- a/libs/pom.xml +++ b/libs/pom.xml @@ -4,7 +4,7 @@ eu.dnetlib.dhp dnet-applications - 3.4.0 + 3.4.1-SNAPSHOT ../ diff --git a/pom.xml b/pom.xml index 256eeb81..ce4221c2 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ 4.0.0 eu.dnetlib.dhp dnet-applications - 3.4.0 + 3.4.1-SNAPSHOT pom @@ -44,7 +44,7 @@ scm:git:gitea@code-repo.d4science.org:D-Net/dnet-applications.git scm:git:gitea@code-repo.d4science.org:D-Net/dnet-applications.git https://code-repo.d4science.org/D-Net/dnet-applications/ - dnet-applications-3.4.0 + HEAD This module is the root descriptor for the dnet-applications project