public static void runExample(
      AdManagerServices adManagerServices, AdManagerSession session, long packageId)
      throws RemoteException {
    // Get the PackageService.
    PackageServiceInterface packageService =
        adManagerServices.get(session, PackageServiceInterface.class);

    // Create a statement to select a single package.
    StatementBuilder statementBuilder = new StatementBuilder()
        .where("id = :id")
        .orderBy("id ASC")
        .limit(1)
        .withBindVariableValue("id", packageId);

    // Get the package.
    PackagePage page = packageService.getPackagesByStatement(statementBuilder.toStatement());

    Package pkg = Iterables.getOnlyElement(Arrays.asList(page.getResults()));

    System.out.printf("Package with ID %d will create proposal line items using"
        + " product package with ID %d.%n", pkg.getId(), pkg.getProductPackageId());

    // Remove limit and offset from statement.
    statementBuilder.removeLimitAndOffset();

    // Create action to activate packages.
    com.google.api.ads.admanager.axis.v201808.CreateProposalLineItemsFromPackages action =
        new com.google.api.ads.admanager.axis.v201808.CreateProposalLineItemsFromPackages();

    // Perform action.
    UpdateResult result = packageService.performPackageAction(
        action, statementBuilder.toStatement());

    if (result != null && result.getNumChanges() > 0) {
      System.out.printf("Number of packages proposal line items were created for: %d%n",
          result.getNumChanges());
    } else {
      System.out.println("No proposal line items were created.");
    }
  }
public static void runExample ( AdManagerServices adManagerServices , AdManagerSession session , long packageId ) throws RemoteException { PackageServiceInterface packageService = adManagerServices . get ( session , PackageServiceInterface . class ) ; StatementBuilder statementBuilder = new StatementBuilder ( ) . where ( "id = :id" ) . orderBy ( "id ASC" ) . limit ( 1 ) . withBindVariableValue ( "id" , packageId ) ; PackagePage page = packageService . getPackagesByStatement ( statementBuilder . toStatement ( ) ) ; Package pkg = Iterables . getOnlyElement ( Arrays . asList ( page . getResults ( ) ) ) ; System . out . printf ( "Package with ID %d will create proposal line items using" + " product package with ID %d.%n" , pkg . getId ( ) , pkg . getProductPackageId ( ) ) ; statementBuilder . removeLimitAndOffset ( ) ; com . google . api . ads . admanager . axis . v201808 . CreateProposalLineItemsFromPackages action = new com . google . api . ads . admanager . axis . v201808 . CreateProposalLineItemsFromPackages ( ) ; UpdateResult result = packageService . performPackageAction ( action , statementBuilder . toStatement ( ) ) ; if ( result != null && result . getNumChanges ( ) > 0 ) { System . out . printf ( "Number of packages proposal line items were created for: %d%n" , result . getNumChanges ( ) ) ; } else { System . out . println ( "No proposal line items were created." ) ; } }
Runs the example.

@param adManagerServices the services factory.
@param session the session.
@param packageId the ID of the package to create line items from.
@throws ApiException if the API request failed with one or more service errors.
@throws RemoteException if the API request failed due to other errors.