@Override
public void handleRequest(Genomics genomics) throws IOException {
if (projectNumber != null) {
ListDatasetsResponse datasets = genomics.datasets().list()
.setProjectNumber(projectNumber).execute();
if (datasets.getDatasets() == null) {
return;
}
for (Dataset dataset : datasets.getDatasets()) {
printDataset(genomics, dataset, includeDetails);
}
} else {
Map<String, String> datasets = getPreviousDatasets();
if (datasets.isEmpty()) {
System.out.println("There aren't any recently used datasets. " +
"Specify a --project_number flag to get datasets for a specific project, or use the " +
"'createdataset' command to make a new dataset.\n" +
"You can find Google Genomics Public Data in project 761052378059");
return;
}
for (Map.Entry<String, String> dataset : datasets.entrySet()) {
printDataset(genomics, dataset.getKey(), dataset.getValue(), null, includeDetails);
}
}
}