@Override public ReportQuery.Builder from(String reportType) { return from(ReportDefinitionReportType.fromValue(reportType)); }
@Override public ReportQuery build() { validate(); StringBuilder stringBuilder = new StringBuilder(); // Creates SELECT. stringBuilder.append("SELECT "); Joiner.on(", ").skipNulls().appendTo(stringBuilder, fields); // Creates FROM. stringBuilder.append(String.format(" FROM %s", from)); // Creates WHERE. if (!whereBuilders.isEmpty()) { stringBuilder.append( String.format(" WHERE %s", Joiner.on(" AND ").skipNulls().join(whereBuilders))); } // Creates DURING. if (dateRange != null) { stringBuilder.append(String.format(" DURING %s", dateRange)); } else if (startDate != null && endDate != null) { stringBuilder.append( String.format( " DURING %s,%s", startDate.toString(DURING_DATE_FORMAT), endDate.toString(DURING_DATE_FORMAT))); } return new ReportQuery(stringBuilder.toString()); }
/** * Constructs a new report query builder by copying all properties from the passed report query * builder. * * @param builderInterface the report query builder whose properties will be copied to. */ public Builder(BuilderInterface builderInterface) { checkNotNull(builderInterface, "The report query builder cannot be null."); Builder builder = (Builder) builderInterface; proxiedImpl = new ReportQueryBuilderImpl(builder.proxiedImpl); InvocationHandler invocationHandler = new AdsUtilityInvocationHandler( proxiedImpl, AdWordsInternals.getInstance().getAdsUtilityRegistry()); this.proxy = Reflection.newProxy(BuilderInterface.class, invocationHandler); }
/** * Constructs a new report query builder by copying all properties from the passed report query * builder. * * @param builderInterface the report query builder whose properties will be copied to. */ public Builder(BuilderInterface builderInterface) { checkNotNull(builderInterface, "The report query builder cannot be null."); Builder builder = (Builder) builderInterface; proxiedImpl = new ReportQueryBuilderImpl(builder.proxiedImpl); InvocationHandler invocationHandler = new AdsUtilityInvocationHandler( proxiedImpl, AdWordsInternals.getInstance().getAdsUtilityRegistry()); this.proxy = Reflection.newProxy(BuilderInterface.class, invocationHandler); }
/** Constructs a new report query builder. */ public Builder() { proxiedImpl = new ReportQueryBuilderImpl(this); InvocationHandler invocationHandler = new AdsUtilityInvocationHandler( proxiedImpl, AdWordsInternals.getInstance().getAdsUtilityRegistry()); this.proxy = Reflection.newProxy(BuilderInterface.class, invocationHandler); }
@Override public ReportQuery.Builder from(String reportType) { return from(ReportDefinitionReportType.fromValue(reportType)); }
@Override public ReportQuery build() { validate(); StringBuilder stringBuilder = new StringBuilder(); // Creates SELECT. stringBuilder.append("SELECT "); Joiner.on(", ").skipNulls().appendTo(stringBuilder, fields); // Creates FROM. stringBuilder.append(String.format(" FROM %s", from)); // Creates WHERE. if (!whereBuilders.isEmpty()) { stringBuilder.append( String.format(" WHERE %s", Joiner.on(" AND ").skipNulls().join(whereBuilders))); } // Creates DURING. if (dateRange != null) { stringBuilder.append(String.format(" DURING %s", dateRange)); } else if (startDate != null && endDate != null) { stringBuilder.append( String.format( " DURING %s,%s", startDate.toString(DURING_DATE_FORMAT), endDate.toString(DURING_DATE_FORMAT))); } return new ReportQuery(stringBuilder.toString()); }
/** Constructs a new report query builder. */ public Builder() { proxiedImpl = new ReportQueryBuilderImpl(this); InvocationHandler invocationHandler = new AdsUtilityInvocationHandler( proxiedImpl, AdWordsInternals.getInstance().getAdsUtilityRegistry()); this.proxy = Reflection.newProxy(BuilderInterface.class, invocationHandler); }