new dsm api for first collection date and registration date
parent
13e9821940
commit
362ab547cb
@ -0,0 +1,129 @@
|
||||
package eu.dnetlib.openaire.dsm.domain;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class SimpleDatasourceInfo {
|
||||
|
||||
private String id;
|
||||
private String officialName;
|
||||
private String englishName;
|
||||
private Map<String, String> organizations = new LinkedHashMap<>();
|
||||
@Deprecated
|
||||
private String typology;
|
||||
private String eoscType;
|
||||
private String eoscDatasourceType;
|
||||
private String registeredBy;
|
||||
private String registrationDate;
|
||||
private String compatibility;
|
||||
private String firstCollectionDate;
|
||||
private String lastCollectionDate;
|
||||
private long lastCollectionTotal;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(final String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getOfficialName() {
|
||||
return officialName;
|
||||
}
|
||||
|
||||
public void setOfficialName(final String officialName) {
|
||||
this.officialName = officialName;
|
||||
}
|
||||
|
||||
public String getEnglishName() {
|
||||
return englishName;
|
||||
}
|
||||
|
||||
public void setEnglishName(final String englishName) {
|
||||
this.englishName = englishName;
|
||||
}
|
||||
|
||||
public Map<String, String> getOrganizations() {
|
||||
return organizations;
|
||||
}
|
||||
|
||||
public void setOrganizations(final Map<String, String> organizations) {
|
||||
this.organizations = organizations;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public String getTypology() {
|
||||
return typology;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void setTypology(final String typology) {
|
||||
this.typology = typology;
|
||||
}
|
||||
|
||||
public String getEoscType() {
|
||||
return eoscType;
|
||||
}
|
||||
|
||||
public void setEoscType(final String eoscType) {
|
||||
this.eoscType = eoscType;
|
||||
}
|
||||
|
||||
public String getEoscDatasourceType() {
|
||||
return eoscDatasourceType;
|
||||
}
|
||||
|
||||
public void setEoscDatasourceType(final String eoscDatasourceType) {
|
||||
this.eoscDatasourceType = eoscDatasourceType;
|
||||
}
|
||||
|
||||
public String getRegisteredBy() {
|
||||
return registeredBy;
|
||||
}
|
||||
|
||||
public void setRegisteredBy(final String registeredBy) {
|
||||
this.registeredBy = registeredBy;
|
||||
}
|
||||
|
||||
public String getRegistrationDate() {
|
||||
return registrationDate;
|
||||
}
|
||||
|
||||
public void setRegistrationDate(final String registrationDate) {
|
||||
this.registrationDate = registrationDate;
|
||||
}
|
||||
|
||||
public String getCompatibility() {
|
||||
return compatibility;
|
||||
}
|
||||
|
||||
public void setCompatibility(final String compatibility) {
|
||||
this.compatibility = compatibility;
|
||||
}
|
||||
|
||||
public String getFirstCollectionDate() {
|
||||
return firstCollectionDate;
|
||||
}
|
||||
|
||||
public void setFirstCollectionDate(final String firstCollectionDate) {
|
||||
this.firstCollectionDate = firstCollectionDate;
|
||||
}
|
||||
|
||||
public String getLastCollectionDate() {
|
||||
return lastCollectionDate;
|
||||
}
|
||||
|
||||
public void setLastCollectionDate(final String lastCollectionDate) {
|
||||
this.lastCollectionDate = lastCollectionDate;
|
||||
}
|
||||
|
||||
public long getLastCollectionTotal() {
|
||||
return lastCollectionTotal;
|
||||
}
|
||||
|
||||
public void setLastCollectionTotal(final long lastCollectionTotal) {
|
||||
this.lastCollectionTotal = lastCollectionTotal;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
select count(*) as count
|
||||
from (
|
||||
select d.id
|
||||
from dsm_services d left outer join dsm_api a on (d.id = a.service)
|
||||
group by d.id
|
||||
having min(a.first_collection_date) >= cast(? as date)
|
||||
) as t
|
@ -0,0 +1,8 @@
|
||||
select count(*) as count
|
||||
from (
|
||||
select d.id
|
||||
from dsm_services d left outer join dsm_api a on (d.id = a.service)
|
||||
where d._typology_to_remove_ like ?
|
||||
group by d.id
|
||||
having min(a.first_collection_date) >= cast(? as date)
|
||||
) as t
|
@ -0,0 +1,29 @@
|
||||
SELECT
|
||||
s.id AS "id",
|
||||
s.officialname AS "officialName",
|
||||
s.englishname AS "englishName",
|
||||
s._typology_to_remove_ AS "typology",
|
||||
s.eosc_type AS "eoscType",
|
||||
s.eosc_datasource_type AS "eoscDatasourceType",
|
||||
s.registeredby AS "registeredBy",
|
||||
s.registrationdate::text AS "registrationDate",
|
||||
MIN(a.first_collection_date) AS "firstCollectionDate",
|
||||
MAX(a.last_collection_date) AS "lastCollectionDate",
|
||||
(array_remove(array_agg(a.last_collection_total order by a.last_collection_date desc), NULL))[1] AS "lastCollectionTotal",
|
||||
array_remove(array_agg(DISTINCT coalesce(a.compatibility_override, a.compatibility)), NULL) AS "compatibilities",
|
||||
array_remove(array_agg(DISTINCT o.id||' @@@ '||o.legalname), NULL) AS "organizations"
|
||||
FROM
|
||||
dsm_services s
|
||||
left outer join dsm_api a on (s.id = a.service)
|
||||
left outer join dsm_service_organization dso on (s.id = dso.service)
|
||||
left outer join dsm_organizations o on (o.id = dso.organization)
|
||||
GROUP BY
|
||||
s.id,
|
||||
s.officialname,
|
||||
s.englishname,
|
||||
s._typology_to_remove_,
|
||||
s.eosc_type,
|
||||
s.eosc_datasource_type,
|
||||
s.registeredby,
|
||||
s.registrationdate
|
||||
HAVING MIN(a.first_collection_date) >= cast(? as date)
|
@ -0,0 +1,31 @@
|
||||
SELECT
|
||||
s.id AS "id",
|
||||
s.officialname AS "officialName",
|
||||
s.englishname AS "englishName",
|
||||
s._typology_to_remove_ AS "typology",
|
||||
s.eosc_type AS "eoscType",
|
||||
s.eosc_datasource_type AS "eoscDatasourceType",
|
||||
s.registeredby AS "registeredBy",
|
||||
s.registrationdate::text AS "registrationDate",
|
||||
MIN(a.first_collection_date) AS "firstCollectionDate",
|
||||
MAX(a.last_collection_date) AS "lastCollectionDate",
|
||||
(array_remove(array_agg(a.last_collection_total order by a.last_collection_date desc), NULL))[1] AS "lastCollectionTotal",
|
||||
array_remove(array_agg(DISTINCT coalesce(a.compatibility_override, a.compatibility)), NULL) AS "compatibilities",
|
||||
array_remove(array_agg(DISTINCT o.id||' @@@ '||o.legalname), NULL) AS "organizations"
|
||||
FROM
|
||||
dsm_services s
|
||||
left outer join dsm_api a on (s.id = a.service)
|
||||
left outer join dsm_service_organization dso on (s.id = dso.service)
|
||||
left outer join dsm_organizations o on (o.id = dso.organization)
|
||||
WHERE
|
||||
s._typology_to_remove_ like ?
|
||||
GROUP BY
|
||||
s.id,
|
||||
s.officialname,
|
||||
s.englishname,
|
||||
s._typology_to_remove_,
|
||||
s.eosc_type,
|
||||
s.eosc_datasource_type,
|
||||
s.registeredby,
|
||||
s.registrationdate
|
||||
HAVING MIN(a.first_collection_date) >= cast(? as date)
|
@ -0,0 +1,38 @@
|
||||
SELECT
|
||||
s.id AS "id",
|
||||
s.officialname AS "officialName",
|
||||
s.englishname AS "englishName",
|
||||
s._typology_to_remove_ AS "typology",
|
||||
s.eosc_type AS "eoscType",
|
||||
s.eosc_datasource_type AS "eoscDatasourceType",
|
||||
s.registeredby AS "registeredBy",
|
||||
s.registrationdate::text AS "registrationDate",
|
||||
MIN(a.first_collection_date) AS "firstCollectionDate",
|
||||
MAX(a.last_collection_date) AS "lastCollectionDate",
|
||||
(array_remove(array_agg(a.last_collection_total order by a.last_collection_date desc), NULL))[1] AS "lastCollectionTotal",
|
||||
array_remove(array_agg(DISTINCT coalesce(a.compatibility_override, a.compatibility)), NULL) AS "compatibilities",
|
||||
array_remove(array_agg(DISTINCT o.id||' @@@ '||o.legalname), NULL) AS "organizations"
|
||||
FROM
|
||||
dsm_services s
|
||||
left outer join dsm_api a on (s.id = a.service)
|
||||
left outer join dsm_service_organization dso on (s.id = dso.service)
|
||||
left outer join dsm_organizations o on (o.id = dso.organization)
|
||||
WHERE
|
||||
s.registrationdate is not null
|
||||
and s.registeredby is not null
|
||||
and s.managed = true
|
||||
GROUP BY
|
||||
s.id,
|
||||
s.officialname,
|
||||
s.englishname,
|
||||
s._typology_to_remove_,
|
||||
s.eosc_type,
|
||||
s.eosc_datasource_type,
|
||||
s.registeredby,
|
||||
s.registrationdate
|
||||
HAVING
|
||||
s.registrationdate < max(a.last_collection_date)
|
||||
and sum(a.last_collection_total) > 0
|
||||
ORDER BY s.registrationdate desc
|
||||
LIMIT ?
|
||||
|
Loading…
Reference in New Issue