Package com.google.api.ads.dfa.axis.v1_20

Examples of com.google.api.ads.dfa.axis.v1_20.User


  @Test
  public void otherModuleTransactional() {
    assertNull( userRepository.getUserWithId( 1 ) );

    User user = new User( 1, "user 1" );
    userRepository.save( user );

    closeSession();
    openSession();

    User other = userRepository.getUserWithId( 1 );
    assertNotNull( other );
    assertEquals( user, other );
  }
View Full Code Here


  }

  @Test
  public void combinedSave() {
    Product product = new Product( 2, "product 2" );
    User user = new User( 2, "user 2" );

    userRepository.save( user, product );

    closeSession();
    openSession();

    User otherUser = userRepository.getUserWithId( 2 );
    assertNotNull( otherUser );
    assertEquals( user, otherUser );

    Product otherProduct = productRepository.getProductWithId( 2 );
    assertNotNull( otherProduct );
View Full Code Here

          throws Exception {
    // Request the user service.
    UserRemote userService = dfaServices.get(session, UserRemote.class);

    // Retrieve the user who is to be modified.
    User user = userService.getUser(userId);

    // Create and configure a user filter.
    UserFilter filterToAdd = new UserFilter();
    // The following field has been filled in to make a filter that allows a
    // user to access only the assigned objects.
    // This value was determined using GetUserFilterCriteriaTypes.java.
    filterToAdd.setUserFilterCriteriaId(2);
    // Because this filter used the criteria type "Assigned" it is necessary
    // to specify what advertisers this user has access to. This next step
    // would be skipped for the criteria types "All" and "None".

    // Create an object filter to represent each object the user has access
    // to. Since this is an advertiser filter, an object filter represents an
    // advertiser. The total of object filter objects will need to match the
    // total of advertisers the user is assigned.
    ObjectFilter allowedObject = new ObjectFilter();
    // Insert the advertiser ID of an advertiser assigned to this user.
    allowedObject.setId(advertiserId);
    // Create any additional object filters that are needed, then create an
    // array of all of the object filters for this filter.
    ObjectFilter[] objectFilters = {allowedObject};
    // Add these settings to the user filter
    filterToAdd.setObjectFilters(objectFilters);

    // Add the filter to the user. The following method is specific to
    // advertiser filters. See the User class documentation for the names of
    // methods for other filters.
    user.setAdvertiserUserFilter(filterToAdd);

    // Save the changes made and display a success message.
    UserSaveResult userSaveResult = userService.saveUser(user);
    System.out.printf("User with ID \"%s\" was modified.", userSaveResult.getId());
  }
View Full Code Here

    AdvertiserSearchCriteria advSearchCriteria = new AdvertiserSearchCriteria();
    advSearchCriteria.setPageSize(100);
    // When paging, start counting page numbers from 1 rather than 0.
    advSearchCriteria.setPageNumber(1);

    AdvertiserRecordSet advertiserRecordSet;
    int i = 1;

    do {
      // Get advertisers by criteria.
      advertiserRecordSet = advertiserService.getAdvertisers(
          advSearchCriteria);

      for (Advertiser result : advertiserRecordSet.getRecords()) {
        System.out.printf("%s) Advertiser with name \"%s\", ID \"%s\", and spotlight " +
            "configuration ID \"%s\" was found.%n", i++, result.getName(), result.getId(),
            result.getSpotId());
      }

      advSearchCriteria.setPageNumber(advSearchCriteria.getPageNumber() + 1);
    } while (advSearchCriteria.getPageNumber() <= advertiserRecordSet.getTotalNumberOfPages());

    System.out.printf("Number of results found: %s%n",
        advertiserRecordSet.getTotalNumberOfRecords());
  }
View Full Code Here

*/
public class GetAdvertisers {

