/** * Prints all the rows of data returned by the API. * * @param mcfData the data returned from the API. */ private static void printDataTable(McfData mcfData) { System.out.println("Data Table:"); if (mcfData.getTotalResults() > 0) { // Print the column names. List<ColumnHeaders> headers = mcfData.getColumnHeaders(); for (ColumnHeaders header : headers) { if (header.getDataType().equals(MCF_SEQUENCE_TYPE)) { System.out.printf("%-50s", header.getName()); } else { System.out.printf("%25s", header.getName()); } } System.out.println(); // Print the rows of data. for (List<McfData.Rows> row : mcfData.getRows()) { for (int columnIndex = 0; columnIndex < row.size(); ++columnIndex) { ColumnHeaders header = headers.get(columnIndex); McfData.Rows cell = row.get(columnIndex); if (header.getDataType().equals(MCF_SEQUENCE_TYPE)) { System.out.printf( "%-50s", getStringFromMcfSequence(cell.getConversionPathValue(), " > ")); } else if (header.getDataType().equals(INTEGER_TYPE)) { System.out.printf("%25d", Long.parseLong(cell.getPrimitiveValue())); } else { System.out.printf("%25s", cell.getPrimitiveValue()); } } System.out.println(); } } else { System.out.println("No rows found"); } System.out.println(); }
/** * Prints the information for each column. The reporting data from the API is returned as rows of * data. The column headers describe the names and types of each column in rows. * * @param mcfData the data returned from the API. */ private static void printColumnHeaders(McfData mcfData) { System.out.println("Column Headers:"); for (ColumnHeaders header : mcfData.getColumnHeaders()) { System.out.println("Column Name: " + header.getName()); System.out.println("Column Type: " + header.getColumnType()); System.out.println("Column Data Type: " + header.getDataType()); } System.out.println(); }