Search in sources :

Example 1 with ISearchEngineTypeTransfer

use of com.qlangtech.tis.datax.ISearchEngineTypeTransfer in project tis by qlangtech.

the class SchemaAction method doToggleEsExpertModel.

/**
 * ES普通视图模式下保存到缓存(点击专家模式)
 */
@Func(value = PermissionConstant.APP_SCHEMA_UPDATE, sideEffect = false)
public void doToggleEsExpertModel(Context context) throws Exception {
    UploadSchemaWithRawContentForm form = this.getFormValues();
    if (!validateStupidContent(context, form)) {
        return;
    }
    ISearchEngineTypeTransfer typeTransfer = ISearchEngineTypeTransfer.load(this, form.getDataxName());
    JSONObject mergeTarget = ISearchEngineTypeTransfer.getOriginExpertSchema(form.getSchemaXmlContent());
    String esMapping = JsonUtil.toString(typeTransfer.mergeFromStupidModel(form, mergeTarget));
    UploadResource schemaResource = new UploadResource();
    schemaResource.setContent(esMapping.getBytes(TisUTF8.get()));
    this.doGetXmlContent(context, schemaResource, form.getFields());
}
Also used : JSONObject(com.alibaba.fastjson.JSONObject) ISearchEngineTypeTransfer(com.qlangtech.tis.datax.ISearchEngineTypeTransfer) Func(com.qlangtech.tis.manage.spring.aop.Func)

Example 2 with ISearchEngineTypeTransfer

use of com.qlangtech.tis.datax.ISearchEngineTypeTransfer in project tis by qlangtech.

the class SchemaAction method doGetEsTplFields.

// private static Logger log = LoggerFactory.getLogger(SchemaAction.class);
/**
 * DataX 创建流程中取得es的默认字段
 *
 * @param context
 * @throws Exception
 */
public void doGetEsTplFields(Context context) throws Exception {
    String dataxName = this.getString(DataxUtils.DATAX_NAME);
    StepType stepType = StepType.parse(this.getString("stepType"));
    // DataxProcessor process = DataxProcessor.load(this, dataxName);
    // IDataxProcessor.TableMap tabMapper = null;
    // ESField field = null;
    ISearchEngineTypeTransfer typeTransfer = ISearchEngineTypeTransfer.load(this, dataxName);
    DataxReader dataxReader = DataxReader.load(this, dataxName);
    // ESField field = null;
    if (stepType.update) {
        DataxProcessor dataxProcessor = DataxProcessor.load(this, dataxName);
        for (Map.Entry<String, IDataxProcessor.TableAlias> e : dataxProcessor.getTabAlias().entrySet()) {
            writerStructFields(context, e.getValue(), typeTransfer);
            return;
        }
    } else {
        for (ISelectedTab tab : dataxReader.getSelectedTabs()) {
            // ESSchema parseResult = new ESSchema();
            SchemaMetaContent tplSchema = typeTransfer.initSchemaMetaContent(tab);
            this.setBizResult(context, tplSchema.toJSON());
            return;
        }
    }
    throw new IllegalStateException("have not find any tab in DataXReader");
}
Also used : IDataxProcessor(com.qlangtech.tis.datax.IDataxProcessor) DataxProcessor(com.qlangtech.tis.datax.impl.DataxProcessor) ISelectedTab(com.qlangtech.tis.plugin.ds.ISelectedTab) ISearchEngineTypeTransfer(com.qlangtech.tis.datax.ISearchEngineTypeTransfer) DataxReader(com.qlangtech.tis.datax.impl.DataxReader)

Example 3 with ISearchEngineTypeTransfer

use of com.qlangtech.tis.datax.ISearchEngineTypeTransfer in project tis by qlangtech.

the class SchemaAction method doToggleEsStupidModel.

/**
 * ES:高级视图模式下保存到缓存(点击小白模式)
 */
@Func(value = PermissionConstant.APP_SCHEMA_UPDATE, sideEffect = false)
public void doToggleEsStupidModel(Context context) throws Exception {
    // 整段xml文本
    com.alibaba.fastjson.JSONObject body = this.parseJsonPost();
    ISearchEngineTypeTransfer typeTransfer = ISearchEngineTypeTransfer.load(this, body.getString(DataxUtils.DATAX_NAME));
    // final String content = body.getString("content");
    // byte[] schemaContent = body.getString("content").getBytes(TisUTF8.get());
    // JSONArray fields = JSON.parseArray(content);
    writerStructFields(context, body, typeTransfer);
}
Also used : JSONObject(com.alibaba.fastjson.JSONObject) ISearchEngineTypeTransfer(com.qlangtech.tis.datax.ISearchEngineTypeTransfer) Func(com.qlangtech.tis.manage.spring.aop.Func)

Aggregations

ISearchEngineTypeTransfer (com.qlangtech.tis.datax.ISearchEngineTypeTransfer)3 JSONObject (com.alibaba.fastjson.JSONObject)2 Func (com.qlangtech.tis.manage.spring.aop.Func)2 IDataxProcessor (com.qlangtech.tis.datax.IDataxProcessor)1 DataxProcessor (com.qlangtech.tis.datax.impl.DataxProcessor)1 DataxReader (com.qlangtech.tis.datax.impl.DataxReader)1 ISelectedTab (com.qlangtech.tis.plugin.ds.ISelectedTab)1