Revision 49990
Added by Michele Artini over 6 years ago
modules/dnet-openaire-datasource-manager/trunk/src/main/java/eu/dnetlib/enabling/datasources/DatasourceFunctions.java | ||
---|---|---|
141 | 141 |
return null; |
142 | 142 |
} |
143 | 143 |
|
144 |
public static Map<String, Object> orgToMap(final Organization<?> org) { |
|
145 |
// TODO Auto-generated method stub |
|
146 |
return null; |
|
144 |
public static Map<String, Object> orgToMap(final String dsId, final Organization<?> org) { |
|
145 |
final Map<String, Object> map = new HashMap<>(); |
|
146 |
map.put("dsId", dsId); |
|
147 |
map.put("orgId", org.getId()); |
|
148 |
map.put("legalname", org.getLegalname()); |
|
149 |
map.put("legalshortname", org.getLegalshortname()); |
|
150 |
map.put("websiteurl", org.getWebsiteurl()); |
|
151 |
map.put("logourl", org.getLogourl()); |
|
152 |
map.put("country", org.getCountry()); |
|
153 |
return map; |
|
147 | 154 |
} |
148 | 155 |
|
149 | 156 |
public static Map<String, Object> apiToMap(final Api<?> api) { |
modules/dnet-openaire-datasource-manager/trunk/src/main/java/eu/dnetlib/enabling/datasources/LocalOpenaireDatasourceManager.java | ||
---|---|---|
91 | 91 |
|
92 | 92 |
if (ds.getOrganizations() != null) { |
93 | 93 |
for (final Organization<?> org : ds.getOrganizations()) { |
94 |
final Map<String, Object> orgParams = DatasourceFunctions.orgToMap(org); |
|
94 |
final Map<String, Object> orgParams = DatasourceFunctions.orgToMap(ds.getId(), org);
|
|
95 | 95 |
datasourceManagerClients.updateSQL(ds.getId(), addOrg, AfterSqlUpdate.NONE, orgParams); |
96 |
|
|
97 | 96 |
} |
98 | 97 |
} |
99 | 98 |
|
modules/dnet-openaire-datasource-manager/trunk/src/main/resources/eu/dnetlib/enabling/datasources/queries/addOrganization.sql | ||
---|---|---|
1 |
--TODO Add org and relation to ds |
|
1 |
BEGIN; |
|
2 |
|
|
3 |
INSERT INTO dsm_organizations( |
|
4 |
id, |
|
5 |
legalshortname, |
|
6 |
legalname, |
|
7 |
websiteurl, |
|
8 |
logourl, |
|
9 |
country |
|
10 |
) VALUES ( |
|
11 |
:orgId, |
|
12 |
:legalshortname, |
|
13 |
:legalname, |
|
14 |
:websiteurl, |
|
15 |
:logourl, |
|
16 |
:country |
|
17 |
); |
|
18 |
|
|
19 |
INSERT INTO dsm_datasource_organization( |
|
20 |
datasource, |
|
21 |
organization |
|
22 |
) VALUES ( |
|
23 |
:dsId, |
|
24 |
:orgId |
|
25 |
); |
|
26 |
|
|
27 |
COMMIT; |
Also available in: Unified diff