Search in sources :

Example 56 with Func

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

the class AppViewAction method doQueryApp.

@Func(value = PermissionConstant.PERMISSION_INDEX_QUERY, sideEffect = false)
public void doQueryApp(Context context) throws Exception {
    final String appNameFuzzy = StringUtils.trimToEmpty(this.getString("query"));
    final IAppsFetcher fetcher = UserUtils.getAppsFetcher(this.getRequest(), this);
    final List<Application> appresult = fetcher.getApps((criteria) -> {
        criteria.andProjectNameLike(StringUtils.startsWith(appNameFuzzy, "search4") ? (appNameFuzzy + "%") : ("%" + appNameFuzzy + "%"));
    });
    this.setBizResult(context, appresult);
}
Also used : IAppsFetcher(com.qlangtech.tis.manage.common.apps.IAppsFetcher) Application(com.qlangtech.tis.manage.biz.dal.pojo.Application) Func(com.qlangtech.tis.manage.spring.aop.Func)

Example 57 with Func

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

the class GroupAction method doAddGroup.

/**
 * 添加一个组
 *
 * @param context
 * @throws Exception
 */
@Func(PermissionConstant.APP_SERVER_GROUP_SET)
public void doAddGroup(Context context) throws Exception {
    RunEnvironment runtime = RunEnvironment.getEnum(this.getShort("runtime"));
    Integer groupIndex = this.getInt("groupIndex");
    Integer appid = this.getInt("appid");
    if (groupIndex == null) {
        this.addErrorMessage(context, "请填写组编号");
        return;
    }
    if (runtime == null) {
        this.addErrorMessage(context, "请选择运行环境");
        return;
    }
    Integer publishSnapshotId = -1;
    createGroup(runtime, groupIndex, appid, publishSnapshotId, this.getServerGroupDAO());
    this.addActionMessage(context, "【" + runtime.getDescribe() + "】中新创建一条服务器组成功");
}
Also used : RunEnvironment(com.qlangtech.tis.pubhook.common.RunEnvironment) Func(com.qlangtech.tis.manage.spring.aop.Func)

Example 58 with Func

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

the class RoleAction method doUpdateRole.

/**
 * 更新角色
 *
 * @param context
 */
@Func(PermissionConstant.AUTHORITY_ROLE_UPDATE)
public void doUpdateRole(Context context) {
    // 用户选中的func功能集合
    final List<Integer> funcids = Arrays.asList(this.getIntAry("funcid"));
    final Role role = this.getRoleDAO().loadFromWriteDB(this.getInt("roleid"));
    String roleName = this.getString("rolename");
    role.setRoleName(roleName);
    context.put("role", role);
    context.put(selfuncidKEY, Collections.unmodifiableCollection(funcids));
    if (StringUtils.isBlank(roleName)) {
        this.addErrorMessage(context, "请添写角色名称");
        return;
    }
    RoleCriteria criteria = new RoleCriteria();
    criteria.createCriteria().andRoleNameEqualTo(roleName).andRIdNotEqualTo(role.getrId());
    if (this.getRoleDAO().countByExample(criteria) > 0) {
        this.addErrorMessage(context, "角色名称:“" + roleName + "”已经创建");
        return;
    }
    if (funcids.size() < 1) {
        this.addErrorMessage(context, "请为新添加的角色设置相应的功能");
        return;
    }
    FuncRoleRelationCriteria fcriteria = new FuncRoleRelationCriteria();
    fcriteria.createCriteria().andRIdEqualTo(role.getrId());
    List<FuncRoleRelation> rellist = this.getFuncRoleRelationDAO().selectByExample(fcriteria);
    List<Integer> orignfunclist = new ArrayList<Integer>();
    for (FuncRoleRelation rel : rellist) {
        orignfunclist.add(rel.getFuncId());
    }
    List<Integer> addfuncs = new ArrayList<Integer>();
    // 需要删除的
    for (Integer funcid : funcids) {
        if (orignfunclist.contains(funcid)) {
            orignfunclist.remove(funcid);
        } else {
            addfuncs.add(funcid);
        }
    }
    for (Integer funcid : orignfunclist) {
        fcriteria = new FuncRoleRelationCriteria();
        fcriteria.createCriteria().andRIdEqualTo(role.getrId()).andFuncIdEqualTo(funcid);
        this.getFuncRoleRelationDAO().deleteByExample(fcriteria);
    }
    Role update = new Role();
    update.setRoleName(roleName);
    RoleCriteria rcriteria = new RoleCriteria();
    rcriteria.createCriteria().andRIdEqualTo(role.getrId());
    this.getRoleDAO().updateByExampleSelective(update, rcriteria);
    // 需要添加的
    createRelation(addfuncs, role);
    this.addActionMessage(context, "成功更新角色:“" + role.getRoleName() + "”");
}
Also used : Role(com.qlangtech.tis.manage.biz.dal.pojo.Role) RoleCriteria(com.qlangtech.tis.manage.biz.dal.pojo.RoleCriteria) FuncRoleRelationCriteria(com.qlangtech.tis.manage.biz.dal.pojo.FuncRoleRelationCriteria) ArrayList(java.util.ArrayList) FuncRoleRelation(com.qlangtech.tis.manage.biz.dal.pojo.FuncRoleRelation) Func(com.qlangtech.tis.manage.spring.aop.Func)

Example 59 with Func

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

the class RoleAction method doAddRole.

@Func(PermissionConstant.AUTHORITY_ROLE_ADD)
public void doAddRole(Context context) {
    String roleName = this.getString("rolename");
    final Integer[] funcids = (Integer[]) getSelfuncid().toArray();
    if (StringUtils.isBlank(roleName)) {
        this.addErrorMessage(context, "请添写角色名称");
        return;
    }
    RoleCriteria criteria = new RoleCriteria();
    criteria.createCriteria().andRoleNameEqualTo(roleName);
    if (this.getRoleDAO().countByExample(criteria) > 0) {
        this.addErrorMessage(context, "角色名称:“" + roleName + "”已经创建");
        return;
    }
    if (funcids.length < 1) {
        this.addErrorMessage(context, "请为新添加的角色设置相应的功能");
        return;
    }
    Role role = new Role();
    role.setGmtCreate(new Date());
    role.setGmtModified(new Date());
    role.setRoleName(roleName);
    Integer newRoleId = this.getRoleDAO().insertSelective(role);
    role.setrId(newRoleId);
    createRelation(Arrays.asList(funcids), role);
    this.addActionMessage(context, "成功添加角色:“" + roleName + "”");
}
Also used : Role(com.qlangtech.tis.manage.biz.dal.pojo.Role) RoleCriteria(com.qlangtech.tis.manage.biz.dal.pojo.RoleCriteria) Date(java.util.Date) Func(com.qlangtech.tis.manage.spring.aop.Func)

Example 60 with Func

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

the class UploadJarAction method doUploadJar.

/**
 * 处理上传文件的请求
 */
@Func(PermissionConstant.CONFIG_UPLOAD)
public // @FormGroup(GROUP_NAME) UploadJarForm form,
void doUploadJar(Context context) throws Exception {
    if (form.getSchema() == null || form.getConfig() == null) {
        this.addErrorMessage(context, "您需要上传schema和solrconfig文件");
        return;
    }
    Snapshot snapshot = parseSnapshot(context, this.form);
    // 最后 创建snapshot对象
    this.addActionMessage(context, "成功添加snapshotID:" + this.getSnapshotDAO().insertSelective(snapshot) + "的快照记录");
}
Also used : Snapshot(com.qlangtech.tis.manage.biz.dal.pojo.Snapshot) 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