Create a deleteAllRecord
, then use the writeRecords()
method to write a baseline set of records to the Record Store.
To perform a baseline write:
Create a connection to a Record Store server by calling the
create()
method:RecordStoreLocator locator = RecordStoreLocator.create(host, port, instanceName);
Create a Record Store instance by calling the
getService()
method:RecordStore recordStore = locator.getService();
Start a
READ_WRITE
transaction by calling thestartTransaction()
method:TransactionId transactionId = recordStore.startTransaction(TransactionType.READ_WRITE);
Create a new record called
deleteAllRecord
with a property value ofDELETE
:Record deleteAllRecord = new Record(); deleteAllRecord.addPropertyValue(new PropertyValue("Endeca.Action", "DELETE"));
Add
deleteAllRecord
as the first record in a record batch:recordBatch1.addFirst(deleteAllRecord);
Write the first batch of records by calling the
writeRecords()
method:recordStore.writeRecords(recordBatch1);
Repeat this step to write other batches of records to the Record Store.
Commit the transaction by calling the
commitTransaction()
method:recordStore.commitTransaction(transactionId);
Example 6. Example of performing a baseline write
RecordStoreLocator locator = RecordStoreLocator.create(host, port, instanceName); RecordStore recordStore = locator.getService(); TransactionId transactionId = recordStore.startTransaction(TransactionType.READ_WRITE); Record deleteAllRecord = new Record(); deleteAllRecord.addPropertyValue(new PropertyValue("Endeca.Action", "DELETE")); recordBatch1.addFirst(deleteAllRecord); recordStore.writeRecords(recordBatch1); recordStore.writeRecords(recordBatch2); recordStore.commitTransaction(transactionId);