use of com.qlangtech.tis.manage.spring.aop.Func in project tis by qlangtech.
the class SaveFileContentAction method doSyncDailyConfig.
/**
* 将日常的文件同步到线上<br>
* 这段逻辑原先应该是在线上执行的,现在要放在日常上执行,日常连线上肯定是可以执行的
*
* @param context
*/
@Func(PermissionConstant.CONFIG_SYNCHRONIZE_FROM_DAILY)
public void doSyncDailyConfig(Context context) throws Exception {
AppDomainInfo app = this.getAppDomain();
Assert.assertEquals(this.getInt("appid"), app.getAppid());
// 配置文件同步控制器
final ResSynManager synManager = ResSynManager.createSynManagerOnlineFromDaily(app.getAppName(), this);
if (!synManager.shallSynchronize()) {
this.addErrorMessage(context, "DAILY环境配置文件已经同步到线上,不需要再同步了");
return;
}
// final Snapshot snapshot =
if (synManager.getSynchronizedOnlineSnapshot(context, this)) {
this.addActionMessage(context, "已经将日常的配置成功发布到线上生产环境");
}
// 创建新SNAPSHOT
// this.addActionMessage(
// context,
// "同步文件成功,最新snapshot:"
// + createNewSnapshot(snapshot, "synchronize from daily",
// this, new Long(this.getUserId()),
// this.getLoginUserName()));
}
use of com.qlangtech.tis.manage.spring.aop.Func in project tis by qlangtech.
the class AddAppAction method doDelete.
/**
* 删除一条记录
*
* @param context
*/
@Func(PermissionConstant.APP_DELETE)
public void doDelete(Context context) {
Integer appid = this.getInt("appid");
Assert.assertNotNull("appid can not be null", appid);
// 需要判断在solr cluster中是否存在
DocCollection collection = this.getZkStateReader().getClusterState().getCollectionOrNull(this.getAppDomain().getAppName());
if (collection != null) {
this.addErrorMessage(context, "集群中存在索引实例“" + collection.getName() + "”,请先联系管理员将该实例删除");
return;
}
rescycleAppDB(appid);
this.addActionMessage(context, "索引实例“" + this.getAppDomain().getAppName() + "”该应用被成功删除");
}
use of com.qlangtech.tis.manage.spring.aop.Func in project tis by qlangtech.
the class AddAppAction method doAdvanceAddApp.
/**
* 高级添加,会在数据库中添加对象记录
*
* @param context
*/
@Func(PermissionConstant.APP_ADD)
public void doAdvanceAddApp(Context context) throws Exception {
CreateIndexConfirmModel confiemModel = parseJsonPost(CreateIndexConfirmModel.class);
confiemModel.setTplAppId(getTemplateApp(this).getAppId());
SchemaResult schemaResult = this.parseSchema(context, ISchemaPluginContext.NULL, confiemModel);
if (!createNewApp(context, confiemModel.getAppform(), -1, /**
* publishSnapshotId
*/
null, /* schemaContent */
true).isSuccess()) {
// 只作表单校验 表单校验不通过
return;
}
this.createCollection(context, confiemModel, schemaResult, (ctx, app, publishSnapshotId, schemaContent) -> {
return this.createNewApp(ctx, app, publishSnapshotId, schemaContent);
});
}
use of com.qlangtech.tis.manage.spring.aop.Func in project tis by qlangtech.
the class OfflineDatasourceAction method doReflectTableCols.
/**
* 通过sql语句反射sql语句中的列
*/
@Func(value = PermissionConstant.PERMISSION_DATASOURCE_EDIT, sideEffect = false)
public void doReflectTableCols(Context context) throws Exception {
String topology = this.getString("topology");
if (StringUtils.isEmpty(topology)) {
throw new IllegalArgumentException("param topology can not be null");
}
SqlDataFlowTopology wfTopology = SqlTaskNodeMeta.getSqlDataFlowTopology(topology);
Map<String, DependencyNode> /**
* id
*/
dumpNodes = wfTopology.getDumpNodes().stream().collect(Collectors.toMap((d) -> d.getId(), (d) -> d));
com.alibaba.fastjson.JSONArray sqlAry = this.parseJsonArrayPost();
com.alibaba.fastjson.JSONObject j = null;
// String sql = null;
// List<RowMetaData> rowMetaData = null;
List<SqlCols> colsMeta = Lists.newArrayList();
SqlCols sqlCols = null;
DependencyNode dumpNode = null;
TISTable tabCfg = null;
// List<ColumnMetaData> reflectCols = null;
for (int i = 0; i < sqlAry.size(); i++) {
j = sqlAry.getJSONObject(i);
// sql = j.getString("sql");
sqlCols = new SqlCols();
sqlCols.setKey(j.getString("key"));
String dumpNodeId = sqlCols.getKey();
dumpNode = dumpNodes.get(dumpNodeId);
if (dumpNode == null) {
throw new IllegalStateException("key:" + dumpNodeId + " can not find relevant dump node in topplogy '" + topology + "'");
}
// tabCfg = GitUtils.$().getTableConfig(dumpNode.getDbName(), dumpNode.getName());
DataSourceFactoryPluginStore dbPlugin = TIS.getDataBasePluginStore(new PostedDSProp(dumpNode.getDbName()));
TISTable tisTable = dbPlugin.loadTableMeta(dumpNode.getName());
if (CollectionUtils.isEmpty(tisTable.getReflectCols())) {
throw new IllegalStateException("db:" + dumpNode.getDbName() + ",table:" + dumpNode.getName() + " relevant table col reflect cols can not be empty");
}
sqlCols.setCols(tisTable.getReflectCols());
colsMeta.add(sqlCols);
}
this.setBizResult(context, colsMeta);
}
use of com.qlangtech.tis.manage.spring.aop.Func in project tis by qlangtech.
the class GroupAction method doDeleteGroup.
/**
* 删除服务器组
*
* @param context
* @throws Exception
*/
@Func(PermissionConstant.APP_SERVER_GROUP_SET)
public void doDeleteGroup(Context context) throws Exception {
final Integer groupid = this.getInt("groupid");
Assert.assertNotNull("groupid can not be null", groupid);
ServerGroupCriteria query = new ServerGroupCriteria();
query.createCriteria().andGidEqualTo(groupid);
// 删除group
this.getServerGroupDAO().deleteByExample(query);
this.addActionMessage(context, "成功删除组ID:" + groupid);
}
Aggregations