Search in sources :

Example 11 with ServerGroup

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

Example 12 with ServerGroup

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

the class ViewPojo method getSnapshotDoamin.

public static SnapshotDomain getSnapshotDoamin(BasicModule module, final AppDomainInfo appDomainInfo) {
    ServerGroup group = DownloadServlet.getServerGroup(appDomainInfo.getAppid(), (short) 0, appDomainInfo.getRunEnvironment().getId(), module.getServerGroupDAO());
    if (group == null) {
        // return false;
        throw new IllegalStateException("application:" + appDomainInfo + " can not get relevant serverGroup");
    }
    final SnapshotDomain snapshot = module.getSnapshotViewDAO().getView(group.getPublishSnapshotId());
    return snapshot;
}
Also used : ServerGroup(com.qlangtech.tis.manage.biz.dal.pojo.ServerGroup) SnapshotDomain(com.qlangtech.tis.manage.common.SnapshotDomain)

Aggregations

ServerGroup (com.qlangtech.tis.manage.biz.dal.pojo.ServerGroup)12 ServerGroupCriteria (com.qlangtech.tis.manage.biz.dal.pojo.ServerGroupCriteria)5 SnapshotDomain (com.qlangtech.tis.manage.common.SnapshotDomain)2 ISnapshotViewDAO (com.qlangtech.tis.manage.biz.dal.dao.ISnapshotViewDAO)1 Application (com.qlangtech.tis.manage.biz.dal.pojo.Application)1 Criteria (com.qlangtech.tis.manage.biz.dal.pojo.ServerGroupCriteria.Criteria)1 Snapshot (com.qlangtech.tis.manage.biz.dal.pojo.Snapshot)1 Func (com.qlangtech.tis.manage.spring.aop.Func)1 SnapshotNotFindException (com.qlangtech.tis.openapi.SnapshotNotFindException)1 ServerGroupAdapter (com.qlangtech.tis.runtime.pojo.ServerGroupAdapter)1 ArrayList (java.util.ArrayList)1 Date (java.util.Date)1