@Test public void testListToDataset() { DatasetReference datasetRef = new DatasetReference().setDatasetId("dataset-id").setProjectId("project-id"); DatasetList.Datasets listDataSet = new DatasetList.Datasets() .setDatasetReference(datasetRef) .setId("project-id:dataset-id") .setFriendlyName("friendly") .setKind("bigquery#dataset") .setLabels(Collections.singletonMap("foo", "bar")); Dataset dataset = HttpBigQueryRpc.LIST_TO_DATASET.apply(listDataSet); assertThat(dataset.getKind()).isEqualTo("bigquery#dataset"); assertThat(dataset.getId()).isEqualTo("project-id:dataset-id"); assertThat(dataset.getFriendlyName()).isEqualTo("friendly"); assertThat(dataset.getDatasetReference()).isEqualTo(datasetRef); assertThat(dataset.getLabels()).containsExactly("foo", "bar"); } }
BuilderImpl(com.google.api.services.bigquery.model.Dataset datasetPb) { if (datasetPb.getDatasetReference() != null) { this.datasetId = DatasetId.fromPb(datasetPb.getDatasetReference()); } if (datasetPb.getAccess() != null) { this.acl = Lists.transform( datasetPb.getAccess(), new Function<Dataset.Access, Acl>() { @Override public Acl apply(Dataset.Access accessPb) { return Acl.fromPb(accessPb); } }); } this.creationTime = datasetPb.getCreationTime(); this.defaultTableLifetime = datasetPb.getDefaultTableExpirationMs(); this.description = datasetPb.getDescription(); this.etag = datasetPb.getEtag(); this.friendlyName = datasetPb.getFriendlyName(); this.generatedId = datasetPb.getId(); this.lastModified = datasetPb.getLastModifiedTime(); this.location = datasetPb.getLocation(); this.selfLink = datasetPb.getSelfLink(); this.labels = Labels.fromPb(datasetPb.getLabels()); }
BuilderImpl(com.google.api.services.bigquery.model.Dataset datasetPb) { if (datasetPb.getDatasetReference() != null) { this.datasetId = DatasetId.fromPb(datasetPb.getDatasetReference()); } if (datasetPb.getAccess() != null) { this.acl = Lists.transform(datasetPb.getAccess(), new Function<Dataset.Access, Acl>() { @Override public Acl apply(Dataset.Access accessPb) { return Acl.fromPb(accessPb); } }); } this.creationTime = datasetPb.getCreationTime(); this.defaultTableLifetime = datasetPb.getDefaultTableExpirationMs(); this.description = datasetPb.getDescription(); this.etag = datasetPb.getEtag(); this.friendlyName = datasetPb.getFriendlyName(); this.generatedId = datasetPb.getId(); this.lastModified = datasetPb.getLastModifiedTime(); this.location = datasetPb.getLocation(); this.selfLink = datasetPb.getSelfLink(); }
BuilderImpl(com.google.api.services.bigquery.model.Dataset datasetPb) { if (datasetPb.getDatasetReference() != null) { this.datasetId = DatasetId.fromPb(datasetPb.getDatasetReference()); } if (datasetPb.getAccess() != null) { this.acl = Lists.transform(datasetPb.getAccess(), new Function<Dataset.Access, Acl>() { @Override public Acl apply(Dataset.Access accessPb) { return Acl.fromPb(accessPb); } }); } this.creationTime = datasetPb.getCreationTime(); this.defaultTableLifetime = datasetPb.getDefaultTableExpirationMs(); this.description = datasetPb.getDescription(); this.etag = datasetPb.getEtag(); this.friendlyName = datasetPb.getFriendlyName(); this.generatedId = datasetPb.getId(); this.lastModified = datasetPb.getLastModifiedTime(); this.location = datasetPb.getLocation(); this.selfLink = datasetPb.getSelfLink(); }
BuilderImpl(com.google.api.services.bigquery.model.Dataset datasetPb) { if (datasetPb.getDatasetReference() != null) { this.datasetId = DatasetId.fromPb(datasetPb.getDatasetReference()); } if (datasetPb.getAccess() != null) { this.acl = Lists.transform( datasetPb.getAccess(), new Function<Dataset.Access, Acl>() { @Override public Acl apply(Dataset.Access accessPb) { return Acl.fromPb(accessPb); } }); } this.creationTime = datasetPb.getCreationTime(); this.defaultTableLifetime = datasetPb.getDefaultTableExpirationMs(); this.description = datasetPb.getDescription(); this.etag = datasetPb.getEtag(); this.friendlyName = datasetPb.getFriendlyName(); this.generatedId = datasetPb.getId(); this.lastModified = datasetPb.getLastModifiedTime(); this.location = datasetPb.getLocation(); this.selfLink = datasetPb.getSelfLink(); this.labels = Labels.fromPb(datasetPb.getLabels()); }