use of com.qlangtech.tis.manage.Savefilecontent in project tis by qlangtech.
the class SchemaAction method doSaveByExpertModel.
/**
* 在傻瓜模式下保存
*
* @param context
* @throws Exception
*/
@Func(value = PermissionConstant.APP_SCHEMA_UPDATE, sideEffect = true)
public void doSaveByExpertModel(Context context) throws Exception {
VisualizingSchemaForm form = this.parseJsonPost(VisualizingSchemaForm.class);
if (!validateStupidContent(context, form.getVisualizingForm())) {
return;
}
Savefilecontent meta = form.getMeta();
String schema = this.createSchema(SchemaAction.createSchemaPlugin(this.getCollectionName()), form.getVisualizingForm(), context);
//
SchemaAction.CreateSnapshotResult createResult = createNewSnapshot(context, createSchemaPlugin(this.getCollectionName()), this.getSnapshotViewDAO().getView(meta.getSnapshotid()), ConfigFileReader.FILE_SCHEMA, schema.getBytes(TisUTF8.get()), this, this, meta.getMemo(), Long.parseLong(this.getUser().getId()), this.getLoginUserName());
if (!createResult.isSuccess()) {
return;
}
this.setBizResult(context, createResult);
this.addActionMessage(context, "保存文件成功,最新snapshot:" + createResult.getNewId());
}
use of com.qlangtech.tis.manage.Savefilecontent in project tis by qlangtech.
the class SaveFileContentAction method doSaveContent.
/**
* 保存文本内容
*/
@Func(PermissionConstant.CONFIG_EDIT)
public void doSaveContent(Context context) throws Exception {
if (!RunEnvironment.isDevelopMode()) {
this.addErrorMessage(context, "请先更新日常环境中的配置文件,然后同步到线上环境!");
return;
}
Savefilecontent xmlContent = this.parseJsonPost(Savefilecontent.class);
Integer snapshotid = xmlContent.getSnapshotid();
String fileName = xmlContent.getFilename();
// if (isEditSchemaApply(context, fileName)) return;
PropteryGetter propertyGetter = createConfigFileGetter(fileName);
Long userid = 999l;
try {
userid = new Long(this.getUserId());
} catch (Throwable e) {
}
ISchemaPluginContext schemaPlugin = SchemaAction.createSchemaPlugin(this.getCollectionName());
CreateSnapshotResult createResult = createNewSnapshot(context, this.getSnapshotViewDAO().getView(snapshotid, false), propertyGetter, schemaPlugin, xmlContent.getContentBytes(), this, this, xmlContent.getMemo(), userid, this.getLoginUserName());
if (!createResult.isSuccess()) {
// forward("edit_" + BasicContentScreen.getResourceName(propertyGetter));
return;
}
this.setBizResult(context, createResult);
this.addActionMessage(context, "保存文件成功,最新snapshot:" + createResult.getNewId());
}
Aggregations