use of com.qlangtech.tis.workflow.pojo.WorkFlow in project tis by qlangtech.
the class SchemaAction method getWorkflow.
private WorkFlow getWorkflow(String wfName) {
WorkFlowCriteria wquery = new WorkFlowCriteria();
wquery.createCriteria().andNameEqualTo(wfName);
List<WorkFlow> workFlows = this.getWorkflowDAOFacade().getWorkFlowDAO().selectByExample(wquery, 1, 1);
Optional<WorkFlow> first = workFlows.stream().findFirst();
if (!first.isPresent()) {
throw new IllegalStateException("workflow:" + wfName + " can not find relevant instance in db");
}
return first.get();
}
use of com.qlangtech.tis.workflow.pojo.WorkFlow in project tis by qlangtech.
the class SchemaAction method doGetApp.
/**
* 当一个索引创建之后又被删除了,又需要重新创建就需要需执行该流程了,过程中需要将之前的记录找回来
*
* @param context
*/
public void doGetApp(Context context) throws Exception {
final String collectionName = this.getString("name");
if (StringUtils.isEmpty(collectionName)) {
throw new IllegalArgumentException("param name can not be null");
}
AddAppAction.ExtendApp app = new AddAppAction.ExtendApp();
Application a = this.getApplicationDAO().selectByName(collectionName);
BeanUtils.copyProperties(app, a);
WorkFlow df = this.getWorkflowDAOFacade().getWorkFlowDAO().selectByPrimaryKey(a.getWorkFlowId());
if (df == null) {
this.addErrorMessage(context, "当前索引'" + collectionName + "'还未绑定数据流实例");
return;
}
app.setWorkflow(df.getId() + ":" + df.getName());
DepartmentCriteria dc = new DepartmentCriteria();
dc.createCriteria();
List<Department> dpts = this.getDepartmentDAO().selectByExample(dc);
if (dpts.size() < 1) {
this.addErrorMessage(context, "系统还未创建部门实例");
return;
}
app.setSelectableDepartment(dpts.stream().map((r) -> new Option(r.getName(), String.valueOf(r.getDptId()))).collect(Collectors.toList()));
Map<String, Object> result = Maps.newHashMap();
result.put("app", app);
if (!getStructSchema(context, app, (schema) -> {
result.put("schema", schema);
})) {
return;
}
this.setBizResult(context, result);
}
use of com.qlangtech.tis.workflow.pojo.WorkFlow 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;
}
use of com.qlangtech.tis.workflow.pojo.WorkFlow in project tis by qlangtech.
the class WorkFlowDAOImpl method selectByPrimaryKey.
public WorkFlow selectByPrimaryKey(Integer id) {
WorkFlow key = new WorkFlow();
key.setId(id);
WorkFlow record = (WorkFlow) this.load("work_flow.ibatorgenerated_selectByPrimaryKey", key);
return record;
}
use of com.qlangtech.tis.workflow.pojo.WorkFlow in project tis by qlangtech.
the class WorkFlowDAOImpl method loadFromWriteDB.
public WorkFlow loadFromWriteDB(Integer id) {
WorkFlow key = new WorkFlow();
key.setId(id);
WorkFlow record = (WorkFlow) this.loadFromWriterDB("work_flow.ibatorgenerated_selectByPrimaryKey", key);
return record;
}
Aggregations