for (Map.Entry<String, Map<String, IndexMutation>> stores : mutations.entrySet()) {
String store = stores.getKey();
String tableName = getTableName(store);
for (Map.Entry<String, IndexMutation> entry : stores.getValue().entrySet()) {
String rowId = entry.getKey();
IndexMutation mutation = entry.getValue();
RowMutation rowMutation = new RowMutation();
rowMutation.setRowId(rowId);
rowMutation.setTable(tableName);
rowMutation.setWal(_wal);
rowMutation.setWaitToBeVisible(_waitToBeVisible);
mutationBatch.add(rowMutation);
if (mutation.isDeleted()) {
rowMutation.setRowMutationType(RowMutationType.DELETE_ROW);
continue;
}
RecordMutation recordMutation = new RecordMutation().setRecordMutationType(RecordMutationType.REPLACE_COLUMNS);
Record record = new Record().setFamily(getFamily(store)).setRecordId(rowId);
rowMutation.addToRecordMutations(recordMutation);
rowMutation.setRowMutationType(RowMutationType.UPDATE_ROW);
if (mutation.hasAdditions()) {
for (IndexEntry indexEntry : mutation.getAdditions()) {
record.addToColumns(new Column(indexEntry.key, getValue(indexEntry.value)));
}
}
if (mutation.hasDeletions()) {
for (IndexEntry indexEntry : mutation.getAdditions()) {
record.addToColumns(new Column(indexEntry.key, null));
}
}
}
}