Revision 49983
Added by Michele Artini over 6 years ago
modules/dnet-openaire-datasource-manager/trunk/src/main/java/eu/dnetlib/enabling/datasources/DatasourceFunctions.java | ||
---|---|---|
14 | 14 |
|
15 | 15 |
import eu.dnetlib.enabling.datasources.common.Api; |
16 | 16 |
import eu.dnetlib.enabling.datasources.common.ApiParam; |
17 |
import eu.dnetlib.enabling.datasources.common.ApiParamKey;
|
|
17 |
import eu.dnetlib.enabling.datasources.common.ApiParamImpl;
|
|
18 | 18 |
import eu.dnetlib.enabling.datasources.common.Datasource; |
19 |
import eu.dnetlib.enabling.datasources.common.Identity; |
|
20 |
import eu.dnetlib.enabling.datasources.common.Organization; |
|
19 | 21 |
import eu.dnetlib.enabling.datasources.common.SearchApisEntry; |
20 | 22 |
|
21 | 23 |
public class DatasourceFunctions { |
22 | 24 |
|
23 | 25 |
private static final Log log = LogFactory.getLog(DatasourceFunctions.class); |
24 | 26 |
|
25 |
public static Datasource<?, ?> mapToDatasource(final Map<String, Object> map) {
|
|
26 |
final Datasource<?, ?> ds = new Datasource<>();
|
|
27 |
public static Datasource<Organization<?>, Identity> mapToDatasource(final Map<String, Object> map) {
|
|
28 |
final Datasource<Organization<?>, Identity> ds = new Datasource<>();
|
|
27 | 29 |
ds.setId(castObject(map.get("id"), String.class)); |
28 | 30 |
ds.setOfficialname(castObject(map.get("officialname"), String.class)); |
29 | 31 |
ds.setEnglishname(castObject(map.get("englishname"), String.class)); |
... | ... | |
89 | 91 |
return a; |
90 | 92 |
} |
91 | 93 |
|
92 |
public static Api<?> mapToApi(final Map<String, Object> map) {
|
|
93 |
final Api<?> a = new Api<>();
|
|
94 |
public static Api<ApiParam> mapToApi(final Map<String, Object> map) {
|
|
95 |
final Api<ApiParam> a = new Api<>();
|
|
94 | 96 |
a.setId(castObject(map.get("id"), String.class)); |
95 | 97 |
a.setProtocol(castObject(map.get("protocol"), String.class)); |
96 | 98 |
a.setDatasource(castObject(map.get("datasource"), String.class)); |
... | ... | |
115 | 117 |
a.setApiParams(Arrays.stream((Object[]) castObject(map.get("params"), Array.class).getArray()) |
116 | 118 |
.map(Object::toString) |
117 | 119 |
.map(s -> { |
118 |
final ApiParam<ApiParamKey<?>> p = new ApiParam<>();
|
|
120 |
final ApiParam p = new ApiParamImpl();
|
|
119 | 121 |
p.setParam(StringUtils.substringBefore(s, "=")); |
120 | 122 |
p.setValue(StringUtils.substringAfter(s, "=")); |
121 | 123 |
return p; |
... | ... | |
129 | 131 |
return a; |
130 | 132 |
} |
131 | 133 |
|
132 |
public static String dsToProfile(final Datasource<?, ?> ds, final String profId) {
|
|
134 |
public static String dsToProfile(final Datasource<Organization<?>, Identity> ds, final String profId) {
|
|
133 | 135 |
// TODO Auto-generated method stub |
134 | 136 |
return null; |
135 | 137 |
} |
136 | 138 |
|
137 |
public static Map<String, Object> dsToMap(final Datasource<?, ?> ds) {
|
|
139 |
public static Map<String, Object> dsToMap(final Datasource<Organization<?>, Identity> ds) {
|
|
138 | 140 |
// TODO Auto-generated method stub |
139 | 141 |
return null; |
140 | 142 |
} |
141 | 143 |
|
144 |
public static Map<String, Object> orgToMap(final Organization<?> org) { |
|
145 |
// TODO Auto-generated method stub |
|
146 |
return null; |
|
147 |
} |
|
148 |
|
|
142 | 149 |
public static Map<String, Object> apiToMap(final Api<?> api) { |
143 | 150 |
final Map<String, Object> map = new HashMap<>(); |
144 | 151 |
map.put("apiId", api.getId()); |
modules/dnet-openaire-datasource-manager/trunk/src/main/java/eu/dnetlib/enabling/datasources/LocalOpenaireDatasourceManager.java | ||
---|---|---|
20 | 20 |
|
21 | 21 |
import eu.dnetlib.enabling.datasources.DatasourceManagerClients.AfterSqlUpdate; |
22 | 22 |
import eu.dnetlib.enabling.datasources.common.Api; |
23 |
import eu.dnetlib.enabling.datasources.common.ApiParam; |
|
23 | 24 |
import eu.dnetlib.enabling.datasources.common.BrowsableField; |
24 | 25 |
import eu.dnetlib.enabling.datasources.common.BrowseTerm; |
25 | 26 |
import eu.dnetlib.enabling.datasources.common.BrowseTermImpl; |
26 | 27 |
import eu.dnetlib.enabling.datasources.common.Datasource; |
27 | 28 |
import eu.dnetlib.enabling.datasources.common.DatasourceManagerException; |
29 |
import eu.dnetlib.enabling.datasources.common.Identity; |
|
28 | 30 |
import eu.dnetlib.enabling.datasources.common.LocalDatasourceManager; |
31 |
import eu.dnetlib.enabling.datasources.common.Organization; |
|
29 | 32 |
import eu.dnetlib.enabling.datasources.common.SearchApisEntry; |
30 | 33 |
|
31 |
public class LocalOpenaireDatasourceManager implements LocalDatasourceManager<Datasource<?, ?>, Api<?>> {
|
|
34 |
public class LocalOpenaireDatasourceManager implements LocalDatasourceManager<Datasource<Organization<?>, Identity>, Api<ApiParam>> {
|
|
32 | 35 |
|
33 | 36 |
private DatasourceManagerClients datasourceManagerClients; |
34 | 37 |
|
... | ... | |
38 | 41 |
private static final Resource searchApis = new ClassPathResource(QUERY_BASEDIR + "searchApisNormal.sql"); |
39 | 42 |
private static final Resource searchApisUsingField = new ClassPathResource(QUERY_BASEDIR + "searchApisUsingField.sql"); |
40 | 43 |
private static final Resource addDs = new ClassPathResource(QUERY_BASEDIR + "addDatasource.sql"); |
44 |
private static final Resource addOrg = new ClassPathResource(QUERY_BASEDIR + "addOrganization.sql"); |
|
41 | 45 |
private static final Resource deleteDs = new ClassPathResource(QUERY_BASEDIR + "deleteDatasource.sql"); |
42 | 46 |
private static final Resource setActive = new ClassPathResource(QUERY_BASEDIR + "setActive.sql"); |
43 | 47 |
private static final Resource setManaged = new ClassPathResource(QUERY_BASEDIR + "setManaged.sql"); |
... | ... | |
76 | 80 |
} |
77 | 81 |
|
78 | 82 |
@Override |
79 |
public void saveDs(final Datasource<?, ?> ds) throws DatasourceManagerException {
|
|
83 |
public void saveDs(final Datasource<Organization<?>, Identity> ds) throws DatasourceManagerException {
|
|
80 | 84 |
if (StringUtils.isBlank(ds.getAggregator())) { |
81 | 85 |
ds.setAggregator("OPENAIRE"); |
82 | 86 |
} |
83 | 87 |
|
84 |
final Map<String, Object> params = DatasourceFunctions.dsToMap(ds);
|
|
88 |
final Map<String, Object> dsParams = DatasourceFunctions.dsToMap(ds);
|
|
85 | 89 |
|
86 |
datasourceManagerClients.updateSQL(ds.getId(), addDs, AfterSqlUpdate.UPDATE_DS_PROFILE, params);
|
|
90 |
datasourceManagerClients.updateSQL(ds.getId(), addDs, AfterSqlUpdate.NONE, dsParams);
|
|
87 | 91 |
|
88 |
if (ds.getOrganizations() != null && !ds.getOrganizations().isEmpty()) { |
|
89 |
// TODO |
|
92 |
if (ds.getOrganizations() != null) { |
|
93 |
for (final Organization<?> org : ds.getOrganizations()) { |
|
94 |
final Map<String, Object> orgParams = DatasourceFunctions.orgToMap(org); |
|
95 |
datasourceManagerClients.updateSQL(ds.getId(), addOrg, AfterSqlUpdate.NONE, orgParams); |
|
96 |
|
|
97 |
} |
|
90 | 98 |
} |
91 | 99 |
|
100 |
datasourceManagerClients.regenerateProfile(ds.getId()); |
|
92 | 101 |
} |
93 | 102 |
|
94 | 103 |
@Override |
... | ... | |
97 | 106 |
} |
98 | 107 |
|
99 | 108 |
@Override |
100 |
public Datasource<?, ?> getDs(final String dsId) throws DatasourceManagerException {
|
|
109 |
public Datasource<Organization<?>, Identity> getDs(final String dsId) throws DatasourceManagerException {
|
|
101 | 110 |
return datasourceManagerClients.getDatasourceById(dsId); |
102 | 111 |
} |
103 | 112 |
|
104 | 113 |
@Override |
105 |
public List<? extends Api<?>> getApis(final String dsId) throws DatasourceManagerException {
|
|
114 |
public List<Api<ApiParam>> getApis(final String dsId) throws DatasourceManagerException {
|
|
106 | 115 |
|
107 | 116 |
return datasourceManagerClients.searchSQL(listApisByDsId, ImmutableMap.of("dsId", dsId)) |
108 | 117 |
.stream() |
... | ... | |
231 | 240 |
} |
232 | 241 |
|
233 | 242 |
@Override |
234 |
public void addApi(final Api<?> api) throws DatasourceManagerException {
|
|
243 |
public void addApi(final Api<ApiParam> api) throws DatasourceManagerException {
|
|
235 | 244 |
|
236 | 245 |
datasourceManagerClients.updateSQL(api.getDatasource(), insertApi, AfterSqlUpdate.NONE, DatasourceFunctions.apiToMap(api)); |
237 | 246 |
|
modules/dnet-openaire-datasource-manager/trunk/src/main/java/eu/dnetlib/enabling/datasources/DatasourceManagerClients.java | ||
---|---|---|
22 | 22 |
|
23 | 23 |
import eu.dnetlib.enabling.datasources.common.Datasource; |
24 | 24 |
import eu.dnetlib.enabling.datasources.common.DatasourceManagerException; |
25 |
import eu.dnetlib.enabling.datasources.common.Identity; |
|
26 |
import eu.dnetlib.enabling.datasources.common.Organization; |
|
25 | 27 |
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpDocumentNotFoundException; |
26 | 28 |
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpException; |
27 | 29 |
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService; |
... | ... | |
86 | 88 |
|
87 | 89 |
public boolean regenerateProfile(final String dsId) throws DatasourceManagerException { |
88 | 90 |
|
89 |
final Datasource<?, ?> ds = getDatasourceById(dsId);
|
|
91 |
final Datasource<Organization<?>, Identity> ds = getDatasourceById(dsId);
|
|
90 | 92 |
|
91 | 93 |
try { |
92 | 94 |
|
... | ... | |
132 | 134 |
} |
133 | 135 |
} |
134 | 136 |
|
135 |
public void updateSQL(final String dsId, final String sql, AfterSqlUpdate op, Map<String, Object> sqlparams)
|
|
137 |
public void updateSQL(final String dsId, final String sql, final AfterSqlUpdate op, final Map<String, Object> sqlparams)
|
|
136 | 138 |
throws DatasourceManagerException { |
137 | 139 |
log.debug("Executing query SQL: " + sql); |
138 | 140 |
|
... | ... | |
151 | 153 |
|
152 | 154 |
} |
153 | 155 |
|
154 |
public void updateSQL(final String dsId, final Resource sqlResource, AfterSqlUpdate op, Map<String, Object> sqlparams)
|
|
156 |
public void updateSQL(final String dsId, final Resource sqlResource, final AfterSqlUpdate op, final Map<String, Object> sqlparams)
|
|
155 | 157 |
throws DatasourceManagerException { |
156 | 158 |
try { |
157 | 159 |
updateSQL(dsId, IOUtils.toString(sqlResource.getInputStream()), op, sqlparams); |
... | ... | |
161 | 163 |
} |
162 | 164 |
} |
163 | 165 |
|
164 |
public Datasource<?, ?> getDatasourceById(final String id) throws DatasourceManagerException {
|
|
165 |
List<Map<String, Object>> list = searchSQL(dsQuery, ImmutableMap.of("dsId", id)); |
|
166 |
public Datasource<Organization<?>, Identity> getDatasourceById(final String id) throws DatasourceManagerException {
|
|
167 |
final List<Map<String, Object>> list = searchSQL(dsQuery, ImmutableMap.of("dsId", id));
|
|
166 | 168 |
|
167 | 169 |
if (list.size() != 1) { throw new DatasourceManagerException("Invalid number of ds with id: " + id); } |
168 | 170 |
|
... | ... | |
205 | 207 |
} |
206 | 208 |
|
207 | 209 |
@Required |
208 |
public void setJdbcTemplate(NamedParameterJdbcTemplate jdbcTemplate) { |
|
210 |
public void setJdbcTemplate(final NamedParameterJdbcTemplate jdbcTemplate) {
|
|
209 | 211 |
this.jdbcTemplate = jdbcTemplate; |
210 | 212 |
} |
211 | 213 |
|
modules/dnet-openaire-datasource-manager/trunk/src/main/resources/eu/dnetlib/enabling/datasources/queries/getDatasources.sql | ||
---|---|---|
1 |
-- TODO |
|
2 |
|
|
3 |
SELECT |
|
4 |
ds.id, |
|
5 |
ds.officialname, |
|
6 |
ds.englishname, |
|
7 |
ds.websiteurl, |
|
8 |
ds.logourl, |
|
9 |
ds.contactemail, |
|
10 |
ds.latitude, |
|
11 |
ds.longitude, |
|
12 |
ds.timezone, |
|
13 |
ds.namespaceprefix, |
|
14 |
ds.od_numberofitems, |
|
15 |
ds.od_numberofitemsdate, |
|
16 |
ds.od_policies, |
|
17 |
ds.od_languages, |
|
18 |
ds.od_contenttypes, |
|
19 |
ds.collectedfrom, |
|
20 |
ds.inferred, |
|
21 |
ds.deletedbyinference, |
|
22 |
ds.trust, |
|
23 |
ds.inferenceprovenance, |
|
24 |
ds.dateofvalidation, |
|
25 |
ds.registeredby, |
|
26 |
ds.optional1, |
|
27 |
ds.optional2, |
|
28 |
ds.datasourceclass, |
|
29 |
ds.provenanceactionclass, |
|
30 |
ds.dateofcollection, |
|
31 |
ds.typology, |
|
32 |
ds.activationid, |
|
33 |
ds.mergehomonyms, |
|
34 |
ds.description, |
|
35 |
ds.releasestartdate, |
|
36 |
ds.releaseenddate, |
|
37 |
ds.missionstatementurl, |
|
38 |
ds.dataprovider, |
|
39 |
ds.serviceprovider, |
|
40 |
ds.databaseaccesstype, |
|
41 |
ds.datauploadtype, |
|
42 |
ds.databaseaccessrestriction, |
|
43 |
ds.datauploadrestriction, |
|
44 |
ds.versioning, |
|
45 |
ds.citationguidelineurl, |
|
46 |
ds.qualitymanagementkind, |
|
47 |
ds.pidsystems, |
|
48 |
ds.certificates, |
|
49 |
ds.aggregator, |
|
50 |
ds.issn, |
|
51 |
ds.eissn, |
|
52 |
ds.lissn, |
|
53 |
(array_agg(o.legalname))[1] as organization, |
|
54 |
(array_agg(ccl.code))[1] as countrycode, |
|
55 |
(array_agg(ccl.name))[1] as countryname, |
|
56 |
array_agg(distinct ag.accessinfopackage) as accessinfopackage, |
|
57 |
to_char(now(), 'YYYY-MM-DDThh24:mi:ssZ') AS now |
|
58 |
|
|
59 |
FROM datasources ds |
|
60 |
LEFT OUTER JOIN datasource_organization dso ON ds.id = dso.datasource |
|
61 |
LEFT OUTER JOIN organizations o ON dso.organization = o.id |
|
62 |
LEFT OUTER JOIN class ccl ON ccl.code = o.countryclass |
|
63 |
LEFT OUTER JOIN ( |
|
64 |
SELECT api.datasource, api.contentdescriptionclass, api.compatibilityclass, |
|
65 |
COALESCE(api.id, '')||'<==1==>'||COALESCE(api.typologyclass, '')||'<==2==>'||COALESCE(api.compatibilityclass, '')||'<==3==>'||COALESCE(api.contentdescriptionclass,'')||'<==4==>'||COALESCE(api.protocolclass,'')||'<==5==>'||COALESCE(api.active,false)||'<==6==>'||COALESCE(api.removable,false)||'<==7==>'||array_to_string(array_agg(distinct COALESCE(ac.accessparam, true)||'###'||COALESCE(ac.param,'')||'###'||COALESCE(ac.value,'')||'###'), '@@@') AS accessinfopackage |
|
66 |
FROM api |
|
67 |
LEFT OUTER JOIN ( |
|
68 |
SELECT api, param, accessparam, CASE WHEN edited IS NULL THEN original ELSE edited END as value FROM apicollections |
|
69 |
) AS ac ON (ac.api = api.id) |
|
70 |
GROUP BY |
|
71 |
api.id, |
|
72 |
api.datasource, |
|
73 |
api.contentdescriptionclass, |
|
74 |
api.typologyclass, |
|
75 |
api.compatibilityclass, |
|
76 |
api.protocolclass, |
|
77 |
api.active, |
|
78 |
api.removable |
|
79 |
) AS ag on (ag.datasource = ds.id) |
|
80 |
|
|
81 |
WHERE ds.id = :dsId |
|
82 |
|
|
83 |
GROUP BY |
|
84 |
ds.id, |
|
85 |
ds.officialname, |
|
86 |
ds.englishname, |
|
87 |
ds.websiteurl, |
|
88 |
ds.logourl, |
|
89 |
ds.contactemail, |
|
90 |
ds.latitude, |
|
91 |
ds.longitude, |
|
92 |
ds.timezone, |
|
93 |
ds.namespaceprefix, |
|
94 |
ds.od_numberofitems, |
|
95 |
ds.od_numberofitemsdate, |
|
96 |
ds.od_policies, |
|
97 |
ds.od_languages, |
|
98 |
ds.od_contenttypes, |
|
99 |
ds.collectedfrom, |
|
100 |
ds.inferred, |
|
101 |
ds.deletedbyinference, |
|
102 |
ds.trust, |
|
103 |
ds.inferenceprovenance, |
|
104 |
ds.dateofvalidation, |
|
105 |
ds.registeredby, |
|
106 |
ds.optional1, |
|
107 |
ds.optional2, |
|
108 |
ds.datasourceclass, |
|
109 |
ds.provenanceactionclass, |
|
110 |
ds.dateofcollection, |
|
111 |
ds.typology, |
|
112 |
ds.activationid, |
|
113 |
ds.mergehomonyms, |
|
114 |
ds.description, |
|
115 |
ds.releasestartdate, |
|
116 |
ds.releaseenddate, |
|
117 |
ds.missionstatementurl, |
|
118 |
ds.dataprovider, |
|
119 |
ds.serviceprovider, |
|
120 |
ds.databaseaccesstype, |
|
121 |
ds.datauploadtype, |
|
122 |
ds.databaseaccessrestriction, |
|
123 |
ds.datauploadrestriction, |
|
124 |
ds.versioning, |
|
125 |
ds.citationguidelineurl, |
|
126 |
ds.qualitymanagementkind, |
|
127 |
ds.pidsystems, |
|
128 |
ds.certificates, |
|
129 |
ds.aggregator, |
|
130 |
ds.issn, |
|
131 |
ds.eissn, |
|
132 |
ds.lissn |
modules/dnet-openaire-datasource-manager/trunk/src/main/resources/eu/dnetlib/enabling/datasources/queries/addDatasource.sql | ||
---|---|---|
1 |
-- TODO |
|
2 |
|
|
3 |
BEGIN; |
|
4 |
|
|
5 |
INSERT INTO datasources ( |
|
6 |
_dnet_resource_identifier_, |
|
1 |
INSERT INTO dsm_datasources( |
|
7 | 2 |
id, |
8 |
officialName,
|
|
9 |
englishName,
|
|
10 |
websiteUrl,
|
|
11 |
logoUrl,
|
|
12 |
contactEmail,
|
|
3 |
officialname,
|
|
4 |
englishname,
|
|
5 |
websiteurl,
|
|
6 |
logourl,
|
|
7 |
contactemail,
|
|
13 | 8 |
latitude, |
14 | 9 |
longitude, |
15 | 10 |
timezone, |
16 |
namespacePrefix, |
|
17 |
od_NumberOfItems, |
|
18 |
od_NumberOfItemsDate, |
|
19 |
od_Policies, |
|
20 |
od_Languages, |
|
21 |
od_ContentTypes, |
|
22 |
collectedFrom, |
|
23 |
inferred, |
|
24 |
deletedByInference, |
|
25 |
trust, |
|
26 |
inferenceProvenance, |
|
27 |
dateOfValidation, |
|
28 |
registeredby, |
|
29 |
datasourceClass, |
|
30 |
provenanceActionClass, |
|
31 |
dateOfCollection, |
|
11 |
namespaceprefix, |
|
12 |
languages,--array |
|
13 |
od_contenttypes, |
|
14 |
collectedfrom, |
|
15 |
dateofvalidation, |
|
32 | 16 |
typology, |
33 |
activationId, |
|
34 |
mergehomonyms, |
|
17 |
provenanceaction, |
|
18 |
platform, |
|
19 |
activationid, |
|
35 | 20 |
description, |
36 |
releaseStartDate,
|
|
37 |
releaseEndDate,
|
|
38 |
missionStatementUrl,
|
|
39 |
dataProvider,
|
|
40 |
serviceProvider,
|
|
41 |
databaseAccessType,
|
|
42 |
dataUploadType,
|
|
43 |
databaseAccessRestriction,
|
|
44 |
dataUploadRestriction,
|
|
21 |
releasestartdate,
|
|
22 |
releaseenddate,
|
|
23 |
missionstatementurl,
|
|
24 |
dataprovider,
|
|
25 |
serviceprovider,
|
|
26 |
databaseaccesstype,
|
|
27 |
datauploadtype,
|
|
28 |
databaseaccessrestriction,
|
|
29 |
datauploadrestriction,
|
|
45 | 30 |
versioning, |
46 |
citationGuidelineUrl,
|
|
47 |
qualityManagementKind,
|
|
48 |
pidSystems,
|
|
31 |
citationguidelineurl,
|
|
32 |
qualitymanagementkind,
|
|
33 |
pidsystems,
|
|
49 | 34 |
certificates, |
50 | 35 |
aggregator, |
51 | 36 |
issn, |
52 | 37 |
eissn, |
53 |
lissn |
|
38 |
lissn, |
|
39 |
registeredby, |
|
40 |
subjects,--array |
|
41 |
managed |
|
54 | 42 |
) VALUES ( |
55 |
$id$, |
|
56 |
$id$, |
|
57 |
$officialName$, |
|
58 |
$englishName$, |
|
59 |
$websiteUrl$, |
|
60 |
$logoUrl$, |
|
61 |
$contactEmail$, |
|
62 |
$latitude$, |
|
63 |
$longitude$, |
|
64 |
$timezone$, |
|
65 |
$namespacePrefix$, |
|
66 |
$odNumberOfItems$, |
|
67 |
$odNumberOfItemsDate$, |
|
68 |
$odPolicies$, |
|
69 |
$odLanguages$, |
|
70 |
$odContentTypes$, |
|
71 |
$collectedFrom$, |
|
72 |
$inferred$, |
|
73 |
$deletedByInference$, |
|
74 |
$trust$, |
|
75 |
$inferenceProvenance$, |
|
76 |
$dateOfValidation$, |
|
77 |
$registeredBy$, |
|
78 |
$datasourceClass$, |
|
79 |
$provenanceActionClass$, |
|
80 |
$dateOfCollection$, |
|
81 |
$typology$, |
|
82 |
$activationId$, |
|
83 |
$mergehomonyms$, |
|
84 |
$description$, |
|
85 |
$releaseStartDate$, |
|
86 |
$releaseEndDate$, |
|
87 |
$missionStatementUrl$, |
|
88 |
$dataProvider$, |
|
89 |
$serviceProvider$, |
|
90 |
$databaseAccessType$, |
|
91 |
$dataUploadType$, |
|
92 |
$databaseAccessRestriction$, |
|
93 |
$dataUploadRestriction$, |
|
94 |
$versioning$, |
|
95 |
$citationGuidelineUrl$, |
|
96 |
$qualityManagementKind$, |
|
97 |
$pidSystems$, |
|
98 |
$certificates$, |
|
99 |
$aggregator$, |
|
100 |
$issn$, |
|
101 |
$eissn$, |
|
102 |
$lissn$ |
|
103 |
); |
|
104 |
|
|
105 |
$if(hasOrganization)$ |
|
106 |
INSERT INTO organizations ( |
|
107 |
_dnet_resource_identifier_, |
|
108 |
id, |
|
109 |
legalname, |
|
110 |
countryclass |
|
111 |
) VALUES ( |
|
112 |
$id$||'::'||$organization$, |
|
113 |
$id$||'::'||$organization$, |
|
114 |
$organization$, |
|
115 |
$countryCode$ |
|
116 |
); |
|
117 |
|
|
118 |
INSERT INTO datasource_organization ( |
|
119 |
_dnet_resource_identifier_, |
|
120 |
datasource, |
|
121 |
organization |
|
122 |
) VALUES ( |
|
123 |
$id$||'@@'||$id$||'::'||$organization$, |
|
124 |
$id$, |
|
125 |
$id$||'::'||$organization$ |
|
126 |
); |
|
127 |
$endif$ |
|
128 |
|
|
129 |
|
|
130 |
|
|
131 |
$interfaces:{ifc| |
|
132 |
INSERT INTO api ( |
|
133 |
_dnet_resource_identifier_, |
|
134 |
id, |
|
135 |
datasource, |
|
136 |
protocolclass, |
|
137 |
contentdescriptionclass, |
|
138 |
removable, |
|
139 |
typologyclass, |
|
140 |
compatibilityclass |
|
141 |
) VALUES ( |
|
142 |
$ifc.id$, |
|
143 |
$ifc.id$, |
|
144 |
$id$, |
|
145 |
$ifc.accessProtocol$, |
|
146 |
$ifc.contentDescription$, |
|
147 |
true, |
|
148 |
$ifc.typology$, |
|
149 |
$ifc.compliance$ |
|
150 |
); |
|
151 |
|
|
152 |
$ifc.accessParams.keys:{p| |
|
153 |
INSERT INTO apicollections ( |
|
154 |
_dnet_resource_identifier_, |
|
155 |
param, |
|
156 |
original, |
|
157 |
api, |
|
158 |
accessparam |
|
159 |
) VALUES ( |
|
160 |
$ifc.id$||'@@'||$p$, |
|
161 |
$p$, |
|
162 |
$ifc.accessParams.(p)$, |
|
163 |
$ifc.id$, |
|
164 |
true |
|
165 |
); |
|
166 |
}$ |
|
167 |
|
|
168 |
$ifc.extraFields.keys:{p| |
|
169 |
INSERT INTO apicollections ( |
|
170 |
_dnet_resource_identifier_, |
|
171 |
param, |
|
172 |
original, |
|
173 |
api, |
|
174 |
accessparam |
|
175 |
) VALUES ( |
|
176 |
$ifc.id$||'@@'||$p$, |
|
177 |
$p$, |
|
178 |
$ifc.extraFields.(p)$, |
|
179 |
$ifc.id$, |
|
180 |
false |
|
181 |
); |
|
182 |
}$ |
|
183 |
}$ |
|
184 |
|
|
185 |
COMMIT; |
|
43 |
:id, |
|
44 |
:officialname, |
|
45 |
:englishname, |
|
46 |
:websiteurl, |
|
47 |
:logourl, |
|
48 |
:contactemail, |
|
49 |
:latitude, |
|
50 |
:longitude, |
|
51 |
:timezone, |
|
52 |
:namespaceprefix, |
|
53 |
:languages,--array |
|
54 |
:od_contenttypes, |
|
55 |
:collectedfrom, |
|
56 |
:dateofvalidation, |
|
57 |
:typology, |
|
58 |
:provenanceaction, |
|
59 |
:platform, |
|
60 |
:activationid, |
|
61 |
:description, |
|
62 |
:releasestartdate, |
|
63 |
:releaseenddate, |
|
64 |
:missionstatementurl, |
|
65 |
:dataprovider, |
|
66 |
:serviceprovider, |
|
67 |
:databaseaccesstype, |
|
68 |
:datauploadtype, |
|
69 |
:databaseaccessrestriction, |
|
70 |
:datauploadrestriction, |
|
71 |
:versioning, |
|
72 |
:citationguidelineurl, |
|
73 |
:qualitymanagementkind, |
|
74 |
:pidsystems, |
|
75 |
:certificates, |
|
76 |
:aggregator, |
|
77 |
:issn, |
|
78 |
:eissn, |
|
79 |
:lissn, |
|
80 |
:registeredby, |
|
81 |
:subjects,--array |
|
82 |
:managed |
|
83 |
) |
modules/dnet-openaire-datasource-manager/trunk/src/main/resources/eu/dnetlib/enabling/datasources/queries/addOrganization.sql | ||
---|---|---|
1 |
--TODO Add org and relation to ds |
Also available in: Unified diff