@Test public void noMatchExplicit() throws PropertyEnricherException { final TaxonCacheService cacheService = new TaxonCacheService("/org/eol/globi/taxon/taxonCacheNoHeader.tsv", TAXON_MAP_TEST_RESOURCE); cacheService.setCacheDir(mapdbDir); AtomicBoolean matched = new AtomicBoolean(false); cacheService.match(TermUtil.toNamesToTerms(Collections.singletonList("foo:bar")), new TermMatchListener() { @Override public void foundTaxonForTerm(Long requestId, Term term, Taxon resolvedTaxon, NameType nameType) { assertThat(nameType, is(NameType.NONE)); matched.set(true); } }); assertTrue(matched.get()); }
@Override public void match(List<Term> terms, TermMatchListener termMatchListener) throws PropertyEnricherException { lazyInit(); for (Term term : terms) { String nodeIdAndName = term.getName(); Long nodeId = term instanceof TermRequestImpl ? ((TermRequestImpl) term).getNodeId() : null; if (!resolveName(termMatchListener, term, term.getId(), nodeId)) { if (StringUtils.isBlank(nodeIdAndName) || !resolveName(termMatchListener, term, term.getName(), nodeId)) { termMatchListener.foundTaxonForTerm(nodeId, term, new TaxonImpl(term.getId(), term.getName()), NameType.NONE); } } } }
TaxonCacheService extends CacheService implements PropertyEnricher, TermMatcher { @Override public void match(List<Term> terms, TermMatchListener termMatchListener) throws PropertyEnricherException { lazyInit(); for (Term term : terms) { String nodeIdAndName = term.getName(); Long nodeId = term instanceof TermRequestImpl ? ((TermRequestImpl) term).getNodeId() : null; if (!resolveName(termMatchListener, term, term.getId(), nodeId)) { if (StringUtils.isBlank(nodeIdAndName) || !resolveName(termMatchListener, term, term.getName(), nodeId)) { termMatchListener.foundTaxonForTerm(nodeId, term, new TaxonImpl(term.getId(), term.getName()), NameType.NONE); } } } } }
TaxonCacheService extends CacheService implements PropertyEnricher, TermMatcher { @Override public void match(List<Term> terms, TermMatchListener termMatchListener) throws PropertyEnricherException { lazyInit(); for (Term term : terms) { String nodeIdAndName = term.getName(); Long nodeId = term instanceof TermRequestImpl ? ((TermRequestImpl) term).getNodeId() : null; if (!resolveName(termMatchListener, term, term.getId(), nodeId)) { if (StringUtils.isBlank(nodeIdAndName) || !resolveName(termMatchListener, term, term.getName(), nodeId)) { termMatchListener.foundTaxonForTerm(nodeId, term, new TaxonImpl(term.getId(), term.getName()), NameType.NONE); } } } } TaxonCacheService(final TermResource<Taxon> taxonCache, final TermResource<Triple<Taxon, NameType, Taxon>> taxonMap);  TaxonCacheService(final String termResource, final String taxonMapResource); }
TaxonCacheService extends CacheService implements PropertyEnricher, TermMatcher { @Override public void match(List<Term> terms, TermMatchListener termMatchListener) throws PropertyEnricherException { lazyInit(); for (Term term : terms) { String nodeIdAndName = term.getName(); Long nodeId = term instanceof TermRequestImpl ? ((TermRequestImpl) term).getNodeId() : null; if (!resolveName(termMatchListener, term, term.getId(), nodeId)) { if (StringUtils.isBlank(nodeIdAndName) || !resolveName(termMatchListener, term, term.getName(), nodeId)) { termMatchListener.foundTaxonForTerm(nodeId, term, new TaxonImpl(term.getId(), term.getName()), NameType.NONE); } } } } TaxonCacheService(final TermResource<Taxon> taxonCache, final TermResource<Triple<Taxon, NameType, Taxon>> taxonMap);  TaxonCacheService(final String termResource, final String taxonMapResource); @Override Map<String, String> enrichFirstMatch(Map<String, String> properties); @Override List<Map<String, String>> enrichAllMatches(Map<String, String> properties); String getName(Map<String, String> properties); String getExternalId(Map<String, String> properties); @Override void match(List<Term> terms, TermMatchListener termMatchListener); int getMaxTaxonLinks(); void setMaxTaxonLinks(int maxTaxonLinks); static Iterator<Fun.Tuple2<String, Map<String, String>>> taxonCacheIterator(final TermResource<Taxon> config); static void logCacheLoadStats(long time, int numberOfItems); static void logCacheLoadStats(long time, int numberOfItems, Log log); @Override void shutdown(); static void close(Engine engine); }
TaxonCacheService extends CacheService implements PropertyEnricher, TermMatcher { @Override public void match(List<Term> terms, TermMatchListener termMatchListener) throws PropertyEnricherException { lazyInit(); for (Term term : terms) { String nodeIdAndName = term.getName(); Long nodeId = term instanceof TermRequestImpl ? ((TermRequestImpl) term).getNodeId() : null; if (!resolveName(termMatchListener, term, term.getId(), nodeId)) { if (StringUtils.isBlank(nodeIdAndName) || !resolveName(termMatchListener, term, term.getName(), nodeId)) { termMatchListener.foundTaxonForTerm(nodeId, term, new TaxonImpl(term.getId(), term.getName()), NameType.NONE); } } } } TaxonCacheService(final TermResource<Taxon> taxonCache, final TermResource<Triple<Taxon, NameType, Taxon>> taxonMap);  TaxonCacheService(final String termResource, final String taxonMapResource); @Override Map<String, String> enrichFirstMatch(Map<String, String> properties); @Override List<Map<String, String>> enrichAllMatches(Map<String, String> properties); String getName(Map<String, String> properties); String getExternalId(Map<String, String> properties); @Override void match(List<Term> terms, TermMatchListener termMatchListener); int getMaxTaxonLinks(); void setMaxTaxonLinks(int maxTaxonLinks); static Iterator<Fun.Tuple2<String, Map<String, String>>> taxonCacheIterator(final TermResource<Taxon> config); static void logCacheLoadStats(long time, int numberOfItems); static void logCacheLoadStats(long time, int numberOfItems, Log log); @Override void shutdown(); static void close(Engine engine);  }