Search in sources :

Example 1 with Criteria

use of com.qlangtech.tis.manage.biz.dal.pojo.ApplicationCriteria.Criteria in project tis by qlangtech.

the class AppViewAction method doGetApps.

/**
 * 取得索引实例列表
 *
 * @param context
 * @throws Exception
 */
public void doGetApps(Context context) throws Exception {
    Integer dptid = this.getInt("dptid", null);
    String appName = this.getString("name");
    Integer dptId = (Integer) context.get("dptId");
    String recept = (String) context.get("recept");
    // 应用集合
    ApplicationCriteria query = new ApplicationCriteria();
    Criteria criteria = query.createCriteria();
    criteria.andAppIdNotEqualTo(SysInitializeAction.TEMPLATE_APPLICATION_DEFAULT_ID);
    if (dptid != null) {
        context.put("bizdomain", this.getDepartmentDAO().loadFromWriteDB(dptid));
    // criteria.andDptIdEqualTo(dptid);
    }
    if (appName != null && !appName.equals("search4")) {
        criteria.andProjectNameLike("%" + appName + "%");
    }
    if (dptId != null) {
        criteria.andDptIdEqualTo(dptId);
    }
    if (recept != null && !StringUtils.isEmpty(recept)) {
        criteria.andReceptEqualTo(recept);
    }
    query.setOrderByClause("last_process_time desc,app_id desc");
    int allRows = this.getApplicationDAO().countByExample(query);
    Pager pager = getPager();
    List<Application> apps = Collections.emptyList();
    pager.setTotalCount(allRows);
    if (allRows < 1) {
        // this.addErrorMessage(context, "很抱歉,未能找到结果");
        this.setBizResult(context, new PaginationResult(pager, apps));
        return;
    }
    context.put("recept", recept);
    context.put("dptId", dptId);
    apps = this.getApplicationDAO().selectByExample(query, pager.getCurPage(), pager.getRowsPerPage());
    apps.forEach((app) -> {
    // WorkFlow df = null;
    // if (app.getWorkFlowId() != null && (df = getWorkflowDAOFacade().getWorkFlowDAO().selectByPrimaryKey(app.getWorkFlowId())) != null) {
    // app.setDataflowName(df.getName());
    // }
    });
    this.setBizResult(context, new PaginationResult(pager, apps));
}
Also used : ApplicationCriteria(com.qlangtech.tis.manage.biz.dal.pojo.ApplicationCriteria) Pager(com.koubei.web.tag.pager.Pager) Criteria(com.qlangtech.tis.manage.biz.dal.pojo.ApplicationCriteria.Criteria) ApplicationCriteria(com.qlangtech.tis.manage.biz.dal.pojo.ApplicationCriteria) Application(com.qlangtech.tis.manage.biz.dal.pojo.Application)

Example 2 with Criteria

use of com.qlangtech.tis.manage.biz.dal.pojo.ApplicationCriteria.Criteria in project tis by qlangtech.

the class AddAppAction method doUpdate.

/**
 * 更新应用
 */
@Func(PermissionConstant.APP_UPDATE)
public // Navigator nav,
void doUpdate(Context context) {
    Application form = new Application();
    context.put("app", form);
    Integer bizid = this.getInt("bizid");
    final Integer appid = this.getInt("appid");
    Assert.assertNotNull(bizid);
    Assert.assertNotNull(appid);
    form.setAppId(appid);
    DepartmentCriteria criteria = new DepartmentCriteria();
    criteria.createCriteria().andDptIdEqualTo(bizid).andLeafEqualTo(BooleanYorNConvertCallback.YES);
    List<Department> depatment = this.getDepartmentDAO().selectByExample(criteria);
    Assert.assertTrue("dptid:" + bizid + " depatment can not be null ", depatment.size() == 1);
    for (Department d : depatment) {
        form.setDptId(d.getDptId());
        form.setDptName(d.getFullName());
    }
    form.setProjectName(this.getString(SchemaAction.FIELD_PROJECT_NAME));
    form.setRecept(this.getString("recept"));
    if (!isAppNameValid(this, context, SchemaAction.FIELD_PROJECT_NAME, form)) {
        return;
    }
    // 是否使用自动部署新方案
    form.setIsAutoDeploy("true".equalsIgnoreCase(this.getString("isautodeploy")));
    if (!validateAppForm(context, form)) {
        return;
    }
    IAppsFetcher fetcher = getAppsFetcher();
    fetcher.update(form, new CriteriaSetter() {

        @Override
        public void set(Criteria criteria) {
            criteria.andAppIdEqualTo(appid);
        }
    });
    this.addActionMessage(context, "已经成功更新应用[" + form.getProjectName() + "]");
}
Also used : CriteriaSetter(com.qlangtech.tis.manage.common.apps.AppsFetcher.CriteriaSetter) Criteria(com.qlangtech.tis.manage.biz.dal.pojo.ApplicationCriteria.Criteria) IAppsFetcher(com.qlangtech.tis.manage.common.apps.IAppsFetcher) Func(com.qlangtech.tis.manage.spring.aop.Func)

