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

com.microsoft.bingads.v13.bulk.entities.BulkCampaignConversionGoal 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.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.campaignmanagement.CampaignConversionGoal;
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;

/**
 * This abstract class provides properties that are shared by all bulk campaign conversion goal classes.
 */
public class BulkCampaignConversionGoal extends SingleRecordBulkEntity {
    
    private CampaignConversionGoal campaignConversionGoal;

    private static final List> MAPPINGS;

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

        m.add(new SimpleBulkMapping(StringTable.ParentId,
                new Function() {
                    @Override
                    public Long apply(BulkCampaignConversionGoal g) {
                        return g.getCampaignConversionGoal().getCampaignId();
                    }
                },
                new BiConsumer() {
                    @Override
                    public void accept(String v, BulkCampaignConversionGoal g) {
                        g.getCampaignConversionGoal().setCampaignId(StringExtensions.parseOptional(v, new Function() {
                            @Override
                            public Long apply(String value) {
                                return Long.parseLong(value);
                            }
                        }));
                    }
                }
        ));
        
        m.add(new SimpleBulkMapping(StringTable.GoalId,
                new Function() {
                    @Override
                    public Long apply(BulkCampaignConversionGoal g) {
                        return g.getCampaignConversionGoal().getGoalId();
                    }
                },
                new BiConsumer() {
                    @Override
                    public void accept(String v, BulkCampaignConversionGoal g) {
                        g.getCampaignConversionGoal().setGoalId(StringExtensions.parseOptional(v, new Function() {
                            @Override
                            public Long apply(String value) {
                                return Long.parseLong(value);
                            }
                        }));
                    }
                }
        ));

        MAPPINGS = Collections.unmodifiableList(m);
    }

    @Override
    public void processMappingsFromRowValues(RowValues values) {
        this.setCampaignConversionGoal(new CampaignConversionGoal());
        MappingHelpers.convertToEntity(values, MAPPINGS, this);

    }

    @Override
    public void processMappingsToRowValues(RowValues values, boolean excludeReadonlyData) {
        validatePropertyNotNull(getCampaignConversionGoal(), "CampaignConversionGoal");

        MappingHelpers.convertToValues(this, values, MAPPINGS);
    }
    
    public CampaignConversionGoal createCampaignConversionGoal()
    {
    	return new CampaignConversionGoal();
    }

    /**
     * Gets the campaign conversion goal.
     */
    public CampaignConversionGoal getCampaignConversionGoal() {
        return campaignConversionGoal;
    }

    /**
     * Sets the campaign conversion goal.
     */
    public void setCampaignConversionGoal(CampaignConversionGoal goal) {
        this.campaignConversionGoal = goal;
    }

}






© 2015 - 2024 Weber Informatics LLC | Privacy Policy