Examples of LineItem


Examples of com.acme.jpa.model.LineItem

      {
         em.createQuery("delete from Record").executeUpdate();
      }
      List<Record> records = new ArrayList<Record>();
      Record a = new Record("Record A");
      LineItem l1 = new LineItem(new BigDecimal(50));
      a.addLineItem(l1);
      em.persist(a);
      records.add(a);
      return records;
   }
View Full Code Here

Examples of com.google.api.ads.dfp.axis.v201302.LineItem

    // Create targeting.
    Targeting targeting = new Targeting();
    targeting.setInventoryTargeting(inventoryTargeting);

    // Create a line item.
    LineItem lineItem = new LineItem();
    lineItem.setTargeting(targeting);
    lineItem.setLineItemType(LineItemType.SPONSORSHIP);

    // Set the roadblocking type.
    lineItem.setRoadblockingType(RoadblockingType.ONE_OR_MORE);

    // Set the creative rotation type.
    lineItem.setCreativeRotationType(CreativeRotationType.OPTIMIZED);

    // Create creative placeholder size.
    Size size = new Size();
    size.setWidth(300);
    size.setHeight(250);
    size.setIsAspectRatio(false);

    // Create the creative placeholder.
    CreativePlaceholder creativePlaceholder = new CreativePlaceholder();
    creativePlaceholder.setSize(size);

    // Set the size of creatives that can be associated with this line item.
    lineItem.setCreativePlaceholders(new CreativePlaceholder[] {creativePlaceholder});

    // Set the length of the line item to run.
    lineItem.setStartDateTimeType(StartDateTimeType.IMMEDIATELY);
    lineItem.setEndDateTime(
        DateTimes.toDateTime(Instant.now().plus(Duration.standardDays(30L)), "America/New_York"));

    // Set the cost type.
    lineItem.setCostType(CostType.CPM);

    // Set the line item to use 50% of the impressions.
    lineItem.setUnitType(UnitType.IMPRESSIONS);
    lineItem.setUnitsBought(50L);

    // Get forecast for line item.
    Forecast forecast = forecastService.getForecast(lineItem);

    long matched = forecast.getMatchedUnits();
View Full Code Here

