Search in sources :

Example 1 with Snapshot

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

Example 2 with 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;
}
Also used : Snapshot(com.qlangtech.tis.manage.biz.dal.pojo.Snapshot) ServerGroup(com.qlangtech.tis.manage.biz.dal.pojo.ServerGroup) Criteria(com.qlangtech.tis.manage.biz.dal.pojo.ServerGroupCriteria.Criteria) ServerGroupAdapter(com.qlangtech.tis.runtime.pojo.ServerGroupAdapter) ServerGroupCriteria(com.qlangtech.tis.manage.biz.dal.pojo.ServerGroupCriteria) ArrayList(java.util.ArrayList)

Example 3 with Snapshot

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;
}
Also used : Snapshot(com.qlangtech.tis.manage.biz.dal.pojo.Snapshot) ISchemaPluginContext(com.qlangtech.tis.solrdao.ISchemaPluginContext) ConfigFileValidateResult(com.qlangtech.tis.manage.common.ConfigFileValidateResult)

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

Example 5 with Snapshot

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

Aggregations

Snapshot (com.qlangtech.tis.manage.biz.dal.pojo.Snapshot)9 ServerGroup (com.qlangtech.tis.manage.biz.dal.pojo.ServerGroup)1 ServerGroupCriteria (com.qlangtech.tis.manage.biz.dal.pojo.ServerGroupCriteria)1 Criteria (com.qlangtech.tis.manage.biz.dal.pojo.ServerGroupCriteria.Criteria)1 UploadResource (com.qlangtech.tis.manage.biz.dal.pojo.UploadResource)1 ConfigFileValidateResult (com.qlangtech.tis.manage.common.ConfigFileValidateResult)1 SnapshotDomain (com.qlangtech.tis.manage.common.SnapshotDomain)1 Func (com.qlangtech.tis.manage.spring.aop.Func)1 ServerGroupAdapter (com.qlangtech.tis.runtime.pojo.ServerGroupAdapter)1 ISchemaPluginContext (com.qlangtech.tis.solrdao.ISchemaPluginContext)1 IOException (java.io.IOException)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 ArrayList (java.util.ArrayList)1