public static void runExample(
      AdManagerServices adManagerServices, AdManagerSession session, long rateCardId)
      throws RemoteException {
    // Get the PremiumRateService.
    PremiumRateServiceInterface premiumRateService =
        adManagerServices.get(session, PremiumRateServiceInterface.class);

    PremiumRate premiumRate = new PremiumRate();

    // Create an ad unit premium to apply to the rate card.
    AdUnitPremiumFeature adUnitPremiumFeature = new AdUnitPremiumFeature();

    // Create a CPM based premium rate value with adjustments in micro amounts.
    // This will adjust a CPM priced proposal line item that has
    // inventory targeting specified by 2 units of the currency associated with
    // the rate card (this comes from absolute value adjustment).
    PremiumRateValue cpmPremiumRateValue = new PremiumRateValue();
    cpmPremiumRateValue.setPremiumFeature(adUnitPremiumFeature);
    cpmPremiumRateValue.setRateType(RateType.CPM);
    cpmPremiumRateValue.setAdjustmentSize(2000000L);
    cpmPremiumRateValue.setAdjustmentType(PremiumAdjustmentType.ABSOLUTE_VALUE);

    // Create a CPC based premium rate value with adjustments in milli amounts.
    // This will adjust a CPC priced proposal line item that has
    // inventory targeting specified by 10% of the cost associated with the rate
    // card (this comes from a percentage adjustment).
    PremiumRateValue cpcPremiumRateValue = new PremiumRateValue();
    cpcPremiumRateValue.setPremiumFeature(adUnitPremiumFeature);
    cpcPremiumRateValue.setRateType(RateType.CPC);
    cpcPremiumRateValue.setAdjustmentSize(10000L);
    cpcPremiumRateValue.setAdjustmentType(PremiumAdjustmentType.PERCENTAGE);

    // Associate premium rate with the rate card and set premium information.
    // This premium will apply for proposal line items targeting 'any' ad unit
    // for both CPM and CPC rate types.
    premiumRate.setRateCardId(rateCardId);
    premiumRate.setPricingMethod(PricingMethod.ANY_VALUE);
    premiumRate.setPremiumFeature(adUnitPremiumFeature);
    premiumRate.setPremiumRateValues(
        new PremiumRateValue[] {cpmPremiumRateValue, cpcPremiumRateValue});

    PremiumRate[] createdPremiumRates =
        premiumRateService.createPremiumRates(new PremiumRate[] {premiumRate});

    for (PremiumRate createdPremiumRate : createdPremiumRates) {
      System.out.printf(
          "A premium rate for '%s' was added to the rate card with ID of %d.%n",
          createdPremiumRate.getPremiumFeature().getClass().getSimpleName(),
          createdPremiumRate.getRateCardId());
    }
  }
public static void runExample ( AdManagerServices adManagerServices , AdManagerSession session , long rateCardId ) throws RemoteException { PremiumRateServiceInterface premiumRateService = adManagerServices . get ( session , PremiumRateServiceInterface . class ) ; PremiumRate premiumRate = new PremiumRate ( ) ; AdUnitPremiumFeature adUnitPremiumFeature = new AdUnitPremiumFeature ( ) ; PremiumRateValue cpmPremiumRateValue = new PremiumRateValue ( ) ; cpmPremiumRateValue . setPremiumFeature ( adUnitPremiumFeature ) ; cpmPremiumRateValue . setRateType ( RateType . CPM ) ; cpmPremiumRateValue . setAdjustmentSize ( 2000000L ) ; cpmPremiumRateValue . setAdjustmentType ( PremiumAdjustmentType . ABSOLUTE_VALUE ) ; PremiumRateValue cpcPremiumRateValue = new PremiumRateValue ( ) ; cpcPremiumRateValue . setPremiumFeature ( adUnitPremiumFeature ) ; cpcPremiumRateValue . setRateType ( RateType . CPC ) ; cpcPremiumRateValue . setAdjustmentSize ( 10000L ) ; cpcPremiumRateValue . setAdjustmentType ( PremiumAdjustmentType . PERCENTAGE ) ; premiumRate . setRateCardId ( rateCardId ) ; premiumRate . setPricingMethod ( PricingMethod . ANY_VALUE ) ; premiumRate . setPremiumFeature ( adUnitPremiumFeature ) ; premiumRate . setPremiumRateValues ( new PremiumRateValue [ ] { cpmPremiumRateValue , cpcPremiumRateValue } ) ; PremiumRate [ ] createdPremiumRates = premiumRateService . createPremiumRates ( new PremiumRate [ ] { premiumRate } ) ; for ( PremiumRate createdPremiumRate : createdPremiumRates ) { System . out . printf ( "A premium rate for '%s' was added to the rate card with ID of %d.%n" , createdPremiumRate . getPremiumFeature ( ) . getClass ( ) . getSimpleName ( ) , createdPremiumRate . getRateCardId ( ) ) ; } }
Runs the example.

@param adManagerServices the services factory.
@param session the session.
@param rateCardId the ID of the rate card to add premium rates to.
@throws ApiException if the API request failed with one or more service errors.
@throws RemoteException if the API request failed due to other errors.