use of org.talend.components.marklogic.exceptions.MarkLogicErrorCode in project components by Talend.
the class MarkLogicRowProcessor method write.
@Override
public void write(Object indexedRecordDatum) throws IOException {
if (indexedRecordDatum == null) {
return;
}
cleanWrites();
IndexedRecord indexedRecord = (IndexedRecord) indexedRecordDatum;
Schema indexedRecordSchema = indexedRecord.getSchema();
int docIdFieldIndex = indexedRecordSchema.getFields().indexOf(indexedRecordSchema.getField(inputProperties.docIdColumn.getStringValue()));
if (docIdFieldIndex == -1) {
throw new MarkLogicException(new MarkLogicErrorCode("Can't find docId column " + inputProperties.docIdColumn.getStringValue() + " in input row"));
}
String docId = (String) indexedRecord.get(docIdFieldIndex);
GenericData.Record matchedDocument = docContentReader.readDocument(docId);
totalCounter++;
documents.add(matchedDocument);
}
use of org.talend.components.marklogic.exceptions.MarkLogicErrorCode in project components by Talend.
the class MarkLogicCriteriaReader method getCurrent.
@Override
public IndexedRecord getCurrent() throws NoSuchElementException {
++documentCounter;
MatchDocumentSummary currentSummary = currentPage[pageCounter];
current = new GenericData.Record(settings.outputSchema);
try {
String docId = currentSummary.getUri();
current = docContentReader.readDocument(docId);
result.totalCountLong++;
result.successCountLong++;
pageCounter++;
return current;
} catch (Exception e) {
throw new MarkLogicException(new MarkLogicErrorCode("Can't read document from MarkLogic database"), e);
}
}
Aggregations