Revision 50488
Added by Michele Artini about 6 years ago
VerifyDatasourceJobNode.java | ||
---|---|---|
5 | 5 |
import com.google.common.base.Splitter; |
6 | 6 |
import com.googlecode.sarasvati.Arc; |
7 | 7 |
import com.googlecode.sarasvati.NodeToken; |
8 |
import eu.dnetlib.enabling.datasources.rmi.DatasourceConstants; |
|
8 |
|
|
9 | 9 |
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpDocumentNotFoundException; |
10 | 10 |
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpException; |
11 | 11 |
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService; |
... | ... | |
32 | 32 |
String compliance; |
33 | 33 |
try { |
34 | 34 |
compliance = lookupService.getResourceProfileByQuery("/*[.//RESOURCE_IDENTIFIER/@value='" + dsId + "']//INTERFACE[@id = '" + ifaceId |
35 |
+ "']/INTERFACE_EXTRA_FIELD[@name='" |
|
36 |
+ DatasourceConstants.OVERRIDING_COMPLIANCE_FIELD + "']/text()"); |
|
37 |
} catch (ISLookUpDocumentNotFoundException e) { |
|
35 |
+ "']/INTERFACE_EXTRA_FIELD[@name='overriding_compliance']/text()"); |
|
36 |
} catch (final ISLookUpDocumentNotFoundException e) { |
|
38 | 37 |
compliance = lookupService.getResourceProfileByQuery("/*[.//RESOURCE_IDENTIFIER/@value='" + dsId + "']//INTERFACE[@id = '" + ifaceId |
39 | 38 |
+ "']/@compliance/string()"); |
40 | 39 |
} |
... | ... | |
55 | 54 |
|
56 | 55 |
private void verifyValue(final String value, final String expected) throws Exception { |
57 | 56 |
if (expected != null && !expected.isEmpty()) { |
58 |
for (String s : Splitter.on(",").omitEmptyStrings().trimResults().split(expected)) { |
|
57 |
for (final String s : Splitter.on(",").omitEmptyStrings().trimResults().split(expected)) {
|
|
59 | 58 |
if (value.toLowerCase().startsWith(s.toLowerCase())) { return; } |
60 | 59 |
} |
61 | 60 |
throw new MSROException("Invalid value: " + value + ", Valid term prefixes are: [" + expected + "]"); |
Also available in: Unified diff
merged branch dsm into trunk