com.microsoft.bingads.v13.bulk.entities.BulkVideo Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of microsoft.bingads Show documentation
Show all versions of microsoft.bingads Show documentation
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.
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.Video;
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 a video that can be read or written in a bulk file.
*
*
* Properties of this class and of classes that it is derived from, correspond to fields of the Video record in a bulk file.
* For more information, see Video at
* https://go.microsoft.com/fwlink/?linkid=846127.
*
*
* @see BulkServiceManager
* @see BulkOperation
* @see BulkFileReader
* @see BulkFileWriter
*/
public class BulkVideo extends SingleRecordBulkEntity {
private Long accountId;
private Video video;
private static final List> MAPPINGS;
static {
List> m = new ArrayList>();
m.add(new SimpleBulkMapping(StringTable.Id,
new Function() {
@Override
public Long apply(BulkVideo t) {
return t.getVideo().getId();
}
},
new BiConsumer() {
@Override
public void accept(String v, BulkVideo c) {
c.getVideo().setId(StringExtensions.nullOrLong(v));
}
}
));
m.add(new SimpleBulkMapping(StringTable.ParentId,
new Function() {
@Override
public Long apply(BulkVideo t) {
return t.getAccountId();
}
},
new BiConsumer() {
@Override
public void accept(String v, BulkVideo c) {
c.setAccountId(StringExtensions.parseOptional(v, new Function() {
@Override
public Long apply(String value) {
return Long.parseLong(value);
}
}));
}
}
));
m.add(new SimpleBulkMapping(StringTable.Status,
new Function() {
@Override
public String apply(BulkVideo t) {
return t.getVideo().getStatus();
}
},
new BiConsumer() {
@Override
public void accept(String v, BulkVideo c) {
c.getVideo().setStatus(v);
}
}
));
m.add(new SimpleBulkMapping(StringTable.Description,
new Function() {
@Override
public String apply(BulkVideo t) {
return t.getVideo().getDescription();
}
},
new BiConsumer() {
@Override
public void accept(String v, BulkVideo c) {
c.getVideo().setDescription(v);
}
}
));
m.add(new SimpleBulkMapping(StringTable.AspectRatio,
new Function() {
@Override
public String apply(BulkVideo t) {
return t.getVideo().getAspectRatio();
}
},
new BiConsumer() {
@Override
public void accept(String v, BulkVideo c) {
c.getVideo().setAspectRatio(v);
}
}
));
m.add(new SimpleBulkMapping(StringTable.Url,
new Function() {
@Override
public String apply(BulkVideo t) {
return t.getVideo().getUrl();
}
},
new BiConsumer() {
@Override
public void accept(String v, BulkVideo c) {
c.getVideo().setUrl(v);
}
}
));
m.add(new SimpleBulkMapping(StringTable.SourceUrl,
new Function() {
@Override
public String apply(BulkVideo t) {
return t.getVideo().getSourceUrl();
}
},
new BiConsumer() {
@Override
public void accept(String v, BulkVideo c) {
c.getVideo().setSourceUrl(v);
}
}
));
m.add(new SimpleBulkMapping(StringTable.ThumbnailUrl,
new Function() {
@Override
public String apply(BulkVideo t) {
return t.getVideo().getThumbnailUrl();
}
},
new BiConsumer() {
@Override
public void accept(String v, BulkVideo c) {
c.getVideo().setThumbnailUrl(v);
}
}
));
m.add(new SimpleBulkMapping(StringTable.DurationInMillionSeconds,
new Function() {
@Override
public Integer apply(BulkVideo t) {
return t.getVideo().getDurationInMilliseconds();
}
},
new BiConsumer() {
@Override
public void accept(String v, BulkVideo c) {
c.getVideo().setDurationInMilliseconds(StringExtensions.parseOptional(v, new Function() {
@Override
public Integer apply(String value) {
return Integer.parseInt(value);
}
}));
}
}
));
MAPPINGS = Collections.unmodifiableList(m);
}
/**
* Gets the account id
* */
public Long getAccountId() {
return accountId;
}
/**
* Sets the account id
* */
public void setAccountId(Long accountId) {
this.accountId = accountId;
}
/**
* Gets the video.
*/
public Video getVideo() {
return video;
}
/**
* Sets the video.
*/
public void setVideo(Video video) {
this.video = video;
}
@Override
public void processMappingsFromRowValues(RowValues values) {
this.setVideo(new Video());
MappingHelpers.convertToEntity(values, MAPPINGS, this);
}
@Override
public void processMappingsToRowValues(RowValues values, boolean excludeReadonlyData) {
validatePropertyNotNull(getVideo(), "Video");
MappingHelpers.convertToValues(this, values, MAPPINGS);
}
}