@Test public void testReadFields() { final String catalogId = "catalogId"; CatalogConfiguration c = new CatalogConfiguration(catalogId, "", new BaseConfiguration() {{ addProperty(CatalogConfiguration.PROPERTY_FIELDS, "field1,field2 , field3 "); addProperty(CatalogConfiguration.FIELD_PREFIX + '.' + "field1" + '.' + Z3950Catalog.PROPERTY_FIELD_QUERY, "query1"); addProperty(CatalogConfiguration.FIELD_PREFIX + '.' + "field2" + '.' + Z3950Catalog.PROPERTY_FIELD_QUERY, "query2"); }}); Map<String, Z3950Field> result = Z3950Catalog.readFields(c); assertNotNull(result); assertEquals(3, result.size()); Z3950Field field1 = result.get("field1"); assertNotNull("field1", field1); assertEquals("query1", field1.getQuery()); Z3950Field field2 = result.get("field2"); assertNotNull("field2", field2); assertEquals("query2", field2.getQuery()); Z3950Field field3 = result.get("field3"); assertNotNull("field3", field3); assertNull(field3.getQuery()); }
static Map<String, Z3950Field> readFields(CatalogConfiguration c) { Map<String, Z3950Field> fields = new HashMap<String, Z3950Field>(); List<CatalogQueryField> queryFields = c.getQueryFields(); for (CatalogQueryField queryField : queryFields) { fields.put(queryField.getName(), new Z3950Field(queryField)); } return fields; }
Z3950Catalog implements BibliographicCatalog { static Map<String, Z3950Field> readFields(CatalogConfiguration c) { Map<String, Z3950Field> fields = new HashMap<String, Z3950Field>(); List<CatalogQueryField> queryFields = c.getQueryFields(); for (CatalogQueryField queryField : queryFields) { fields.put(queryField.getName(), new Z3950Field(queryField)); } return fields; } }
Z3950Catalog implements BibliographicCatalog { static Map<String, Z3950Field> readFields(CatalogConfiguration c) { Map<String, Z3950Field> fields = new HashMap<String, Z3950Field>(); List<CatalogQueryField> queryFields = c.getQueryFields(); for (CatalogQueryField queryField : queryFields) { fields.put(queryField.getName(), new Z3950Field(queryField)); } return fields; } Z3950Catalog(String host, int port, String base, Charset recordCharset, Map<String, Z3950Field> fields); }
Z3950Catalog implements BibliographicCatalog { static Map<String, Z3950Field> readFields(CatalogConfiguration c) { Map<String, Z3950Field> fields = new HashMap<String, Z3950Field>(); List<CatalogQueryField> queryFields = c.getQueryFields(); for (CatalogQueryField queryField : queryFields) { fields.put(queryField.getName(), new Z3950Field(queryField)); } return fields; } Z3950Catalog(String host, int port, String base, Charset recordCharset, Map<String, Z3950Field> fields); static Z3950Catalog get(CatalogConfiguration c); @Override List<MetadataItem> find(String fieldId, String value, Locale locale); }
Z3950Catalog implements BibliographicCatalog { static Map<String, Z3950Field> readFields(CatalogConfiguration c) { Map<String, Z3950Field> fields = new HashMap<String, Z3950Field>(); List<CatalogQueryField> queryFields = c.getQueryFields(); for (CatalogQueryField queryField : queryFields) { fields.put(queryField.getName(), new Z3950Field(queryField)); } return fields; } Z3950Catalog(String host, int port, String base, Charset recordCharset, Map<String, Z3950Field> fields); static Z3950Catalog get(CatalogConfiguration c); @Override List<MetadataItem> find(String fieldId, String value, Locale locale); static final String TYPE; }