AllThesaurus extends Thesaurus { @Override public KeywordBean getKeywordWithLabel(final String label, final String langCode) { KeywordBean result = onThesauri(null, new Function<Thesaurus, KeywordBean>() { @Nullable @Override public KeywordBean apply(@Nonnull Thesaurus thesaurus) { try { return updateKeywordBeanThesaurusInfo(thesaurus.getKeywordWithLabel(label, langCode)); } catch (TermNotFoundException e) { return null; } } }); if (result == null) { throw new TermNotFoundException(label); } return result; } AllThesaurus(ThesaurusFinder thesaurusFinder, IsoLanguagesMapper isoLangMapper, String siteUrl); static String buildKeywordUri(KeywordBean actualWord); @Override String getKey(); @Override String getDname(); @Override String getFname(); @Override Path getFile(); @Override String getType(); @Override String getTitle(); @Override String getDate(); @Override String getDownloadUrl(); @Override String getKeywordUrl(); @Override void retrieveThesaurusTitle(); @Override synchronized LocalRepository getRepository(); @Override synchronized Thesaurus setRepository(LocalRepository repository); @Override synchronized Thesaurus initRepository(); @Override synchronized QueryResultsTable performRequest(final String query); @Override boolean hasConceptScheme(String uri); @Override synchronized URI addElement(KeywordBean keyword); @Override synchronized Thesaurus removeElement(KeywordBean keyword); @Override synchronized Thesaurus removeElement(String namespace, String code); @Override synchronized Thesaurus removeElement(String uri); @Override synchronized URI updateElement(KeywordBean keyword, boolean replace); @Override synchronized boolean isFreeCode(final String namespace, final String code); @Override Thesaurus updateCode(KeywordBean bean, String newcode); @Override synchronized Thesaurus updateCode(String namespace, String oldcode, String newcode); @Override synchronized Thesaurus updateCodeByURI(String olduri, String newuri); @Override void addTitleElement(String thesaurusTitle); @Override IsoLanguagesMapper getIsoLanguageMapper(); @Override synchronized void addRelation(String subject, KeywordRelation related, String relatedSubject); @Override KeywordBean getKeyword(String uri, String... languages); @Override boolean hasKeyword(String uri); @Override List<KeywordBean> getRelated(final String uri, final KeywordRelation request, final String... languages); @Override boolean hasKeywordWithLabel(final String label, final String langCode); @Override KeywordBean getKeywordWithLabel(final String label, final String langCode); @Override synchronized void clear(); @Nonnull @Override FileTime getLastModifiedTime(); @Override String getDefaultNamespace(); static final String FNAME; static final String SEPARATOR; static final String ALL_THESAURUS_KEY; }
@Test public void testGetKeywordWithLabel() throws Exception { final KeywordBean existingKeywordBean = getExistingKeywordBean(); final KeywordBean found = this.allThesaurus.getKeywordWithLabel(existingKeywordBean.getPreferredLabel("eng"), "eng"); assertAllKeywordBean(found); }
@Test(expected = TermNotFoundException.class) public void testGetKeywordWithLabelCantFind() throws Exception { this.allThesaurus.getKeywordWithLabel("jkdjfdklsdj", "eng"); }