use of com.qlangtech.tis.manage.biz.dal.pojo.Snapshot in project tis by qlangtech.
the class SaveFileContentAction method getSnapshot.
private static final SnapshotDomain getSnapshot(BasicModule module, Context context) {
Snapshot sn = (Snapshot) context.get("snapshot");
if (sn != null) {
return module.getSnapshotViewDAO().getView(sn.getSnId(), false);
}
// isEditModel() ? this.getInt("snapshotid") :
Integer snapshotId = module.getInt("snapshot");
SnapshotDomain snapshot = module.getSnapshotViewDAO().getView(snapshotId, false);
if (snapshot == null) {
throw new IllegalArgumentException("snapshotId:" + snapshotId + " can not find pojo in db");
}
context.put("snap", snapshot.getSnapshot());
return snapshot;
}
use of com.qlangtech.tis.manage.biz.dal.pojo.Snapshot in project tis by qlangtech.
the class BasicScreen method createServerGroupAdapterList.
public static List<ServerGroupAdapter> createServerGroupAdapterList(ServerGroupCriteriaSetter setter, final boolean publishSnapshotIdIsNotNull, RunContext daoContext) {
ServerGroupCriteria criteria = new ServerGroupCriteria();
ServerGroupCriteria.Criteria query = criteria.createCriteria();
query.andNotDelete();
setter.process(query);
// query.andAppIdEqualTo(domain.getAppid()).andRuntEnvironmentEqualTo(
// domain.getRunEnvironment().getId());
//
// if (publishSnapshotIdIsNotNull) {
// query.andPublishSnapshotIdIsNotNull();
// }
List<ServerGroup> groupList = daoContext.getServerGroupDAO().selectByExample(criteria, 1, 400);
List<ServerGroupAdapter> groupAdapterList = new ArrayList<ServerGroupAdapter>();
for (ServerGroup group : groupList) {
Snapshot snapshot = new Snapshot();
int maxSnapshotId = 0;
if (publishSnapshotIdIsNotNull) {
snapshot = daoContext.getSnapshotDAO().selectByPrimaryKey(group.getPublishSnapshotId());
// SnapshotCriteria snapshotCriteria = new SnapshotCriteria();
// snapshotCriteria.createCriteria().andAppidEqualTo(
// group.getGid());
// maxSnapshotId = daoContext.getSnapshotDAO().getMaxSnapshotId(
// snapshotCriteria);
maxSnapshotId = setter.getMaxSnapshotId(group, daoContext);
if (snapshot == null) {
throw new IllegalStateException("group:" + group.getGid() + " has not set PublishSnapshotId,or group.getPublishSnapshotId():" + group.getPublishSnapshotId() + " has any snapshot in db");
}
}
ServerGroupAdapter adapter = new ServerGroupAdapter(group, snapshot);
// maxSnapshotId
adapter.setMaxSnapshotId(maxSnapshotId);
// ServerCriteria scrit = new ServerCriteria();
// scrit.createCriteria(false).andGidEqualTo(group.getGid());
// ;
// adapter.addServer(daoContext.getServerDAO().selectByExample(scrit));
adapter.addServer(setter.getServers(daoContext, group));
groupAdapterList.add(adapter);
}
return groupAdapterList;
}
use of com.qlangtech.tis.manage.biz.dal.pojo.Snapshot in project tis by qlangtech.
the class UploadJarAction method parseSnapshot.
/**
* 创建snapshot
*
* @param context
* @param formm
* @return
* @throws IOException
*/
protected Snapshot parseSnapshot(Context context, UploadJarForm formm, SnapshotCreater snapshotCreater) throws IOException {
ConfigContentGetter[] getter = getContentGetter(formm);
ConfigFileValidateResult validateValidateResult = null;
boolean fileValid = true;
// 校验文件格式是否正确
ISchemaPluginContext schemaPlugin = SchemaAction.createSchemaPlugin(this.getCollectionName());
for (ConfigContentGetter get : getter) {
validateValidateResult = get.getterStrategy.validate(schemaPlugin, get.content);
if (!validateValidateResult.isValid()) {
this.addErrorMessage(context, validateValidateResult.getValidateResult());
fileValid = false;
}
}
if (!fileValid) {
return null;
}
// createSnapshot(getter);
Snapshot snapshot = snapshotCreater.create(getter);
snapshot.setPreSnId(-1);
return snapshot;
}
use of com.qlangtech.tis.manage.biz.dal.pojo.Snapshot in project tis by qlangtech.
the class SnapshotDAOImpl method deleteByPrimaryKey.
public int deleteByPrimaryKey(Integer snId) {
Snapshot key = new Snapshot();
key.setSnId(snId);
return this.deleteRecords("snapshot.ibatorgenerated_deleteByPrimaryKey", key);
}
use of com.qlangtech.tis.manage.biz.dal.pojo.Snapshot in project tis by qlangtech.
the class SnapshotDAOImpl method loadFromWriteDB.
public Snapshot loadFromWriteDB(Integer snId) {
Snapshot key = new Snapshot();
key.setSnId(snId);
Snapshot record = this.loadFromWriterDB("snapshot.ibatorgenerated_selectByPrimaryKey", key);
return record;
}
Aggregations