Search in sources :

Example 26 with Func

use of com.qlangtech.tis.manage.spring.aop.Func in project tis by qlangtech.

the class RoleAction method doAddFunc.

// do_select_role
/**
 * 添加功能点
 *
 * @param context
 */
@Func(PermissionConstant.AUTHORITY_FUNC_ADD)
public void doAddFunc(Context context) {
    final String funckey = StringUtils.trim(this.getString("funcKey"));
    final String funcName = StringUtils.trim(this.getString("funcName"));
    if (StringUtils.isBlank(funckey)) {
        this.addErrorMessage(context, "请设置Funckey");
        return;
    }
    if (StringUtils.isBlank(funcName)) {
        this.addErrorMessage(context, "请设置FuncName");
        return;
    }
    FuncCriteria fcriteria = new FuncCriteria();
    fcriteria.createCriteria().andFunKeyEqualTo(funckey);
    fcriteria.or(fcriteria.createCriteria().andFuncNameEqualTo(funcName));
    if (this.getFuncDAO().countByExample(fcriteria) > 0) {
        this.addErrorMessage(context, "不同重复添加相同的Funckey或者FuncName");
        return;
    }
    Integer groupType = this.getInt("groupType");
    FuncGroup selType = null;
    // }
    if (selType == null) {
        this.addErrorMessage(context, "请选择功能类型");
        return;
    }
    com.qlangtech.tis.manage.biz.dal.pojo.Func func = new com.qlangtech.tis.manage.biz.dal.pojo.Func();
    func.setFuncGroupKey(groupType);
    func.setFunKey(funckey);
    func.setFuncName(funcName);
    func.setGmtCreate(new Date());
    func.setGmtModified(new Date());
    func.setFuncGroupName(selType.getName());
    this.getFuncDAO().insertSelective(func);
    this.addActionMessage(context, "已经成功添加Func" + funcName + "(" + funckey + ")");
}
Also used : FuncGroup(com.qlangtech.tis.manage.common.Config.FuncGroup) Func(com.qlangtech.tis.manage.spring.aop.Func) Date(java.util.Date) FuncCriteria(com.qlangtech.tis.manage.biz.dal.pojo.FuncCriteria) Func(com.qlangtech.tis.manage.spring.aop.Func)

Example 27 with Func

use of com.qlangtech.tis.manage.spring.aop.Func in project tis by qlangtech.

the class SchemaAction method doGotoSolrAppCreateConfirm.

/**
 * 编辑完成schema之后需要跳转到索引確認頁面<br>
 * 这里只作校验
 *
 * @param context
 * @throws Exception
 */
@Func(value = PermissionConstant.APP_ADD)
public void doGotoSolrAppCreateConfirm(Context context) throws Exception {
    this.errorsPageShow(context);
    // 这里只做schema的校验
    CreateIndexConfirmModel confiemModel = parseJsonPost(CreateIndexConfirmModel.class);
    SchemaResult schemaParse = parseSchema(context, ISchemaPluginContext.NULL, confiemModel);
    LuceneVersion ver = confiemModel.parseTplVersion();
// if (schemaParse.success) {
// // 服务器端自动选机器
// // TODO 目前先不选机器
// // TISZkStateReader zookeeper = this.getZkStateReader();
// // Optional<CoreNode> cn = zookeeper.getCoreNodeCandidate(ver);
// // if (cn.isPresent()) {
// // this.setBizResult(context, cn.get());
// // }
// } else {
// // this.addErrorMessage(context, "Schema解析有错");
// }
}
Also used : LuceneVersion(com.qlangtech.tis.fullbuild.indexbuild.LuceneVersion) Func(com.qlangtech.tis.manage.spring.aop.Func)

Example 28 with Func

use of com.qlangtech.tis.manage.spring.aop.Func 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 29 with Func

use of com.qlangtech.tis.manage.spring.aop.Func in project tis by qlangtech.

the class SchemaAction method doToggleSolrStupidModel.

/**
 * Solr高级视图模式下保存到缓存(点击小白模式)
 */
@Func(value = PermissionConstant.APP_SCHEMA_UPDATE, sideEffect = false)
public void doToggleSolrStupidModel(Context context) throws Exception {
    // 整段xml文本
    com.alibaba.fastjson.JSONObject body = this.parseJsonPost();
    byte[] schemaContent = body.getString("content").getBytes(TisUTF8.get());
    this.getStructSchema(context, ISchemaPluginContext.NULL, schemaContent);
}
Also used : JSONObject(com.alibaba.fastjson.JSONObject) Func(com.qlangtech.tis.manage.spring.aop.Func)

