Search in sources :

Example 6 with Func

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);
}
Also used : QueryRequestContext(com.qlangtech.tis.runtime.module.screen.IndexQuery.QueryRequestContext) QueryRequestWrapper(com.qlangtech.tis.runtime.module.screen.IndexQuery.QueryRequestWrapper) Func(com.qlangtech.tis.manage.spring.aop.Func)

Example 7 with Func

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() + "”");
}
Also used : Role(com.qlangtech.tis.manage.biz.dal.pojo.Role) UsrDptRelationCriteria(com.qlangtech.tis.manage.biz.dal.pojo.UsrDptRelationCriteria) UsrDptRelation(com.qlangtech.tis.manage.biz.dal.pojo.UsrDptRelation) Func(com.qlangtech.tis.manage.spring.aop.Func)

Example 8 with Func

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));
}
Also used : Department(com.qlangtech.tis.manage.biz.dal.pojo.Department) Date(java.util.Date) DepartmentCriteria(com.qlangtech.tis.manage.biz.dal.pojo.DepartmentCriteria) Func(com.qlangtech.tis.manage.spring.aop.Func)

Example 9 with Func

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;
    }
}
Also used : IFullBuildContext(com.qlangtech.tis.fullbuild.IFullBuildContext) Context(com.alibaba.citrus.turbine.Context) DelegateControl4JsonPostMsgHandler(com.qlangtech.tis.runtime.module.misc.impl.DelegateControl4JsonPostMsgHandler) Matcher(java.util.regex.Matcher) IFieldErrorHandler(com.qlangtech.tis.runtime.module.misc.IFieldErrorHandler) JSONArray(org.json.JSONArray) JSONObject(org.json.JSONObject) IControlMsgHandler(com.qlangtech.tis.runtime.module.misc.IControlMsgHandler) Validator(com.qlangtech.tis.plugin.annotation.Validator) Func(com.qlangtech.tis.manage.spring.aop.Func)

Example 10 with Func

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