use of com.qlangtech.tis.manage.biz.dal.pojo.Application in project tis by qlangtech.
the class DownloadServlet method getDownloadResource.
protected DownloadResource getDownloadResource(Matcher matcher) {
Integer bizid = Integer.parseInt(matcher.group(1));
Integer appid = Integer.parseInt(matcher.group(2));
Short groupIndex = Short.parseShort(matcher.group(3));
// 开发环境 线上 线下。。。。
Short runtime = Short.parseShort(matcher.group(4));
final String resourceName = matcher.group(5);
final ServerGroup group = getServerGroup(appid, groupIndex, runtime, this.getContext().getServerGroupDAO());
if (group == null) {
throw new IllegalStateException("appid:" + appid + ",groupIndex:" + groupIndex + " runtime:" + AppDomainInfo.getRunEnvir(runtime) + " can not find a group");
}
if (group.getPublishSnapshotId() == null) {
throw new IllegalStateException("group id:" + group.getGid() + " group have not set publishSnapshotId");
}
Application app = this.getContext().getApplicationDAO().selectByPrimaryKey(appid);
if (bizid.intValue() != app.getDptId()) {
throw new IllegalArgumentException("bizid.intValue()" + bizid.intValue() + " != app.getBizId()" + app.getDptId());
}
final SnapshotDomain snapshot = this.getContext().getSnapshotViewDAO().getView(group.getPublishSnapshotId());
// Snapshot snapshot, String resourceName
return new DownloadResource(app, snapshot, resourceName);
}
use of com.qlangtech.tis.manage.biz.dal.pojo.Application 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.Application 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.Application 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.Application in project tis by qlangtech.
the class CollectionAction method doDeleteIndex.
/**
* 删除索引实例
*
* @param context
* @throws Exception
*/
public void doDeleteIndex(Context context) throws Exception {
getIndexWithPost();
// 删除
Application app = this.getApplicationDAO().selectByName(this.indexName.getCollectionName());
if (app == null) {
throw new IllegalStateException("indexName:" + this.indexName.getCollectionName() + " relevant instance in db can not be empty");
}
// final WorkFlow workFlow = this.loadDF(app.getWorkFlowId());
this.rescycleAppDB(app.getAppId());
// this.getWorkflowDAOFacade().getWorkFlowDAO().deleteByPrimaryKey(workFlow.getId());
WorkFlowBuildHistoryCriteria wfHistoryCriteria = new WorkFlowBuildHistoryCriteria();
// wfHistoryCriteria.createCriteria().andWorkFlowIdEqualTo(workFlow.getId());
this.getWorkflowDAOFacade().getWorkFlowBuildHistoryDAO().deleteByExample(wfHistoryCriteria);
this.deleteCollectionInCloud(context, app.getProjectName());
// 删除workflow数据库及本地存储文件
// TopologyDir topologyDir = SqlTaskNodeMeta.getTopologyDir(workFlow.getName());
// if (topologyDir.synchronizeSubRemoteRes().size() > 0) {
// IndexStreamCodeGenerator indexStreamCodeGenerator
// = CoreAction.getIndexStreamCodeGenerator(this, workFlow, false);
// indexStreamCodeGenerator.deleteScript();
// }
// topologyDir.delete();
IPluginStore<IncrStreamFactory> store = CoreAction.getIncrStreamFactoryStore(this);
try {
if (store.getPlugin() != null) {
// 删除增量实例
TISK8sDelegate k8sDelegate = TISK8sDelegate.getK8SDelegate(this.getCollectionName());
k8sDelegate.removeIncrProcess();
}
} catch (Throwable e) {
// 可能创建过程增量没有正常,不能导致删除失败
logger.warn("k8sDelegate illegal", e);
}
}
Aggregations