new_funders_api #17
|
@ -29,7 +29,7 @@ public class FundersApiController extends AbstractExporterController {
|
|||
@Autowired
|
||||
private FunderDao fDao;
|
||||
|
||||
@RequestMapping(value = "/funders", produces = {
|
||||
@RequestMapping(value = "/funders/{page}/{size}", produces = {
|
||||
"application/json"
|
||||
}, method = RequestMethod.GET)
|
||||
@Operation(summary = "get basic information about funders", description = "basic information about funders: id, name, shortname, registration date")
|
||||
|
@ -56,7 +56,7 @@ public class FundersApiController extends AbstractExporterController {
|
|||
return fDao.findFunder(id);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/funder/ids", produces = {
|
||||
@RequestMapping(value = "/funders/{page}/{size}/ids", produces = {
|
||||
"application/json"
|
||||
}, method = RequestMethod.GET)
|
||||
@Operation(summary = "get the list of funder ids", description = "get the list of funder ids")
|
||||
|
|
|
@ -1,15 +1,30 @@
|
|||
package eu.dnetlib.openaire.funders.domain.db;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Transient;
|
||||
|
||||
import org.hibernate.annotations.Type;
|
||||
import org.hibernate.annotations.TypeDef;
|
||||
import org.hibernate.annotations.TypeDefs;
|
||||
|
||||
import com.vladmihalcea.hibernate.type.array.StringArrayType;
|
||||
import com.vladmihalcea.hibernate.type.json.JsonBinaryType;
|
||||
import com.vladmihalcea.hibernate.type.json.JsonStringType;
|
||||
|
||||
@Entity
|
||||
@Table(name = "funders")
|
||||
@Table(name = "funders_view")
|
||||
@TypeDefs({
|
||||
@TypeDef(name = "string-array", typeClass = StringArrayType.class),
|
||||
@TypeDef(name = "json", typeClass = JsonStringType.class),
|
||||
@TypeDef(name = "jsonb", typeClass = JsonBinaryType.class)
|
||||
})
|
||||
public class FunderDbEntry implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1290088460508203016L;
|
||||
|
@ -34,10 +49,17 @@ public class FunderDbEntry implements Serializable {
|
|||
private String country;
|
||||
|
||||
@Column(name = "registrationdate")
|
||||
private LocalDateTime registrationDate;
|
||||
private LocalDate registrationDate;
|
||||
|
||||
@Column(name = "registered")
|
||||
private boolean registered;
|
||||
private Boolean registered;
|
||||
|
||||
@Type(type = "json")
|
||||
@Column(name = "pids", columnDefinition = "jsonb")
|
||||
private List<FunderPid> pids;
|
||||
|
||||
@Transient
|
||||
private List<LocalDate> aggregationDates;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
|
@ -87,20 +109,35 @@ public class FunderDbEntry implements Serializable {
|
|||
this.country = country;
|
||||
}
|
||||
|
||||
public LocalDateTime getRegistrationDate() {
|
||||
public LocalDate getRegistrationDate() {
|
||||
return registrationDate;
|
||||
}
|
||||
|
||||
public void setRegistrationDate(final LocalDateTime registrationDate) {
|
||||
public void setRegistrationDate(final LocalDate registrationDate) {
|
||||
this.registrationDate = registrationDate;
|
||||
}
|
||||
|
||||
public boolean isRegistered() {
|
||||
public Boolean getRegistered() {
|
||||
return registered;
|
||||
}
|
||||
|
||||
public void setRegistered(final boolean registered) {
|
||||
public void setRegistered(final Boolean registered) {
|
||||
this.registered = registered;
|
||||
}
|
||||
|
||||
public List<LocalDate> getAggregationDates() {
|
||||
return aggregationDates;
|
||||
}
|
||||
|
||||
public void setAggregationDates(final List<LocalDate> aggregationDates) {
|
||||
this.aggregationDates = aggregationDates;
|
||||
}
|
||||
|
||||
public List<FunderPid> getPids() {
|
||||
return pids;
|
||||
}
|
||||
|
||||
public void setPids(final List<FunderPid> pids) {
|
||||
this.pids = pids;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
package eu.dnetlib.openaire.funders.domain.db;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class FunderPid implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 2145493560459874509L;
|
||||
|
||||
private String type;
|
||||
|
||||
private String value;
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(final String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(final String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
}
|
|
@ -27,7 +27,7 @@ openaire.exporter.enable.dsm = true
|
|||
openaire.exporter.enable.community = true
|
||||
openaire.exporter.enable.community.import = false
|
||||
openaire.exporter.enable.context = true
|
||||
openaire.exporter.enable.funders = false
|
||||
openaire.exporter.enable.funders = true
|
||||
openaire.exporter.enable.project = true
|
||||
openaire.exporter.enable.info = true
|
||||
|
||||
|
|
|
@ -8,10 +8,13 @@ CREATE VIEW funders_view AS SELECT
|
|||
o.logourl AS logourl,
|
||||
o.country AS country,
|
||||
o.dateofcollection AS registrationdate,
|
||||
o.registered_funder AS registered
|
||||
o.registered_funder AS registered,
|
||||
CASE WHEN count(pids.pid) = 0 THEN '[]'::jsonb ELSE jsonb_agg(jsonb_build_object('type', pids.issuertype,'value', pids.pid)) END AS pids
|
||||
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;
|
||||
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)
|
||||
LEFT OUTER JOIN dsm_organizationpids opids ON (o.id = opids.organization)
|
||||
LEFT OUTER JOIN dsm_identities pids ON (opids.pid = pids.pid)
|
||||
GROUP BY o.id;
|
||||
|
|
Loading…
Reference in New Issue