Search in sources :

Example 6 with WorkFlow

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();
}
Also used : WorkFlow(com.qlangtech.tis.workflow.pojo.WorkFlow) WorkFlowCriteria(com.qlangtech.tis.workflow.pojo.WorkFlowCriteria)

Example 7 with WorkFlow

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);
}
Also used : WorkFlow(com.qlangtech.tis.workflow.pojo.WorkFlow) StringUtils(org.apache.commons.lang.StringUtils) PluginStore(com.qlangtech.tis.plugin.PluginStore) PSchemaField(com.qlangtech.tis.solrdao.pojo.PSchemaField) TIS(com.qlangtech.tis.TIS) ISelectedTab(com.qlangtech.tis.plugin.ds.ISelectedTab) WorkFlowCriteria(com.qlangtech.tis.workflow.pojo.WorkFlowCriteria) IServerGroupDAO(com.qlangtech.tis.manage.biz.dal.dao.IServerGroupDAO) SaveFileContentAction(com.qlangtech.tis.runtime.module.action.jarcontent.SaveFileContentAction) Document(org.jdom2.Document) com.qlangtech.tis.solrdao(com.qlangtech.tis.solrdao) ByteArrayInputStream(java.io.ByteArrayInputStream) PermissionConstant(com.qlangtech.tis.manage.PermissionConstant) IDataxProcessor(com.qlangtech.tis.datax.IDataxProcessor) IPluginStore(com.qlangtech.tis.plugin.IPluginStore) EntityResolver(org.xml.sax.EntityResolver) Savefilecontent(com.qlangtech.tis.manage.Savefilecontent) com.qlangtech.tis.manage.biz.dal.pojo(com.qlangtech.tis.manage.biz.dal.pojo) Validator(com.qlangtech.tis.plugin.annotation.Validator) ISolrAppSource(com.qlangtech.tis.manage.ISolrAppSource) JSONException(com.alibaba.fastjson.JSONException) com.qlangtech.tis.manage.common(com.qlangtech.tis.manage.common) Collectors(java.util.stream.Collectors) IOUtils(org.apache.commons.io.IOUtils) ISearchEngineTypeTransfer(com.qlangtech.tis.datax.ISearchEngineTypeTransfer) DataxReader(com.qlangtech.tis.datax.impl.DataxReader) SAXException(org.xml.sax.SAXException) RunEnvironment(com.qlangtech.tis.pubhook.common.RunEnvironment) JSONObject(com.alibaba.fastjson.JSONObject) DocumentBuilderFactory(javax.xml.parsers.DocumentBuilderFactory) Pattern(java.util.regex.Pattern) UnsupportedEncodingException(java.io.UnsupportedEncodingException) LuceneVersion(com.qlangtech.tis.fullbuild.indexbuild.LuceneVersion) ParseResult(com.qlangtech.tis.solrdao.impl.ParseResult) java.util(java.util) BeanUtils(org.apache.commons.beanutils.BeanUtils) DocType(org.jdom2.DocType) Func(com.qlangtech.tis.manage.spring.aop.Func) ColumnMetaData(com.qlangtech.tis.plugin.ds.ColumnMetaData) SolrType(com.qlangtech.tis.solrdao.SolrFieldsParser.SolrType) Context(com.alibaba.citrus.turbine.Context) JsonUtil(com.qlangtech.tis.trigger.util.JsonUtil) JSONArray(com.alibaba.fastjson.JSONArray) com.qlangtech.tis.runtime.module.misc(com.qlangtech.tis.runtime.module.misc) DataxProcessor(com.qlangtech.tis.datax.impl.DataxProcessor) Charset(java.nio.charset.Charset) XModifier(com.yushu.tis.xmodifier.XModifier) DataxUtils(com.qlangtech.tis.offline.DataxUtils) InputSource(org.xml.sax.InputSource) ReflectSchemaFieldType(com.qlangtech.tis.plugin.ds.ReflectSchemaFieldType) FieldTypeFactory(com.qlangtech.tis.plugin.solr.schema.FieldTypeFactory) IOException(java.io.IOException) Maps(com.google.common.collect.Maps) JSON(com.alibaba.fastjson.JSON) StringReader(java.io.StringReader) DocumentBuilder(javax.xml.parsers.DocumentBuilder) Assert(com.qlangtech.tis.common.utils.Assert) WorkFlow(com.qlangtech.tis.workflow.pojo.WorkFlow) JSONObject(com.alibaba.fastjson.JSONObject)

Example 8 with WorkFlow

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;
}
Also used : WorkFlow(com.qlangtech.tis.workflow.pojo.WorkFlow) StringUtils(org.apache.commons.lang.StringUtils) PluginStore(com.qlangtech.tis.plugin.PluginStore) PSchemaField(com.qlangtech.tis.solrdao.pojo.PSchemaField) TIS(com.qlangtech.tis.TIS) ISelectedTab(com.qlangtech.tis.plugin.ds.ISelectedTab) WorkFlowCriteria(com.qlangtech.tis.workflow.pojo.WorkFlowCriteria) IServerGroupDAO(com.qlangtech.tis.manage.biz.dal.dao.IServerGroupDAO) SaveFileContentAction(com.qlangtech.tis.runtime.module.action.jarcontent.SaveFileContentAction) Document(org.jdom2.Document) com.qlangtech.tis.solrdao(com.qlangtech.tis.solrdao) ByteArrayInputStream(java.io.ByteArrayInputStream) PermissionConstant(com.qlangtech.tis.manage.PermissionConstant) IDataxProcessor(com.qlangtech.tis.datax.IDataxProcessor) IPluginStore(com.qlangtech.tis.plugin.IPluginStore) EntityResolver(org.xml.sax.EntityResolver) Savefilecontent(com.qlangtech.tis.manage.Savefilecontent) com.qlangtech.tis.manage.biz.dal.pojo(com.qlangtech.tis.manage.biz.dal.pojo) Validator(com.qlangtech.tis.plugin.annotation.Validator) ISolrAppSource(com.qlangtech.tis.manage.ISolrAppSource) JSONException(com.alibaba.fastjson.JSONException) com.qlangtech.tis.manage.common(com.qlangtech.tis.manage.common) Collectors(java.util.stream.Collectors) IOUtils(org.apache.commons.io.IOUtils) ISearchEngineTypeTransfer(com.qlangtech.tis.datax.ISearchEngineTypeTransfer) DataxReader(com.qlangtech.tis.datax.impl.DataxReader) SAXException(org.xml.sax.SAXException) RunEnvironment(com.qlangtech.tis.pubhook.common.RunEnvironment) JSONObject(com.alibaba.fastjson.JSONObject) DocumentBuilderFactory(javax.xml.parsers.DocumentBuilderFactory) Pattern(java.util.regex.Pattern) UnsupportedEncodingException(java.io.UnsupportedEncodingException) LuceneVersion(com.qlangtech.tis.fullbuild.indexbuild.LuceneVersion) ParseResult(com.qlangtech.tis.solrdao.impl.ParseResult) java.util(java.util) BeanUtils(org.apache.commons.beanutils.BeanUtils) DocType(org.jdom2.DocType) Func(com.qlangtech.tis.manage.spring.aop.Func) ColumnMetaData(com.qlangtech.tis.plugin.ds.ColumnMetaData) SolrType(com.qlangtech.tis.solrdao.SolrFieldsParser.SolrType) Context(com.alibaba.citrus.turbine.Context) JsonUtil(com.qlangtech.tis.trigger.util.JsonUtil) JSONArray(com.alibaba.fastjson.JSONArray) com.qlangtech.tis.runtime.module.misc(com.qlangtech.tis.runtime.module.misc) DataxProcessor(com.qlangtech.tis.datax.impl.DataxProcessor) Charset(java.nio.charset.Charset) XModifier(com.yushu.tis.xmodifier.XModifier) DataxUtils(com.qlangtech.tis.offline.DataxUtils) InputSource(org.xml.sax.InputSource) ReflectSchemaFieldType(com.qlangtech.tis.plugin.ds.ReflectSchemaFieldType) FieldTypeFactory(com.qlangtech.tis.plugin.solr.schema.FieldTypeFactory) IOException(java.io.IOException) Maps(com.google.common.collect.Maps) JSON(com.alibaba.fastjson.JSON) StringReader(java.io.StringReader) DocumentBuilder(javax.xml.parsers.DocumentBuilder) Assert(com.qlangtech.tis.common.utils.Assert) SolrType(com.qlangtech.tis.solrdao.SolrFieldsParser.SolrType) ParseResult(com.qlangtech.tis.solrdao.impl.ParseResult) PSchemaField(com.qlangtech.tis.solrdao.pojo.PSchemaField) ColumnMetaData(com.qlangtech.tis.plugin.ds.ColumnMetaData)

Example 9 with WorkFlow

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;
}
Also used : WorkFlow(com.qlangtech.tis.workflow.pojo.WorkFlow)

Example 10 with WorkFlow

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;
}
Also used : WorkFlow(com.qlangtech.tis.workflow.pojo.WorkFlow)

Aggregations

WorkFlow (com.qlangtech.tis.workflow.pojo.WorkFlow)10 WorkFlowCriteria (com.qlangtech.tis.workflow.pojo.WorkFlowCriteria)5 Func (com.qlangtech.tis.manage.spring.aop.Func)4 Context (com.alibaba.citrus.turbine.Context)2 JSON (com.alibaba.fastjson.JSON)2 JSONArray (com.alibaba.fastjson.JSONArray)2 JSONException (com.alibaba.fastjson.JSONException)2 JSONObject (com.alibaba.fastjson.JSONObject)2 Maps (com.google.common.collect.Maps)2 TIS (com.qlangtech.tis.TIS)2 Assert (com.qlangtech.tis.common.utils.Assert)2 IDataxProcessor (com.qlangtech.tis.datax.IDataxProcessor)2 ISearchEngineTypeTransfer (com.qlangtech.tis.datax.ISearchEngineTypeTransfer)2 DataxProcessor (com.qlangtech.tis.datax.impl.DataxProcessor)2 DataxReader (com.qlangtech.tis.datax.impl.DataxReader)2 LuceneVersion (com.qlangtech.tis.fullbuild.indexbuild.LuceneVersion)2 ISolrAppSource (com.qlangtech.tis.manage.ISolrAppSource)2 PermissionConstant (com.qlangtech.tis.manage.PermissionConstant)2 Savefilecontent (com.qlangtech.tis.manage.Savefilecontent)2 IServerGroupDAO (com.qlangtech.tis.manage.biz.dal.dao.IServerGroupDAO)2