UpdateJSON.displayTable()

The UpdateJSON.displayTable() method simply writes the entire table to the command line.

This method does not format the table’s contents in any significant way. It is simply provided as a convenience to allow the user to see that data has in fact been modified in the store.

// Dumps the entire table to the command line.
// Output is unformatted.
private void displayTable(KVStore kvstore) {
    TableAPI tableH = kvstore.getTableAPI();
    Table myTable = tableH.getTable("personContacts");

    PrimaryKey pkey = myTable.createPrimaryKey();
    TableIterator<Row> iter = tableH.tableIterator(pkey, null,
            null);
    try {
        while (iter.hasNext()) {
            Row row = iter.next();
            System.out.println("\nAccount: " +
                    row.get("account").asInteger());
            if (row.get("person").isNull()) {
                System.out.println("No person field");
            } else {
                System.out.println(row.get("person").asMap());
            }
        }
    } finally {
        if (iter != null) {
            iter.close();
        }
    }
}