forked from D-Net/dnet-hadoop
more NPE checks
This commit is contained in:
parent
6dfcd0c9a2
commit
d28b7085f6
|
@ -136,24 +136,21 @@ public class VocabularyGroup implements Serializable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Qualifier lookupTermBySynonym(final String vocId, final String syn) {
|
public Qualifier lookupTermBySynonym(final String vocId, final String syn) {
|
||||||
if (StringUtils.isBlank(vocId)) {
|
return find(vocId)
|
||||||
return OafMapperUtils.unknown("", "");
|
|
||||||
}
|
|
||||||
|
|
||||||
final Vocabulary vocabulary = vocs.get(vocId.toLowerCase());
|
|
||||||
|
|
||||||
return Optional
|
|
||||||
.ofNullable(vocabulary.getTerm(syn))
|
|
||||||
.map(
|
.map(
|
||||||
term -> OafMapperUtils
|
vocabulary -> Optional
|
||||||
.qualifier(term.getId(), term.getName(), vocabulary.getId(), vocabulary.getName()))
|
.ofNullable(vocabulary.getTerm(syn))
|
||||||
.orElse(
|
|
||||||
Optional
|
|
||||||
.ofNullable(vocabulary.getTermBySynonym(syn))
|
|
||||||
.map(
|
.map(
|
||||||
term -> OafMapperUtils
|
term -> OafMapperUtils
|
||||||
.qualifier(term.getId(), term.getName(), vocabulary.getId(), vocabulary.getName()))
|
.qualifier(term.getId(), term.getName(), vocabulary.getId(), vocabulary.getName()))
|
||||||
.orElse(null));
|
.orElse(
|
||||||
|
Optional
|
||||||
|
.ofNullable(vocabulary.getTermBySynonym(syn))
|
||||||
|
.map(
|
||||||
|
term -> OafMapperUtils
|
||||||
|
.qualifier(term.getId(), term.getName(), vocabulary.getId(), vocabulary.getName()))
|
||||||
|
.orElse(null)))
|
||||||
|
.orElse(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue