com.microsoft.bingads.v13.internal.bulk.entities.BulkNegativeSiteIdentifier 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.internal.bulk.entities;
import com.microsoft.bingads.v13.bulk.entities.Status;
import com.microsoft.bingads.v13.internal.bulk.StringExtensions;
import com.microsoft.bingads.v13.internal.bulk.StringTable;
import com.microsoft.bingads.v13.internal.bulk.BulkMapping;
import com.microsoft.bingads.v13.internal.bulk.DynamicColumnNameMapping;
import com.microsoft.bingads.v13.internal.bulk.MappingHelpers;
import com.microsoft.bingads.v13.internal.bulk.SimpleBulkMapping;
import com.microsoft.bingads.internal.functionalinterfaces.BiConsumer;
import com.microsoft.bingads.internal.functionalinterfaces.Function;
import com.microsoft.bingads.v13.internal.bulk.RowValues;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/**
* Reserved for internal use.
*/
public abstract class BulkNegativeSiteIdentifier extends BulkEntityIdentifier {
private Status status;// { get; set; }
private long entityId;// { get; set; }
private String entityName;// { get; set; }
public Status getStatus() {
return status;
}
public void setStatus(Status status) {
this.status = status;
}
public long getEntityId() {
return entityId;
}
public void setEntityId(long entityId) {
this.entityId = entityId;
}
public String getEntityName() {
return entityName;
}
public void setEntityName(String entityName) {
this.entityName = entityName;
}
protected abstract String getParentColumnName();
private static List> MAPPINGS;
static {
List> m = new ArrayList>();
m.add(new SimpleBulkMapping(StringTable.Status,
new Function() {
@Override
public String apply(BulkNegativeSiteIdentifier c) {
return StringExtensions.toStatusBulkString(c.getStatus());
}
},
new BiConsumer() {
@Override
public void accept(String v, BulkNegativeSiteIdentifier c) {
c.setStatus(StringExtensions.parseOptional(v, new Function() {
@Override
public Status apply(String value) {
return Status.fromValue(value);
}
}));
}
}
));
m.add(new SimpleBulkMapping(StringTable.ParentId,
new Function() {
@Override
public String apply(BulkNegativeSiteIdentifier c) {
return c.getEntityId() == 0 ? null : Long.toString(c.getEntityId());
}
},
new BiConsumer() {
@Override
public void accept(String v, BulkNegativeSiteIdentifier c) {
c.setEntityId(StringExtensions.parse(v, new Function() {
@Override
public Long apply(String value) {
return value == null || value.isEmpty() ? 0L : Long.parseLong(value);
}
}));
}
}
));
m.add(new DynamicColumnNameMapping(
new Function() {
@Override
public String apply(BulkNegativeSiteIdentifier c) {
return c.getParentColumnName();
}
},
new Function() {
@Override
public String apply(BulkNegativeSiteIdentifier c) {
return c.getEntityName();
}
},
new BiConsumer() {
@Override
public void accept(String v, BulkNegativeSiteIdentifier c) {
c.setEntityName(v);
}
}
));
MAPPINGS = Collections.unmodifiableList(m);
}
@Override
public void readFromRowValues(RowValues values) {
MappingHelpers.convertToEntity(values, MAPPINGS, this);
}
@Override
public void writeToRowValues(RowValues values, boolean excludeReadonlyData) {
MappingHelpers.convertToValues(this, values, MAPPINGS);
}
@Override
public boolean isDeleteRow() {
return status == Status.DELETED;
}
}