Search in sources :

Example 1 with ConfigFileValidateResult

use of com.qlangtech.tis.manage.common.ConfigFileValidateResult 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)

Aggregations

Snapshot (com.qlangtech.tis.manage.biz.dal.pojo.Snapshot)1 ConfigFileValidateResult (com.qlangtech.tis.manage.common.ConfigFileValidateResult)1 ISchemaPluginContext (com.qlangtech.tis.solrdao.ISchemaPluginContext)1