@Test public void ensureThatEnrichedPropertiesAreIndexed() throws NodeFactoryException { Transaction transaction = getGraphDb().beginTx(); assertThat(getGraphDb().index().existsForNodes("taxons"), is(true)); assertThat(getGraphDb().index().existsForNodes("thisDoesnoTExist"), is(false)); transaction.success(); transaction.close(); assertEnrichedPropertiesSet(taxonService.getOrCreateTaxon(new TaxonImpl("some name")), ""); assertEnrichedPropertiesSet(taxonService.findTaxonByName("some name"), ""); }
@Override public TaxonNode getOrCreateTaxon(Taxon taxon) throws NodeFactoryException { if (StringUtils.isBlank(taxon.getExternalId()) && StringUtils.length(taxon.getName()) < 3) { throw new NodeFactoryException("taxon name [" + taxon.getName() + "] too short and no externalId is provided"); } TaxonNode taxonNode = findTaxon(taxon); return taxonNode == null ? createTaxon(taxon) : taxonNode; }
ResolvingTaxonIndex extends NonResolvingTaxonIndex { @Override public TaxonNode getOrCreateTaxon(Taxon taxon) throws NodeFactoryException { if (StringUtils.isBlank(taxon.getExternalId()) && StringUtils.length(taxon.getName()) < 3) { throw new NodeFactoryException("taxon name [" + taxon.getName() + "] too short and no externalId is provided"); } TaxonNode taxonNode = findTaxon(taxon); return taxonNode == null ? createTaxon(taxon) : taxonNode; } }
ResolvingTaxonIndex extends NonResolvingTaxonIndex { @Override public TaxonNode getOrCreateTaxon(Taxon taxon) throws NodeFactoryException { if (StringUtils.isBlank(taxon.getExternalId()) && StringUtils.length(taxon.getName()) < 3) { throw new NodeFactoryException("taxon name [" + taxon.getName() + "] too short and no externalId is provided"); } TaxonNode taxonNode = findTaxon(taxon); return taxonNode == null ? createTaxon(taxon) : taxonNode; } ResolvingTaxonIndex(PropertyEnricher enricher, GraphDatabaseService graphDbService); }
ResolvingTaxonIndex extends NonResolvingTaxonIndex { @Override public TaxonNode getOrCreateTaxon(Taxon taxon) throws NodeFactoryException { if (StringUtils.isBlank(taxon.getExternalId()) && StringUtils.length(taxon.getName()) < 3) { throw new NodeFactoryException("taxon name [" + taxon.getName() + "] too short and no externalId is provided"); } TaxonNode taxonNode = findTaxon(taxon); return taxonNode == null ? createTaxon(taxon) : taxonNode; } ResolvingTaxonIndex(PropertyEnricher enricher, GraphDatabaseService graphDbService); @Override TaxonNode getOrCreateTaxon(Taxon taxon); TaxonNode indexFirstAndConnectRemaining(List<Map<String, String>> taxonMatches, Taxon origTaxon); Taxon selectPrimaryTaxon(List<Map<String, String>> taxonMatches); TaxonNode indexAndConnect(List<Map<String, String>> taxonMatches, Taxon origTaxon, Taxon primaryTaxon); void setEnricher(PropertyEnricher enricher); void setIndexResolvedTaxaOnly(boolean indexResolvedOnly); boolean isIndexResolvedOnly(); }
ResolvingTaxonIndex extends NonResolvingTaxonIndex { @Override public TaxonNode getOrCreateTaxon(Taxon taxon) throws NodeFactoryException { if (StringUtils.isBlank(taxon.getExternalId()) && StringUtils.length(taxon.getName()) < 3) { throw new NodeFactoryException("taxon name [" + taxon.getName() + "] too short and no externalId is provided"); } TaxonNode taxonNode = findTaxon(taxon); return taxonNode == null ? createTaxon(taxon) : taxonNode; } ResolvingTaxonIndex(PropertyEnricher enricher, GraphDatabaseService graphDbService); @Override TaxonNode getOrCreateTaxon(Taxon taxon); TaxonNode indexFirstAndConnectRemaining(List<Map<String, String>> taxonMatches, Taxon origTaxon); Taxon selectPrimaryTaxon(List<Map<String, String>> taxonMatches); TaxonNode indexAndConnect(List<Map<String, String>> taxonMatches, Taxon origTaxon, Taxon primaryTaxon); void setEnricher(PropertyEnricher enricher); void setIndexResolvedTaxaOnly(boolean indexResolvedOnly); boolean isIndexResolvedOnly();  }