@Test public void test_dwcaQuery01() throws InvalidQueryException { QuerySpec query = new QuerySpec(); query.addCondition(new QueryCondition("acceptedName.genusOrMonomial", "=", "Parus")); client.dwcaQuery(query, new DevNullOutputStream()); }
@Override public void dwcaQuery(QuerySpec querySpec, OutputStream out) throws InvalidQueryException { SimpleHttpRequest request = newQuerySpecRequest("dwca/query", querySpec); sendRequest(request); int status = request.getStatus(); if (status != HTTP_OK) { byte[] response = request.getResponseBody(); ServerException exception = newServerException(status, response); if (exception.was(InvalidQueryException.class)) { throw invalidQueryException(exception); } throw exception; } InputStream in = null; try { logger.info("Downloading DarwinCore archive"); in = request.getResponseBodyAsStream(); IOUtil.pipe(in, out, 4096); logger.info("DarwinCore archive download complete"); } finally { IOUtil.close(in); } }
TaxonClient extends NbaClient<Taxon> implements ITaxonAccess { @Override public void dwcaQuery(QuerySpec querySpec, OutputStream out) throws InvalidQueryException { SimpleHttpRequest request = newQuerySpecRequest("dwca/query", querySpec); sendRequest(request); int status = request.getStatus(); if (status != HTTP_OK) { byte[] response = request.getResponseBody(); ServerException exception = newServerException(status, response); if (exception.was(InvalidQueryException.class)) { throw invalidQueryException(exception); } throw exception; } InputStream in = null; try { logger.info("Downloading DarwinCore archive"); in = request.getResponseBodyAsStream(); IOUtil.pipe(in, out, 4096); logger.info("DarwinCore archive download complete"); } finally { IOUtil.close(in); } } }
TaxonClient extends NbaClient<Taxon> implements ITaxonAccess { @Override public void dwcaQuery(QuerySpec querySpec, OutputStream out) throws InvalidQueryException { SimpleHttpRequest request = newQuerySpecRequest("dwca/query", querySpec); sendRequest(request); int status = request.getStatus(); if (status != HTTP_OK) { byte[] response = request.getResponseBody(); ServerException exception = newServerException(status, response); if (exception.was(InvalidQueryException.class)) { throw invalidQueryException(exception); } throw exception; } InputStream in = null; try { logger.info("Downloading DarwinCore archive"); in = request.getResponseBodyAsStream(); IOUtil.pipe(in, out, 4096); logger.info("DarwinCore archive download complete"); } finally { IOUtil.close(in); } } TaxonClient(ClientConfig config, String rootPath); }
TaxonClient extends NbaClient<Taxon> implements ITaxonAccess { @Override public void dwcaQuery(QuerySpec querySpec, OutputStream out) throws InvalidQueryException { SimpleHttpRequest request = newQuerySpecRequest("dwca/query", querySpec); sendRequest(request); int status = request.getStatus(); if (status != HTTP_OK) { byte[] response = request.getResponseBody(); ServerException exception = newServerException(status, response); if (exception.was(InvalidQueryException.class)) { throw invalidQueryException(exception); } throw exception; } InputStream in = null; try { logger.info("Downloading DarwinCore archive"); in = request.getResponseBodyAsStream(); IOUtil.pipe(in, out, 4096); logger.info("DarwinCore archive download complete"); } finally { IOUtil.close(in); } } TaxonClient(ClientConfig config, String rootPath); @Override void downloadQuery(QuerySpec querySpec, OutputStream out); @Override void dwcaQuery(QuerySpec querySpec, OutputStream out); @Override void dwcaGetDataSet(String name, OutputStream out); @Override String[] dwcaGetDataSetNames(); @Override GroupByScientificNameQueryResult groupByScientificName(
      GroupByScientificNameQuerySpec querySpec); }
TaxonClient extends NbaClient<Taxon> implements ITaxonAccess { @Override public void dwcaQuery(QuerySpec querySpec, OutputStream out) throws InvalidQueryException { SimpleHttpRequest request = newQuerySpecRequest("dwca/query", querySpec); sendRequest(request); int status = request.getStatus(); if (status != HTTP_OK) { byte[] response = request.getResponseBody(); ServerException exception = newServerException(status, response); if (exception.was(InvalidQueryException.class)) { throw invalidQueryException(exception); } throw exception; } InputStream in = null; try { logger.info("Downloading DarwinCore archive"); in = request.getResponseBodyAsStream(); IOUtil.pipe(in, out, 4096); logger.info("DarwinCore archive download complete"); } finally { IOUtil.close(in); } } TaxonClient(ClientConfig config, String rootPath); @Override void downloadQuery(QuerySpec querySpec, OutputStream out); @Override void dwcaQuery(QuerySpec querySpec, OutputStream out); @Override void dwcaGetDataSet(String name, OutputStream out); @Override String[] dwcaGetDataSetNames(); @Override GroupByScientificNameQueryResult groupByScientificName(
      GroupByScientificNameQuerySpec querySpec);  }