Revision 54970
Added by Michele Artini about 5 years ago
WorkflowsUIUtils.java | ||
---|---|---|
14 | 14 |
import eu.dnetlib.administration.uis.modules.datasources.ProtocolParameter; |
15 | 15 |
import eu.dnetlib.administration.uis.modules.datasources.VocabularyEntry; |
16 | 16 |
import eu.dnetlib.clients.is.InformationServiceClient; |
17 |
import eu.dnetlib.exceptions.DnetGenericException; |
|
18 | 17 |
import eu.dnetlib.exceptions.InformationServiceException; |
19 | 18 |
|
20 | 19 |
@Component |
... | ... | |
25 | 24 |
@Autowired |
26 | 25 |
private InformationServiceClient isClient; |
27 | 26 |
|
28 |
public String getDatasourceProfile(final String dsId) throws DnetGenericException { |
|
29 |
try { |
|
30 |
return dsId.startsWith("entity/datasource") |
|
31 |
? isClient.getProfile(dsId) |
|
32 |
: isClient.findOne("collection('/db/DRIVER/entity/datasource')/*[.//DATASOURCE_ORIGINAL_ID='" + dsId + "']"); |
|
33 |
} catch (final InformationServiceException e) { |
|
34 |
log.error("Datasource profile not found: " + dsId, e); |
|
35 |
throw new DnetGenericException("Datasource profile not found: " + dsId, e); |
|
36 |
} |
|
37 |
} |
|
38 |
|
|
39 | 27 |
public List<VocabularyEntry> fetchVocabularyTerms(final String voc) throws InformationServiceException { |
40 | 28 |
final String xquery = "for $x in collection('/db/DRIVER/conf/vocabulary')[.//VOCABULARY_NAME/@code = '" |
41 | 29 |
+ voc.trim() + "']//TERM return concat($x/@code, ' @@@ ', $x/@english_name)"; |
Also available in: Unified diff