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 41bedbdb..9e92b883 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 @@ -82,7 +82,7 @@ public class CommunityApiController { "application/json" }, method = RequestMethod.POST) @Operation(summary = "update community details", description = "update community details", tags = { - C, R + C, W }) @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "OK"), @@ -107,7 +107,7 @@ public class CommunityApiController { @ApiResponse(responseCode = "404", description = "not found"), @ApiResponse(responseCode = "500", description = "unexpected error") }) - public Page getCommunityProjects(@PathVariable final String id, @PathVariable final int page, final int size) + public Page getCommunityProjects(@PathVariable final String id, @PathVariable final Integer page, @PathVariable final Integer size) throws CommunityException, ResourceNotFoundException { return communityService.getCommunityProjects(id, page, size); } @@ -537,7 +537,7 @@ public class CommunityApiController { @ApiResponse(responseCode = "404", description = "not found"), @ApiResponse(responseCode = "500", description = "unexpected error") }) - public Map> getPropagationOrganizationCommunityMap() { + public Map> getPropagationOrganizationCommunityMap() throws CommunityException { return communityService.getPropagationOrganizationCommunityMap(); } @@ -552,7 +552,7 @@ public class CommunityApiController { @ApiResponse(responseCode = "404", description = "not found"), @ApiResponse(responseCode = "500", description = "unexpected error") }) - public Set getPropagationOrganizationsForCommunity(@PathVariable final String communityId) { + public Set getPropagationOrganizationsForCommunity(@PathVariable final String communityId) throws CommunityException { return communityService.getPropagationOrganizationsForCommunity(communityId); } @@ -568,7 +568,7 @@ public class CommunityApiController { @ApiResponse(responseCode = "500", description = "unexpected error") }) public Set addPropagationOrganizationForCommunity(@PathVariable final String communityId, - @RequestParam final String organizationId) { + @RequestParam final String organizationId) throws CommunityException { return communityService.addPropagationOrganizationForCommunity(communityId, organizationId); } @@ -584,7 +584,7 @@ public class CommunityApiController { @ApiResponse(responseCode = "500", description = "unexpected error") }) public Set removePropagationOrganizationForCommunity(@PathVariable final String communityId, - @RequestParam final String organizationId) { + @RequestParam final String organizationId) throws CommunityException { return communityService.removePropagationOrganizationForCommunity(communityId, organizationId); } diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityService.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityService.java index be63ddc3..ec0074ff 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityService.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/CommunityService.java @@ -11,6 +11,8 @@ import java.util.stream.Collectors; import javax.transaction.Transactional; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.data.domain.Page; @@ -64,198 +66,345 @@ public class CommunityService { @Autowired private DbSubCommunityRepository dbSubCommunityRepository; + private static final Log log = LogFactory.getLog(CommunityService.class); + public List listCommunities() throws CommunityException { - return dbCommunityRepository.findAll() - .stream() - .map(CommunityMappingUtils::toCommunitySummary) - .collect(Collectors.toList()); + try { + return dbCommunityRepository.findAll() + .stream() + .map(CommunityMappingUtils::toCommunitySummary) + .collect(Collectors.toList()); + } catch (final Throwable e) { + log.error(e); + throw new CommunityException(e); + } } public CommunityDetails saveCommunity(final CommunityDetails details) throws CommunityException { - dbCommunityRepository.save(CommunityMappingUtils.toCommunity(details)); - return getCommunity(details.getId()); + try { + dbCommunityRepository.save(CommunityMappingUtils.toCommunity(details)); + return getCommunity(details.getId()); + } catch (final Throwable e) { + log.error(e); + throw new CommunityException(e); + } } public CommunityDetails getCommunity(final String id) throws CommunityException, ResourceNotFoundException { - final DbCommunity c = dbCommunityRepository.findById(id).orElseThrow(() -> new ResourceNotFoundException("Community not found: " + id)); - return CommunityMappingUtils.CommunityDetails(c); + try { + final DbCommunity c = dbCommunityRepository.findById(id).orElseThrow(() -> new ResourceNotFoundException("Community not found: " + id)); + return CommunityMappingUtils.CommunityDetails(c); + } catch (final Throwable e) { + log.error(e); + throw new CommunityException(e); + } } @Transactional public void setCommunity(final String id, final CommunityWritableProperties details) throws CommunityException, ResourceNotFoundException { - final DbCommunity c = dbCommunityRepository.findById(id).orElseThrow(() -> new ResourceNotFoundException("Community not found: " + id)); - CommunityMappingUtils.populateCommunity(c, details); - dbCommunityRepository.save(c); + try { + final DbCommunity c = dbCommunityRepository.findById(id).orElseThrow(() -> new ResourceNotFoundException("Community not found: " + id)); + CommunityMappingUtils.populateCommunity(c, details); + dbCommunityRepository.save(c); + } catch (final Throwable e) { + log.error(e); + throw new CommunityException(e); + } } public Page getCommunityProjects(final String id, final int page, final int size) throws CommunityException, ResourceNotFoundException { - return dbProjectRepository.findByCommunity(id, PageRequest.of(page, size)).map(CommunityMappingUtils::toCommunityProject); + try { + return dbProjectRepository.findByCommunity(id, PageRequest.of(page, size)).map(CommunityMappingUtils::toCommunityProject); + } catch (final Throwable e) { + log.error(e); + throw new CommunityException(e); + } } public CommunityProject addCommunityProject(final String id, final CommunityProject project) throws CommunityException, ResourceNotFoundException { - final DbProject p = CommunityMappingUtils.toDbProject(id, project); - dbProjectRepository.save(p); - return project; + try { + final DbProject p = CommunityMappingUtils.toDbProject(id, project); + dbProjectRepository.save(p); + return project; + } catch (final Throwable e) { + log.error(e); + throw new CommunityException(e); + } } public List addCommunityProjectList(final String id, final List projectList) throws CommunityException, ResourceNotFoundException { + try { + final List list = projectList.stream() + .map(p -> CommunityMappingUtils.toDbProject(id, p)) + .collect(Collectors.toList()); - final List list = projectList.stream() - .map(p -> CommunityMappingUtils.toDbProject(id, p)) - .collect(Collectors.toList()); + dbProjectRepository.saveAll(list); - dbProjectRepository.saveAll(list); - - return projectList; + return projectList; + } catch (final Throwable e) { + log.error(e); + throw new CommunityException(e); + } } public void removeCommunityProject(final String id, final String projectId) throws CommunityException, ResourceNotFoundException { - dbProjectRepository.deleteById(new DbProjectPK(id, projectId)); + try { + dbProjectRepository.deleteById(new DbProjectPK(id, projectId)); + } catch (final Throwable e) { + log.error(e); + throw new CommunityException(e); + } } public void removeCommunityProjectList(final String id, final List projectIdList) throws CommunityException, ResourceNotFoundException { - final List list = projectIdList.stream() - .map(projectId -> new DbProjectPK(id, projectId)) - .collect(Collectors.toList()); - dbProjectRepository.deleteAllById(list); + try { + final List list = projectIdList.stream() + .map(projectId -> new DbProjectPK(id, projectId)) + .collect(Collectors.toList()); + dbProjectRepository.deleteAllById(list); + } catch (final Throwable e) { + log.error(e); + throw new CommunityException(e); + } } public List getCommunityContentproviders(final String id) throws CommunityException, ResourceNotFoundException { - return dbDatasourceRepository.findByCommunity(id) - .stream() - .map(CommunityMappingUtils::toCommunityContentprovider) - .collect(Collectors.toList()); + try { + return dbDatasourceRepository.findByCommunity(id) + .stream() + .map(CommunityMappingUtils::toCommunityContentprovider) + .collect(Collectors.toList()); + } catch (final Throwable e) { + log.error(e); + throw new CommunityException(e); + } } public CommunityContentprovider addCommunityContentprovider(final String id, final CommunityContentprovider cp) throws CommunityException, ResourceNotFoundException { - final DbDatasource ds = CommunityMappingUtils.toDbDatasource(id, cp); - dbDatasourceRepository.save(ds); - return cp; + try { + final DbDatasource ds = CommunityMappingUtils.toDbDatasource(id, cp); + dbDatasourceRepository.save(ds); + return cp; + } catch (final Throwable e) { + log.error(e); + throw new CommunityException(e); + } } public List addCommunityContentProvidersList(final String id, final List contentprovidersList) throws CommunityException, ResourceNotFoundException { + try { + final List list = contentprovidersList.stream() + .map(cp -> CommunityMappingUtils.toDbDatasource(id, cp)) + .collect(Collectors.toList()); - final List list = contentprovidersList.stream() - .map(cp -> CommunityMappingUtils.toDbDatasource(id, cp)) - .collect(Collectors.toList()); + dbDatasourceRepository.saveAll(list); - dbDatasourceRepository.saveAll(list); - - return contentprovidersList; + return contentprovidersList; + } catch (final Throwable e) { + log.error(e); + throw new CommunityException(e); + } } public void removeCommunityContentProvider(final String id, final String contentproviderId) throws CommunityException, ResourceNotFoundException { - dbDatasourceRepository.deleteById(new DbDatasourcePK(id, contentproviderId)); + try { + dbDatasourceRepository.deleteById(new DbDatasourcePK(id, contentproviderId)); + } catch (final Throwable e) { + log.error(e); + throw new CommunityException(e); + } } public void removeCommunityContentProviderList(final String id, final List contentProviderIdList) throws CommunityException, ResourceNotFoundException { - final List list = contentProviderIdList.stream() - .map(dsId -> new DbDatasourcePK(id, dsId)) - .collect(Collectors.toList()); - dbDatasourceRepository.deleteAllById(list); + try { + final List list = contentProviderIdList.stream() + .map(dsId -> new DbDatasourcePK(id, dsId)) + .collect(Collectors.toList()); + dbDatasourceRepository.deleteAllById(list); + } catch (final Throwable e) { + log.error(e); + throw new CommunityException(e); + } } public void removeCommunityOrganization(final String id, final String organizationId) throws CommunityException, ResourceNotFoundException { - dbDatasourceRepository.deleteById(new DbDatasourcePK(id, organizationId)); + try { + dbDatasourceRepository.deleteById(new DbDatasourcePK(id, organizationId)); + } catch (final Throwable e) { + log.error(e); + throw new CommunityException(e); + } } public List getCommunityOrganizations(final String id) throws CommunityException, ResourceNotFoundException { - return dbSupportOrgRepository.findByCommunity(id) - .stream() - .map(CommunityMappingUtils::toCommunityOrganization) - .collect(Collectors.toList()); + try { + return dbSupportOrgRepository.findByCommunity(id) + .stream() + .map(CommunityMappingUtils::toCommunityOrganization) + .collect(Collectors.toList()); + } catch (final Throwable e) { + log.error(e); + throw new CommunityException(e); + } } public CommunityOrganization addCommunityOrganization(final String id, final CommunityOrganization organization) throws CommunityException, ResourceNotFoundException { - final DbSupportOrg o = CommunityMappingUtils.toDbSupportOrg(id, organization); - dbSupportOrgRepository.save(o); - return organization; + try { + final DbSupportOrg o = CommunityMappingUtils.toDbSupportOrg(id, organization); + dbSupportOrgRepository.save(o); + return organization; + } catch (final Throwable e) { + log.error(e); + throw new CommunityException(e); + } } public List addCommunityOrganizationList(final String id, final List orgList) throws CommunityException, ResourceNotFoundException { + try { + final List list = orgList.stream() + .map(o -> CommunityMappingUtils.toDbSupportOrg(id, o)) + .collect(Collectors.toList()); - final List list = orgList.stream() - .map(o -> CommunityMappingUtils.toDbSupportOrg(id, o)) - .collect(Collectors.toList()); + dbSupportOrgRepository.saveAll(list); - dbSupportOrgRepository.saveAll(list); - - return orgList; + return orgList; + } catch (final Throwable e) { + log.error(e); + throw new CommunityException(e); + } } public void removeSubCommunity(final String id, final String subCommunityId) throws CommunityException, ResourceNotFoundException { - dbSubCommunityRepository.deleteById(subCommunityId); + try { + dbSubCommunityRepository.deleteById(subCommunityId); + } catch (final Throwable e) { + log.error(e); + throw new CommunityException(e); + } } public List getSubCommunities(final String id) throws CommunityException, ResourceNotFoundException { - - return dbSubCommunityRepository.findByCommunity(id) - .stream() - .map(CommunityMappingUtils::toSubCommunity) - .collect(Collectors.toList()); + try { + return dbSubCommunityRepository.findByCommunity(id) + .stream() + .map(CommunityMappingUtils::toSubCommunity) + .collect(Collectors.toList()); + } catch (final Throwable e) { + log.error(e); + throw new CommunityException(e); + } } - public SubCommunity addSubCommunity(final SubCommunity sub) { - final DbSubCommunity sc = CommunityMappingUtils.toDbSubCommunity(sub); - dbSubCommunityRepository.save(sc); - return sub; + public SubCommunity addSubCommunity(final SubCommunity sub) throws CommunityException { + try { + final DbSubCommunity sc = CommunityMappingUtils.toDbSubCommunity(sub); + dbSubCommunityRepository.save(sc); + return sub; + } catch (final Throwable e) { + log.error(e); + throw new CommunityException(e); + } } - public List addSubCommunityList(final List subs) { - final List list = subs.stream() - .map(CommunityMappingUtils::toDbSubCommunity) - .collect(Collectors.toList()); + public List addSubCommunityList(final List subs) throws CommunityException { + try { + final List list = subs.stream() + .map(CommunityMappingUtils::toDbSubCommunity) + .collect(Collectors.toList()); - dbSubCommunityRepository.saveAll(list); + dbSubCommunityRepository.saveAll(list); - return subs; + return subs; + } catch (final Throwable e) { + log.error(e); + throw new CommunityException(e); + } } public CommunityDetails addCommunitySubjects(final String id, final String... subjects) throws CommunityException, ResourceNotFoundException { - return modifyElementToArrayField(id, c -> c.getSubjects(), (c, subs) -> c.setSubjects(subs), false, subjects); + try { + return modifyElementToArrayField(id, c -> c.getSubjects(), (c, subs) -> c.setSubjects(subs), false, subjects); + } catch (final Throwable e) { + log.error(e); + throw new CommunityException(e); + } } public CommunityDetails removeCommunitySubjects(final String id, final String... subjects) throws CommunityException, ResourceNotFoundException { - return modifyElementToArrayField(id, c -> c.getSubjects(), (c, subs) -> c.setSubjects(subs), true, subjects); + try { + return modifyElementToArrayField(id, c -> c.getSubjects(), (c, subs) -> c.setSubjects(subs), true, subjects); + } catch (final Throwable e) { + log.error(e); + throw new CommunityException(e); + } } public CommunityDetails addCommunityFOS(final String id, final String... foss) throws CommunityException, ResourceNotFoundException { - return modifyElementToArrayField(id, c -> c.getFos(), (c, fos) -> c.setFos(fos), false, foss); + try { + return modifyElementToArrayField(id, c -> c.getFos(), (c, fos) -> c.setFos(fos), false, foss); + } catch (final Throwable e) { + log.error(e); + throw new CommunityException(e); + } } public CommunityDetails removeCommunityFOS(final String id, final String... foss) throws CommunityException, ResourceNotFoundException { - return modifyElementToArrayField(id, c -> c.getFos(), (c, fos) -> c.setFos(fos), true, foss); + try { + return modifyElementToArrayField(id, c -> c.getFos(), (c, fos) -> c.setFos(fos), true, foss); + } catch (final Throwable e) { + log.error(e); + throw new CommunityException(e); + } } public CommunityDetails addCommunitySDG(final String id, final String... sdgs) throws CommunityException, ResourceNotFoundException { - return modifyElementToArrayField(id, c -> c.getSdg(), (c, sdg) -> c.setSdg(sdg), false, sdgs); + try { + return modifyElementToArrayField(id, c -> c.getSdg(), (c, sdg) -> c.setSdg(sdg), false, sdgs); + } catch (final Throwable e) { + log.error(e); + throw new CommunityException(e); + } } public CommunityDetails removeCommunitySDG(final String id, final String... sdgs) throws CommunityException, ResourceNotFoundException { - return modifyElementToArrayField(id, c -> c.getSdg(), (c, sdg) -> c.setSdg(sdg), true, sdgs); + try { + return modifyElementToArrayField(id, c -> c.getSdg(), (c, sdg) -> c.setSdg(sdg), true, sdgs); + } catch (final Throwable e) { + log.error(e); + throw new CommunityException(e); + } } public CommunityDetails addCommunityAdvancedConstraint(final String id, final SelectionCriteria advancedCosntraint) throws CommunityException, ResourceNotFoundException { + try { + final DbCommunity dbEntry = dbCommunityRepository.findById(id).orElseThrow(() -> new ResourceNotFoundException("Community not found: " + id)); + dbEntry.setAdvancedConstraints(advancedCosntraint); + dbCommunityRepository.save(dbEntry); + return getCommunity(id); - final DbCommunity dbEntry = dbCommunityRepository.findById(id).orElseThrow(() -> new ResourceNotFoundException("Community not found: " + id)); - dbEntry.setAdvancedConstraints(advancedCosntraint); - dbCommunityRepository.save(dbEntry); - return getCommunity(id); - + } catch (final Throwable e) { + log.error(e); + throw new CommunityException(e); + } } public CommunityDetails removeCommunityAdvancedConstraint(final String id) throws ResourceNotFoundException, CommunityException { - final DbCommunity dbEntry = dbCommunityRepository.findById(id).orElseThrow(() -> new ResourceNotFoundException("Community not found: " + id)); - dbEntry.setAdvancedConstraints(null); - dbCommunityRepository.save(dbEntry); - return getCommunity(id); + try { + final DbCommunity dbEntry = dbCommunityRepository.findById(id).orElseThrow(() -> new ResourceNotFoundException("Community not found: " + id)); + dbEntry.setAdvancedConstraints(null); + dbCommunityRepository.save(dbEntry); + return getCommunity(id); + } catch (final Throwable e) { + log.error(e); + throw new CommunityException(e); + } } public CommunityDetails removeCommunityZenodoCommunity(final String id, final String zenodoCommunity, final boolean isMain) @@ -269,10 +418,15 @@ public class CommunityService { public CommunityDetails addCommunityZenodoCommunity(final String id, final String zenodoCommunity, final boolean isMain) throws CommunityException, ResourceNotFoundException { - if (isMain) { - return updateElementToSimpleField(id, (c, val) -> c.setMainZenodoCommunity(val), zenodoCommunity); - } else { - return modifyElementToArrayField(id, c -> c.getOtherZenodoCommunities(), (c, arr) -> c.setOtherZenodoCommunities(arr), false, zenodoCommunity); + try { + if (isMain) { + return updateElementToSimpleField(id, (c, val) -> c.setMainZenodoCommunity(val), zenodoCommunity); + } else { + return modifyElementToArrayField(id, c -> c.getOtherZenodoCommunities(), (c, arr) -> c.setOtherZenodoCommunities(arr), false, zenodoCommunity); + } + } catch (final Throwable e) { + log.error(e); + throw new CommunityException(e); } } @@ -280,10 +434,15 @@ public class CommunityService { private CommunityDetails updateElementToSimpleField(final String id, final BiConsumer setter, final String value) throws ResourceNotFoundException, CommunityException { - final DbCommunity dbEntry = dbCommunityRepository.findById(id).orElseThrow(() -> new ResourceNotFoundException("Community not found: " + id)); - setter.accept(dbEntry, value); - dbCommunityRepository.save(dbEntry); - return getCommunity(id); + try { + final DbCommunity dbEntry = dbCommunityRepository.findById(id).orElseThrow(() -> new ResourceNotFoundException("Community not found: " + id)); + setter.accept(dbEntry, value); + dbCommunityRepository.save(dbEntry); + return getCommunity(id); + } catch (final Throwable e) { + log.error(e); + throw new CommunityException(e); + } } @Transactional @@ -315,40 +474,70 @@ public class CommunityService { return getCommunity(id); } - public List getOpenAIRECommunities(final String zenodoId) { - return dbCommunityRepository.findByZenodoId(zenodoId); + public List getOpenAIRECommunities(final String zenodoId) throws CommunityException { + try { + return dbCommunityRepository.findByZenodoId(zenodoId); + } catch (final Throwable e) { + log.error(e); + throw new CommunityException(e); + } } - public Map> getPropagationOrganizationCommunityMap() { - return dbOrganizationRepository.findAll() - .stream() - .collect(Collectors.groupingBy(DbOrganization::getOrgId, Collectors.mapping(DbOrganization::getCommunity, Collectors.toSet()))); + public Map> getPropagationOrganizationCommunityMap() throws CommunityException { + try { + return dbOrganizationRepository.findAll() + .stream() + .collect(Collectors.groupingBy(DbOrganization::getOrgId, Collectors.mapping(DbOrganization::getCommunity, Collectors.toSet()))); + } catch (final Throwable e) { + log.error(e); + throw new CommunityException(e); + } } - public Set getPropagationOrganizationsForCommunity(final String communityId) { - return dbOrganizationRepository.findByCommunity(communityId) - .stream() - .map(DbOrganization::getOrgId) - .collect(Collectors.toSet()); + public Set getPropagationOrganizationsForCommunity(final String communityId) throws CommunityException { + try { + return dbOrganizationRepository.findByCommunity(communityId) + .stream() + .map(DbOrganization::getOrgId) + .collect(Collectors.toSet()); + } catch (final Throwable e) { + log.error(e); + throw new CommunityException(e); + } } @Transactional - public Set addPropagationOrganizationForCommunity(final String communityId, final String organizationId) { - final DbOrganization o = new DbOrganization(communityId, organizationId); - dbOrganizationRepository.save(o); - return getPropagationOrganizationsForCommunity(communityId); + public Set addPropagationOrganizationForCommunity(final String communityId, final String organizationId) throws CommunityException { + try { + final DbOrganization o = new DbOrganization(communityId, organizationId); + dbOrganizationRepository.save(o); + return getPropagationOrganizationsForCommunity(communityId); + } catch (final Throwable e) { + log.error(e); + throw new CommunityException(e); + } } @Transactional - public Set removePropagationOrganizationForCommunity(final String communityId, final String organizationId) { - final DbOrganization o = new DbOrganization(communityId, organizationId); - dbOrganizationRepository.delete(o); - return getPropagationOrganizationsForCommunity(communityId); + public Set removePropagationOrganizationForCommunity(final String communityId, final String organizationId) throws CommunityException { + try { + final DbOrganization o = new DbOrganization(communityId, organizationId); + dbOrganizationRepository.delete(o); + return getPropagationOrganizationsForCommunity(communityId); + } catch (final Throwable e) { + log.error(e); + throw new CommunityException(e); + } } - public List listSubConcepts(final String conceptId, final boolean all) { - // TODO Auto-generated method stub - return null; + public List listSubConcepts(final String conceptId, final boolean all) throws CommunityException { + try { + // TODO Auto-generated method stub + return null; + } catch (final Throwable e) { + log.error(e); + throw new CommunityException(e); + } } } diff --git a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/repository/DbProjectRepository.java b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/repository/DbProjectRepository.java index 0c0e7214..f2747dad 100644 --- a/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/repository/DbProjectRepository.java +++ b/apps/dnet-exporter-api/src/main/java/eu/dnetlib/openaire/community/repository/DbProjectRepository.java @@ -2,7 +2,7 @@ package eu.dnetlib.openaire.community.repository; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.data.domain.Page; -import org.springframework.data.domain.PageRequest; +import org.springframework.data.domain.Pageable; import org.springframework.data.jpa.repository.JpaRepository; import eu.dnetlib.openaire.community.model.DbProject; @@ -11,6 +11,6 @@ import eu.dnetlib.openaire.community.model.DbProjectPK; @ConditionalOnProperty(value = "openaire.exporter.enable.community", havingValue = "true") public interface DbProjectRepository extends JpaRepository { - Page findByCommunity(String community, PageRequest page); + Page findByCommunity(String community, Pageable page); } diff --git a/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/exceptions/CommunityException.java b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/exceptions/CommunityException.java index d9dd0592..c8f416d6 100644 --- a/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/exceptions/CommunityException.java +++ b/libs/dnet-exporter-model/src/main/java/eu/dnetlib/openaire/exporter/exceptions/CommunityException.java @@ -1,7 +1,5 @@ package eu.dnetlib.openaire.exporter.exceptions; -import java.io.IOException; - public class CommunityException extends Exception { /** @@ -13,7 +11,7 @@ public class CommunityException extends Exception { super(message); } - public CommunityException(final IOException e) { + public CommunityException(final Throwable e) { super(e); } }