Java Client Read Document

From OpenIndivo Documentation Wiki

Jump to: navigation, search

Read a specific document from the record. Optionally specify whether the returned document should only contain the latest version.

Code examples

Read a document

//authenticate to the server
String username = "username@indivohealth.org";
String password = "password";
AuthenticateResultType authResult = client.authenticate(username, password); String ticket = authResult.getActorTicket();
//read document headers for active lab documents ReadDocumentHeaderListResultType result = client.readDocumentHeaders( authResult.getActorTicket(), username, DocumentClassificationUrns.LAB_TEST, true);
//identify the index of the document that we're interested in List <DocumentHeaderType> headerList = result.getDocumentHeader(); DocumentHeaderType header = headerList.get(0); String documentIndex = header.getDocumentIndex();
//read the document that we're interested in ReadDocumentResultType readResult = client.readDocument( ticket, username, documentIndex);

Read a document with its latest version only

//authenticate to the server
String username = "username@indivohealth.org";
String password = "password";
AuthenticateResultType authResult = client.authenticate(username, password); String ticket = authResult.getActorTicket();
//read document headers for active lab documents ReadDocumentHeaderListResultType result = client.readDocumentHeaders( authResult.getActorTicket(), username, DocumentClassificationUrns.LAB_TEST, true);
//identify the index of the document that we're interested in List <DocumentHeaderType> headerList = result.getDocumentHeader(); DocumentHeaderType header = headerList.get(0); String documentIndex = header.getDocumentIndex();
//read the document that we're interested in... specify "true" for isLatestVersionOnly ReadDocumentResultType readResult = client.readDocument( ticket, username, documentIndex, true);
Personal tools