new_funders_api #17
|
@ -0,0 +1,22 @@
|
||||||
|
package eu.dnetlib.openaire.common;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
import org.springframework.data.domain.Page;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
import org.springframework.data.repository.NoRepositoryBean;
|
||||||
|
import org.springframework.data.repository.Repository;
|
||||||
|
|
||||||
|
@NoRepositoryBean
|
||||||
|
public interface ReadOnlyRepository<T, ID> extends Repository<T, ID> {
|
||||||
|
|
||||||
|
Optional<T> findById(ID id);
|
||||||
|
|
||||||
|
boolean existsById(ID id);
|
||||||
|
|
||||||
|
Page<T> findAll(Pageable pageable);
|
||||||
|
|
||||||
|
Iterable<T> findAll();
|
||||||
|
|
||||||
|
long count();
|
||||||
|
}
|
|
@ -1,91 +0,0 @@
|
||||||
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;
|
|
||||||
import org.dom4j.DocumentException;
|
|
||||||
import org.dom4j.io.SAXReader;
|
|
||||||
|
|
||||||
import static org.apache.commons.lang3.StringUtils.*;
|
|
||||||
|
|
||||||
public class ConversionUtils {
|
|
||||||
|
|
||||||
public static final String SEPARATOR = "::";
|
|
||||||
|
|
||||||
public static FunderDetails asFunderDetails(final FunderDbEntry fdb) {
|
|
||||||
final FunderDetails f = new FunderDetails();
|
|
||||||
|
|
||||||
f.setId(fdb.getId());
|
|
||||||
f.setName(fdb.getName());
|
|
||||||
f.setShortname(fdb.getShortname());
|
|
||||||
f.setJurisdiction(fdb.getJurisdiction());
|
|
||||||
f.setRegistrationDate(fdb.getRegistrationdate());
|
|
||||||
f.setLastUpdateDate(fdb.getLastupdatedate());
|
|
||||||
|
|
||||||
return f;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ExtendedFunderDetails asExtendedFunderDetails(final FunderDbEntry fdb) {
|
|
||||||
final ExtendedFunderDetails f = new ExtendedFunderDetails(asFunderDetails(fdb));
|
|
||||||
|
|
||||||
if (fdb.getFundingpaths() != null) {
|
|
||||||
f.setFundingStreams(
|
|
||||||
fdb.getFundingpaths().stream()
|
|
||||||
.map(ConversionUtils::asFundingStream)
|
|
||||||
.collect(Collectors.toList()));
|
|
||||||
}
|
|
||||||
|
|
||||||
return f;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static FundingStream asFundingStream(final FundingPathDbEntry pathDbEntry) {
|
|
||||||
final FundingStream f = new FundingStream();
|
|
||||||
|
|
||||||
try {
|
|
||||||
final Document xml = new SAXReader().read(new StringReader(pathDbEntry.getPath()));
|
|
||||||
|
|
||||||
for(int i=2;i>=0;i--) {
|
|
||||||
if (hasFundingLevel(i, xml)) {
|
|
||||||
f.setId(getId(i, xml));
|
|
||||||
f.setName(getName(i, xml));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isBlank(f.getId()) && isNoneBlank(xml.valueOf("//funder/id/text()"))) {
|
|
||||||
f.setId(xml.valueOf("//funder/shortname/text()"));
|
|
||||||
f.setName(xml.valueOf("//funder/name/text()"));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isBlank(f.getId())) {
|
|
||||||
throw new IllegalStateException("invalid funding path:\n" + xml.asXML());
|
|
||||||
}
|
|
||||||
|
|
||||||
return f;
|
|
||||||
|
|
||||||
} catch (DocumentException e) {
|
|
||||||
throw new IllegalStateException("unable to parse funding path:\n" + pathDbEntry.getPath());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static String getName(int level, final Document d) {
|
|
||||||
return d.valueOf(String.format("//funding_level_%s/description/text()", level));
|
|
||||||
}
|
|
||||||
|
|
||||||
private static String getId(int level, final Document d) {
|
|
||||||
return substringAfter(
|
|
||||||
d.valueOf(
|
|
||||||
String.format("//funding_level_%s/id/text()", level)
|
|
||||||
), SEPARATOR);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static boolean hasFundingLevel(int level, Document d) {
|
|
||||||
return isNotBlank(getId(level, d));
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -9,8 +9,7 @@ import org.springframework.data.domain.PageRequest;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import eu.dnetlib.openaire.exporter.exceptions.FundersApiException;
|
import eu.dnetlib.openaire.exporter.exceptions.FundersApiException;
|
||||||
import eu.dnetlib.openaire.exporter.model.funders.ExtendedFunderDetails;
|
import eu.dnetlib.openaire.funders.domain.db.FunderDbEntry;
|
||||||
import eu.dnetlib.openaire.exporter.model.funders.FunderDetails;
|
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@ConditionalOnProperty(value = "openaire.exporter.enable.funders", havingValue = "true")
|
@ConditionalOnProperty(value = "openaire.exporter.enable.funders", havingValue = "true")
|
||||||
|
@ -19,16 +18,14 @@ public class FunderDao {
|
||||||
@Autowired
|
@Autowired
|
||||||
private FunderRepository funderRepository;
|
private FunderRepository funderRepository;
|
||||||
|
|
||||||
public ExtendedFunderDetails getExtendedFunderDetails(final String funderId) throws FundersApiException {
|
public FunderDbEntry findFunder(final String funderId) throws FundersApiException {
|
||||||
return ConversionUtils
|
return funderRepository.findById(funderId).orElseThrow(() -> new FundersApiException("Funder not found. ID: " + funderId));
|
||||||
.asExtendedFunderDetails(funderRepository.findById(funderId).orElseThrow(() -> new FundersApiException("Funder not found. ID: " + funderId)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<FunderDetails> listFunderDetails(final int page, final int size) throws FundersApiException {
|
public List<FunderDbEntry> listFunders(final int page, final int size) throws FundersApiException {
|
||||||
return funderRepository.findAll(PageRequest.of(page, size))
|
return funderRepository.findAll(PageRequest.of(page, size))
|
||||||
.getContent()
|
.getContent()
|
||||||
.stream()
|
.stream()
|
||||||
.map(ConversionUtils::asFunderDetails)
|
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,7 +33,7 @@ public class FunderDao {
|
||||||
return funderRepository.findAll(PageRequest.of(page, size))
|
return funderRepository.findAll(PageRequest.of(page, size))
|
||||||
.getContent()
|
.getContent()
|
||||||
.stream()
|
.stream()
|
||||||
.map(f -> f.getId())
|
.map(FunderDbEntry::getId)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
package eu.dnetlib.openaire.funders;
|
package eu.dnetlib.openaire.funders;
|
||||||
|
|
||||||
import eu.dnetlib.openaire.funders.domain.db.FunderDbEntry;
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import eu.dnetlib.openaire.common.ReadOnlyRepository;
|
||||||
|
import eu.dnetlib.openaire.funders.domain.db.FunderDbEntry;
|
||||||
|
|
||||||
@Repository
|
@Repository
|
||||||
public interface FunderRepository extends JpaRepository<FunderDbEntry, String> {
|
public interface FunderRepository extends ReadOnlyRepository<FunderDbEntry, String> {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,8 +2,6 @@ package eu.dnetlib.openaire.funders;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
|
||||||
import org.apache.commons.logging.LogFactory;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
import org.springframework.web.bind.annotation.CrossOrigin;
|
||||||
|
@ -14,8 +12,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import eu.dnetlib.openaire.common.AbstractExporterController;
|
import eu.dnetlib.openaire.common.AbstractExporterController;
|
||||||
import eu.dnetlib.openaire.exporter.exceptions.FundersApiException;
|
import eu.dnetlib.openaire.exporter.exceptions.FundersApiException;
|
||||||
import eu.dnetlib.openaire.exporter.model.funders.ExtendedFunderDetails;
|
import eu.dnetlib.openaire.funders.domain.db.FunderDbEntry;
|
||||||
import eu.dnetlib.openaire.exporter.model.funders.FunderDetails;
|
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||||
import io.swagger.v3.oas.annotations.responses.ApiResponses;
|
import io.swagger.v3.oas.annotations.responses.ApiResponses;
|
||||||
|
@ -29,24 +26,22 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
@Tag(name = "OpenAIRE funders API", description = "the OpenAIRE funders API")
|
@Tag(name = "OpenAIRE funders API", description = "the OpenAIRE funders API")
|
||||||
public class FundersApiController extends AbstractExporterController {
|
public class FundersApiController extends AbstractExporterController {
|
||||||
|
|
||||||
private static final Log log = LogFactory.getLog(FundersApiController.class);
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private FunderDao fDao;
|
private FunderDao fDao;
|
||||||
|
|
||||||
@RequestMapping(value = "/funders", produces = {
|
@RequestMapping(value = "/funders", produces = {
|
||||||
"application/json"
|
"application/json"
|
||||||
}, method = RequestMethod.GET)
|
}, method = RequestMethod.GET)
|
||||||
@Operation(summary = "get basic information about funders", description = "basic information about funders: id, name, shortname, last update date, registration date")
|
@Operation(summary = "get basic information about funders", description = "basic information about funders: id, name, shortname, registration date")
|
||||||
@ApiResponses(value = {
|
@ApiResponses(value = {
|
||||||
@ApiResponse(responseCode = "200", description = "OK"),
|
@ApiResponse(responseCode = "200", description = "OK"),
|
||||||
@ApiResponse(responseCode = "500", description = "unexpected error")
|
@ApiResponse(responseCode = "500", description = "unexpected error")
|
||||||
})
|
})
|
||||||
public List<FunderDetails> getFunders(
|
public List<FunderDbEntry> getFunders(
|
||||||
@PathVariable final int page,
|
@PathVariable final int page,
|
||||||
@PathVariable final int size) throws FundersApiException {
|
@PathVariable final int size) throws FundersApiException {
|
||||||
|
|
||||||
return fDao.listFunderDetails(page, size);
|
return fDao.listFunders(page, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value = "/funder/{id}", produces = {
|
@RequestMapping(value = "/funder/{id}", produces = {
|
||||||
|
@ -57,10 +52,8 @@ public class FundersApiController extends AbstractExporterController {
|
||||||
@ApiResponse(responseCode = "200", description = "OK"),
|
@ApiResponse(responseCode = "200", description = "OK"),
|
||||||
@ApiResponse(responseCode = "500", description = "unexpected error")
|
@ApiResponse(responseCode = "500", description = "unexpected error")
|
||||||
})
|
})
|
||||||
public ExtendedFunderDetails getFunderDetails(
|
public FunderDbEntry getFunderDetails(@PathVariable final String id) throws FundersApiException {
|
||||||
@PathVariable final String id) throws FundersApiException {
|
return fDao.findFunder(id);
|
||||||
|
|
||||||
return fDao.getExtendedFunderDetails(id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value = "/funder/ids", produces = {
|
@RequestMapping(value = "/funder/ids", produces = {
|
||||||
|
@ -71,7 +64,7 @@ public class FundersApiController extends AbstractExporterController {
|
||||||
@ApiResponse(responseCode = "200", description = "OK"),
|
@ApiResponse(responseCode = "200", description = "OK"),
|
||||||
@ApiResponse(responseCode = "500", description = "unexpected error")
|
@ApiResponse(responseCode = "500", description = "unexpected error")
|
||||||
})
|
})
|
||||||
public List<String> getFunderIds(
|
public List<String> listFunderIds(
|
||||||
@PathVariable final int page,
|
@PathVariable final int page,
|
||||||
@PathVariable final int size) throws FundersApiException {
|
@PathVariable final int size) throws FundersApiException {
|
||||||
|
|
||||||
|
|
|
@ -1,38 +1,43 @@
|
||||||
package eu.dnetlib.openaire.funders.domain.db;
|
package eu.dnetlib.openaire.funders.domain.db;
|
||||||
|
|
||||||
import java.sql.Date;
|
import java.io.Serializable;
|
||||||
import java.util.Set;
|
import java.time.LocalDateTime;
|
||||||
import javax.persistence.*;
|
|
||||||
|
|
||||||
import eu.dnetlib.openaire.dsm.domain.db.IdentityDbEntry;
|
import javax.persistence.Column;
|
||||||
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.Id;
|
||||||
|
import javax.persistence.Table;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "funders")
|
@Table(name = "funders")
|
||||||
public class FunderDbEntry {
|
public class FunderDbEntry implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1290088460508203016L;
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
|
@Column(name = "id")
|
||||||
private String id;
|
private String id;
|
||||||
private String name;
|
|
||||||
private String shortname;
|
|
||||||
private String jurisdiction;
|
|
||||||
private String websiteurl;
|
|
||||||
private String policy;
|
|
||||||
private Date registrationdate;
|
|
||||||
private Date lastupdatedate;
|
|
||||||
|
|
||||||
@OneToMany(
|
@Column(name = "legalshortname")
|
||||||
cascade = { CascadeType.PERSIST, CascadeType.MERGE },
|
private String legalShortName;
|
||||||
fetch = FetchType.LAZY )
|
|
||||||
@JoinTable(
|
|
||||||
name = "funder_identity",
|
|
||||||
joinColumns = @JoinColumn(name = "funder"),
|
|
||||||
inverseJoinColumns = @JoinColumn(name = "pid"))
|
|
||||||
private Set<IdentityDbEntry> pids;
|
|
||||||
|
|
||||||
@OneToMany(mappedBy = "funderid", cascade = CascadeType.ALL, fetch = FetchType.LAZY)
|
@Column(name = "legalname")
|
||||||
private Set<FundingPathDbEntry> fundingpaths;
|
private String legalName;
|
||||||
|
|
||||||
public FunderDbEntry() {}
|
@Column(name = "websiteurl")
|
||||||
|
private String websiteUrl;
|
||||||
|
|
||||||
|
@Column(name = "logourl")
|
||||||
|
private String logoUrl;
|
||||||
|
|
||||||
|
@Column(name = "country")
|
||||||
|
private String country;
|
||||||
|
|
||||||
|
@Column(name = "registrationdate")
|
||||||
|
private LocalDateTime registrationDate;
|
||||||
|
|
||||||
|
@Column(name = "registered")
|
||||||
|
private boolean registered;
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return id;
|
return id;
|
||||||
|
@ -42,75 +47,60 @@ public class FunderDbEntry {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getLegalShortName() {
|
||||||
return name;
|
return legalShortName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setName(final String name) {
|
public void setLegalShortName(final String legalShortName) {
|
||||||
this.name = name;
|
this.legalShortName = legalShortName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getShortname() {
|
public String getLegalName() {
|
||||||
return shortname;
|
return legalName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setShortname(final String shortname) {
|
public void setLegalName(final String legalName) {
|
||||||
this.shortname = shortname;
|
this.legalName = legalName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getJurisdiction() {
|
public String getWebsiteUrl() {
|
||||||
return jurisdiction;
|
return websiteUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setJurisdiction(final String jurisdiction) {
|
public void setWebsiteUrl(final String websiteUrl) {
|
||||||
this.jurisdiction = jurisdiction;
|
this.websiteUrl = websiteUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getWebsiteurl() {
|
public String getLogoUrl() {
|
||||||
return websiteurl;
|
return logoUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setWebsiteurl(final String websiteurl) {
|
public void setLogoUrl(final String logoUrl) {
|
||||||
this.websiteurl = websiteurl;
|
this.logoUrl = logoUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPolicy() {
|
public String getCountry() {
|
||||||
return policy;
|
return country;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPolicy(final String policy) {
|
public void setCountry(final String country) {
|
||||||
this.policy = policy;
|
this.country = country;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getRegistrationdate() {
|
public LocalDateTime getRegistrationDate() {
|
||||||
return registrationdate;
|
return registrationDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRegistrationdate(final Date registrationdate) {
|
public void setRegistrationDate(final LocalDateTime registrationDate) {
|
||||||
this.registrationdate = registrationdate;
|
this.registrationDate = registrationDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getLastupdatedate() {
|
public boolean isRegistered() {
|
||||||
return lastupdatedate;
|
return registered;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLastupdatedate(final Date lastupdatedate) {
|
public void setRegistered(final boolean registered) {
|
||||||
this.lastupdatedate = lastupdatedate;
|
this.registered = registered;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<IdentityDbEntry> getPids() {
|
|
||||||
return pids;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPids(final Set<IdentityDbEntry> pids) {
|
|
||||||
this.pids = pids;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Set<FundingPathDbEntry> getFundingpaths() {
|
|
||||||
return fundingpaths;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFundingpaths(final Set<FundingPathDbEntry> fundingpaths) {
|
|
||||||
this.fundingpaths = fundingpaths;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,118 @@
|
||||||
|
package eu.dnetlib.openaire.funders.domain.db;
|
||||||
|
|
||||||
|
import java.sql.Date;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import javax.persistence.CascadeType;
|
||||||
|
import javax.persistence.FetchType;
|
||||||
|
import javax.persistence.Id;
|
||||||
|
import javax.persistence.JoinColumn;
|
||||||
|
import javax.persistence.JoinTable;
|
||||||
|
import javax.persistence.OneToMany;
|
||||||
|
|
||||||
|
import eu.dnetlib.openaire.dsm.domain.db.IdentityDbEntry;
|
||||||
|
|
||||||
|
// @Entity
|
||||||
|
// @Table(name = "funders")
|
||||||
|
@Deprecated
|
||||||
|
public class OldFunderDbEntry {
|
||||||
|
|
||||||
|
@Id
|
||||||
|
private String id;
|
||||||
|
private String name;
|
||||||
|
private String shortname;
|
||||||
|
private String jurisdiction;
|
||||||
|
private String websiteurl;
|
||||||
|
private String policy;
|
||||||
|
private Date registrationdate;
|
||||||
|
private Date lastupdatedate;
|
||||||
|
|
||||||
|
@OneToMany(cascade = { CascadeType.PERSIST, CascadeType.MERGE }, fetch = FetchType.LAZY)
|
||||||
|
@JoinTable(name = "funder_identity", joinColumns = @JoinColumn(name = "funder"), inverseJoinColumns = @JoinColumn(name = "pid"))
|
||||||
|
private Set<IdentityDbEntry> pids;
|
||||||
|
|
||||||
|
@OneToMany(mappedBy = "funderid", cascade = CascadeType.ALL, fetch = FetchType.LAZY)
|
||||||
|
private Set<OldFundingPathDbEntry> fundingpaths;
|
||||||
|
|
||||||
|
public OldFunderDbEntry() {}
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(final String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(final String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getShortname() {
|
||||||
|
return shortname;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setShortname(final String shortname) {
|
||||||
|
this.shortname = shortname;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getJurisdiction() {
|
||||||
|
return jurisdiction;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setJurisdiction(final String jurisdiction) {
|
||||||
|
this.jurisdiction = jurisdiction;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getWebsiteurl() {
|
||||||
|
return websiteurl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWebsiteurl(final String websiteurl) {
|
||||||
|
this.websiteurl = websiteurl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPolicy() {
|
||||||
|
return policy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPolicy(final String policy) {
|
||||||
|
this.policy = policy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getRegistrationdate() {
|
||||||
|
return registrationdate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRegistrationdate(final Date registrationdate) {
|
||||||
|
this.registrationdate = registrationdate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getLastupdatedate() {
|
||||||
|
return lastupdatedate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLastupdatedate(final Date lastupdatedate) {
|
||||||
|
this.lastupdatedate = lastupdatedate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Set<IdentityDbEntry> getPids() {
|
||||||
|
return pids;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPids(final Set<IdentityDbEntry> pids) {
|
||||||
|
this.pids = pids;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Set<OldFundingPathDbEntry> getFundingpaths() {
|
||||||
|
return fundingpaths;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFundingpaths(final Set<OldFundingPathDbEntry> fundingpaths) {
|
||||||
|
this.fundingpaths = fundingpaths;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,12 +1,15 @@
|
||||||
package eu.dnetlib.openaire.funders.domain.db;
|
package eu.dnetlib.openaire.funders.domain.db;
|
||||||
|
|
||||||
import javax.persistence.*;
|
import javax.persistence.Column;
|
||||||
|
import javax.persistence.Id;
|
||||||
|
import javax.persistence.Transient;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
|
|
||||||
@Entity
|
// @Entity
|
||||||
@Table(name = "fundingpaths")
|
// @Table(name = "fundingpaths")
|
||||||
public class FundingPathDbEntry {
|
@Deprecated
|
||||||
|
public class OldFundingPathDbEntry {
|
||||||
|
|
||||||
@JsonIgnore
|
@JsonIgnore
|
||||||
@Transient
|
@Transient
|
||||||
|
@ -28,7 +31,7 @@ public class FundingPathDbEntry {
|
||||||
|
|
||||||
private String funderid;
|
private String funderid;
|
||||||
|
|
||||||
public FundingPathDbEntry() {}
|
public OldFundingPathDbEntry() {}
|
||||||
|
|
||||||
public String getDnetresourceidentifier() {
|
public String getDnetresourceidentifier() {
|
||||||
return dnetresourceidentifier;
|
return dnetresourceidentifier;
|
|
@ -0,0 +1,17 @@
|
||||||
|
ALTER TABLE dsm_organizations ADD COLUMN registered_funder boolean;
|
||||||
|
|
||||||
|
CREATE VIEW funders_view AS SELECT
|
||||||
|
o.id AS id,
|
||||||
|
o.legalshortname AS legalshortname,
|
||||||
|
o.legalname AS legalname,
|
||||||
|
o.websiteurl AS websiteurl,
|
||||||
|
o.logourl AS logourl,
|
||||||
|
o.country AS country,
|
||||||
|
o.dateofcollection AS registrationdate,
|
||||||
|
o.registered_funder AS registered
|
||||||
|
FROM
|
||||||
|
dsm_organizations o
|
||||||
|
JOIN dsm_service_organization so ON (o.id = so.organization)
|
||||||
|
JOIN dsm_services s ON (so.service = s.id)
|
||||||
|
JOIN projects p ON (p.collectedfrom = s.id)
|
||||||
|
GROUP BY o.id;
|
|
@ -4,6 +4,7 @@ import java.util.List;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
@JsonAutoDetect
|
@JsonAutoDetect
|
||||||
public class ExtendedFunderDetails extends FunderDetails {
|
public class ExtendedFunderDetails extends FunderDetails {
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package eu.dnetlib.openaire.exporter.model.funders;
|
package eu.dnetlib.openaire.exporter.model.funders;
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public class FundingStream {
|
public class FundingStream {
|
||||||
|
|
||||||
private String id;
|
private String id;
|
||||||
|
|
Loading…
Reference in New Issue