com.microsoft.bingads.v13.bulk.entities.BulkVideoAdExtension Maven / Gradle / Ivy
package com.microsoft.bingads.v13.bulk.entities;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
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.ArrayOfstring;
import com.microsoft.bingads.v13.campaignmanagement.VideoAdExtension;
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;
/**
* Represents a video ad extension that can be read or written in a bulk file.
* This class exposes the properties
* that can be read and written as fields of the Video Ad Extension record in a
* bulk file.
*
* For more information, see Video Ad Extension at
* https://go.microsoft.com/fwlink/?linkid=846127
*
* @see BulkServiceManager
* @see BulkOperation
* @see BulkFileReader
* @see BulkFileWriter
*/
public class BulkVideoAdExtension extends BulkAdExtension {
/**
* Gets the video ad extension.
*/
public VideoAdExtension getVideoAdExtension() {
return getAdExtension();
}
/**
* Sets the video ad extension.
*/
public void setVideoAdExtension(VideoAdExtension videoAdExtension) {
setAdExtension(videoAdExtension);
}
private static final List> MAPPINGS;
static {
List> m = new ArrayList>();
m.add(new SimpleBulkMapping(
StringTable.Name,
new Function() {
@Override
public String apply(BulkVideoAdExtension c) {
return StringExtensions.toOptionalBulkString(c.getAdExtension().getName(), c.getAdExtension().getId());
}
},
new BiConsumer() {
@Override
public void accept(String v, BulkVideoAdExtension c) {
c.getAdExtension().setName(StringExtensions.getValueOrEmptyString(v));
}
}
));
m.add(new SimpleBulkMapping(StringTable.DisplayText,
new Function() {
@Override
public String apply(BulkVideoAdExtension c) {
return StringExtensions.toOptionalBulkString(c.getAdExtension().getDisplayText(), c.getAdExtension().getId());
}
},
new BiConsumer() {
@Override
public void accept(String v, BulkVideoAdExtension c) {
c.getAdExtension().setDisplayText(StringExtensions.getValueOrEmptyString(v));
}
}
));
m.add(new SimpleBulkMapping(StringTable.AltText,
new Function() {
@Override
public String apply(BulkVideoAdExtension c) {
return StringExtensions.toOptionalBulkString(c.getAdExtension().getAlternativeText(), c.getAdExtension().getId());
}
},
new BiConsumer() {
@Override
public void accept(String v, BulkVideoAdExtension c) {
c.getAdExtension().setAlternativeText(StringExtensions.getValueOrEmptyString(v));
}
}
));
m.add(new SimpleBulkMapping(StringTable.ActionText,
new Function() {
@Override
public String apply(BulkVideoAdExtension c) {
return StringExtensions.toOptionalBulkString(c.getAdExtension().getActionText(), c.getAdExtension().getId());
}
},
new BiConsumer() {
@Override
public void accept(String v, BulkVideoAdExtension c) {
c.getAdExtension().setActionText(StringExtensions.getValueOrEmptyString(v));
}
}
));
m.add(new SimpleBulkMapping(StringTable.ThumbnailUrl,
new Function() {
@Override
public String apply(BulkVideoAdExtension t) {
return t.getVideoAdExtension().getThumbnailUrl();
}
},
new BiConsumer() {
@Override
public void accept(String v, BulkVideoAdExtension c) {
c.getVideoAdExtension().setThumbnailUrl(v);
}
}
));
m.add(new SimpleBulkMapping(StringTable.ThumbnailId,
new Function() {
@Override
public String apply(BulkVideoAdExtension c) {
return StringExtensions.toBulkString(c.getAdExtension().getThumbnailId());
}
},
new BiConsumer() {
@Override
public void accept(String v, BulkVideoAdExtension c) {
c.getAdExtension().setThumbnailId(StringExtensions.nullOrLong(v));
}
}
));
m.add(new SimpleBulkMapping(StringTable.VideoId,
new Function() {
@Override
public String apply(BulkVideoAdExtension c) {
return StringExtensions.toBulkString(c.getAdExtension().getVideoId());
}
},
new BiConsumer() {
@Override
public void accept(String v, BulkVideoAdExtension c) {
c.getAdExtension().setVideoId(StringExtensions.nullOrLong(v));
}
}
));
m.add(new SimpleBulkMapping(StringTable.FinalUrl,
new Function() {
@Override
public String apply(BulkVideoAdExtension c) {
return StringExtensions.writeUrls("; ", c.getAdExtension().getFinalUrls(), c.getAdExtension().getId());
}
},
new BiConsumer() {
@Override
public void accept(String v, BulkVideoAdExtension c) {
ArrayOfstring urls = new ArrayOfstring();
List urlArray = StringExtensions.parseUrls(v);
if(urlArray == null) {
urls = null;
} else {
urls.getStrings().addAll(urlArray);
}
c.getAdExtension().setFinalUrls(urls);
}
}
));
m.add(new SimpleBulkMapping(StringTable.FinalMobileUrl,
new Function() {
@Override
public String apply(BulkVideoAdExtension c) {
return StringExtensions.writeUrls("; ", c.getAdExtension().getFinalMobileUrls(), c.getAdExtension().getId());
}
},
new BiConsumer() {
@Override
public void accept(String v, BulkVideoAdExtension c) {
ArrayOfstring urls = new ArrayOfstring();
List urlArray = StringExtensions.parseUrls(v);
if(urlArray == null) {
urls = null;
} else {
urls.getStrings().addAll(urlArray);
}
c.getAdExtension().setFinalMobileUrls(urls);
}
}
));
m.add(new SimpleBulkMapping(StringTable.TrackingTemplate,
new Function() {
@Override
public String apply(BulkVideoAdExtension t) {
return StringExtensions.toOptionalBulkString(t.getAdExtension().getTrackingUrlTemplate(), t.getAdExtension().getId());
}
},
new BiConsumer() {
@Override
public void accept(String v, BulkVideoAdExtension c) {
c.getAdExtension().setTrackingUrlTemplate(StringExtensions.getValueOrEmptyString(v));
}
}
));
m.add(new SimpleBulkMapping(StringTable.CustomParameter,
new Function() {
@Override
public String apply(BulkVideoAdExtension c) {
return StringExtensions.toCustomParaBulkString(c.getAdExtension().getUrlCustomParameters(), c.getAdExtension().getId());
}
},
new BiConsumer() {
@Override
public void accept(String v, BulkVideoAdExtension c) {
try {
c.getAdExtension().setUrlCustomParameters(StringExtensions.parseCustomParameters(v));
} catch (Exception e) {
e.printStackTrace();
}
}
}
));
m.add(new SimpleBulkMapping(StringTable.FinalUrlSuffix,
new Function() {
@Override
public String apply(BulkVideoAdExtension c) {
return StringExtensions.toOptionalBulkString(c.getAdExtension().getFinalUrlSuffix(), c.getAdExtension().getId());
}
},
new BiConsumer() {
@Override
public void accept(String v, BulkVideoAdExtension c) {
c.getAdExtension().setFinalUrlSuffix(StringExtensions.getValueOrEmptyString(v));
}
}
));
MAPPINGS = Collections.unmodifiableList(m);
}
@Override
public void processMappingsFromRowValues(RowValues values) {
VideoAdExtension extension = new VideoAdExtension();
extension.setType("VideoAdExtension");
setAdExtension(extension);
super.processMappingsFromRowValues(values);
MappingHelpers.convertToEntity(values, MAPPINGS, this);
}
@Override
public void processMappingsToRowValues(RowValues values, boolean excludeReadonlyData) {
validatePropertyNotNull(this.getVideoAdExtension(), "VideoAdExtension");
super.processMappingsToRowValues(values, excludeReadonlyData);
MappingHelpers.convertToValues(this, values, MAPPINGS);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy