Search in sources :

Example 6 with ServerGroupCriteria

use of com.qlangtech.tis.manage.biz.dal.pojo.ServerGroupCriteria 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 7 with ServerGroupCriteria

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

the class GroupChangeSnapshotAction method doChange.

@Func(PermissionConstant.CONFIG_SNAPSHOT_CHANGE)
public // Navigator nav,
void doChange(Context context) throws Exception {
    Assert.assertNotNull("form can not be null", form);
    Assert.assertNotNull("form.getGroupSnapshot() can not be null", form.getGroupSnapshot());
    Assert.assertNotNull("form.getSnapshotId() can not be null", form.getSnapshotId());
    ServerGroupCriteria criteria = new ServerGroupCriteria();
    criteria.createCriteria().andGidEqualTo(form.getGroupId()).andRuntEnvironmentEqualTo(this.getAppDomain().getRunEnvironment().getId());
    ServerGroup group = new ServerGroup();
    group.setPublishSnapshotId(form.getSnapshotId());
    if (this.getServerGroupDAO().updateByExampleSelective(group, criteria) < 1) {
        throw new IllegalArgumentException("has not update success");
    }
    this.addActionMessage(context, "已经将第" + this.getServerGroupDAO().selectByPrimaryKey(form.getGroupId()).getGroupIndex() + "组,发布快照切换成:snapshot" + form.getSnapshotId());
}
Also used : ServerGroup(com.qlangtech.tis.manage.biz.dal.pojo.ServerGroup) ServerGroupCriteria(com.qlangtech.tis.manage.biz.dal.pojo.ServerGroupCriteria) Func(com.qlangtech.tis.manage.spring.aop.Func)

Aggregations

ServerGroupCriteria (com.qlangtech.tis.manage.biz.dal.pojo.ServerGroupCriteria)7 ServerGroup (com.qlangtech.tis.manage.biz.dal.pojo.ServerGroup)5 Func (com.qlangtech.tis.manage.spring.aop.Func)2 Application (com.qlangtech.tis.manage.biz.dal.pojo.Application)1 ApplicationCriteria (com.qlangtech.tis.manage.biz.dal.pojo.ApplicationCriteria)1 Criteria (com.qlangtech.tis.manage.biz.dal.pojo.ServerGroupCriteria.Criteria)1 Snapshot (com.qlangtech.tis.manage.biz.dal.pojo.Snapshot)1 ServerGroupAdapter (com.qlangtech.tis.runtime.pojo.ServerGroupAdapter)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 ArrayList (java.util.ArrayList)1 Date (java.util.Date)1