@Override public boolean hasNext() { return documentDataIterator != null && documentDataIterator.hasNext(); } }
private List<Object[]> getNextFromDataTable() { List<Object[]> next = new ArrayList<>(batchSize); // Must be set to true again if the iterator has more elements. hasNext = false; log.trace("Filling document ID list with the next batch of documents."); while (dataTableDocumentIds.hasNext() && next.size() < batchSize) next.add(dataTableDocumentIds.next()); // totalDocumentCount could be set to the Limit parameter. Thus we // should stop when we reach the limit. and not set hasNext back to // true. if (processedDocuments < totalDocumentCount - 1) { log.trace("Checking if there are more documents to read from the data table."); hasNext = dataTableDocumentIds.hasNext(); } return next; }
private byte[][] getNextFromDataTable() { byte[][] next; // Must be set to true again if the iterator has more elements. hasNext = false; next = xmlBytes.next(); // totalDocumentCount could be set to the Limit parameter. Thus we // should stop when we reach the limit. and not set hasNext back to // true. if (processedDocuments < totalDocumentCount - 1) { hasNext = xmlBytes.hasNext(); if (!hasNext) close(); } return next; }
@Override public AbstractCas next() throws AnalysisEngineProcessException { JCas jCas = getEmptyJCas(); if (documentDataIterator.hasNext()) { try { initializer.initializeAnnotationTableNames(jCas); } catch (ResourceInitializationException e) { throw new AnalysisEngineProcessException(e); } populateCas(jCas); } return jCas; }
@Override public void initialize(UimaContext context) throws ResourceInitializationException { super.initialize(context); // Check whether a subset table name or a data table name was given. if (readDataTable) { log.debug("Reading from data table {}", tableName); dataTableDocumentIds = dbc.query(tableName, Arrays.asList(dbc.getFieldConfiguration(dbc.getActiveTableSchema()).getPrimaryKey())); hasNext = dataTableDocumentIds.hasNext(); } else { log.debug("Reading from subset table {}", tableName); hasNext = dbc.withConnectionQueryBoolean(c -> c.hasUnfetchedRows(tableName)); } }