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 + ")");
}
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解析有错");
// }
}
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());
}
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);
}
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())));
}
Aggregations