Skip to content

Commit

Permalink
Fix access-related issues
Browse files Browse the repository at this point in the history
  • Loading branch information
mziccard committed Jan 29, 2016
1 parent 68eed9e commit 73250ea
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@

package com.google.gcloud.bigquery;

import com.google.api.client.googleapis.json.GoogleJsonError;
import com.google.api.client.googleapis.json.GoogleJsonResponseException;
import com.google.common.collect.ImmutableSet;
import com.google.gcloud.BaseServiceException;
import com.google.gcloud.RetryHelper.RetryHelperException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,15 @@ private Builder() {
}

private Builder(CopyJobConfiguration jobConfiguration) {
super(Type.COPY);
this();
this.sourceTables = jobConfiguration.sourceTables;
this.destinationTable = jobConfiguration.destinationTable;
this.createDisposition = jobConfiguration.createDisposition;
this.writeDisposition = jobConfiguration.writeDisposition;
}

private Builder(com.google.api.services.bigquery.model.JobConfiguration configurationPb) {
super(Type.COPY);
this();
JobConfigurationTableCopy copyConfigurationPb = configurationPb.getCopy();
this.destinationTable = TableId.fromPb(copyConfigurationPb.getDestinationTable());
if (copyConfigurationPb.getSourceTables() != null) {
Expand Down Expand Up @@ -171,7 +171,7 @@ public Builder toBuilder() {
}

@Override
protected ToStringHelper toStringHelper() {
ToStringHelper toStringHelper() {
return super.toStringHelper()
.add("sourceTables", sourceTables)
.add("destinationTable", destinationTable)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ private Builder() {
}

private Builder(ExtractJobConfiguration jobInfo) {
super(Type.EXTRACT);
this();
this.sourceTable = jobInfo.sourceTable;
this.destinationUris = jobInfo.destinationUris;
this.printHeader = jobInfo.printHeader;
Expand All @@ -66,7 +66,7 @@ private Builder(ExtractJobConfiguration jobInfo) {
}

private Builder(com.google.api.services.bigquery.model.JobConfiguration configurationPb) {
super(Type.EXTRACT);
this();
JobConfigurationExtract extractConfigurationPb = configurationPb.getExtract();
this.sourceTable = TableId.fromPb(extractConfigurationPb.getSourceTable());
this.destinationUris = extractConfigurationPb.getDestinationUris();
Expand Down Expand Up @@ -199,7 +199,7 @@ public Builder toBuilder() {
}

@Override
protected ToStringHelper toStringHelper() {
ToStringHelper toStringHelper() {
return super.toStringHelper()
.add("sourceTable", sourceTable)
.add("destinationUris", destinationUris)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,12 @@ public abstract static class Builder<T extends JobConfiguration, B extends Build

private Type type;

protected Builder(Type type) {
Builder(Type type) {
this.type = checkNotNull(type);
}

@SuppressWarnings("unchecked")
protected B self() {
B self() {
return (B) this;
}

Expand All @@ -89,7 +89,7 @@ B type(Type type) {
public abstract T build();
}

protected JobConfiguration(Builder builder) {
JobConfiguration(Builder builder) {
this.type = builder.type;
}

Expand All @@ -105,7 +105,7 @@ public Type type() {
*/
public abstract Builder toBuilder();

protected ToStringHelper toStringHelper() {
ToStringHelper toStringHelper() {
return MoreObjects.toStringHelper(this).add("type", type);
}

Expand All @@ -114,11 +114,11 @@ public String toString() {
return toStringHelper().toString();
}

protected final int baseHashCode() {
final int baseHashCode() {
return Objects.hash(type);
}

protected final boolean baseEquals(JobConfiguration jobConfiguration) {
final boolean baseEquals(JobConfiguration jobConfiguration) {
return Objects.equals(toPb(), jobConfiguration.toPb());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ public boolean equals(Object obj) {
}

JobInfo setProjectId(String projectId) {
return toBuilder().configuration(this.configuration().setProjectId(projectId)).build();
return toBuilder().configuration(configuration.setProjectId(projectId)).build();
}

Job toPb() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,19 @@
* table. Data is provided as URIs that point to objects in Google Cloud Storage. Load job
* configurations have {@link JobConfiguration.Type#LOAD} type.
*/
public class LoadJobConfiguration extends JobConfiguration implements LoadConfiguration {
public final class LoadJobConfiguration extends JobConfiguration implements LoadConfiguration {

private static final long serialVersionUID = -2673554846792429829L;

private final List<String> sourceUris;
protected final TableId destinationTable;
protected final JobInfo.CreateDisposition createDisposition;
protected final JobInfo.WriteDisposition writeDisposition;
protected final FormatOptions formatOptions;
protected final Integer maxBadRecords;
protected final Schema schema;
protected final Boolean ignoreUnknownValues;
protected final List<String> projectionFields;
private final TableId destinationTable;
private final JobInfo.CreateDisposition createDisposition;
private final JobInfo.WriteDisposition writeDisposition;
private final FormatOptions formatOptions;
private final Integer maxBadRecords;
private final Schema schema;
private final Boolean ignoreUnknownValues;
private final List<String> projectionFields;

public static final class Builder
extends JobConfiguration.Builder<LoadJobConfiguration, Builder>
Expand All @@ -63,7 +63,7 @@ private Builder() {
}

private Builder(LoadJobConfiguration loadConfiguration) {
super(Type.LOAD);
this();
this.destinationTable = loadConfiguration.destinationTable;
this.createDisposition = loadConfiguration.createDisposition;
this.writeDisposition = loadConfiguration.writeDisposition;
Expand All @@ -76,7 +76,7 @@ private Builder(LoadJobConfiguration loadConfiguration) {
}

private Builder(com.google.api.services.bigquery.model.JobConfiguration configurationPb) {
super(Type.LOAD);
this();
JobConfigurationLoad loadConfigurationPb = configurationPb.getLoad();
this.destinationTable = TableId.fromPb(loadConfigurationPb.getDestinationTable());
if (loadConfigurationPb.getCreateDisposition() != null) {
Expand Down Expand Up @@ -254,7 +254,7 @@ public Builder toBuilder() {
}

@Override
protected ToStringHelper toStringHelper() {
ToStringHelper toStringHelper() {
return super.toStringHelper()
.add("destinationTable", destinationTable)
.add("createDisposition", createDisposition)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ private Builder() {
}

private Builder(QueryJobConfiguration jobConfiguration) {
super(Type.QUERY);
this();
this.query = jobConfiguration.query;
this.destinationTable = jobConfiguration.destinationTable;
this.tableDefinitions = jobConfiguration.tableDefinitions;
Expand All @@ -109,7 +109,7 @@ private Builder(QueryJobConfiguration jobConfiguration) {
}

private Builder(com.google.api.services.bigquery.model.JobConfiguration configurationPb) {
super(Type.QUERY);
this();
JobConfigurationQuery queryConfigurationPb = configurationPb.getQuery();
this.query = queryConfigurationPb.getQuery();
allowLargeResults = queryConfigurationPb.getAllowLargeResults();
Expand Down Expand Up @@ -432,7 +432,7 @@ public Builder toBuilder() {
}

@Override
protected ToStringHelper toStringHelper() {
ToStringHelper toStringHelper() {
return super.toStringHelper()
.add("query", query)
.add("destinationTable", destinationTable)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ public class WriteChannelConfiguration implements LoadConfiguration, Serializabl

private static final long serialVersionUID = 470267591917413578L;

protected final TableId destinationTable;
protected final CreateDisposition createDisposition;
protected final WriteDisposition writeDisposition;
protected final FormatOptions formatOptions;
protected final Integer maxBadRecords;
protected final Schema schema;
protected final Boolean ignoreUnknownValues;
protected final List<String> projectionFields;
private final TableId destinationTable;
private final CreateDisposition createDisposition;
private final WriteDisposition writeDisposition;
private final FormatOptions formatOptions;
private final Integer maxBadRecords;
private final Schema schema;
private final Boolean ignoreUnknownValues;
private final List<String> projectionFields;

public static final class Builder implements LoadConfiguration.Builder {

Expand All @@ -57,9 +57,9 @@ public static final class Builder implements LoadConfiguration.Builder {
private Boolean ignoreUnknownValues;
private List<String> projectionFields;

protected Builder() {}
private Builder() {}

protected Builder(WriteChannelConfiguration writeChannelConfiguration) {
private Builder(WriteChannelConfiguration writeChannelConfiguration) {
this.destinationTable = writeChannelConfiguration.destinationTable;
this.createDisposition = writeChannelConfiguration.createDisposition;
this.writeDisposition = writeChannelConfiguration.writeDisposition;
Expand All @@ -70,7 +70,7 @@ protected Builder(WriteChannelConfiguration writeChannelConfiguration) {
this.projectionFields = writeChannelConfiguration.projectionFields;
}

protected Builder(com.google.api.services.bigquery.model.JobConfiguration configurationPb) {
private Builder(com.google.api.services.bigquery.model.JobConfiguration configurationPb) {
JobConfigurationLoad loadConfigurationPb = configurationPb.getLoad();
this.destinationTable = TableId.fromPb(loadConfigurationPb.getDestinationTable());
if (loadConfigurationPb.getCreateDisposition() != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ public void testSetProjectId() {
}
ExtractJobConfiguration extractConfiguration = EXTRACT_JOB.setProjectId("p").configuration();
assertEquals("p", extractConfiguration.sourceTable().project());
LoadConfiguration loadConfiguration = LOAD_JOB.setProjectId("p").configuration();
LoadJobConfiguration loadConfiguration = LOAD_JOB.setProjectId("p").configuration();
assertEquals("p", loadConfiguration.destinationTable().project());
QueryJobConfiguration queryConfiguration = QUERY_JOB.setProjectId("p").configuration();
assertEquals("p", queryConfiguration.defaultDataset().project());
Expand Down

0 comments on commit 73250ea

Please sign in to comment.