public final class Pql extends Object
ResultSet combinedResultSet = null
do {
ResultSet resultSet = pqlService.select(pagedStatement);
combinedResultSet = (combinedResultSet == null) ? resultSet :
Pql.combineResultSet(combinedResultSet, resultSet);
// ...
} while(!finishedCollectingResultSets)
//...
CsvFiles.writeCsv(Pql.resultSetToStringArrayList(combinedResultSet), filePath);
Modifier and Type | Method and Description |
---|---|
static com.google.api.ads.dfp.axis.v201705.ResultSet |
combineResultSets(com.google.api.ads.dfp.axis.v201705.ResultSet first,
com.google.api.ads.dfp.axis.v201705.ResultSet second)
Combines the first and second result sets, if and only if, the columns
of both result sets match.
|
static com.google.api.ads.dfp.axis.v201705.Value |
createValue(Object value)
Creates a
Value from the value i.e. |
static Object |
getApiValue(com.google.api.ads.dfp.axis.v201705.Value value)
Gets the underlying value of the
Value object that's comparable
to what would be returned in any other API object (i.e. |
static List<String> |
getColumnLabels(com.google.api.ads.dfp.axis.v201705.ResultSet resultSet)
Gets the column labels for the result set.
|
static Object |
getCsvValue(com.google.api.ads.dfp.axis.v201705.Value value)
Gets the underlying value of the
Value object that should be used
for CSV conversion (i.e. |
static Object |
getNativeValue(com.google.api.ads.dfp.axis.v201705.Value value)
Gets the underlying value of the
Value object that's considered
native to Java (i.e. |
static List<String> |
getRowStringValues(com.google.api.ads.dfp.axis.v201705.Row row)
Gets the values in a row of the result set in the form of a string
list.
|
static String |
resultSetToString(com.google.api.ads.dfp.axis.v201705.ResultSet resultSet)
Gets the result set as a table representation in the form of:
|
static List<String[]> |
resultSetToStringArrayList(com.google.api.ads.dfp.axis.v201705.ResultSet resultSet)
Gets the result set as list of string arrays, which can be transformed to
a CSV using
CsvFiles such as |
static String |
toString(com.google.api.ads.dfp.axis.v201705.Value value)
Creates a String from the Value.
|
public static com.google.api.ads.dfp.axis.v201705.Value createValue(Object value)
Value
from the value i.e. a TextValue
for a
value of type String
, BooleanValue
for type
Boolean
, NumberValue
for type Double
,
Long
, or Integer
, DateTimeValue
for type
DateTime
, and DateValue
for type
Date
. If the value is a Value
, the value is returned.
If the value is null
, an empty TextValue
is returned.value
- the value to convertIllegalArgumentException
- if value cannot be convertedpublic static String toString(com.google.api.ads.dfp.axis.v201705.Value value)
DateTimes.toString(Date)
and
DateTimes.toStringWithTimeZone(DateTime)
respectively.value
- the value to convertIllegalArgumentException
- if value cannot be convertedpublic static Object getApiValue(com.google.api.ads.dfp.axis.v201705.Value value)
Value
object that's comparable
to what would be returned in any other API object (i.e. DateTimeValue
will return an API DateTime, not a Joda DateTime).value
- the value to convertValue
or null
if the
underlying value is nullIllegalArgumentException
- if value cannot be convertedpublic static Object getNativeValue(com.google.api.ads.dfp.axis.v201705.Value value)
Value
object that's considered
native to Java (i.e. DateTimeValue will return a Joda DateTime, not an API
DateTime and DateValue will return a string in the form of "yyyy-MM-dd").value
- the value to convertValue
or null
if the
underlying value is nullIllegalArgumentException
- if value cannot be convertedpublic static Object getCsvValue(com.google.api.ads.dfp.axis.v201705.Value value)
Value
object that should be used
for CSV conversion (i.e. DateTimeValue will return a String representation,
but NumberValue will return a Long or Double).value
- the value to convertValue
or null
if the
underlying value is nullIllegalArgumentException
- if value cannot be convertedpublic static List<String[]> resultSetToStringArrayList(com.google.api.ads.dfp.axis.v201705.ResultSet resultSet)
CsvFiles
such as
ResultSet combinedResultSet = Pql.combineResultSet(resultSet1, resultSet2);
//...
combinedResultSet = Pql.combineResultSet(combinedResultSet, resultSet3);
CsvFiles.writeCsv(Pql.resultSetToStringArrayList(combinedResultSet), filePath);
resultSet
- the result set to convert to a CSV compatible formatpublic static String resultSetToString(com.google.api.ads.dfp.axis.v201705.ResultSet resultSet) throws IllegalAccessException
+-------+-------+-------+ |column1|column2|column3| +-------+-------+-------+ |value1 |value2 |value3 | +-------+-------+-------+ |value1 |value2 |value3 | +-------+-------+-------+
resultSet
- the result set to display as a stringIllegalAccessException
- if the values of the result set cannot be
accessedpublic static List<String> getColumnLabels(com.google.api.ads.dfp.axis.v201705.ResultSet resultSet)
resultSet
- the result set to get the column labels forpublic static List<String> getRowStringValues(com.google.api.ads.dfp.axis.v201705.Row row)
row
- the row to get the values forpublic static com.google.api.ads.dfp.axis.v201705.ResultSet combineResultSets(com.google.api.ads.dfp.axis.v201705.ResultSet first, com.google.api.ads.dfp.axis.v201705.ResultSet second)
IllegalArgumentException
- if the columns of the first result set
don't match the secondCopyright © 2018. All Rights Reserved.