SchemaLocalizations { public Collection<String> codelist(String codelistName) throws Exception { int prefix = codelistName.indexOf(':'); if (prefix > -1) { codelistName = codelistName.substring(prefix + 1); } Set<String> codelists = Sets.newHashSet(); for (SchemaLocalization schemaLocalization : this.schemaLocalizations) { final ImmutableTable<String, String, Element> codeListIndex = schemaLocalization.getCodeListIndex(this.languageHolder.getLang3()); codelists.addAll(codeListIndex.row(codelistName).keySet()); } return codelists; } SchemaLocalizations(ApplicationContext context, CurrentLanguageHolder languageHolder,
                               String schema, String extraSchemas); static SchemaLocalizations create(String schema); static SchemaLocalizations create(String schema, String lang3); String nodeLabel(GPathResult node); String nodeLabel(String qualifiedNodeName, String qualifiedParentNodeName); String nodeDesc(GPathResult node); String nodeDesc(String qualifiedNodeName, String qualifiedParentNodeName); String nodeTranslation(String qualifiedNodeName, String qualifiedParentNodeName, String type); String codelistValueLabel(GPathResult node); String codelistValueLabel(String codelist, String value); String codelistValueDesc(GPathResult node); String codelistValueDesc(String codelist, String value); String codelistTranslation(String codelist, String context, String type); String translateLanguageCode(String value); Collection<String> codelist(String codelistName); String schemaString(String... key); static final String LANG_CODELIST_NS; }
@Test public void testCodeList() throws Exception { final Collection<String> codelist1 = localizations.codelist("gmd:codelist1"); assertArrayEquals(codelist1.toString(), new String[]{"code1", "code2"}, sort(codelist1.toArray())); final Collection<String> codelist2 = localizations.codelist("gmd:codelist2"); assertArrayEquals(codelist2.toString(), new String[]{"code1"}, sort(codelist2.toArray())); }