Revision 60102
Added by Michele Artini over 3 years ago
EnrichOpenairePlugin.java | ||
---|---|---|
34 | 34 |
@Value("${plugin.enrich.publications.openaire.url}") |
35 | 35 |
private String baseUrl; |
36 | 36 |
|
37 |
@Value("${plugin.enrich.openaire.datasources.blacklist}") |
|
38 |
private String datasourceBlackList; |
|
39 |
|
|
37 | 40 |
private Map<String, Counter> counters = new HashMap<>(); |
38 | 41 |
|
39 | 42 |
@Override |
... | ... | |
141 | 144 |
private void updateUrls(final MdRecord doc, final Node n) { |
142 | 145 |
doc.getUrls().addAll(doc.getUrls()); |
143 | 146 |
|
147 |
final Set<String> blacklist = |
|
148 |
Arrays.stream(datasourceBlackList.split(",")).map(String::trim).filter(StringUtils::isNotBlank).collect(Collectors.toSet()); |
|
149 |
|
|
144 | 150 |
for (final Object oin : n.selectNodes(".//instance")) { |
145 |
final String rights = ((Element) oin).valueOf("./accessright/@classname").trim(); |
|
146 |
final String hostedBy = ((Element) oin).valueOf("./hostedby/@name").trim(); |
|
147 |
for (final Object ourl : ((Element) oin).selectNodes("./webresource/url")) { |
|
148 |
final MyURL u = new MyURL(((Node) ourl).getText().trim(), hostedBy, rights); |
|
149 |
doc.getUrls().remove(u); |
|
150 |
doc.getUrls().add(u); |
|
151 |
|
|
152 |
final String hostedByid = ((Element) oin).valueOf("./hostedby/@id").trim(); |
|
153 |
|
|
154 |
if (!blacklist.contains(hostedByid)) { |
|
155 |
final String hostedByName = ((Element) oin).valueOf("./hostedby/@name").trim(); |
|
156 |
final String rights = ((Element) oin).valueOf("./accessright/@classname").trim(); |
|
157 |
|
|
158 |
for (final Object ourl : ((Element) oin).selectNodes("./webresource/url")) { |
|
159 |
final MyURL u = new MyURL(((Node) ourl).getText().trim(), hostedByName, rights); |
|
160 |
doc.getUrls().remove(u); |
|
161 |
doc.getUrls().add(u); |
|
162 |
} |
|
151 | 163 |
} |
152 | 164 |
} |
153 | 165 |
} |
Also available in: Unified diff
blacklist