/**
   * 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 common pagination information.
  *
  * @param mcfData the data returned from the API.
  */
 private static void printPaginationInfo(McfData mcfData) {
   System.out.println("Pagination Info:");
   System.out.println("Previous Link: " + mcfData.getPreviousLink());
   System.out.println("Next Link: " + mcfData.getNextLink());
   System.out.println("Items Per Page: " + mcfData.getItemsPerPage());
   System.out.println("Total Results: " + mcfData.getTotalResults());
   System.out.println();
 }
 /**
  * Prints general information about this report.
  *
  * @param mcfData the data returned from the API.
  */
 private static void printReportInfo(McfData mcfData) {
   System.out.println();
   System.out.println("Report Info:");
   System.out.println("ID:" + mcfData.getId());
   System.out.println("Self link: " + mcfData.getSelfLink());
   System.out.println("Kind: " + mcfData.getKind());
   System.out.println("Contains Sampled Data: " + mcfData.getContainsSampledData());
   System.out.println();
 }
 /**
  * Prints the total metric value for all rows the query matched.
  *
  * @param mcfData the data returned from the API.
  */
 private static void printTotalsForAllResults(McfData mcfData) {
   System.out.println("Metric totals over all results:");
   Map<String, String> totalsMap = mcfData.getTotalsForAllResults();
   for (Map.Entry<String, String> entry : totalsMap.entrySet()) {
     System.out.println(entry.getKey() + " : " + entry.getValue());
   }
   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();
  }
  /**
   * Prints general information about the profile from which this report was accessed.
   *
   * @param mcfData the data returned from the API.
   */
  private static void printProfileInfo(McfData mcfData) {
    ProfileInfo profileInfo = mcfData.getProfileInfo();

    System.out.println("Profile Info:");
    System.out.println("Account ID: " + profileInfo.getAccountId());
    System.out.println("Web Property ID: " + profileInfo.getWebPropertyId());
    System.out.println("Internal Web Property ID: " + profileInfo.getInternalWebPropertyId());
    System.out.println("Profile ID: " + profileInfo.getProfileId());
    System.out.println("Profile Name: " + profileInfo.getProfileName());
    System.out.println("Table ID: " + profileInfo.getTableId());
    System.out.println();
  }
  /**
   * Prints the values of all the parameters that were used to query the API.
   *
   * @param mcfData the data returned from the API.
   */
  private static void printQueryInfo(McfData mcfData) {
    Query query = mcfData.getQuery();

    System.out.println("Query Info:");
    System.out.println("Ids: " + query.getIds());
    System.out.println("Start Date: " + query.getStartDate());
    System.out.println("End Date: " + query.getEndDate());
    System.out.println("Metrics: " + query.getMetrics()); // List
    System.out.println("Dimensions: " + query.getDimensions()); // List
    System.out.println("Sort: " + query.getSort()); // List
    System.out.println("Segment: " + query.getSegment());
    System.out.println("Filters: " + query.getFilters());
    System.out.println("Start Index: " + query.getStartIndex());
    System.out.println("Max Results: " + query.getMaxResults());
    System.out.println();
  }