use of com.qlangtech.tis.manage.spring.aop.Func in project tis by qlangtech.
the class IndexQueryAction method doQuery.
@Func(value = PermissionConstant.PERMISSION_INDEX_QUERY, sideEffect = false)
public void doQuery(Context context) throws Exception {
List<String> sfields = Lists.newArrayList(this.getRequest().getParameterValues("sfields"));
final String query = StringUtils.defaultIfEmpty((this.getString("q")).replaceAll("\r|\n", StringUtils.EMPTY), "*:*");
Integer shownum = null;
shownum = this.getInt("shownum", 3);
QueryRequestWrapper request = new QueryRequestWrapper(this.getRequest(), context);
QueryRequestContext requestContext = new QueryRequestContext(request);
final String sort = getString("sort");
final String[] fqs = this.getStringArray("fq");
final QueryResutStrategy queryResutStrategy = QueryIndexServlet.createQueryResutStrategy(this.getAppDomain(), request, getResponse(), getDaoContext());
final List<ServerJoinGroup> serverlist = queryResutStrategy.queryProcess();
QueryIndexServlet.execuetQuery(this, this.getAppDomain(), requestContext, this.getDaoContext(), queryResutStrategy, serverlist, query, sort, fqs, shownum, sfields);
}
use of com.qlangtech.tis.manage.spring.aop.Func in project tis by qlangtech.
the class RoleAction method doSelectRole.
/**
* 用户选择角色
*
* @param context
*/
@Func(PermissionConstant.AUTHORITY_USER_ROLE_SET)
public void doSelectRole(Context context) {
String usrid = this.getString("usrid");
Integer roleid = this.getInt("roleid");
Role role = this.getRoleDAO().loadFromWriteDB(roleid);
Assert.assertNotNull(role);
UsrDptRelationCriteria ucriteria = new UsrDptRelationCriteria();
ucriteria.createCriteria().andUsrIdEqualTo(usrid);
UsrDptRelation record = new UsrDptRelation();
record.setRoleName(role.getRoleName());
record.setrId(role.getrId());
this.getUsrDptRelationDAO().updateByExampleSelective(record, ucriteria);
addActionMessage(context, "用户选择了新的角色:“" + role.getRoleName() + "”");
}
use of com.qlangtech.tis.manage.spring.aop.Func in project tis by qlangtech.
the class BizlineAction method doAddBizline.
@Func(value = PermissionConstant.APP_DEPARTMENT_MANAGE)
public void doAddBizline(Context context) {
this.errorsPageShow(context);
final String name = this.getString("name");
if (StringUtils.isBlank(name)) {
this.addErrorMessage(context, "请填写业务线名称");
return;
}
DepartmentCriteria criteria = new DepartmentCriteria();
criteria.createCriteria().andIsLeaf(false).andNameEqualTo(name).andParentIdEqualTo(-1);
if (this.getDepartmentDAO().countByExample(criteria) > 0) {
this.addErrorMessage(context, "业务线:''" + name + "' 已经存在,不能重复添加");
return;
}
Department dpt = new Department();
dpt.setLeaf(false);
dpt.setName(name);
dpt.setFullName(name);
dpt.setGmtModified(new Date());
dpt.setGmtCreate(new Date());
dpt.setParentId(-1);
dpt.setDptId(this.getDepartmentDAO().insertSelective(dpt));
this.setBizResult(context, dpt);
this.addActionMessage(context, "业务线:'" + name + "' 添加成功");
// this.setBizResult(context, getAllBizDomain(false));
}
use of com.qlangtech.tis.manage.spring.aop.Func in project tis by qlangtech.
the class OfflineDatasourceAction method doValidateWorkflowAddJoinComponentForm.
/**
* WorkflowAddJoinComponent 点击保存按钮进行,服务端进行校验
*
* @param context
* @throws Exception
*/
@Func(value = PermissionConstant.DATAFLOW_MANAGE, sideEffect = false)
public void doValidateWorkflowAddJoinComponentForm(Context context) throws Exception {
com.alibaba.fastjson.JSONObject form = this.parseJsonPost();
IControlMsgHandler handler = new DelegateControl4JsonPostMsgHandler(this, form);
String sql = form.getString("sql");
String exportName = form.getString("exportName");
com.alibaba.fastjson.JSONArray dependenceNodes = form.getJSONArray("dependencies");
final List<String> dependencyNodes = Lists.newArrayList();
final String validateRuleDependency = "dependencies";
//
Map<String, Validator.FieldValidators> validateRule = //
Validator.fieldsValidator(//
"sql", new Validator.FieldValidators(Validator.require) {
}.addDependency(//
validateRuleDependency), new Validator.IFieldValidator() {
@Override
public boolean validate(IFieldErrorHandler msgHandler, Context context, String fieldKey, String fieldData) {
Optional<TisSqlFormatException> sqlErr = SqlTaskNodeMeta.validateSql(fieldData, dependencyNodes);
if (sqlErr.isPresent()) {
msgHandler.addFieldError(context, fieldKey, sqlErr.get().summary());
return false;
}
return true;
}
}, //
"exportName", new Validator.FieldValidators(Validator.require, Validator.identity) {
}, new Validator.IFieldValidator() {
@Override
public boolean validate(IFieldErrorHandler msgHandler, Context context, String fieldKey, String fieldData) {
Matcher m = pattern_table_name.matcher(fieldData);
if (!m.matches()) {
msgHandler.addFieldError(context, fieldKey, "必须符合规则:" + pattern_table_name);
return false;
}
return true;
}
}, //
validateRuleDependency, new Validator.FieldValidators(Validator.require) {
@Override
public void setFieldVal(String val) {
com.alibaba.fastjson.JSONArray dpts = JSON.parseArray(val);
com.alibaba.fastjson.JSONObject o = null;
for (int index = 0; index < dpts.size(); index++) {
o = dpts.getJSONObject(index);
dependencyNodes.add(o.getString("label"));
}
}
}, new Validator.IFieldValidator() {
@Override
public boolean validate(IFieldErrorHandler msgHandler, Context context, String fieldKey, String fieldData) {
com.alibaba.fastjson.JSONArray dpts = JSON.parseArray(fieldData);
if (dpts.size() < 1) {
msgHandler.addFieldError(context, fieldKey, "请选择依赖表节点");
return false;
}
return true;
}
});
if (!Validator.validate(handler, context, validateRule)) {
// return;
}
}
use of com.qlangtech.tis.manage.spring.aop.Func in project tis by qlangtech.
the class OfflineDatasourceAction method doExecuteWorkflow.
/**
* Do execute workflow. 执行数据流任务<br>
* 仅仅只执行DataFlow的数据构建
*
* @param context the context
* @throws Exception the exception
*/
@Func(value = PermissionConstant.DATAFLOW_MANAGE)
public void doExecuteWorkflow(Context context) throws Exception {
Integer id = this.getInt("id");
List<PostParam> params = Lists.newArrayList();
WorkFlow df = this.getWorkflowDAOFacade().getWorkFlowDAO().selectByPrimaryKey(id);
Assert.assertNotNull(df);
params.add(new PostParam(IFullBuildContext.KEY_WORKFLOW_NAME, df.getName()));
params.add(new PostParam(IFullBuildContext.KEY_WORKFLOW_ID, String.valueOf(id)));
// TODO 单独触发的DF执行后期要保证该流程最后的执行的结果数据不能用于索引build
params.add(new PostParam(IFullBuildContext.KEY_APP_SHARD_COUNT, IFullBuildContext.KEY_APP_SHARD_COUNT_SINGLE));
params.add(new PostParam(COMPONENT_START, FullbuildPhase.FullDump.getName()));
params.add(new PostParam(COMPONENT_END, FullbuildPhase.JOIN.getName()));
if (!CoreAction.triggerBuild(this, context, params).success) {
// throw new IllegalStateException("dataflowid:" + id + " trigger faild");
}
}
Aggregations