Search in sources :

Example 1 with EsReader

use of com.dtstack.taier.develop.utils.develop.sync.template.EsReader in project Taier by DTStack.

the class DatasourceService method putDefaultEmptyValueForReader.

/**
 * 向导模式,填充reader的默认信息
 * @param sourceType
 * @param reader
 * @return
 */
private Reader putDefaultEmptyValueForReader(int sourceType, Reader reader) {
    if (Objects.nonNull(RDBMSSourceType.getByDataSourceType(sourceType)) && DataSourceType.HIVE.getVal() != sourceType && DataSourceType.HIVE1X.getVal() != sourceType && DataSourceType.HIVE3X.getVal() != sourceType && DataSourceType.SparkThrift2_1.getVal() != sourceType && DataSourceType.CarbonData.getVal() != sourceType) {
        RDBReader rdbReader = (RDBReader) reader;
        rdbReader.setWhere("");
        rdbReader.setSplitPK("");
        return rdbReader;
    } else if (DataSourceType.ES.getVal() == sourceType) {
        EsReader esReader = (EsReader) reader;
        JSONObject obj = new JSONObject();
        obj.put("col", "");
        JSONObject query = new JSONObject();
        query.put("match", obj);
        esReader.setQuery(query);
        JSONObject column = new JSONObject();
        column.put("key", "col1");
        column.put("type", "string");
        esReader.getColumn().add(column);
        return esReader;
    } else if (DataSourceType.FTP.getVal() == sourceType) {
        FtpReader ftpReader = (FtpReader) reader;
        ftpReader.setPath("/");
        return ftpReader;
    } else if (DataSourceType.INFLUXDB.getVal().equals(sourceType)) {
        InfluxDBReader influxDBReader = (InfluxDBReader) reader;
        influxDBReader.setWhere("");
        influxDBReader.setSplitPK("");
        return influxDBReader;
    }
    return reader;
}
Also used : RDBReader(com.dtstack.taier.develop.utils.develop.sync.template.RDBReader) JSONObject(com.alibaba.fastjson.JSONObject) EsReader(com.dtstack.taier.develop.utils.develop.sync.template.EsReader) FtpReader(com.dtstack.taier.develop.utils.develop.sync.template.FtpReader) InfluxDBReader(com.dtstack.taier.develop.utils.develop.sync.template.InfluxDBReader)

Aggregations

JSONObject (com.alibaba.fastjson.JSONObject)1 EsReader (com.dtstack.taier.develop.utils.develop.sync.template.EsReader)1 FtpReader (com.dtstack.taier.develop.utils.develop.sync.template.FtpReader)1 InfluxDBReader (com.dtstack.taier.develop.utils.develop.sync.template.InfluxDBReader)1 RDBReader (com.dtstack.taier.develop.utils.develop.sync.template.RDBReader)1