1
|
package eu.dnetlib.enabling.datasources;
|
2
|
|
3
|
import java.io.StringReader;
|
4
|
import java.util.*;
|
5
|
import java.util.Map.Entry;
|
6
|
import java.util.stream.Collectors;
|
7
|
|
8
|
import com.google.common.collect.Iterables;
|
9
|
import com.google.common.collect.Lists;
|
10
|
import com.google.common.collect.Maps;
|
11
|
import eu.dnetlib.enabling.datasources.rmi.*;
|
12
|
import eu.dnetlib.enabling.tools.AbstractBaseService;
|
13
|
import org.apache.commons.lang.StringEscapeUtils;
|
14
|
import org.apache.commons.lang.StringUtils;
|
15
|
import org.apache.commons.lang.math.NumberUtils;
|
16
|
import org.apache.commons.logging.Log;
|
17
|
import org.apache.commons.logging.LogFactory;
|
18
|
import org.dom4j.Document;
|
19
|
import org.dom4j.Node;
|
20
|
import org.dom4j.io.SAXReader;
|
21
|
import org.springframework.beans.factory.annotation.Required;
|
22
|
|
23
|
import static eu.dnetlib.enabling.datasources.DatasourceFunctions.asMapOfSqlValues;
|
24
|
import static eu.dnetlib.enabling.datasources.DatasourceFunctions.asSqlValue;
|
25
|
|
26
|
|
27
|
public class DatasourceManagerServiceImpl extends AbstractBaseService implements DatasourceManagerService {
|
28
|
|
29
|
private DatasourceManagerClients datasourceManagerClients;
|
30
|
|
31
|
private List<DbBrowsableField> browsableFields;
|
32
|
|
33
|
private static final Log log = LogFactory.getLog(DatasourceManagerServiceImpl.class);
|
34
|
|
35
|
@Override
|
36
|
public boolean addDatasource(final DatasourceDesc ds) throws DatasourceManagerServiceException {
|
37
|
if (StringUtils.isBlank(ds.getAggregator())) {
|
38
|
ds.setAggregator("OPENAIRE");
|
39
|
}
|
40
|
|
41
|
final Map<String, Object> params = asMapOfSqlValues(ds);
|
42
|
|
43
|
if ((ds.getOrganization() != null) && !ds.getOrganization().trim().isEmpty()) {
|
44
|
params.put("hasOrganization", 1);
|
45
|
}
|
46
|
return datasourceManagerClients.updateSQL(ds.getId(), "addDatasource.sql.st", params, false, true);
|
47
|
}
|
48
|
|
49
|
@Override
|
50
|
public boolean deleteDatasource(final String dsId) throws DatasourceManagerServiceException {
|
51
|
final Map<String, Object> params = Maps.newHashMap();
|
52
|
|
53
|
|
54
|
|
55
|
params.put("dsId", asSqlValue(dsId));
|
56
|
|
57
|
return datasourceManagerClients.updateSQL(dsId, "deleteDatasource.sql.st", params, true, true);
|
58
|
}
|
59
|
|
60
|
@Override
|
61
|
public DatasourceDesc getDatasource(final String dsId) throws DatasourceManagerServiceException {
|
62
|
final List<DatasourceDesc> list = datasourceManagerClients.getDatasourcesByCondition("ds.id = " + asSqlValue(dsId));
|
63
|
if (list.size() != 1) { throw new DatasourceManagerServiceException("Datasource not found, id=" + dsId); }
|
64
|
|
65
|
return list.get(0);
|
66
|
}
|
67
|
|
68
|
@Override
|
69
|
public List<DatasourceDesc> listAllDatasources() throws DatasourceManagerServiceException {
|
70
|
return datasourceManagerClients.getDatasourcesByCondition(null);
|
71
|
}
|
72
|
|
73
|
@Override
|
74
|
public List<DatasourceDesc> listDatasourcesUsingFilter(final String compliance,
|
75
|
final String contentDescription,
|
76
|
final String iisProcessingWorkflow,
|
77
|
final String collectedFrom) throws DatasourceManagerServiceException {
|
78
|
|
79
|
String cond = "";
|
80
|
|
81
|
if ((compliance != null) && !compliance.isEmpty()) {
|
82
|
if (!cond.isEmpty()) {
|
83
|
cond += " and ";
|
84
|
}
|
85
|
cond += "ag.compatibilityclass=" + asSqlValue(compliance);
|
86
|
}
|
87
|
|
88
|
if ((contentDescription != null) && !contentDescription.isEmpty()) {
|
89
|
if (!cond.isEmpty()) {
|
90
|
cond += " and ";
|
91
|
}
|
92
|
cond += "ag.contentdescriptionclass=" + asSqlValue(contentDescription);
|
93
|
}
|
94
|
|
95
|
if ((iisProcessingWorkflow != null) && !iisProcessingWorkflow.isEmpty()) {
|
96
|
if (!cond.isEmpty()) {
|
97
|
cond += " and ";
|
98
|
}
|
99
|
cond += "ag.accessinfopackage LIKE '%###" + DatasourceParams.iis_processing_workflow + "###" + iisProcessingWorkflow + "###%'";
|
100
|
}
|
101
|
|
102
|
if ((collectedFrom != null) && !collectedFrom.isEmpty()) {
|
103
|
if (!cond.isEmpty()) {
|
104
|
cond += " and ";
|
105
|
}
|
106
|
cond += "ds.collectedfrom=" + asSqlValue(collectedFrom);
|
107
|
}
|
108
|
|
109
|
return datasourceManagerClients.getDatasourcesByCondition(cond);
|
110
|
}
|
111
|
|
112
|
@Override
|
113
|
public boolean updateActivationStatus(final String dsId, final String ifaceId, final boolean active) throws DatasourceManagerServiceException {
|
114
|
final Map<String, Object> params = Maps.newHashMap();
|
115
|
|
116
|
params.put("active", asSqlValue(active));
|
117
|
params.put("ifaceId", asSqlValue(ifaceId));
|
118
|
params.put("dsId", asSqlValue(dsId));
|
119
|
|
120
|
return datasourceManagerClients.updateSQL(dsId, "updateActivationStatus.sql.st", params, false, true);
|
121
|
}
|
122
|
|
123
|
@Override
|
124
|
public boolean updateLevelOfCompliance(final String dsId, final String ifaceId, final String level) throws DatasourceManagerServiceException {
|
125
|
final Map<String, Object> params = Maps.newHashMap();
|
126
|
|
127
|
params.put("level", asSqlValue(level));
|
128
|
params.put("ifaceId", asSqlValue(ifaceId));
|
129
|
params.put("dsId", asSqlValue(dsId));
|
130
|
|
131
|
return datasourceManagerClients.updateSQL(dsId, "updateLevelOfCompliance.sql.st", params, false, true);
|
132
|
}
|
133
|
|
134
|
@Override
|
135
|
public boolean updateBaseUrl(final String dsId, final String ifaceId, final String baseUrl) throws DatasourceManagerServiceException {
|
136
|
return updateAccessParam(dsId, ifaceId, DatasourceParams.baseUrl.toString(), baseUrl, true);
|
137
|
}
|
138
|
|
139
|
@Override
|
140
|
public boolean updateContentDescription(final String dsId, final String ifaceId, final String desc) throws DatasourceManagerServiceException {
|
141
|
final Map<String, Object> params = Maps.newHashMap();
|
142
|
params.put("desc", asSqlValue(desc));
|
143
|
params.put("ifaceId", asSqlValue(ifaceId));
|
144
|
params.put("dsId", asSqlValue(dsId));
|
145
|
|
146
|
return datasourceManagerClients.updateSQL(dsId, "updateContentDescription.sql.st", params, false, true);
|
147
|
}
|
148
|
|
149
|
@Override
|
150
|
public boolean setIisProcessingWorkflow(final String dsId, final String ifaceId, final String wf) throws DatasourceManagerServiceException {
|
151
|
return updateExtraField(dsId, ifaceId, DatasourceParams.iis_processing_workflow.toString(), wf, false);
|
152
|
}
|
153
|
|
154
|
@Override
|
155
|
public boolean addInterface(final String dsId, final IfaceDesc iface) throws DatasourceManagerServiceException {
|
156
|
final Map<String, Object> params = Maps.newHashMap();
|
157
|
|
158
|
params.put("datasource", asSqlValue(dsId));
|
159
|
params.put("id", asSqlValue(iface.getId()));
|
160
|
params.put("typology", asSqlValue(iface.getTypology()));
|
161
|
params.put("protocol", asSqlValue(iface.getAccessProtocol()));
|
162
|
params.put("baseUrl", asSqlValue(iface.getBaseUrl()));
|
163
|
params.put("description", asSqlValue(iface.getContentDescription()));
|
164
|
params.put("compliance", asSqlValue(iface.getCompliance()));
|
165
|
|
166
|
final Map<String, String> accessParams = new HashMap<>();
|
167
|
if (iface.getAccessParams() != null) {
|
168
|
for (final Entry<String, String> e : iface.getAccessParams().entrySet()) {
|
169
|
accessParams.put(asSqlValue(e.getKey()), asSqlValue(e.getValue()));
|
170
|
}
|
171
|
}
|
172
|
params.put("accessParams", accessParams);
|
173
|
|
174
|
final Map<String, String> extraFields = new HashMap<>();
|
175
|
if (iface.getExtraFields() != null) {
|
176
|
for (final Entry<String, String> e : iface.getExtraFields().entrySet()) {
|
177
|
extraFields.put(asSqlValue(e.getKey()), asSqlValue(e.getValue()));
|
178
|
}
|
179
|
}
|
180
|
params.put("extraFields", extraFields);
|
181
|
|
182
|
return datasourceManagerClients.updateSQL(dsId, "insertInterface.sql.st", params, false, true);
|
183
|
}
|
184
|
|
185
|
@Override
|
186
|
public boolean deleteInterface(final String dsId, final String ifcId) throws DatasourceManagerServiceException {
|
187
|
final Map<String, Object> params = Maps.newHashMap();
|
188
|
|
189
|
params.put("datasource", asSqlValue(dsId));
|
190
|
params.put("id", asSqlValue(ifcId));
|
191
|
|
192
|
return datasourceManagerClients.updateSQL(dsId, "deleteInterface.sql.st", params, false, true);
|
193
|
}
|
194
|
|
195
|
@Override
|
196
|
public boolean updateExtraField(final String dsId, final String ifaceId, final String field, final String value, final boolean preserveOriginal)
|
197
|
throws DatasourceManagerServiceException {
|
198
|
return updateApiCollectionsRow(dsId, ifaceId, field, value, preserveOriginal, false);
|
199
|
}
|
200
|
|
201
|
@Override
|
202
|
public boolean updateAccessParam(final String dsId, final String ifaceId, final String field, final String value, final boolean preserveOriginal)
|
203
|
throws DatasourceManagerServiceException {
|
204
|
return updateApiCollectionsRow(dsId, ifaceId, field, value, preserveOriginal, true);
|
205
|
}
|
206
|
|
207
|
private boolean updateApiCollectionsRow(final String dsId,
|
208
|
final String ifaceId,
|
209
|
final String field,
|
210
|
final String value,
|
211
|
final boolean preserveOriginal,
|
212
|
final boolean accessParam) throws DatasourceManagerServiceException {
|
213
|
|
214
|
final String openaireDsId = datasourceManagerClients.findDatasourceId(dsId);
|
215
|
|
216
|
final Map<String, Object> params = Maps.newHashMap();
|
217
|
|
218
|
params.put("dsId", asSqlValue(openaireDsId));
|
219
|
params.put("ifaceId", asSqlValue(ifaceId));
|
220
|
params.put("field", asSqlValue(field));
|
221
|
params.put("accessParam", accessParam);
|
222
|
|
223
|
if (value != null) {
|
224
|
params.put("value", asSqlValue(value));
|
225
|
}
|
226
|
|
227
|
if (datasourceManagerClients.isDefinedParam(ifaceId, field)) {
|
228
|
params.put("update", 1);
|
229
|
}
|
230
|
if (preserveOriginal) {
|
231
|
params.put("preserveOriginal", 1);
|
232
|
}
|
233
|
|
234
|
return datasourceManagerClients.updateSQL(openaireDsId, "updateApiCollectionsRow.sql.st", params, false, true);
|
235
|
}
|
236
|
|
237
|
@Override
|
238
|
public boolean deleteAccessParamOrExtraField(final String dsId, final String ifaceId, final String field) throws DatasourceManagerServiceException {
|
239
|
final Map<String, Object> params = Maps.newHashMap();
|
240
|
|
241
|
params.put("dsId", asSqlValue(dsId));
|
242
|
params.put("ifaceId", asSqlValue(ifaceId));
|
243
|
params.put("field", asSqlValue(field));
|
244
|
|
245
|
return datasourceManagerClients.updateSQL(dsId, "deleteApiCollectionsRow.sql.st", params, false, true);
|
246
|
}
|
247
|
|
248
|
@Override
|
249
|
public boolean updateSQL(final String dsId, final String sql, final boolean delete) throws DatasourceManagerServiceException {
|
250
|
return datasourceManagerClients.updateSQL(dsId, sql, delete, true);
|
251
|
}
|
252
|
|
253
|
@Override
|
254
|
public Date findNextScheduledExecution(final String dsId, final String ifaceId)
|
255
|
throws DatasourceManagerServiceException {
|
256
|
return datasourceManagerClients.findNextScheduledExecution(dsId, ifaceId);
|
257
|
}
|
258
|
|
259
|
@Override
|
260
|
public boolean bulkUpdateApiExtraFields(final String repoId, final String ifaceId, final Map<String, String> fields)
|
261
|
throws DatasourceManagerServiceException {
|
262
|
return performUpdate(repoId, ifaceId, fields, false);
|
263
|
}
|
264
|
|
265
|
@Override
|
266
|
public boolean bulkUpdateApiAccessParams(final String repoId, final String ifaceId, final Map<String, String> params)
|
267
|
throws DatasourceManagerServiceException {
|
268
|
return performUpdate(repoId, ifaceId, params, true);
|
269
|
}
|
270
|
|
271
|
private boolean performUpdate(final String repoId, final String ifaceId, final Map<String, String> params, final boolean accessParam)
|
272
|
throws DatasourceManagerServiceException {
|
273
|
final String dsId = datasourceManagerClients.findDatasourceId(repoId);
|
274
|
|
275
|
if (!accessParam) {
|
276
|
deleteOldExtraFields(dsId, ifaceId);
|
277
|
}
|
278
|
|
279
|
for (final Map.Entry<String, String> e : params.entrySet()) {
|
280
|
performSingleUpdate(dsId, ifaceId, e.getKey(), e.getValue(), accessParam);
|
281
|
}
|
282
|
datasourceManagerClients.regenerateProfile(dsId);
|
283
|
return true;
|
284
|
}
|
285
|
|
286
|
private boolean deleteOldExtraFields(final String dsId, final String ifaceId) throws DatasourceManagerServiceException {
|
287
|
final Map<String, Object> params = Maps.newHashMap();
|
288
|
|
289
|
params.put("dsId", asSqlValue(dsId));
|
290
|
params.put("ifaceId", asSqlValue(ifaceId));
|
291
|
|
292
|
return datasourceManagerClients.updateSQL(dsId, "deleteOldExtraFields.sql.st", params, false, false);
|
293
|
}
|
294
|
|
295
|
private boolean performSingleUpdate(final String dsId, final String ifaceId, final String field, final String value, final boolean accessParam)
|
296
|
throws DatasourceManagerServiceException {
|
297
|
final Map<String, Object> params = Maps.newHashMap();
|
298
|
|
299
|
params.put("dsId", asSqlValue(dsId));
|
300
|
params.put("ifaceId", asSqlValue(ifaceId));
|
301
|
params.put("field", asSqlValue(field));
|
302
|
params.put("accessParam", accessParam);
|
303
|
|
304
|
if (value != null) {
|
305
|
params.put("value", asSqlValue(value));
|
306
|
}
|
307
|
|
308
|
if (accessParam && datasourceManagerClients.isDefinedParam(ifaceId, field)) {
|
309
|
params.put("update", 1);
|
310
|
params.put("preserveOriginal", 1);
|
311
|
}
|
312
|
|
313
|
return datasourceManagerClients.updateSQL(dsId, "updateApiCollectionsRow.sql.st", params, false, false);
|
314
|
}
|
315
|
|
316
|
public DatasourceManagerClients getDatasourceManagerClients() {
|
317
|
return datasourceManagerClients;
|
318
|
}
|
319
|
|
320
|
@Required
|
321
|
public void setDatasourceManagerClients(final DatasourceManagerClients datasourceManagerClients) {
|
322
|
this.datasourceManagerClients = datasourceManagerClients;
|
323
|
}
|
324
|
|
325
|
@Override
|
326
|
public boolean overrideCompliance(final String repoId, final String ifaceId, final String compliance) throws DatasourceManagerServiceException {
|
327
|
|
328
|
final String dsId = datasourceManagerClients.findDatasourceId(repoId);
|
329
|
|
330
|
final Map<String, Object> params = Maps.newHashMap();
|
331
|
params.put("dsId", asSqlValue(dsId));
|
332
|
params.put("ifaceId", asSqlValue(ifaceId));
|
333
|
params.put("field", asSqlValue(DatasourceConstants.OVERRIDING_COMPLIANCE_FIELD));
|
334
|
|
335
|
if (StringUtils.isEmpty(compliance)) {
|
336
|
params.put("delete", true);
|
337
|
log.debug("Removing compliance");
|
338
|
} else {
|
339
|
params.put("value", asSqlValue(compliance));
|
340
|
if (datasourceManagerClients.isDefinedParam(ifaceId, DatasourceConstants.OVERRIDING_COMPLIANCE_FIELD)) {
|
341
|
params.put("update", true);
|
342
|
log.debug("Updating compliance: " + compliance);
|
343
|
} else {
|
344
|
params.put("insert", true);
|
345
|
log.debug("Adding compliance: " + compliance);
|
346
|
}
|
347
|
}
|
348
|
return datasourceManagerClients.updateSQL(dsId, "overrideCompliance.sql.st", params, false, true);
|
349
|
}
|
350
|
|
351
|
@Override
|
352
|
public List<BrowsableField> listBrowsableFields() throws DatasourceManagerServiceException {
|
353
|
return getBrowsableFields().stream()
|
354
|
.map(f -> new BrowsableField(f.getId(), f.getLabel()))
|
355
|
.collect(Collectors.toList());
|
356
|
}
|
357
|
|
358
|
@Override
|
359
|
public List<BrowseTerm> browseField(final String f) throws DatasourceManagerServiceException {
|
360
|
final List<BrowseTerm> list = Lists.newArrayList();
|
361
|
|
362
|
try {
|
363
|
final DbBrowsableField field = findBrowseField(f);
|
364
|
if (field != null) {
|
365
|
final SAXReader reader = new SAXReader();
|
366
|
for (final String s : datasourceManagerClients.searchSQL(field.getSql())) {
|
367
|
final Document doc = reader.read(new StringReader(s));
|
368
|
final String id = doc.valueOf("/ROW/FIELD[@name='id']");
|
369
|
final String name = doc.valueOf("/ROW/FIELD[@name='name']");
|
370
|
final int value = NumberUtils.toInt(doc.valueOf("/ROW/FIELD[@name='count']"), 0);
|
371
|
if (StringUtils.isNotEmpty(id)) {
|
372
|
list.add(new BrowseTerm(id, name, value));
|
373
|
}
|
374
|
}
|
375
|
}
|
376
|
} catch (final Exception e) {
|
377
|
log.error("Error browsing field " + f, e);
|
378
|
}
|
379
|
|
380
|
return list;
|
381
|
}
|
382
|
|
383
|
@Override
|
384
|
public List<SearchInterfacesEntry> searchInterface(final String field, final String value) throws DatasourceManagerServiceException {
|
385
|
try {
|
386
|
final Map<String, Object> params = Maps.newHashMap();
|
387
|
params.put("value", value);
|
388
|
|
389
|
if (!field.equalsIgnoreCase("__search__")) {
|
390
|
params.put("field", field);
|
391
|
}
|
392
|
|
393
|
final DbBrowsableField f = findBrowseField(field);
|
394
|
if ((f == null) || f.isText()) {
|
395
|
params.put("delimeter", "'");
|
396
|
}
|
397
|
|
398
|
final SAXReader reader = new SAXReader();
|
399
|
final Iterable<String> iter = datasourceManagerClients.searchSQL("searchRepoInterfaces.sql.st", params);
|
400
|
return Lists.newArrayList(Iterables.transform(iter, s -> {
|
401
|
final SearchInterfacesEntry iface = new SearchInterfacesEntry();
|
402
|
try {
|
403
|
final Document doc = reader.read(new StringReader(s));
|
404
|
final String country = doc.valueOf("/ROW/FIELD[@name='country']");
|
405
|
|
406
|
iface.setRepoId(doc.valueOf("/ROW/FIELD[@name='repoid']"));
|
407
|
iface.setRepoCountry(StringUtils.isEmpty(country) ? "-" : country.toUpperCase());
|
408
|
iface.setRepoName(StringEscapeUtils.unescapeXml(doc.valueOf("/ROW/FIELD[@name='reponame']")));
|
409
|
iface.setRepoPrefix(doc.valueOf("/ROW/FIELD[@name='repoprefix']"));
|
410
|
|
411
|
iface.setId(doc.valueOf("/ROW/FIELD[@name='id']"));
|
412
|
iface.setActive(Boolean.valueOf(doc.valueOf("/ROW/FIELD[@name='active']")));
|
413
|
iface.setProtocol(doc.valueOf("/ROW/FIELD[@name='protocol']"));
|
414
|
iface.setCompliance(doc.valueOf("/ROW/FIELD[@name='compliance']"));
|
415
|
iface.setAggrDate(doc.valueOf("/ROW/FIELD[@name='aggrdate']"));
|
416
|
iface.setAggrTotal(NumberUtils.toInt(doc.valueOf("/ROW/FIELD[@name='aggrtotal']"), 0));
|
417
|
} catch (final Exception e) {
|
418
|
log.error(e);
|
419
|
}
|
420
|
return iface;
|
421
|
}));
|
422
|
} catch (final Exception e) {
|
423
|
log.error("Error searching field " + field + " - value: " + value, e);
|
424
|
}
|
425
|
return Lists.newArrayList();
|
426
|
}
|
427
|
|
428
|
private DbBrowsableField findBrowseField(final String id) {
|
429
|
for (final DbBrowsableField f : getBrowsableFields()) {
|
430
|
if (f.getId().equals(id)) { return f; }
|
431
|
}
|
432
|
return null;
|
433
|
}
|
434
|
|
435
|
@Override
|
436
|
public List<RepositoryMapEntry> getRepositoryMap() throws DatasourceManagerServiceException {
|
437
|
final SAXReader reader = new SAXReader();
|
438
|
|
439
|
try {
|
440
|
final Iterable<String> iter = datasourceManagerClients.searchSQL("findReposMap.sql.st", null);
|
441
|
return Lists.newArrayList(Iterables.transform(iter, s -> {
|
442
|
final RepositoryMapEntry r = new RepositoryMapEntry();
|
443
|
try {
|
444
|
final Document doc = reader.read(new StringReader(s));
|
445
|
r.setId(doc.valueOf("/ROW/FIELD[@name='id']"));
|
446
|
r.setName(StringEscapeUtils.unescapeXml(doc.valueOf("/ROW/FIELD[@name='name']")));
|
447
|
r.setLat(NumberUtils.toFloat(doc.valueOf("/ROW/FIELD[@name='lat']"), 0));
|
448
|
r.setLng(NumberUtils.toFloat(doc.valueOf("/ROW/FIELD[@name='lng']"), 0));
|
449
|
} catch (final Exception e) {
|
450
|
log.error(e);
|
451
|
}
|
452
|
return r;
|
453
|
}));
|
454
|
} catch (final Exception e) {
|
455
|
log.error("Error obtaing repo map entries", e);
|
456
|
}
|
457
|
return Lists.newArrayList();
|
458
|
}
|
459
|
|
460
|
@Override
|
461
|
public List<SimpleDatasourceDesc> simpleListDatasourcesByType(final String type) throws DatasourceManagerServiceException {
|
462
|
final Map<String, Object> params = Maps.newHashMap();
|
463
|
params.put("type", type);
|
464
|
final List<SimpleDatasourceDesc> list = Lists.newArrayList();
|
465
|
try {
|
466
|
final SAXReader reader = new SAXReader();
|
467
|
for (final String s : datasourceManagerClients.searchSQL("simpleFindRepos.sql.st", params)) {
|
468
|
final Document doc = reader.read(new StringReader(s));
|
469
|
final SimpleDatasourceDesc r = new SimpleDatasourceDesc();
|
470
|
r.setId(doc.valueOf("/ROW/FIELD[@name='id']"));
|
471
|
r.setOrigId(doc.valueOf("/ROW/FIELD[@name='id']"));
|
472
|
r.setName(StringEscapeUtils.unescapeXml(doc.valueOf("/ROW/FIELD[@name='name']")));
|
473
|
for (final Object o : doc.selectNodes("/ROW/FIELD[@name='apis']/ITEM")) {
|
474
|
r.getApis().add(((Node) o).getText());
|
475
|
}
|
476
|
r.setValid(true); // TODO
|
477
|
r.setTypology(type);
|
478
|
list.add(r);
|
479
|
}
|
480
|
Collections.sort(list);
|
481
|
} catch (final Exception e) {
|
482
|
log.error("Error listing repos", e);
|
483
|
}
|
484
|
return list;
|
485
|
}
|
486
|
|
487
|
public List<DbBrowsableField> getBrowsableFields() {
|
488
|
return browsableFields;
|
489
|
}
|
490
|
|
491
|
@Required
|
492
|
public void setBrowsableFields(final List<DbBrowsableField> browsableFields) {
|
493
|
this.browsableFields = browsableFields;
|
494
|
}
|
495
|
}
|