use of com.qlangtech.tis.manage.common.apps.IAppsFetcher 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.common.apps.IAppsFetcher 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);
}
use of com.qlangtech.tis.manage.common.apps.IAppsFetcher 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.common.apps.IAppsFetcher 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