Package com.google.api.ads.dfp.v201208

Examples of com.google.api.ads.dfp.v201208.TextValue


      // Set the ID of the suggested ad unit to get.
      String suggestedAdUnitId = "INSERT_SUGGESTED_AD_UNIT_ID_HERE";

      // Get the suggested ad unit.
      SuggestedAdUnit suggestedAdUnit =
          suggestedAdUnitService.getSuggestedAdUnit(suggestedAdUnitId);

      if (suggestedAdUnit != null) {
        System.out.println("Suggested ad unit with ID \"" + suggestedAdUnit.getId()
            + "\", and number of requests \"" + suggestedAdUnit.getNumRequests()
            + "\" was found.");
      } else {
        System.out.println("No suggested ad unit found for this ID.");
      }
    } catch (Exception e) {
View Full Code Here


      Statement filterStatement =
          new StatementBuilder("WHERE numRequests >= :numRequests").putValue("numRequests", 50L)
              .toStatement();

      // Get suggested ad units by statement.
      SuggestedAdUnitPage page =
          suggestedAdUnitService.getSuggestedAdUnitsByStatement(filterStatement);

      if (page.getResults() != null) {
        int i = page.getStartIndex();

        for (SuggestedAdUnit suggestedAdUnit : page.getResults()) {
          System.out.println(i + ") Suggested ad unit with ID \"" + suggestedAdUnit.getId()
              + "\" and number of requests  \"" + suggestedAdUnit.getNumRequests()
              + "\" will be approved.");
          i++;
        }

        System.out.println("Number of suggested ad units to be approved: "
            + page.getTotalResultSetSize());

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

        // Perform action.
View Full Code Here

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

      // Get the SuggestedAdUnitService.
      SuggestedAdUnitServiceInterface suggestedAdUnitService =
          user.getService(DfpService.V201208.SUGGESTED_AD_UNIT_SERVICE);

      // Set the ID of the suggested ad unit to get.
      String suggestedAdUnitId = "INSERT_SUGGESTED_AD_UNIT_ID_HERE";

      // Get the suggested ad unit.
      SuggestedAdUnit suggestedAdUnit =
          suggestedAdUnitService.getSuggestedAdUnit(suggestedAdUnitId);

      if (suggestedAdUnit != null) {
        System.out.println("Suggested ad unit with ID \"" + suggestedAdUnit.getId()
            + "\", and number of requests \"" + suggestedAdUnit.getNumRequests()
            + "\" was found.");
View Full Code Here

      Statement filterStatement =
          new StatementBuilder("ORDER BY name LIMIT 500")
              .toStatement();

      // Get teams by statement.
      TeamPage page = teamService.getTeamsByStatement(filterStatement);

      // Display results.
      if (page.getResults() != null) {
        int i = page.getStartIndex();
        for (Team team : page.getResults()) {

          System.out.println(i + ") Team with ID \"" + team.getId()
              + "\" and name \"" + team.getName()
              + "\" was found.");
          i++;
        }
      }

      System.out.println("Number of results found: " + page.getTotalResultSetSize());
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
View Full Code Here

   */
  public static Value createValue(Object value) {
    if (value instanceof Value) {
      return (Value) value;
    } else if (value == null) {
      return new TextValue(null, null);
    } else {
      if (value instanceof Boolean) {
        return new BooleanValue(null, (Boolean) value);
      } else if (value instanceof Double) {
        return new NumberValue(null, value.toString());
      } else if (value instanceof String) {
        return new TextValue(null, (String) value);
      } else if (value instanceof Long) {
        return new NumberValue(null, value.toString());
      } else if (value instanceof DateTime) {
        return new DateTimeValue(null, (DateTime) value);
      } else {
View Full Code Here

      // Get the line item.
      LineItem lineItem = lineItemService.getLineItem(lineItemId);

      // Create custom field values.
      List<BaseCustomFieldValue> customFieldValues = new ArrayList<BaseCustomFieldValue>();
      TextValue textValue = new TextValue();
      textValue.setValue("Custom field value");

      CustomFieldValue customFieldValue = new CustomFieldValue();
      customFieldValue.setCustomFieldId(customFieldId);
      customFieldValue.setValue(textValue);
      customFieldValues.add(customFieldValue);
View Full Code Here

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

        // Perform action.
        UpdateResult result =
            userTeamAssociationService.performUserTeamAssociationAction(action, filterStatement);

        // Display results.
        if (result != null && result.getNumChanges() > 0) {
          System.out.println("Number of teams that the user was removed from: "
              + result.getNumChanges());
        } else {
          System.out.println("No user team associations were deleted.");
        }
      }
    } catch (Exception e) {
View Full Code Here

      // Get the UserTeamAssociationService.
      UserTeamAssociationServiceInterface userTeamAssociationService =
          user.getService(DfpService.V201208.USER_TEAM_ASSOCIATION_SERVICE);

      // Get the UserService.
      UserServiceInterface userService = user.getService(DfpService.V201208.USER_SERVICE);

      // Get the current user.
      long currentUserId = userService.getCurrentUser().getId();

      // Create filter text to select user team associations by the user ID.
      String statementText = "WHERE userId = :userId LIMIT 500";
      Statement filterStatement =
        new StatementBuilder("")
View Full Code Here

      UserTeamAssociation[] userTeamAssociations = new UserTeamAssociation[userIds.length];

      // For each user, associate it with the given team.
      int i = 0;
      for (Long userId : userIds) {
        UserTeamAssociation userTeamAssociation = new UserTeamAssociation();
        userTeamAssociation.setUserId(userId);
        userTeamAssociation.setTeamId(teamId);
        userTeamAssociations[i++] = userTeamAssociation;
      }

      // Create the user team associations on the server.
      userTeamAssociations =
          userTeamAssociationService.createUserTeamAssociations(userTeamAssociations);

      if (userTeamAssociations != null) {
        for (UserTeamAssociation userTeamAssociation : userTeamAssociations) {
          System.out.println("A user team association between user with ID \""
              + userTeamAssociation.getUserId() + "\" and team with ID \""
              + userTeamAssociation.getTeamId() + "\" was created.");
        }
      } else {
        System.out.println("No user team associations created.");
      }
    } catch (Exception e) {
View Full Code Here

      // Set the IDs of the user and team to get the association for.
      Long userId = Long.parseLong("INSERT_USER_ID_HERE");
      Long teamId = Long.parseLong("INSERT_TEAM_ID_HERE");

      // Get the user team association.
      UserTeamAssociation userTeamAssociation =
          userTeamAssociationService.getUserTeamAssociation(teamId, userId);

      if (userTeamAssociation != null) {
        System.out.println("User team association between user with ID \""
            + userTeamAssociation.getUserId() + "\" and team with ID \""
            + userTeamAssociation.getTeamId() + "\" was found.");
      } else {
        System.out.println("No user team association found.");
      }
    } catch (Exception e) {
      e.printStackTrace();
View Full Code Here

TOP

Related Classes of com.google.api.ads.dfp.v201208.TextValue

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.