Example 30 with Func

use of com.qlangtech.tis.manage.spring.aop.Func in project tis by qlangtech.

the class CoreAction method doCancelTask.

/**
 * 终止正在执行的任务
 *
 * @param context
 * @throws Exception
 */
@Func(value = PermissionConstant.APP_UPDATE)
public void doCancelTask(Context context) throws Exception {
    Integer taskId = this.getInt(IExecChainContext.KEY_TASK_ID);
    IWorkFlowBuildHistoryDAO workFlowBuildDAO = this.getWorkflowDAOFacade().getWorkFlowBuildHistoryDAO();
    WorkFlowBuildHistory buildHistory = workFlowBuildDAO.loadFromWriteDB(taskId);
    ExecResult processState = ExecResult.parse(buildHistory.getState());
    if (!processState.isProcessing()) {
        this.addErrorMessage(context, "当前任务状态为已终止,不能执行终止操作");
        return;
    }
    List<ConfigFileContext.Header> headers = Lists.newArrayList();
    headers.add(new ConfigFileContext.Header(IExecChainContext.KEY_TASK_ID, String.valueOf(taskId)));
    headers.add(new ConfigFileContext.Header(IParamContext.KEY_ASYN_JOB_NAME, String.valueOf(processState == ExecResult.ASYN_DOING)));
    headers.add(new ConfigFileContext.Header(IFullBuildContext.KEY_APP_NAME, IAppSourcePipelineController.DATAX_FULL_PIPELINE + buildHistory.getAppName()));
    TriggerBuildResult triggerResult = CoreAction.triggerBuild(this, context, ConfigFileContext.HTTPMethod.DELETE, Collections.emptyList(), headers);
    if (!triggerResult.success) {
        return;
    }
    WorkFlowBuildHistory record = new WorkFlowBuildHistory();
    record.setState((byte) ExecResult.CANCEL.getValue());
    WorkFlowBuildHistoryCriteria criteria = new WorkFlowBuildHistoryCriteria();
    criteria.createCriteria().andIdEqualTo(triggerResult.getTaskid());
    workFlowBuildDAO.updateByExampleSelective(record, criteria);
    this.addActionMessage(context, "已经成功终止当前任务");
    this.setBizResult(context, new ExtendWorkFlowBuildHistory(this.getWorkflowDAOFacade().getWorkFlowBuildHistoryDAO().loadFromWriteDB(triggerResult.getTaskid())));
}
Also used : IWorkFlowBuildHistoryDAO(com.qlangtech.tis.workflow.dao.IWorkFlowBuildHistoryDAO) ExecResult(com.qlangtech.tis.assemble.ExecResult) Func(com.qlangtech.tis.manage.spring.aop.Func)

Aggregations

Func (com.qlangtech.tis.manage.spring.aop.Func)64 JSONObject (com.alibaba.fastjson.JSONObject)12 DataXJobWorker (com.qlangtech.tis.datax.job.DataXJobWorker)6 File (java.io.File)6 Date (java.util.Date)6 Context (com.alibaba.citrus.turbine.Context)5 Application (com.qlangtech.tis.manage.biz.dal.pojo.Application)5 JSONObject (org.json.JSONObject)5 Validator (com.qlangtech.tis.plugin.annotation.Validator)4 IControlMsgHandler (com.qlangtech.tis.runtime.module.misc.IControlMsgHandler)4 IFieldErrorHandler (com.qlangtech.tis.runtime.module.misc.IFieldErrorHandler)4 DelegateControl4JsonPostMsgHandler (com.qlangtech.tis.runtime.module.misc.impl.DelegateControl4JsonPostMsgHandler)4 WorkFlow (com.qlangtech.tis.workflow.pojo.WorkFlow)4 JSONArray (org.json.JSONArray)4 ExecResult (com.qlangtech.tis.assemble.ExecResult)3 FullbuildPhase (com.qlangtech.tis.assemble.FullbuildPhase)3 IndexStreamCodeGenerator (com.qlangtech.tis.compiler.streamcode.IndexStreamCodeGenerator)3 DescriptorExtensionList (com.qlangtech.tis.extension.DescriptorExtensionList)3 IOException (java.io.IOException)3 Matcher (java.util.regex.Matcher)3