use of com.qlangtech.tis.plugin.ds.ColumnMetaData in project tis by qlangtech.
the class SchemaAction method mergeWfColsWithTplCollection.
/**
* 通过解析workflow的最终导出的字段,来生成Schema配置
*
* @param module
* @param context
* @param appSource
* @return
* @throws Exception
*/
public static SchemaResult mergeWfColsWithTplCollection(BasicModule module, Context context, ISolrAppSource appSource, final ISchemaPluginContext schemaPlugin, SolrFieldsParser.ParseResultCallback... parseResultCallback) throws Exception {
// 通过version取默认模板
Application tplApp = getTemplateApp(module);
SchemaResult tplSchema = getTemplateSchema(module, context, tplApp);
if (!tplSchema.isSuccess()) {
return null;
}
ParseResult parseResult = (ParseResult) tplSchema.getParseResult();
SolrType strType = parseResult.getTisType(ReflectSchemaFieldType.STRING.literia);
List<ColumnMetaData> cols = appSource.reflectCols();
for (ColumnMetaData colName : cols) {
PSchemaField f = new PSchemaField();
f.setName(colName.getKey());
f.setType(strType);
f.setStored(true);
f.setIndexed(false);
f.setMltiValued(false);
f.setDocValue(false);
parseResult.dFields.add(f);
}
parseResult.setUniqueKey(null);
for (SolrFieldsParser.ParseResultCallback c : parseResultCallback) {
c.process(cols, parseResult);
}
parseResult.addReservedFields();
tplSchema.content = XModifier.modifySchemaContent(tplSchema.content, (document2, modifier) -> {
modifier.addModify("/fields/field(:delete)");
modifier.addModify("/sharedKey(:delete)");
modifier.deleteUniqueKey();
updateSchemaXML(parseResult.types, schemaPlugin, parseResult, document2, modifier);
});
parseResultCallback4test.process(cols, parseResult);
return tplSchema;
}
Aggregations