use of sql dates
This commit is contained in:
parent
6965742b77
commit
84bdffc3f4
|
@ -1,7 +1,7 @@
|
||||||
package eu.dnetlib.openaire.funders.domain.db;
|
package eu.dnetlib.openaire.funders.domain.db;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.time.LocalDate;
|
import java.sql.Date;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -16,12 +16,14 @@ import org.hibernate.annotations.TypeDef;
|
||||||
import org.hibernate.annotations.TypeDefs;
|
import org.hibernate.annotations.TypeDefs;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
|
import com.vladmihalcea.hibernate.type.array.DateArrayType;
|
||||||
import com.vladmihalcea.hibernate.type.array.StringArrayType;
|
import com.vladmihalcea.hibernate.type.array.StringArrayType;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "funders_view")
|
@Table(name = "funders_view")
|
||||||
@TypeDefs({
|
@TypeDefs({
|
||||||
@TypeDef(name = "string-array", typeClass = StringArrayType.class),
|
@TypeDef(name = "string-array", typeClass = StringArrayType.class),
|
||||||
|
@TypeDef(name = "date-array", typeClass = DateArrayType.class),
|
||||||
})
|
})
|
||||||
public class FunderDbEntry implements Serializable {
|
public class FunderDbEntry implements Serializable {
|
||||||
|
|
||||||
|
@ -47,7 +49,7 @@ public class FunderDbEntry implements Serializable {
|
||||||
private String country;
|
private String country;
|
||||||
|
|
||||||
@Column(name = "registrationdate")
|
@Column(name = "registrationdate")
|
||||||
private LocalDate registrationDate;
|
private Date registrationDate;
|
||||||
|
|
||||||
@Column(name = "registered")
|
@Column(name = "registered")
|
||||||
private Boolean registered;
|
private Boolean registered;
|
||||||
|
@ -68,9 +70,9 @@ public class FunderDbEntry implements Serializable {
|
||||||
@Transient
|
@Transient
|
||||||
private List<FunderDatasource> datasources = new ArrayList<FunderDatasource>();
|
private List<FunderDatasource> datasources = new ArrayList<FunderDatasource>();
|
||||||
|
|
||||||
@Type(type = "string-array")
|
@Type(type = "date-array")
|
||||||
@Column(name = "aggregationdates", columnDefinition = "text[]")
|
@Column(name = "aggregationdates", columnDefinition = "date[]")
|
||||||
private String[] aggregationDates;
|
private Date[] aggregationDates;
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return id;
|
return id;
|
||||||
|
@ -120,11 +122,11 @@ public class FunderDbEntry implements Serializable {
|
||||||
this.country = country;
|
this.country = country;
|
||||||
}
|
}
|
||||||
|
|
||||||
public LocalDate getRegistrationDate() {
|
public Date getRegistrationDate() {
|
||||||
return registrationDate;
|
return registrationDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRegistrationDate(final LocalDate registrationDate) {
|
public void setRegistrationDate(final Date registrationDate) {
|
||||||
this.registrationDate = registrationDate;
|
this.registrationDate = registrationDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -168,11 +170,11 @@ public class FunderDbEntry implements Serializable {
|
||||||
this.datasources = datasources;
|
this.datasources = datasources;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[] getAggregationDates() {
|
public Date[] getAggregationDates() {
|
||||||
return aggregationDates;
|
return aggregationDates;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAggregationDates(final String[] aggregationDates) {
|
public void setAggregationDates(final Date[] aggregationDates) {
|
||||||
this.aggregationDates = aggregationDates;
|
this.aggregationDates = aggregationDates;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ CREATE OR REPLACE VIEW funders_view AS SELECT
|
||||||
o.dateofcollection AS registrationdate,
|
o.dateofcollection AS registrationdate,
|
||||||
o.registered_funder AS registered,
|
o.registered_funder AS registered,
|
||||||
array_remove(array_agg(DISTINCT s.id||' @=@ '||s.officialname||' @=@ '||s.eosc_datasource_type), NULL) AS datasources,
|
array_remove(array_agg(DISTINCT s.id||' @=@ '||s.officialname||' @=@ '||s.eosc_datasource_type), NULL) AS datasources,
|
||||||
array_remove(array_agg(DISTINCT sf.last_aggregation_date::text ORDER BY sf.last_aggregation_date::text DESC), NULL) AS aggregationdates,
|
array_remove(array_agg(DISTINCT sf.last_aggregation_date ORDER BY sf.last_aggregation_date DESC), NULL) AS aggregationdates,
|
||||||
array_remove(array_agg(DISTINCT pids.issuertype||' @=@ '||pids.pid), NULL) AS pids
|
array_remove(array_agg(DISTINCT pids.issuertype||' @=@ '||pids.pid), NULL) AS pids
|
||||||
FROM
|
FROM
|
||||||
dsm_organizations o
|
dsm_organizations o
|
||||||
|
|
Loading…
Reference in New Issue