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());
}
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");
}
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);
}
Aggregations