Package com.google.api.ads.dfp.v201308

Examples of com.google.api.ads.dfp.v201308.PublisherQueryLanguageServiceInterface


public class GetLineItemsNamedLike {

  public static void runExample(DfpServices dfpServices, DfpSession session)
      throws Exception {
    // Get the PublisherQueryLanguageService.
    PublisherQueryLanguageServiceInterface pqlService =
        dfpServices.get(session, PublisherQueryLanguageServiceInterface.class);

    // Create statement to select all line items.
    StatementBuilder statementBuilder = new StatementBuilder()
        .select("Id, Name, Status")
        .from("Line_Item")
        .where("Name LIKE 'line item%'")
        .orderBy("Id ASC")
        .offset(0)
        .limit(StatementBuilder.SUGGESTED_PAGE_LIMIT);

    // Default for result sets.
    ResultSet combinedResultSet = null;
    ResultSet resultSet;
    int i = 0;

    do {
      // Get line items like 'line item%'.
      resultSet = pqlService.select(statementBuilder.toStatement());

      // Combine result sets with previous ones.
      combinedResultSet = combinedResultSet == null
          ? resultSet
          : Pql.combineResultSets(combinedResultSet, resultSet);
View Full Code Here


  private static final String GEO_TARGET_TYPE = "City";

  public static void runExample(DfpServices dfpServices, DfpSession session, String type)
      throws Exception {
    // Get the PublisherQueryLanguageService.
    PublisherQueryLanguageServiceInterface pqlService =
        dfpServices.get(session, PublisherQueryLanguageServiceInterface.class);

    // Create statement to select all targetable cities.
    StatementBuilder statementBuilder = new StatementBuilder()
        .select("Id, Name, CanonicalParentId, ParentIds, CountryCode")
        .from("Geo_Target")
        .where("Type = :type and Targetable = true")
        .orderBy("CountryCode ASC, Name ASC")
        .offset(0)
        .limit(StatementBuilder.SUGGESTED_PAGE_LIMIT)
        .withBindVariableValue("type", type);

    // Default for result sets.
    ResultSet combinedResultSet = null;
    ResultSet resultSet;
    int i = 0;

    do {
      // Get all cities.
      resultSet = pqlService.select(statementBuilder.toStatement());

      // Combine result sets with previous ones.
      combinedResultSet = combinedResultSet == null
          ? resultSet
          : Pql.combineResultSets(combinedResultSet, resultSet);
View Full Code Here

public class GetAllBrowsers {

  public static void runExample(DfpServices dfpServices, DfpSession session)
      throws Exception {
    // Get the PublisherQueryLanguageService.
    PublisherQueryLanguageServiceInterface pqlService =
        dfpServices.get(session, PublisherQueryLanguageServiceInterface.class);

    // Create statement to select all browsers.
    StatementBuilder statementBuilder = new StatementBuilder()
        .select("Id, BrowserName, MajorVersion, MinorVersion")
        .from("Browser")
        .orderBy("BrowserName ASC")
        .offset(0)
        .limit(StatementBuilder.SUGGESTED_PAGE_LIMIT);

    // Default for result sets.
    ResultSet combinedResultSet = null;
    ResultSet resultSet;
    int i = 0;

    do {
      // Get all browsers.
      resultSet = pqlService.select(statementBuilder.toStatement());

      // Combine result sets with previous ones.
      combinedResultSet = combinedResultSet == null
          ? resultSet
          : Pql.combineResultSets(combinedResultSet, resultSet);
View Full Code Here

      // Get DfpUser from "~/dfp.properties".
      DfpUser user = new DfpUser();

      // Get the PublisherQueryLanguageService.
      PublisherQueryLanguageServiceInterface pqlService =
          user.getService(DfpService.V201208.PUBLISHER_QUERY_LANGUAGE_SERVICE);

      // Create statement to select all targetable cities.
      // For criteria that do not have a "targetable" property, that predicate
      // may be left off, i.e. just "SELECT * FROM Browser_Groups LIMIT 500"
      String selectStatement = "SELECT * FROM City WHERE targetable = true LIMIT 500";
      int offset = 0;
      int resultSetSize = 0;
      List<Row> allRows = new ArrayList<Row>();
      ResultSet resultSet;
     
      do {
        StatementBuilder statementBuilder =
            new StatementBuilder(selectStatement + " OFFSET " + offset);
       
        // Get all cities.
        resultSet = pqlService.select(statementBuilder.toStatement());

        // Collect all cities from each page.
        allRows.addAll(Arrays.asList(resultSet.getRows()));
       
        // Display results.
View Full Code Here

      // Get DfpUser from "~/dfp.properties".
      DfpUser user = new DfpUser();

      // Get the PublisherQueryLanguageService.
      PublisherQueryLanguageServiceInterface pqlService =
          user.getService(DfpService.V201211.PUBLISHER_QUERY_LANGUAGE_SERVICE);

      // Create statement to select all targetable cities.
      // For criteria that do not have a "targetable" property, that predicate
      // may be left off, i.e. just "SELECT * FROM Browser_Groups LIMIT 500"
      String selectStatement = "SELECT * FROM City WHERE targetable = true LIMIT 500";
      int offset = 0;
      int resultSetSize = 0;
      List<Row> allRows = new ArrayList<Row>();
      ResultSet resultSet;
     
      do {
        StatementBuilder statementBuilder =
            new StatementBuilder(selectStatement + " OFFSET " + offset);
       
        // Get all cities.
        resultSet = pqlService.select(statementBuilder.toStatement());

        // Collect all cities from each page.
        allRows.addAll(Arrays.asList(resultSet.getRows()));
       
        // Display results.
View Full Code Here

      // Get DfpUser from "~/dfp.properties".
      DfpUser user = new DfpUser();

      // Get the PublisherQueryLanguageService.
      PublisherQueryLanguageServiceInterface pqlService =
          user.getService(DfpService.V201302.PUBLISHER_QUERY_LANGUAGE_SERVICE);

      // Create statement to select all targetable cities.
      // For criteria that do not have a "targetable" property, that predicate
      // may be left off, i.e. just "SELECT * FROM Browser_Groups LIMIT 500"
      String selectStatement = "SELECT * FROM City WHERE targetable = true LIMIT 500";
      int offset = 0;
      int resultSetSize = 0;
      List<Row> allRows = new ArrayList<Row>();
      ResultSet resultSet;
     
      do {
        StatementBuilder statementBuilder =
            new StatementBuilder(selectStatement + " OFFSET " + offset);
       
        // Get all cities.
        resultSet = pqlService.select(statementBuilder.toStatement());

        // Collect all cities from each page.
        allRows.addAll(Arrays.asList(resultSet.getRows()));
       
        // Display results.
View Full Code Here

      // Get DfpUser from "~/dfp.properties".
      DfpUser user = new DfpUser();

      // Get the PublisherQueryLanguageService.
      PublisherQueryLanguageServiceInterface pqlService =
          user.getService(DfpService.V201306.PUBLISHER_QUERY_LANGUAGE_SERVICE);

      // Create statement to select all targetable cities.
      // For criteria that do not have a "targetable" property, that predicate
      // may be left off, i.e. just "SELECT * FROM Browser_Groups LIMIT 500"
      String selectStatement = "SELECT * FROM City WHERE targetable = true LIMIT 500";
      int offset = 0;
      int resultSetSize = 0;
      List<Row> allRows = new ArrayList<Row>();
      ResultSet resultSet;
     
      do {
        StatementBuilder statementBuilder =
            new StatementBuilder(selectStatement + " OFFSET " + offset);
       
        // Get all cities.
        resultSet = pqlService.select(statementBuilder.toStatement());

        // Collect all cities from each page.
        allRows.addAll(Arrays.asList(resultSet.getRows()));
       
        // Display results.
View Full Code Here

      if (lineItemIds.size() > 0) {
        // Modify statement for action.
        filterStatement.setQuery("WHERE id IN (" + StringUtils.join(lineItemIds, ",") + ")");

        // Create action.
        ActivateLineItems action = new ActivateLineItems();

        // Perform action.
        UpdateResult result = lineItemService.performLineItemAction(action, filterStatement);

        // Display results.
View Full Code Here

      // Set the ID of the activity to update.
      Integer activityId = Integer.parseInt("INSERT_ACTIVITY_ID_HERE");

      // Get the activity.
      Activity activity = activityService.getActivity(activityId);

      // Update the expected URL.
      activity.setExpectedURL("http://google.com");

      // Update the activity on the server.
      Activity[] activities = activityService.updateActivities(new Activity[] {activity});

      for (Activity updatedActivity : activities) {
View Full Code Here

      // Set the ID of the activity group to create the activities for.
      Integer activityGroupId = Integer.parseInt("INSERT_ACTIVITY_GROUP_ID_HERE");

      // Create a daily visits activity.
      Activity dailyVisitsActivity = new Activity();
      dailyVisitsActivity.setName("Activity #" + new Random().nextLong());
      dailyVisitsActivity.setActivityGroupId(activityGroupId);
      dailyVisitsActivity.setType(ActivityType.DAILY_VISITS);

      // Create a custom activity.
      Activity customActivity = new Activity();
      customActivity.setName("Activity #" + new Random().nextLong());
      customActivity.setActivityGroupId(activityGroupId);
      customActivity.setType(ActivityType.CUSTOM);

      // Create the activities on the server.
      Activity[] activities =
          activityService.createActivities(new Activity[] {dailyVisitsActivity, customActivity});
View Full Code Here

TOP

Related Classes of com.google.api.ads.dfp.v201308.PublisherQueryLanguageServiceInterface

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.