예제 #1
0
  public static void runExample(DfaServices dfaServices, DfaSession session, String searchString)
      throws Exception {
    // Request the user service.
    UserRemote userService = dfaServices.get(session, UserRemote.class);

    // Get users that match the search criteria.
    UserSearchCriteria userSearchCriteria = new UserSearchCriteria();
    userSearchCriteria.setSearchString(searchString);
    userSearchCriteria.setPageSize(10);
    UserRecordSet userRecordSet = userService.getUsersByCriteria(userSearchCriteria);

    // Display user names, IDs, network IDs, subnetwork IDs, and group IDs.
    if (userRecordSet.getRecords().length > 0) {
      for (User user : userRecordSet.getRecords()) {
        System.out.printf(
            "User with name \"%s\", ID \"%s\", network ID \"%s\", subnetwork ID"
                + " \"%s\", and user role id \"%s\" was found.%n",
            user.getName(),
            user.getId(),
            user.getNetworkId(),
            user.getSubnetworkId(),
            user.getUserGroupId());
      }
    } else {
      System.out.println("No users found for your criteria.");
    }
  }
  public static void runExample(
      DfaServices dfaServices,
      DfaSession session,
      String creativeName,
      String mobileAssetFileName,
      long advertiserId,
      long campaignId)
      throws Exception {
    // Request the service.
    CreativeRemote service = dfaServices.get(session, CreativeRemote.class);

    // Create the mobile display creative.
    MobileDisplayCreative mobileDisplayCreative = new MobileDisplayCreative();
    mobileDisplayCreative.setAdvertiserId(advertiserId);
    mobileDisplayCreative.setName(creativeName);
    mobileDisplayCreative.setArchived(false);
    // The type ID for mobile creatives is 30. See GetCreativeTypes.java
    mobileDisplayCreative.setTypeId(30);

    // Set the mobile creative asset.
    HTMLCreativeAsset htmlCreativeAsset = new MobileDisplayCreativeAsset();
    htmlCreativeAsset.setAssetFilename(mobileAssetFileName);
    mobileDisplayCreative.setCreativeAssets(new HTMLCreativeAsset[] {htmlCreativeAsset});

    // Save the mobile display creative.
    CreativeSaveResult creativeSaveResult = service.saveCreative(mobileDisplayCreative, campaignId);

    // Display the new creative ID.
    System.out.printf(
        "Mobile display creative with ID \"%s\" was created.%n", creativeSaveResult.getId());
  }
  public static void runExample(DfaServices dfaServices, DfaSession session) throws Exception {
    // Request the service.
    SpotlightRemote service = dfaServices.get(session, SpotlightRemote.class);

    // Get method types.
    SpotlightTagMethodType[] spotlightTagMethodTypes = service.getSpotlightTagMethodTypes();

    // Display method type names and IDs.
    for (SpotlightTagMethodType result : spotlightTagMethodTypes) {
      System.out.println(
          "Method type with name \""
              + result.getName()
              + "\" and ID \""
              + result.getId()
              + "\" was found.");
    }
  }
예제 #4
0
  public static void runExample(DfaServices dfaServices, DfaSession session) throws Exception {
    // Request the service.
    AdRemote service = dfaServices.get(session, AdRemote.class);

    // Get ad types.
    AdType[] adTypes = service.getAdTypes();

    // Display ad type and its ID.
    for (AdType result : adTypes) {
      System.out.println(
          "Ad type with name \""
              + result.getName()
              + "\" and ID \""
              + result.getId()
              + "\" was found.");
    }
  }
  public static void runExample(
      DfaServices dfaServices,
      DfaSession session,
      String assetName,
      String pathToFile,
      long advertiserId)
      throws Exception {
    // Request the service.
    CreativeRemote service = dfaServices.get(session, CreativeRemote.class);

    // Create the HTML asset.
    CreativeAsset swfAsset = new CreativeAsset();
    swfAsset.setForHTMLCreatives(true);
    swfAsset.setName(assetName);
    swfAsset.setContent(Media.getMediaDataFromFile(pathToFile));
    swfAsset.setAdvertiserId(advertiserId);

    // Save the asset.
    CreativeAssetSaveResult creativeAssetSaveResult = service.saveCreativeAsset(swfAsset);

    // Display the new asset file name.
    System.out.printf(
        "Asset was saved with file name of \"%s\".%n", creativeAssetSaveResult.getSavedFilename());
  }