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));
}
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() + "]");
}
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 + "%");
}
});
}
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));
}
Aggregations