Java Client Update Document

From OpenIndivo Documentation Wiki

Jump to: navigation, search

The update document method allows an actor to modify an existing document in an existing record on the Indivo server.

View the Java docs for method definitions and parameter descriptions.

Code examples

Update a credentials document

Shows how a user can change his password using the updateDocument method.


String username = "username@indivohealth.org";
String password = "password";
String fullName = "Full Name";
String role = "patient";
//authenticate to the server AuthenticateResultType authResult = client.authenticate( username, password); //read document headers classified as credentials ReadDocumentHeaderListResultType headers = client.readDocumentHeaders( authResult.getActorTicket(), username, DocumentClassificationUrns.CREDENTIALS, false); List <DocumentHeaderType> headerList = headers.getDocumentHeader(); DocumentHeaderType header = headerList.get(0); //identify the document index of the credentials document String documentIndex = header.getDocumentIndex();
//generate a new credentials document String newPassword = "newPassword"; IndivoDocumentType doc = CredentialDocumentGenerator.generateCredentialsDocument( username, fullName, role, newPassword); //only need the version for the update action DocumentVersionType version = doc.getDocumentVersion().get(doc.getDocumentVersion().size() - 1); //update the credentials document in the record UpdateDocumentResultType result = client.updateDocument( authResult.getActorTicket(), username, documentIndex, version);
Personal tools