Sha256: ca33ce48941d9e203be7a0a3ebba30ec0b8a77a6fa9d7403086ab61eb05e6f86

Contents?: true

Size: 1.75 KB

Versions: 18

Compression:

Stored size: 1.75 KB

Contents

package org.embulk.input.marketo.delegate;

import com.google.common.collect.FluentIterable;
import org.embulk.base.restclient.ServiceResponseMapper;
import org.embulk.base.restclient.record.ServiceRecord;
import org.embulk.base.restclient.record.ValueLocator;
import org.embulk.input.marketo.MarketoService;
import org.embulk.input.marketo.MarketoServiceImpl;
import org.embulk.input.marketo.MarketoUtils;
import org.embulk.input.marketo.model.MarketoField;
import org.embulk.input.marketo.rest.MarketoRestClient;

import java.util.Iterator;
import java.util.List;

/**
 * Created by tai.khuu on 9/18/17.
 */
public class LeadWithListInputPlugin extends MarketoBaseInputPluginDelegate<LeadWithListInputPlugin.PluginTask>
{
    public interface PluginTask extends MarketoBaseInputPluginDelegate.PluginTask
    {
    }

    public LeadWithListInputPlugin()
    {
    }

    @Override
    protected Iterator<ServiceRecord> getServiceRecords(MarketoService marketoService, PluginTask task)
    {
        return FluentIterable.from(marketoService.getAllListLead(task.getExtractedFields())).transform(MarketoUtils.TRANSFORM_OBJECT_TO_JACKSON_SERVICE_RECORD_FUNCTION).iterator();
    }

    @Override
    public ServiceResponseMapper<? extends ValueLocator> buildServiceResponseMapper(PluginTask task)
    {
        try (MarketoRestClient marketoRestClient = createMarketoRestClient(task)) {
            MarketoService marketoService = new MarketoServiceImpl(marketoRestClient);
            List<MarketoField> columns = marketoService.describeLeadByLists();
            task.setExtractedFields(MarketoUtils.getFieldNameFromMarketoFields(columns, MarketoUtils.LIST_ID_COLUMN_NAME));
            return MarketoUtils.buildDynamicResponseMapper(task.getSchemaColumnPrefix(), columns);
        }
    }
}

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
embulk-input-marketo-0.6.9 src/main/java/org/embulk/input/marketo/delegate/LeadWithListInputPlugin.java
embulk-input-marketo-0.6.9.alpha src/main/java/org/embulk/input/marketo/delegate/LeadWithListInputPlugin.java
embulk-input-marketo-0.6.8 src/main/java/org/embulk/input/marketo/delegate/LeadWithListInputPlugin.java
embulk-input-marketo-0.6.8.alpha1 src/main/java/org/embulk/input/marketo/delegate/LeadWithListInputPlugin.java
embulk-input-marketo-0.6.7 src/main/java/org/embulk/input/marketo/delegate/LeadWithListInputPlugin.java
embulk-input-marketo-0.6.7.test.1 src/main/java/org/embulk/input/marketo/delegate/LeadWithListInputPlugin.java
embulk-input-marketo-0.6.6 src/main/java/org/embulk/input/marketo/delegate/LeadWithListInputPlugin.java
embulk-input-marketo-0.6.6.alpha.1 src/main/java/org/embulk/input/marketo/delegate/LeadWithListInputPlugin.java
embulk-input-marketo-0.6.5 src/main/java/org/embulk/input/marketo/delegate/LeadWithListInputPlugin.java
embulk-input-marketo-0.6.4 src/main/java/org/embulk/input/marketo/delegate/LeadWithListInputPlugin.java
embulk-input-marketo-0.6.4.alpha.1 src/main/java/org/embulk/input/marketo/delegate/LeadWithListInputPlugin.java
embulk-input-marketo-0.6.3 src/main/java/org/embulk/input/marketo/delegate/LeadWithListInputPlugin.java
embulk-input-marketo-0.6.2 src/main/java/org/embulk/input/marketo/delegate/LeadWithListInputPlugin.java
embulk-input-marketo-0.6.2.alpha.1 src/main/java/org/embulk/input/marketo/delegate/LeadWithListInputPlugin.java
embulk-input-marketo-0.6.1 src/main/java/org/embulk/input/marketo/delegate/LeadWithListInputPlugin.java
embulk-input-marketo-0.6.1.alpha.1 src/main/java/org/embulk/input/marketo/delegate/LeadWithListInputPlugin.java
embulk-input-marketo-0.6.0 src/main/java/org/embulk/input/marketo/delegate/LeadWithListInputPlugin.java
embulk-input-marketo-0.6.0.alpha.1 src/main/java/org/embulk/input/marketo/delegate/LeadWithListInputPlugin.java