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

com.microsoft.bingads.v13.internal.bulk.entities.BulkAdExtensionIdentifier 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.internal.bulk.entities;

import com.microsoft.bingads.v13.internal.bulk.StringExtensions;
import com.microsoft.bingads.v13.internal.bulk.StringTable;
import com.microsoft.bingads.v13.campaignmanagement.AdExtensionStatus;
import com.microsoft.bingads.v13.internal.bulk.BulkMapping;
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;

public abstract class BulkAdExtensionIdentifier extends BulkEntityIdentifier {

    private Long accountId;

    private Long adExtensionId;

    private AdExtensionStatus status;

    private Integer version;

    private static List> MAPPINGS;

    static {
        List> m = new ArrayList>();

        m.add(new SimpleBulkMapping(StringTable.Id,
                new Function() {
                    @Override
                    public Long apply(BulkAdExtensionIdentifier c) {
                        return c.getAdExtensionId();
                    }
                },
                new BiConsumer() {
                    @Override
                    public void accept(String v, BulkAdExtensionIdentifier c) {
                        c.setAdExtensionId(StringExtensions.parseOptional(v, new Function() {
                            @Override
                            public Long apply(String value) {
                                return Long.parseLong(value);
                            }
                        }));
                    }
                }
        ));

        m.add(new SimpleBulkMapping(StringTable.ParentId,
                new Function() {
                    @Override
                    public Long apply(BulkAdExtensionIdentifier c) {
                        return c.getAccountId();
                    }
                },
                new BiConsumer() {
                    @Override
                    public void accept(String v, BulkAdExtensionIdentifier 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(BulkAdExtensionIdentifier c) {
                        return c.getStatus() != null ? c.getStatus().value() : null;
                    }
                },
                new BiConsumer() {
                    @Override
                    public void accept(String v, BulkAdExtensionIdentifier c) {
                        c.setStatus(StringExtensions.parseOptional(v, new Function() {
                            @Override
                            public AdExtensionStatus apply(String value) {
                                return AdExtensionStatus.fromValue(value);
                            }
                        }));
                    }
                }
        ));

        m.add(new SimpleBulkMapping(StringTable.Version,
                new Function() {
                    @Override
                    public Integer apply(BulkAdExtensionIdentifier c) {
                        return c.getVersion();
                    }
                },
                new BiConsumer() {
                    @Override
                    public void accept(String v, BulkAdExtensionIdentifier c) {
                        c.setVersion(StringExtensions.parseOptionalInteger(v));
                    }
                }
        ));

        MAPPINGS = Collections.unmodifiableList(m);
    }

    public Long getAccountId() {
        return accountId;
    }

    public void setAccountId(Long accountId) {
        this.accountId = accountId;
    }

    public Long getAdExtensionId() {
        return adExtensionId;
    }

    public void setAdExtensionId(Long adExtensionId) {
        this.adExtensionId = adExtensionId;
    }

    public AdExtensionStatus getStatus() {
        return status;
    }

    public void setStatus(AdExtensionStatus status) {
        this.status = status;
    }

    public Integer getVersion() {
        return version;
    }

    public void setVersion(Integer version) {
        this.version = version;
    }

    @Override
    public void writeToRowValues(RowValues values, boolean excludeReadonlyData) {
        MappingHelpers.convertToValues(this, values, MAPPINGS);
    }

    @Override
    public void readFromRowValues(RowValues values) {
        MappingHelpers.convertToEntity(values, MAPPINGS, this);
    }

    @Override
    public boolean isDeleteRow() {
        return AdExtensionStatus.DELETED.equals(status);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy