DroolsDescriptionService implements DescriptionService { @Override public Set<Description> findActiveDescriptionByExactTerm(String exactTerm) { if(exactTerm == null || exactTerm.trim().isEmpty()) return Collections.emptySet(); Set<String> idSet = droolsDescriptionIndex.findMatchedDescriptionTerm(exactTerm,true); Set<Description> descriptions = new HashSet<>(); for (String id : idSet) { DroolsDescription droolsDescription = repository.getDescription(id); descriptions.add(droolsDescription); } return descriptions; } DroolsDescriptionService(SnomedDroolsComponentRepository repository, TestResourceProvider testResourceProvider); @Override Set<String> getFSNs(Set<String> conceptIds, String... languageRefsetIds); @Override Set<Description> findActiveDescriptionByExactTerm(String exactTerm); @Override Set<Description> findInactiveDescriptionByExactTerm(String exactTerm); @Override // FIXME: Currently only finds matching description in ancestors. // Should search all descendants of the second highest ancestor (the ancestor which is a direct child of root). Set<Description> findMatchingDescriptionInHierarchy(Concept concept, Description description); @Override String getCaseSensitiveWordsErrorMessage(Description description); @Override String getLanguageSpecificErrorMessage(Description description); @Override Set<String> findParentsNotContainingSemanticTag(Concept concept, String termSematicTag, String... languageRefsetIds); @Override boolean isRecognisedSemanticTag(String termSemanticTag); DroolsDescriptionIndex getDroolsDescriptionIndex();  }
@Test public void testFindActiveDescriptionByExactTerm() { Set<Description> descriptions = droolsDescriptionService.findActiveDescriptionByExactTerm("Distinctive arrangement of microtubules"); Assert.assertEquals(1, descriptions.size()); for (Description description : descriptions) { Assert.assertEquals("3229017", description.getId()); } }