Example 3 with Criteria

use of com.qlangtech.tis.manage.biz.dal.pojo.ApplicationCriteria.Criteria in project tis by qlangtech.

the class ChangeDomainAction method getMatchApps.

// this.getRequest(), false, this.getUser(), this
protected static List<Application> getMatchApps(HttpServletRequest request, boolean isMaxMatch, final String appNameFuzzy, IUser user, RunContext context) {
    IAppsFetcher fetcher = null;
    fetcher = getAppsFetcher(request, isMaxMatch, user, context);
    return fetcher.getApps(new CriteriaSetter() {

        @Override
        public void set(Criteria criteria) {
            criteria.andProjectNameLike(appNameFuzzy + "%");
        }
    });
}
Also used : CriteriaSetter(com.qlangtech.tis.manage.common.apps.AppsFetcher.CriteriaSetter) Criteria(com.qlangtech.tis.manage.biz.dal.pojo.ApplicationCriteria.Criteria) IAppsFetcher(com.qlangtech.tis.manage.common.apps.IAppsFetcher)

Example 4 with Criteria

use of com.qlangtech.tis.manage.biz.dal.pojo.ApplicationCriteria.Criteria in project tis by qlangtech.

the class DepartmentAction method doDeleteDepartment.

/**
 * 删除部门
 *
 * @param context
 */
public void doDeleteDepartment(Context context) {
    final Integer dptid = this.getInt("dptid");
    Assert.assertNotNull(dptid);
    UsrDptRelationCriteria rcriteria = null;
    DepartmentCriteria query = null;
    // 校验是否有子部门
    query = new DepartmentCriteria();
    query.createCriteria().andParentIdEqualTo(dptid);
    if (this.getDepartmentDAO().countByExample(query) > 0) {
        this.addErrorMessage(context, "该部门有子部门,不能删除");
        return;
    }
    // 校验是否有成员关联在该部门上
    rcriteria = new UsrDptRelationCriteria();
    rcriteria.createCriteria().andDptIdEqualTo(dptid);
    if (this.getUsrDptRelationDAO().countByExample(rcriteria) > 0) {
        this.addErrorMessage(context, "有成员关联在该部门,不能删除");
        return;
    }
    // 检验是否有应用绑定在部门上
    IAppsFetcher fetcher = getAppsFetcher();
    int appsCount = fetcher.count(new CriteriaSetter() {

        @Override
        public void set(Criteria criteria) {
            criteria.andDptIdEqualTo(dptid);
        }
    });
    if (appsCount > 0) {
        this.addErrorMessage(context, "该部门下有" + appsCount + "个应用,不能删除");
        return;
    }
    this.getDepartmentDAO().deleteByPrimaryKey(dptid);
    DataxAction.cleanDepsCache();
    this.addActionMessage(context, "已经成功删除部门:" + OrgAuthorityAction.getDepartmentName(this.getDepartmentDAO(), dptid));
}
Also used : UsrDptRelationCriteria(com.qlangtech.tis.manage.biz.dal.pojo.UsrDptRelationCriteria) CriteriaSetter(com.qlangtech.tis.manage.common.apps.AppsFetcher.CriteriaSetter) Criteria(com.qlangtech.tis.manage.biz.dal.pojo.ApplicationCriteria.Criteria) UsrDptRelationCriteria(com.qlangtech.tis.manage.biz.dal.pojo.UsrDptRelationCriteria) DepartmentCriteria(com.qlangtech.tis.manage.biz.dal.pojo.DepartmentCriteria) IAppsFetcher(com.qlangtech.tis.manage.common.apps.IAppsFetcher) DepartmentCriteria(com.qlangtech.tis.manage.biz.dal.pojo.DepartmentCriteria)

Aggregations

Criteria (com.qlangtech.tis.manage.biz.dal.pojo.ApplicationCriteria.Criteria)4 CriteriaSetter (com.qlangtech.tis.manage.common.apps.AppsFetcher.CriteriaSetter)3 IAppsFetcher (com.qlangtech.tis.manage.common.apps.IAppsFetcher)3 Pager (com.koubei.web.tag.pager.Pager)1 Application (com.qlangtech.tis.manage.biz.dal.pojo.Application)1 ApplicationCriteria (com.qlangtech.tis.manage.biz.dal.pojo.ApplicationCriteria)1 DepartmentCriteria (com.qlangtech.tis.manage.biz.dal.pojo.DepartmentCriteria)1 UsrDptRelationCriteria (com.qlangtech.tis.manage.biz.dal.pojo.UsrDptRelationCriteria)1 Func (com.qlangtech.tis.manage.spring.aop.Func)1