Java Client Create Record
From OpenIndivo Documentation Wiki
Create a new record on the server. While the record schema does not require specific document types to be present in a newly created record, the server and the Indivo framework do. A new record MUST contain a credentials document, an actor attributes document, and an access policies document. A new record SHOULD contain a contact information document.
[edit]
Code examples
[edit]
Create a new record
//authenticate to the server
String username = "username@indivohealth.org";
String password = "password";
AuthenticateResultType authResult = client.authenticate(
username,
password);
//formulate the new record
String authorId = username;
String authorName = "Author Name";
String authorRole = "administrator";
String newRecordId = "newUsername@indivohealth.org";
String newRecordPassword = "newPassword";
String newRecordRole = "patient";
String [] newRecordRoles = new String [] {newRecordRole};
String [] newRecordGroups = null;
String [] newRecordProxies = null;
IndivoRecordType record = DefaultRecordGenerator.generateDefaultRecord(
authorId,
authorName,
authorRole,
newRecordId,
newRecordPassword,
newRecordRole,
newRecordRoles,
newRecordGroups,
newRecordProxies);
//create the record on the server
CreateResultType createResult = client.createRecord(
authResult.getActorTicket(),
newRecordId,
record);

