Thesaurus { public Thesaurus updateCode(KeywordBean bean, String newcode) throws AccessDeniedException, IOException { return updateCode(bean.getNameSpaceCode(), bean.getRelativeCode(), newcode); } protected  Thesaurus();  Thesaurus(IsoLanguagesMapper isoLanguageMapper, String fname, String type, String dname, Path thesaurusFile, String siteUrl);  Thesaurus(IsoLanguagesMapper isoLanguageMapper, String fname, String tname, String tnamespace, String type, String dname, Path thesaurusFile, String siteUrl, boolean ignoreMissingError); static String buildThesaurusKey(String fname, String type, String dname); Map<String, String> getMultilingualTitles(); Map<String,Map<String, String>> getDublinCoreMultilingual(); String getKey(); String getDname(); String getFname(); Path getFile(); String getType(); String getTitle(); String getDate(); @Nonnull FileTime getLastModifiedTime(); String getDownloadUrl(); String getKeywordUrl(); void retrieveThesaurusTitle(); synchronized LocalRepository getRepository(); synchronized Thesaurus setRepository(LocalRepository repository); synchronized Thesaurus initRepository(); synchronized QueryResultsTable performRequest(String query); boolean hasConceptScheme(String uri); List<String> getConceptSchemes(); synchronized URI addElement(KeywordBean keyword); synchronized Thesaurus removeElement(KeywordBean keyword); synchronized Thesaurus removeElement(String namespace, String code); synchronized Thesaurus removeElement(String uri); synchronized URI updateElement(KeywordBean keyword, boolean replace); synchronized boolean isFreeCode(String namespace, String code); Thesaurus updateCode(KeywordBean bean, String newcode); synchronized Thesaurus updateCode(String namespace, String oldcode, String newcode); synchronized Thesaurus updateCodeByURI(String olduri, String newuri); void addTitleElement(String thesaurusTitle); IsoLanguagesMapper getIsoLanguageMapper(); synchronized void addRelation(String subject, KeywordRelation related, String relatedSubject); KeywordBean getKeyword(String uri, String... languages); List<KeywordBean> getTopConcepts(String... languages); boolean hasKeyword(String uri); List<KeywordBean> getBroader(String uri, String... languages); boolean hasBroader(String uri); List<KeywordBean> getRelated(String uri, KeywordRelation request, String... languages); boolean hasKeywordWithLabel(String label, String langCode); KeywordBean getKeywordWithLabel(String label, String langCode); synchronized void clear(); String getDefaultNamespace(); Map<String, String> getTitles(ApplicationContext context);  }
@Test public void testUpdateCode() throws Exception { String label = "Hello"; String note = "note"; String code = "http: String lang = "eng"; KeywordBean keyword = new KeywordBean(isoLangMapper) .setUriCode(code) .setDefinition(note, lang) .setValue(label, lang); writableThesaurus.addElement(keyword); QueryBuilder<KeywordBean> builder = QueryBuilder.keywordQueryBuilder(isoLangMapper, "eng").where(Wheres.ID(code)); assertEquals(1, builder.build().execute(writableThesaurus).size()); writableThesaurus.updateCode(keyword.getNameSpaceCode(), keyword.getRelativeCode(), "10"); assertEquals(0, builder.build().execute(writableThesaurus).size()); builder.where(Wheres.ID(keyword.getNameSpaceCode() + 10)); assertEquals(1, builder.build().execute(writableThesaurus).size()); keyword.setRelativeCode("10"); writableThesaurus.updateCode(keyword, "15"); assertEquals(0, builder.build().execute(writableThesaurus).size()); builder.where(Wheres.ID(keyword.getNameSpaceCode() + 15)); assertEquals(1, builder.build().execute(writableThesaurus).size()); writableThesaurus.updateCodeByURI(keyword.getNameSpaceCode() + 15, "http: assertEquals(0, builder.build().execute(writableThesaurus).size()); builder.where(Wheres.ID("http: assertEquals(1, builder.build().execute(writableThesaurus).size()); writableThesaurus.updateCodeByURI("http: assertEquals(0, builder.build().execute(writableThesaurus).size()); builder.where(Wheres.ID("http: assertEquals(1, builder.build().execute(writableThesaurus).size()); }