Search in sources :

Example 1 with EsWriter

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

the class DatasourceService method putDefaultEmptyValueForWriter.

private Writer putDefaultEmptyValueForWriter(int targetType, Writer writer) {
    if (Objects.nonNull(RDBMSSourceType.getByDataSourceType(targetType)) && !notPutValueFoeWriterSourceTypeSet.contains(targetType)) {
        RDBWriter rdbWriter = (RDBWriter) writer;
        rdbWriter.setPostSql("");
        rdbWriter.setPostSql("");
        rdbWriter.setSession("");
        if (DataSourceType.GREENPLUM6.getVal() == targetType) {
            rdbWriter.setWriteMode("insert");
        } else {
            rdbWriter.setWriteMode("replace");
        }
        return rdbWriter;
    } else if (DataSourceType.ES.getVal() == targetType) {
        EsWriter esWriter = (EsWriter) writer;
        esWriter.setType("");
        esWriter.setIndex("");
        JSONObject column = new JSONObject();
        column.put("key", "col1");
        column.put("type", "string");
        JSONObject idColumn = new JSONObject();
        idColumn.put("index", 0);
        idColumn.put("type", "int");
        esWriter.getIdColumn().add(idColumn);
        return esWriter;
    }
    return writer;
}
Also used : JSONObject(com.alibaba.fastjson.JSONObject) RDBWriter(com.dtstack.taier.develop.utils.develop.sync.template.RDBWriter) EsWriter(com.dtstack.taier.develop.utils.develop.sync.template.EsWriter)

Aggregations

JSONObject (com.alibaba.fastjson.JSONObject)1 EsWriter (com.dtstack.taier.develop.utils.develop.sync.template.EsWriter)1 RDBWriter (com.dtstack.taier.develop.utils.develop.sync.template.RDBWriter)1