All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.microsoft.bingads.v13.bulk.entities.BulkAudienceGroup Maven / Gradle / Ivy

Go to download

The Bing Ads Java SDK is a library improving developer experience when working with the Bing Ads services by providing high-level access to features such as Bulk API, OAuth Authorization and SOAP API.

There is a newer version: 13.0.22.1
Show newest version
package com.microsoft.bingads.v13.bulk.entities;

import java.text.ParseException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;

import com.microsoft.bingads.internal.UncheckedParseException;
import com.microsoft.bingads.internal.functionalinterfaces.BiConsumer;
import com.microsoft.bingads.internal.functionalinterfaces.Function;
import com.microsoft.bingads.v13.bulk.BulkFileReader;
import com.microsoft.bingads.v13.bulk.BulkFileWriter;
import com.microsoft.bingads.v13.bulk.BulkOperation;
import com.microsoft.bingads.v13.bulk.BulkServiceManager;
import com.microsoft.bingads.v13.campaignmanagement.AudienceGroup;
import com.microsoft.bingads.v13.campaignmanagement.AgeRange;
import com.microsoft.bingads.v13.campaignmanagement.ArrayOflong;
import com.microsoft.bingads.v13.campaignmanagement.ArrayOfstring;
import com.microsoft.bingads.v13.campaignmanagement.AssetGroup;
import com.microsoft.bingads.v13.campaignmanagement.AssetGroupStatus;
import com.microsoft.bingads.v13.campaignmanagement.CallToAction;
import com.microsoft.bingads.v13.campaignmanagement.CampaignType;
import com.microsoft.bingads.v13.campaignmanagement.GenderType;
import com.microsoft.bingads.v13.internal.bulk.BulkMapping;
import com.microsoft.bingads.v13.internal.bulk.MappingHelpers;
import com.microsoft.bingads.v13.internal.bulk.RowValues;
import com.microsoft.bingads.v13.internal.bulk.SimpleBulkMapping;
import com.microsoft.bingads.v13.internal.bulk.StringExtensions;
import com.microsoft.bingads.v13.internal.bulk.StringTable;
import com.microsoft.bingads.v13.internal.bulk.entities.SingleRecordBulkEntity;

/**
 * Represents an Audience Group.
 * 

*

* This class exposes the {@link #setAudienceGroup} and {@link #getAudienceGroup} that can be used to read and write * fields of the Audience Group record in a bulk file. *

*

*

* For more information, see Audience Group at * https://go.microsoft.com/fwlink/?linkid=846127. *

* * @see BulkServiceManager * @see BulkOperation * @see BulkFileReader * @see BulkFileWriter */ public class BulkAudienceGroup extends SingleRecordBulkEntity { private Status status; private Long accountId; private List audienceIds; private List ageRanges; private List genderTypes; private AudienceGroup audienceGroup; private static final List> MAPPINGS; static { List> m = new ArrayList>(); m.add(new SimpleBulkMapping(StringTable.Status, new Function() { @Override public String apply(BulkAudienceGroup c) { return c.getStatus() != null ? c.getStatus().value() : null; } }, new BiConsumer() { @Override public void accept(String v, BulkAudienceGroup c) { c.setStatus(StringExtensions.parseOptional(v, new Function() { @Override public Status apply(String value) { return Status.fromValue(value); } })); } } )); m.add(new SimpleBulkMapping(StringTable.Id, new Function() { @Override public Long apply(BulkAudienceGroup c) { return c.getAudienceGroup().getId(); } }, new BiConsumer() { @Override public void accept(String v, BulkAudienceGroup c) { c.getAudienceGroup().setId(StringExtensions.nullOrLong(v)); } } )); m.add(new SimpleBulkMapping(StringTable.ParentId, new Function() { @Override public Long apply(BulkAudienceGroup c) { return c.getAccountId(); } }, new BiConsumer() { @Override public void accept(String v, BulkAudienceGroup c) { c.setAccountId(StringExtensions.parseOptional(v, new Function() { @Override public Long apply(String value) { return Long.parseLong(value); } })); } } )); m.add(new SimpleBulkMapping(StringTable.AudienceGroupName, new Function() { @Override public String apply(BulkAudienceGroup c) { return c.getAudienceGroup().getName(); } }, new BiConsumer() { @Override public void accept(String v, BulkAudienceGroup c) { c.getAudienceGroup().setName(v); } } )); m.add(new SimpleBulkMapping(StringTable.Audiences, new Function() { @Override public String apply(BulkAudienceGroup c) { return StringExtensions.toLongListBulkString(";", c.getAudienceIds()); } }, new BiConsumer() { @Override public void accept(String v, BulkAudienceGroup c) { c.setAudienceIds(StringExtensions.parseIdList(v)); } } )); m.add(new SimpleBulkMapping(StringTable.AgeRanges, new Function() { @Override public String apply(BulkAudienceGroup c) { return StringExtensions.toAgeRangeListBulkString(";", c.getAgeRanges()); } }, new BiConsumer() { @Override public void accept(String v, BulkAudienceGroup c) { c.setAgeRanges(StringExtensions.parseAgeRangeList(v)); } } )); m.add(new SimpleBulkMapping(StringTable.GenderTypes, new Function() { @Override public String apply(BulkAudienceGroup c) { return StringExtensions.toGenderTypeListBulkString(";", c.getGenderTypes()); } }, new BiConsumer() { @Override public void accept(String v, BulkAudienceGroup c) { c.setGenderTypes(StringExtensions.parseGenderTypeList(v)); } } )); m.add(new SimpleBulkMapping(StringTable.Description, new Function() { @Override public String apply(BulkAudienceGroup c) { return c.getAudienceGroup().getDescription(); } }, new BiConsumer() { @Override public void accept(String v, BulkAudienceGroup c) { c.getAudienceGroup().setDescription(v); } } )); MAPPINGS = Collections.unmodifiableList(m); } @Override public void processMappingsFromRowValues(RowValues values) { this.setAudienceGroup(new AudienceGroup()); MappingHelpers.convertToEntity(values, MAPPINGS, this); } @Override public void processMappingsToRowValues(RowValues values, boolean excludeReadonlyData) { validatePropertyNotNull(getAudienceGroup(), "AudienceGroup"); MappingHelpers.convertToValues(this, values, MAPPINGS); } public AudienceGroup getAudienceGroup() { return audienceGroup; } public void setAudienceGroup(AudienceGroup audienceGroup) { this.audienceGroup = audienceGroup; } public Long getAccountId() { return accountId; } public void setAccountId(Long accountId) { this.accountId = accountId; } public Status getStatus() { return status; } public void setStatus(Status status) { this.status = status; } public List getAudienceIds() { return audienceIds; } public void setAudienceIds(List audienceIds) { this.audienceIds = audienceIds; } public List getAgeRanges() { return ageRanges; } public void setAgeRanges(List ageRanges) { this.ageRanges = ageRanges; } public List getGenderTypes() { return genderTypes; } public void setGenderTypes(List genderTypes) { this.genderTypes = genderTypes; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy