use of com.qlangtech.tis.manage.biz.dal.pojo.ApplicationCriteria in project tis by qlangtech.
the class TSearcherClusterInfoCollect method getAppNameMap.
/**
* 保存索引名称和 应用的映射关系
*
* @return
*/
private Map<String, /* index Name */
Application> getAppNameMap() {
if (appNamesMap == null) {
synchronized (TSearcherClusterInfoCollect.class) {
if (appNamesMap == null) {
appNamesMap = new HashMap<String, Application>();
ApplicationCriteria query = new ApplicationCriteria();
List<Application> apps = this.getApplicationDAO().selectByExample(query, 1, 500);
for (Application app : apps) {
appNamesMap.put(app.getProjectName(), app);
}
}
}
}
return appNamesMap;
}
use of com.qlangtech.tis.manage.biz.dal.pojo.ApplicationCriteria 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 in project tis by qlangtech.
the class TestCollectionAction method clearUpDB.
private void clearUpDB() {
IWorkflowDAOFacade wfDaoFacade = applicationContext.getBean("wfDaoFacade", IWorkflowDAOFacade.class);
DatasourceTableCriteria tabCriteria = new DatasourceTableCriteria();
tabCriteria.createCriteria().andNameEqualTo(TEST_TABLE_EMPLOYEES_NAME);
wfDaoFacade.getDatasourceTableDAO().deleteByExample(tabCriteria);
DatasourceDbCriteria dbCriteria = new DatasourceDbCriteria();
dbCriteria.createCriteria().andNameEqualTo(TEST_DS_NAME);
wfDaoFacade.getDatasourceDbDAO().deleteByExample(dbCriteria);
WorkFlowCriteria wfCriteria = new WorkFlowCriteria();
wfCriteria.createCriteria().andNameEqualTo(TEST_TABLE_EMPLOYEES_NAME);
wfDaoFacade.getWorkFlowDAO().deleteByExample(wfCriteria);
// daoContext" class="com.qlangtech.tis.manage.common.RunContextImpl
RunContext daoContext = applicationContext.getBean("daoContext", RunContext.class);
ApplicationCriteria appCriteria = new ApplicationCriteria();
appCriteria.createCriteria().andProjectNameEqualTo(TISCollectionUtils.NAME_PREFIX + TEST_TABLE_EMPLOYEES_NAME);
for (Application app : daoContext.getApplicationDAO().selectByExample(appCriteria)) {
ServerGroupCriteria sgCriteria = new ServerGroupCriteria();
sgCriteria.createCriteria().andAppIdEqualTo(app.getAppId());
daoContext.getServerGroupDAO().deleteByExample(sgCriteria);
}
daoContext.getApplicationDAO().deleteByExample(appCriteria);
for (Long gid : daoContext.getServerGroupDAO().getServergroupWithoutAppReference()) {
// assertNotNull(g.getGid());
daoContext.getServerGroupDAO().deleteByPrimaryKey(gid.intValue());
}
// select g.gid
// from server_group g left join application a on g.app_id = a.app_id
// where a.app_id is null
}
use of com.qlangtech.tis.manage.biz.dal.pojo.ApplicationCriteria in project tis by qlangtech.
the class DataxAction method doUpdateDatax.
@Func(value = PermissionConstant.DATAX_MANAGE)
public void doUpdateDatax(Context context) throws Exception {
String dataxName = this.getCollectionName();
DataxProcessor old = IAppSource.load(null, dataxName);
DataxProcessor editting = IAppSource.load(this, dataxName);
File oldWorkDir = old.getDataXWorkDir((IPluginContext) null);
File edittingDir = editting.getDataXWorkDir((IPluginContext) this);
String edittingDirSuffix = StringUtils.substringAfter(edittingDir.getName(), oldWorkDir.getName());
Matcher matcher = PatternEdittingDirSuffix.matcher(edittingDirSuffix);
if (!matcher.matches()) {
throw new IllegalStateException("dir name is illegal,oldDir:" + oldWorkDir.getAbsolutePath() + " editting dir:" + edittingDir.getAbsolutePath());
}
File backDir = new File(oldWorkDir.getParentFile(), oldWorkDir.getName() + ".bak");
// 先备份
try {
FileUtils.moveDirectory(oldWorkDir, backDir);
FileUtils.moveDirectory(edittingDir, oldWorkDir);
FileUtils.forceDelete(backDir);
} catch (Exception e) {
try {
FileUtils.moveDirectory(backDir, oldWorkDir);
} catch (Throwable ex) {
}
throw new IllegalStateException("oldWorkDir update is illegal:" + oldWorkDir.getAbsolutePath(), e);
}
// 更新一下时间戳,workflow 会重新创建流程
Application dataXApp = new Application();
dataXApp.setUpdateTime(new Date());
ApplicationCriteria appCriteria = new ApplicationCriteria();
appCriteria.createCriteria().andProjectNameEqualTo(dataxName);
this.getApplicationDAO().updateByExampleSelective(dataXApp, appCriteria);
IAppSource.cleanAppSourcePluginStoreCache(null, dataxName);
IAppSource.cleanAppSourcePluginStoreCache(this, dataxName);
this.addActionMessage(context, "已经成功更新");
}
use of com.qlangtech.tis.manage.biz.dal.pojo.ApplicationCriteria in project tis by qlangtech.
the class NormalUserApplicationFetcher method getApps.
// NormalUserApplicationFetcher(TUser user, RunContext context) {
// super(user, context);
// }
@Override
public final List<Application> getApps(CriteriaSetter setter) {
ApplicationCriteria criteria = createCriteria(setter);
criteria.setOrderByClause("app_id desc");
return this.getApplicationDAO().selectByExample(criteria, 1, 500);
}
Aggregations