  public static void runExample(DfaServices dfaServices, DfaSession session) throws Exception {
    // Request the advertiser service from the service client factory.
    AdvertiserRemote advertiserService = dfaServices.get(session, AdvertiserRemote.class);

    // Create advertiser search criteria structure.
    AdvertiserSearchCriteria advSearchCriteria = new AdvertiserSearchCriteria();
    advSearchCriteria.setPageSize(100);
    // When paging, start counting page numbers from 1 rather than 0.
    advSearchCriteria.setPageNumber(1);

    AdvertiserRecordSet advertiserRecordSet;
    int i = 1;

    do {
      // Get advertisers by criteria.
      advertiserRecordSet = advertiserService.getAdvertisers(
          advSearchCriteria);

      for (Advertiser result : advertiserRecordSet.getRecords()) {
        System.out.printf("%s) Advertiser with name \"%s\", ID \"%s\", and spotlight " +
            "configuration ID \"%s\" was found.%n", i++, result.getName(), result.getId(),
View Full Code Here

  public static void runExample(DfaServices dfaServices, DfaSession session) throws Exception {
    // Request the advertiser service from the service client factory.
    AdvertiserRemote advertiserService = dfaServices.get(session, AdvertiserRemote.class);

    // Create advertiser search criteria structure.
    AdvertiserSearchCriteria advSearchCriteria = new AdvertiserSearchCriteria();
    advSearchCriteria.setPageSize(100);
    // When paging, start counting page numbers from 1 rather than 0.
    advSearchCriteria.setPageNumber(1);

    AdvertiserRecordSet advertiserRecordSet;
    int i = 1;

    do {
      // Get advertisers by criteria.
      advertiserRecordSet = advertiserService.getAdvertisers(
          advSearchCriteria);

      for (Advertiser result : advertiserRecordSet.getRecords()) {
        System.out.printf("%s) Advertiser with name \"%s\", ID \"%s\", and spotlight " +
            "configuration ID \"%s\" was found.%n", i++, result.getName(), result.getId(),
            result.getSpotId());
      }

      advSearchCriteria.setPageNumber(advSearchCriteria.getPageNumber() + 1);
    } while (advSearchCriteria.getPageNumber() <= advertiserRecordSet.getTotalNumberOfPages());

    System.out.printf("Number of results found: %s%n",
        advertiserRecordSet.getTotalNumberOfRecords());
  }
View Full Code Here

      DfaServices dfaServices, DfaSession session, long advertiserId) throws Exception {
    // Request the service.
    ChangeLogRemote service = dfaServices.get(session, ChangeLogRemote.class);

    // Create change log search criteria structure.
    ChangeLogRecordSearchCriteria searchCriteria = new ChangeLogRecordSearchCriteria();
    searchCriteria.setPageSize(10);
    searchCriteria.setObjectId(advertiserId);
    // The following field has been filled in to choose advertiser change
    // logs. This values was determined using GetChangeLogObjectTypes.java.
    searchCriteria.setObjectTypeId(1L);

    // Get change log record set.
    ChangeLogRecordSet changeLogRecordSet = service.getChangeLogRecords(searchCriteria);

    // Set up a formatter to make the change log timestamps human-readable.
View Full Code Here

    // The following field has been filled in to choose advertiser change
    // logs. This values was determined using GetChangeLogObjectTypes.java.
    searchCriteria.setObjectTypeId(1L);

    // Get change log record set.
    ChangeLogRecordSet changeLogRecordSet = service.getChangeLogRecords(searchCriteria);

    // Set up a formatter to make the change log timestamps human-readable.
    SimpleDateFormat dateFormat = new SimpleDateFormat("d MMM yyyy HH:mm");

    // Display the contents of each change log record
    if (changeLogRecordSet.getRecords() != null) {
      for (ChangeLogRecord result : changeLogRecordSet.getRecords()) {
        System.out.println("Action \"" + result.getAction()
            + "\", Context \"" +  result.getContext()
            + "\", Change Date \"" + dateFormat.format(result.getChangeDate().getTime())
            + "\", New Value \"" + result.getNewValue()
            + "\", Old Value \"" + result.getOldValue()
View Full Code Here

  private static final String ADVERTISER_ID = "INSERT_ADVERTISER_ID_HERE";

  public static void runExample(
      DfaServices dfaServices, DfaSession session, long advertiserId) throws Exception {
    // Request the service.
    ChangeLogRemote service = dfaServices.get(session, ChangeLogRemote.class);

    // Create change log search criteria structure.
    ChangeLogRecordSearchCriteria searchCriteria = new ChangeLogRecordSearchCriteria();
    searchCriteria.setPageSize(10);
    searchCriteria.setObjectId(advertiserId);
    // The following field has been filled in to choose advertiser change
    // logs. This values was determined using GetChangeLogObjectTypes.java.
    searchCriteria.setObjectTypeId(1L);

    // Get change log record set.
    ChangeLogRecordSet changeLogRecordSet = service.getChangeLogRecords(searchCriteria);

    // Set up a formatter to make the change log timestamps human-readable.
    SimpleDateFormat dateFormat = new SimpleDateFormat("d MMM yyyy HH:mm");

    // Display the contents of each change log record
View Full Code Here

  public static void runExample(DfaServices dfaServices, DfaSession session) throws Exception {
    // Request the service.
    SpotlightRemote service = dfaServices.get(session, SpotlightRemote.class);

    // Set search criteria.
    CountrySearchCriteria countrySearchCriteria = new CountrySearchCriteria ();
    countrySearchCriteria.setSecure(false);

    // Get countries.
    Country[] countries = service.getCountriesByCriteria(countrySearchCriteria);

    // Display country names, codes and secure server support information.
View Full Code Here

TOP

Related Classes of com.google.api.ads.dfa.axis.v1_20.User

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.