use of com.yahoo.document.json.document.DocumentParser in project vespa by vespa-engine.
the class JsonReader method readSingleDocument.
/**
* Reads a single operation. The operation is not expected to be part of an array.
* @param operationType the type of operation (update or put)
* @param docIdString document ID.
* @return the document
*/
public DocumentOperation readSingleDocument(DocumentParser.SupportedOperation operationType, String docIdString) {
DocumentId docId = new DocumentId(docIdString);
final DocumentParseInfo documentParseInfo;
try {
DocumentParser documentParser = new DocumentParser(parser);
documentParseInfo = documentParser.parse(Optional.of(docId)).get();
} catch (IOException e) {
state = END_OF_FEED;
throw new RuntimeException(e);
}
documentParseInfo.operationType = operationType;
VespaJsonDocumentReader vespaJsonDocumentReader = new VespaJsonDocumentReader();
DocumentOperation operation = vespaJsonDocumentReader.createDocumentOperation(getDocumentTypeFromString(documentParseInfo.documentId.getDocType(), typeManager), documentParseInfo);
operation.setCondition(TestAndSetCondition.fromConditionString(documentParseInfo.condition));
return operation;
}
Aggregations