Search in sources :

Example 1 with ApplicationCriteria

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;
}
Also used : ApplicationCriteria(com.qlangtech.tis.manage.biz.dal.pojo.ApplicationCriteria) Application(com.qlangtech.tis.manage.biz.dal.pojo.Application)

Example 2 with ApplicationCriteria

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));
}
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 3 with ApplicationCriteria

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
}
Also used : ApplicationCriteria(com.qlangtech.tis.manage.biz.dal.pojo.ApplicationCriteria) DatasourceTableCriteria(com.qlangtech.tis.workflow.pojo.DatasourceTableCriteria) ServerGroupCriteria(com.qlangtech.tis.manage.biz.dal.pojo.ServerGroupCriteria) IWorkflowDAOFacade(com.qlangtech.tis.workflow.dao.IWorkflowDAOFacade) WorkFlowCriteria(com.qlangtech.tis.workflow.pojo.WorkFlowCriteria) DatasourceDbCriteria(com.qlangtech.tis.workflow.pojo.DatasourceDbCriteria) Application(com.qlangtech.tis.manage.biz.dal.pojo.Application)

Example 4 with ApplicationCriteria

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, "已经成功更新");
}
Also used : Matcher(java.util.regex.Matcher) ApplicationCriteria(com.qlangtech.tis.manage.biz.dal.pojo.ApplicationCriteria) File(java.io.File) Application(com.qlangtech.tis.manage.biz.dal.pojo.Application) IOException(java.io.IOException) Func(com.qlangtech.tis.manage.spring.aop.Func)

Example 5 with ApplicationCriteria

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);
}
Also used : ApplicationCriteria(com.qlangtech.tis.manage.biz.dal.pojo.ApplicationCriteria)

Aggregations

ApplicationCriteria (com.qlangtech.tis.manage.biz.dal.pojo.ApplicationCriteria)10 Application (com.qlangtech.tis.manage.biz.dal.pojo.Application)7 Pager (com.koubei.web.tag.pager.Pager)1 GitUser (com.qlangtech.tis.git.GitUtils.GitUser)1 Criteria (com.qlangtech.tis.manage.biz.dal.pojo.ApplicationCriteria.Criteria)1 ServerGroupCriteria (com.qlangtech.tis.manage.biz.dal.pojo.ServerGroupCriteria)1 Func (com.qlangtech.tis.manage.spring.aop.Func)1 IWorkflowDAOFacade (com.qlangtech.tis.workflow.dao.IWorkflowDAOFacade)1 DatasourceDbCriteria (com.qlangtech.tis.workflow.pojo.DatasourceDbCriteria)1 DatasourceTableCriteria (com.qlangtech.tis.workflow.pojo.DatasourceTableCriteria)1 WorkFlowCriteria (com.qlangtech.tis.workflow.pojo.WorkFlowCriteria)1 File (java.io.File)1 IOException (java.io.IOException)1 SQLException (java.sql.SQLException)1 Matcher (java.util.regex.Matcher)1