Examples of com.google.api.ads.dfp.axis.v201306.LineItem

    // Get the drop-down custom field ID.
    long dropDownCustomFieldId =
        customFieldService.getCustomFieldOption(customFieldOptionId).getCustomFieldId();

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

    // Create number custom field value.
    NumberValue numberValue = new NumberValue();
    numberValue.setValue("12345");

    CustomFieldValue numberCustomFieldValue = new CustomFieldValue();
    numberCustomFieldValue.setCustomFieldId(numberCustomFieldId);
    numberCustomFieldValue.setValue(numberValue);

    // Create drop-down custom field value.
    DropDownCustomFieldValue dropDownCustomFieldValue = new DropDownCustomFieldValue();
    dropDownCustomFieldValue.setCustomFieldId(dropDownCustomFieldId);
    dropDownCustomFieldValue.setCustomFieldOptionId(customFieldOptionId);

    // Create a combined custom field value list of existing different custom
    // field values and new ones.
    List<BaseCustomFieldValue> combinedCustomFieldValues = Lists.newArrayList();
    if (lineItem.getCustomFieldValues() != null) {
      for (BaseCustomFieldValue existingCustomFieldValue : lineItem.getCustomFieldValues()) {
        if (!existingCustomFieldValue.getCustomFieldId().equals(numberCustomFieldId)
            && !existingCustomFieldValue.getCustomFieldId().equals(dropDownCustomFieldId)) {
          combinedCustomFieldValues.add(existingCustomFieldValue);
        }
      }
    }
    combinedCustomFieldValues.addAll(
        Arrays.asList(numberCustomFieldValue, dropDownCustomFieldValue));

    // Set the combined custom field values.
    lineItem.setCustomFieldValues(combinedCustomFieldValues.toArray(new BaseCustomFieldValue[]{}));

    // Update the line item on the server.
    LineItem[] lineItems = lineItemService.updateLineItems(new LineItem[] {lineItem});

    for (LineItem updatedLineItem : lineItems) {
View Full Code Here

Examples of com.google.api.ads.dfp.axis.v201308.LineItem

    // Set the custom targeting.
    targeting.setCustomTargeting(topCustomCriteriaSet);

    // Create a line item.
    LineItem lineItem = new LineItem();
    lineItem.setName("Line item #" + new Random().nextInt(Integer.MAX_VALUE));
    lineItem.setOrderId(orderId);
    lineItem.setTargeting(targeting);

    // Allow the line item to be booked even if there is not enough inventory.
    lineItem.setAllowOverbook(true);

    // Set the line item type to STANDARD and priority to High. In this case,
    // 8 would be Normal, and 10 would be Low.
    lineItem.setLineItemType(LineItemType.STANDARD);
    lineItem.setPriority(6);

    // Set the creative rotation type to even.
    lineItem.setCreativeRotationType(CreativeRotationType.EVEN);

    // Create creative placeholder size.
    Size size = new Size();
    size.setWidth(300);
    size.setHeight(250);
    size.setIsAspectRatio(false);

    // Create the creative placeholder.
    CreativePlaceholder creativePlaceholder = new CreativePlaceholder();
    creativePlaceholder.setSize(size);

    // Set the size of creatives that can be associated with this line item.
    lineItem.setCreativePlaceholders(new CreativePlaceholder[] {creativePlaceholder});

    // Set the length of the line item to run.
    lineItem.setStartDateTimeType(StartDateTimeType.IMMEDIATELY);
    lineItem.setEndDateTime(
        DateTimes.toDateTime(Instant.now().plus(Duration.standardDays(30L)), "America/New_York"));

    // Set the cost per unit to $2.
    lineItem.setCostType(CostType.CPM);
    lineItem.setCostPerUnit(new Money("USD", 2000000L));

    // Set the number of units bought to 500,000 so that the budget is
    // $1,000.
    lineItem.setUnitsBought(500000L);
    lineItem.setUnitType(UnitType.IMPRESSIONS);

    // Create the line item on the server.
    LineItem[] lineItems = lineItemService.createLineItems(new LineItem[] {lineItem});

    for (LineItem createdLineItem : lineItems) {
View Full Code Here

Examples of com.google.api.ads.dfp.axis.v201311.LineItem

    // Get the drop-down custom field ID.
    long dropDownCustomFieldId =
        customFieldService.getCustomFieldOption(customFieldOptionId).getCustomFieldId();

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

    // Create number custom field value.
    NumberValue numberValue = new NumberValue();
    numberValue.setValue("12345");

    CustomFieldValue numberCustomFieldValue = new CustomFieldValue();
    numberCustomFieldValue.setCustomFieldId(numberCustomFieldId);
    numberCustomFieldValue.setValue(numberValue);

    // Create drop-down custom field value.
    DropDownCustomFieldValue dropDownCustomFieldValue = new DropDownCustomFieldValue();
    dropDownCustomFieldValue.setCustomFieldId(dropDownCustomFieldId);
    dropDownCustomFieldValue.setCustomFieldOptionId(customFieldOptionId);

    // Create a combined custom field value list of existing different custom
    // field values and new ones.
    List<BaseCustomFieldValue> combinedCustomFieldValues = Lists.newArrayList();
    if (lineItem.getCustomFieldValues() != null) {
      for (BaseCustomFieldValue existingCustomFieldValue : lineItem.getCustomFieldValues()) {
        if (!existingCustomFieldValue.getCustomFieldId().equals(numberCustomFieldId)
            && !existingCustomFieldValue.getCustomFieldId().equals(dropDownCustomFieldId)) {
          combinedCustomFieldValues.add(existingCustomFieldValue);
        }
      }
    }
    combinedCustomFieldValues.addAll(
        Arrays.asList(numberCustomFieldValue, dropDownCustomFieldValue));

    // Set the combined custom field values.
    lineItem.setCustomFieldValues(combinedCustomFieldValues.toArray(new BaseCustomFieldValue[]{}));

    // Update the line item on the server.
    LineItem[] lineItems = lineItemService.updateLineItems(new LineItem[] {lineItem});

    for (LineItem updatedLineItem : lineItems) {
View Full Code Here

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

          new CustomCriteriaNode[] {customCriteria2, customCriteria3});
      topCustomCriteriaSet.setChildren(
          new CustomCriteriaNode[] {customCriteria1, subCustomCriteriaSet});

      // Set the custom criteria targeting on the line item.
      LineItem lineItem = lineItemService.getLineItem(lineItemId);
      lineItem.getTargeting().setCustomTargeting(topCustomCriteriaSet);

      // Update the line items on the server.
      lineItem = lineItemService.updateLineItem(lineItem);

      // Display the updated line item.
      System.out.printf("Line item with ID %s update with custom criteria targeting \n%s\n",
          lineItem.getId(),
          getCustomCriteriaSetString(lineItem.getTargeting().getCustomTargeting(), 0));
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
View Full Code Here

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

      Targeting targeting = new Targeting();
      targeting.setInventoryTargeting(inventoryTargeting);
      targeting.setTechnologyTargeting(technologyTargeting);

      // Create local line item object.
      LineItem lineItem = new LineItem();
      lineItem.setName("Mobile line item");
      lineItem.setOrderId(orderId);
      lineItem.setTargeting(targeting);
      lineItem.setLineItemType(LineItemType.STANDARD);
      lineItem.setAllowOverbook(true);

      // Set the target platform to mobile.
      lineItem.setTargetPlatform(TargetPlatform.MOBILE);

      // Set the creative rotation type to even.
      lineItem.setCreativeRotationType(CreativeRotationType.EVEN);

      // Create the creative placeholder.
      CreativePlaceholder creativePlaceholder = new CreativePlaceholder();
      creativePlaceholder.setSize(new Size(300, 250, false));

      // Set the size of creatives that can be associated with this line item.
      lineItem.setCreativePlaceholders(new CreativePlaceholder[] {creativePlaceholder});

      // Set the length of the line item to run.
      lineItem.setStartDateTimeType(StartDateTimeType.IMMEDIATELY);
      lineItem.setEndDateTime(DateTimeUtils.fromString("2012-09-01T00:00:00"));

      // Set the cost per unit to $2.
      lineItem.setCostType(CostType.CPM);
      lineItem.setCostPerUnit(new Money("USD", 2000000L));

      // Set the number of units bought to 500,000 so that the budget is
      // $1,000.
      lineItem.setUnitsBought(500000L);
      lineItem.setUnitType(UnitType.IMPRESSIONS);

      // Create the line item on the server.
      lineItem = lineItemService.createLineItem(lineItem);

      if (lineItem != null) {
        System.out.println("A line item with ID \"" + lineItem.getId()
            + "\", belonging to order ID \"" + lineItem.getOrderId() + "\", and named \""
            + lineItem.getName() + "\" was created.");
      } else {
        System.out.println("No line item created.");
      }
    } catch (Exception e) {
      e.printStackTrace();
View Full Code Here

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

      // Get the drop-down custom field.
      DropDownCustomField dropDownCustomField =
          (DropDownCustomField) customFieldService.getCustomField(dropDownCustomFieldId);

      // 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);

      DropDownCustomFieldValue dropDownCustomFieldValue = new DropDownCustomFieldValue();
      dropDownCustomFieldValue.setCustomFieldId(dropDownCustomFieldId);
      dropDownCustomFieldValue.setCustomFieldOptionId(customFieldOptionId);
      customFieldValues.add(dropDownCustomFieldValue);

      // Only add existing custom field values for different custom fields than
      // the ones you are setting.
      if (lineItem.getCustomFieldValues() != null) {
        for (BaseCustomFieldValue oldCustomFieldValue : lineItem.getCustomFieldValues()) {
          if (!oldCustomFieldValue.getCustomFieldId().equals(customFieldId)
              && !oldCustomFieldValue.getCustomFieldId().equals(dropDownCustomFieldId)) {
            customFieldValues.add(oldCustomFieldValue);
          }
        }
      }

      lineItem.setCustomFieldValues(customFieldValues.toArray(new BaseCustomFieldValue[]{}));

      // Update the line item on the server.
      LineItem[] lineItems = lineItemService.updateLineItems(new LineItem[] {lineItem});

      if (lineItems != null) {
        for (LineItem updatedLineItem : lineItems) {
          List<String> customFieldValueStrings = new ArrayList<String>();
          for (BaseCustomFieldValue baseCustomFieldValue : lineItem.getCustomFieldValues()) {
            if (baseCustomFieldValue instanceof CustomFieldValue
                && ((CustomFieldValue) baseCustomFieldValue).getValue() instanceof TextValue) {
              customFieldValueStrings.add("{ID: '" + baseCustomFieldValue.getCustomFieldId()
                  + "', value: '"
                  + ((TextValue) ((CustomFieldValue) baseCustomFieldValue).getValue()).getValue()
                  + "'}");
            } else if (baseCustomFieldValue instanceof DropDownCustomFieldValue) {
              customFieldValueStrings.add("{ID: '" + baseCustomFieldValue.getCustomFieldId()
                  + "', custom field option ID: '"
                  + ((DropDownCustomFieldValue) baseCustomFieldValue).getCustomFieldOptionId()
                  + "'}");
            }
          }
          System.out.println("A line item with ID \"" + lineItem.getId()
              + "\" set with custom field values \""
              + StringUtils.join(customFieldValueStrings, ","));
        }
      } else {
        System.out.println("No line items were updated.");
View Full Code Here

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

    // Set the end date time to have the line line item run till.
    String endDateTime = "INSERT_END_DATE_TIME_HERE";

    // Create prospective line item.
    LineItem lineItem = new LineItem();
    lineItem.setLineItemType(LineItemType.SPONSORSHIP);
    lineItem.setTargeting(targeting);

    // Create the creative placeholder.
    CreativePlaceholder creativePlaceholder = new CreativePlaceholder();
    creativePlaceholder.setSize(new Size(300, 250, false));

    // Set the size of creatives that can be associated with this line item.
    lineItem.setCreativePlaceholders(new CreativePlaceholder[] {creativePlaceholder});

    // Set the line item's time to be now until the projected end date time.
    lineItem.setStartDateTimeType(StartDateTimeType.IMMEDIATELY);
    lineItem.setEndDateTime(DateTimeUtils.fromString(endDateTime));

    // Set the line item to use 50% of the impressions.
    lineItem.setUnitType(UnitType.IMPRESSIONS);
    lineItem.setUnitsBought(50L);

    // Set the cost type to match the unit type.
    lineItem.setCostType(CostType.CPM);

    // Get forecast for line item.
    Forecast forecast = forecastService.getForecast(lineItem);

    // Display results.
View Full Code Here

Examples of com.google.api.ads.dfp.v201211.LineItem

    // Set the end date time to have the line line item run till.
    String endDateTime = "INSERT_END_DATE_TIME_HERE";

    // Create prospective line item.
    LineItem lineItem = new LineItem();
    lineItem.setLineItemType(LineItemType.SPONSORSHIP);
    lineItem.setTargeting(targeting);

    // Create the creative placeholder.
    CreativePlaceholder creativePlaceholder = new CreativePlaceholder();
    creativePlaceholder.setSize(new Size(300, 250, false));

    // Set the size of creatives that can be associated with this line item.
    lineItem.setCreativePlaceholders(new CreativePlaceholder[] {creativePlaceholder});

    // Set the line item's time to be now until the projected end date time.
    lineItem.setStartDateTimeType(StartDateTimeType.IMMEDIATELY);
    lineItem.setEndDateTime(DateTimeUtils.fromString(endDateTime));

    // Set the line item to use 50% of the impressions.
    lineItem.setUnitType(UnitType.IMPRESSIONS);
    lineItem.setUnitsBought(50L);

    // Set the cost type to match the unit type.
    lineItem.setCostType(CostType.CPM);

    // Get forecast for line item.
    Forecast forecast = forecastService.getForecast(lineItem);

    // Display results.
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.