Search in sources :

Example 6 with ApplicationCriteria

use of com.qlangtech.tis.manage.biz.dal.pojo.ApplicationCriteria in project tis by qlangtech.

the class NormalUserApplicationFetcher method createCriteria.

private ApplicationCriteria createCriteria(CriteriaSetter setter) {
    ApplicationCriteria criteria = new ApplicationCriteria();
    setter.set(process(criteria.createCriteria()));
    return criteria;
}
Also used : ApplicationCriteria(com.qlangtech.tis.manage.biz.dal.pojo.ApplicationCriteria)

Example 7 with ApplicationCriteria

use of com.qlangtech.tis.manage.biz.dal.pojo.ApplicationCriteria in project tis by qlangtech.

the class TSearcherClusterInfoCollect method getBuAppMap.

/**
 */
public // Map<String, List<App>>
BuAppMap getBuAppMap() {
    BuAppMap buAppMap = new BuAppMap();
    ApplicationCriteria query = new ApplicationCriteria();
    List<Application> apps = getApplicationDAO().selectByExample(query);
    List<App> applist = null;
    for (Application ap : apps) {
        App pp = new App();
        pp.setAppid(ap.getAppId());
        pp.setDpt(ap.getDptName());
        pp.setServiceName(ap.getProjectName());
        if ((applist = buAppMap.get(pp.getBu())) == null) {
            applist = new ArrayList<App>();
            buAppMap.put(pp.getBu(), applist);
        }
        applist.add(pp);
    }
    return buAppMap;
}
Also used : ApplicationCriteria(com.qlangtech.tis.manage.biz.dal.pojo.ApplicationCriteria) Application(com.qlangtech.tis.manage.biz.dal.pojo.Application)

Example 8 with ApplicationCriteria

use of com.qlangtech.tis.manage.biz.dal.pojo.ApplicationCriteria in project tis by qlangtech.

the class OfflineManager method deleteWorkflow.

// public WorkflowPojo getWorkflowConfig(String name, boolean isMaster) {
// return
// }
// public WorkflowPojo getWorkflowConfig(String name, String sha) {
// return GitUtils.$().getWorkflowSha(GitUtils.WORKFLOW_GIT_PROJECT_ID, sha,
// name);
// }
public void deleteWorkflow(int id, BasicModule action, Context context) {
    WorkFlow workFlow = workflowDAOFacade.getWorkFlowDAO().selectByPrimaryKey(id);
    if (workFlow == null) {
        action.addErrorMessage(context, "数据库没有这条记录");
        return;
    }
    if (workFlow.getInChange().intValue() != 0) {
        action.addErrorMessage(context, "该工作流在变更中,无法删除");
        return;
    }
    ApplicationCriteria applicationCriteria = new ApplicationCriteria();
    applicationCriteria.createCriteria().andWorkFlowIdEqualTo(id);
    List<Application> applications = action.getApplicationDAO().selectByExample(applicationCriteria);
    if (!CollectionUtils.isEmpty(applications)) {
        StringBuilder stringBuilder = new StringBuilder();
        for (Application application : applications) {
            stringBuilder.append(application.getProjectName()).append(", ");
        }
        action.addErrorMessage(context, "请先删除与该工作流相关的索引,相关索引为" + stringBuilder.toString());
        return;
    }
    try {
        GitUser user = GitUser.dft();
        // delete git
        GitUtils.$().deleteWorkflow(workFlow.getName(), user);
        // delete db
        workflowDAOFacade.getWorkFlowDAO().deleteByPrimaryKey(id);
        // TODO 删除线上db的数据,发送一个http请求
        action.addActionMessage(context, "工作流删除成功");
    } catch (Exception e) {
        action.addErrorMessage(context, "工作流删除失败");
        action.addErrorMessage(context, e.getMessage());
    }
}
Also used : ApplicationCriteria(com.qlangtech.tis.manage.biz.dal.pojo.ApplicationCriteria) Application(com.qlangtech.tis.manage.biz.dal.pojo.Application) SQLException(java.sql.SQLException) GitUser(com.qlangtech.tis.git.GitUtils.GitUser)

Example 9 with ApplicationCriteria

use of com.qlangtech.tis.manage.biz.dal.pojo.ApplicationCriteria in project tis by qlangtech.

the class ApplicationDAOImpl method updateLastProcessTime.

@Override
public int updateLastProcessTime(String appname) {
    if (StringUtils.isBlank(appname)) {
        throw new IllegalArgumentException("param appId can not be null");
    }
    ApplicationCriteria criteria = new ApplicationCriteria();
    criteria.createCriteria().andProjectNameEqualTo(appname);
    return this.updateRecords("application.ibatorgenerated_updateLastProcessTime", criteria);
}
Also used : ApplicationCriteria(com.qlangtech.tis.manage.biz.dal.pojo.ApplicationCriteria)

Example 10 with ApplicationCriteria

use of com.qlangtech.tis.manage.biz.dal.pojo.ApplicationCriteria in project tis by qlangtech.

the class CheckAppDomainExistValve method queryApplication.

public static AppDomainInfo queryApplication(HttpServletRequest request, RunContext context, final String appname, RunEnvironment runtime) {
    if (true) {
        ApplicationCriteria query = new ApplicationCriteria();
        query.createCriteria().andProjectNameEqualTo(appname);
        AppDomainInfo appDomain = null;
        for (Application app : context.getApplicationDAO().selectByExample(query)) {
            // Integer bizid, Integer appid, RunEnvironment runEnvironment, Application app
            appDomain = new // getRuntime(match),
            AppDomainInfo(// getRuntime(match),
            app.getDptId(), // getRuntime(match),
            app.getAppId(), runtime, app);
            // appDomain.setAppName(appname);
            break;
        }
        return appDomain;
    }
    return null;
// // ApplicationCriteria criteria = new ApplicationCriteria();
// // criteria.createCriteria().andProjectNameEqualTo(
// // // match.group(1)
// // appname);// .andNotDelete();
// AppDomainInfo appDomain = null;
// IAppsFetcher appFetcher = UserUtils.getAppsFetcher(request, context);
// 
// List<Application> applist = appFetcher.getApps(new CriteriaSetter() {
// @Override
// public void set(Criteria criteria) {
// criteria.andProjectNameEqualTo(appname);
// }
// });
// 
// // List<Application> applist = applicationDAO.selectByExample(criteria,
// // 1,
// // 100);
// 
// // AppsFetcher.create();
// 
// for (Application app : applist) {
// // appDomain = new AppDomainInfo(app, Integer
// // .parseInt(match.group(2)), applicationDAO);
// 
// // 如果应用的部门为空则说明不是一个合法的部门
// if (app.getDptId() == null || app.getDptId() < 1) {
// return CheckAppDomainExistValve.createNull();
// }
// 
// appDomain = new AppDomainInfo(app.getDptId(), app.getAppId(), runtime,
// // getRuntime(match),
// context);
// 
// appDomain.setAutoDeploy(app.getIsAutoDeploy());
// break;
// }
// return appDomain;
}
Also used : ApplicationCriteria(com.qlangtech.tis.manage.biz.dal.pojo.ApplicationCriteria) Application(com.qlangtech.tis.manage.biz.dal.pojo.Application)

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