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

com.sailthru.client.params.job.ImportJob Maven / Gradle / Ivy

There is a newer version: 2.4.1
Show newest version
package com.sailthru.client.params.job;

import com.google.gson.reflect.TypeToken;
import com.sailthru.client.SailthruUtil;
import com.sailthru.client.params.ApiFileParams;
import java.io.File;
import java.util.List;
import java.util.Map;
import java.lang.reflect.Type;
import java.util.HashMap;

/**
 *
 * @author Prajwal Tuladhar 
 */
public class ImportJob extends Job implements ApiFileParams {
    
    private static final String JOB = "import";
    
    protected String emails;
    protected transient File file = null;
    protected String list;

    public ImportJob() {
        this.job = JOB;
    }
    
    public ImportJob setEmails(List emails) {
        this.emails = SailthruUtil.arrayListToCSV(emails);
        return this;
    }
    
    public ImportJob setFile(String filePath) {
        this.file = new File(filePath);
        return this;
    }
    
    public ImportJob setFile(File file) {
        this.file = file;
        return this;
    }
    
    public ImportJob setList(String list) {
        this.list = list;
        return this;
    }
    
    @Override
    public Type getType() {
        return new TypeToken() {}.getType();
    }
    
    
    public Map getFileParams() {
        Map files = new HashMap();
        if (this.file != null) {
            files.put("file", this.file);
        }
        return files;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy