Search in sources :

Example 1 with Func

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()));
}
Also used : ResSynManager(com.qlangtech.tis.runtime.pojo.ResSynManager) Func(com.qlangtech.tis.manage.spring.aop.Func)

Example 2 with Func

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() + "”该应用被成功删除");
}
Also used : DocCollection(org.apache.solr.common.cloud.DocCollection) Func(com.qlangtech.tis.manage.spring.aop.Func)

Example 3 with Func

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);
    });
}
Also used : SchemaResult(com.qlangtech.tis.solrdao.SchemaResult) Func(com.qlangtech.tis.manage.spring.aop.Func)

Example 4 with Func

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);
}
Also used : WorkFlow(com.qlangtech.tis.workflow.pojo.WorkFlow) StringUtils(org.apache.commons.lang.StringUtils) ERRules.$(com.qlangtech.tis.sql.parser.er.ERRules.$) SqlTaskNode(com.qlangtech.tis.sql.parser.SqlTaskNode) JoinRule(com.qlangtech.tis.git.GitUtils.JoinRule) TIS(com.qlangtech.tis.TIS) WorkFlowCriteria(com.qlangtech.tis.workflow.pojo.WorkFlowCriteria) Autowired(org.springframework.beans.factory.annotation.Autowired) Option(com.qlangtech.tis.manage.common.Option) DbScope(com.qlangtech.tis.offline.DbScope) DescriptorsJSON(com.qlangtech.tis.util.DescriptorsJSON) IFieldErrorHandler(com.qlangtech.tis.runtime.module.misc.IFieldErrorHandler) JSONObject(org.json.JSONObject) Matcher(java.util.regex.Matcher) DescriptorExtensionList(com.qlangtech.tis.extension.DescriptorExtensionList) PermissionConstant(com.qlangtech.tis.manage.PermissionConstant) FullbuildPhase(com.qlangtech.tis.assemble.FullbuildPhase) IPluginStore(com.qlangtech.tis.plugin.IPluginStore) PluginFormProperties(com.qlangtech.tis.extension.PluginFormProperties) PostParam(com.qlangtech.tis.manage.common.HttpUtils.PostParam) Validator(com.qlangtech.tis.plugin.annotation.Validator) GitRepositoryCommitPojo(com.qlangtech.tis.offline.pojo.GitRepositoryCommitPojo) DelegateControl4JsonPostMsgHandler(com.qlangtech.tis.runtime.module.misc.impl.DelegateControl4JsonPostMsgHandler) HeteroList(com.qlangtech.tis.util.HeteroList) Descriptor(com.qlangtech.tis.extension.Descriptor) TabCardinality(com.qlangtech.tis.sql.parser.er.TabCardinality) Collectors(java.util.stream.Collectors) name.fraser.neil.plaintext.diff_match_patch(name.fraser.neil.plaintext.diff_match_patch) IFullBuildContext(com.qlangtech.tis.fullbuild.IFullBuildContext) IOUtils(org.apache.commons.io.IOUtils) DataxReader(com.qlangtech.tis.datax.impl.DataxReader) IWorkFlowDAO(com.qlangtech.tis.workflow.dao.IWorkFlowDAO) IControlMsgHandler(com.qlangtech.tis.runtime.module.misc.IControlMsgHandler) TableRelation(com.qlangtech.tis.sql.parser.er.TableRelation) DataxAction(com.qlangtech.tis.coredefine.module.action.DataxAction) SqlDataFlowTopology(com.qlangtech.tis.sql.parser.SqlTaskNodeMeta.SqlDataFlowTopology) DBConfigSuit(com.qlangtech.tis.db.parser.DBConfigSuit) Pattern(java.util.regex.Pattern) SuFormProperties(com.qlangtech.tis.extension.impl.SuFormProperties) Types(java.sql.Types) Pager(com.koubei.web.tag.pager.Pager) java.util(java.util) Func(com.qlangtech.tis.manage.spring.aop.Func) UploadPluginMeta(com.qlangtech.tis.util.UploadPluginMeta) Context(com.alibaba.citrus.turbine.Context) TISDb(com.qlangtech.tis.offline.pojo.TISDb) JsonUtil(com.qlangtech.tis.trigger.util.JsonUtil) Lists(com.google.common.collect.Lists) PropertyType(com.qlangtech.tis.extension.impl.PropertyType) DatasourceTable(com.qlangtech.tis.workflow.pojo.DatasourceTable) CollectionUtils(org.apache.commons.collections.CollectionUtils) GitUtils(com.qlangtech.tis.git.GitUtils) OfflineManager(com.qlangtech.tis.offline.module.manager.impl.OfflineManager) FormFieldType(com.qlangtech.tis.plugin.annotation.FormFieldType) com.qlangtech.tis.sql.parser.meta(com.qlangtech.tis.sql.parser.meta) WorkflowPojo(com.qlangtech.tis.offline.pojo.WorkflowPojo) IWorkflowDAOFacade(com.qlangtech.tis.workflow.dao.IWorkflowDAOFacade) MapUtils(org.apache.commons.collections.MapUtils) IdentityName(com.qlangtech.tis.plugin.IdentityName) JSONTokener(org.json.JSONTokener) com.qlangtech.tis.plugin.ds(com.qlangtech.tis.plugin.ds) FileUtils(org.apache.commons.io.FileUtils) IOException(java.io.IOException) Maps(com.google.common.collect.Maps) File(java.io.File) TisSqlFormatException(com.qlangtech.tis.sql.parser.exception.TisSqlFormatException) JSON(com.alibaba.fastjson.JSON) ERRules(com.qlangtech.tis.sql.parser.er.ERRules) BasicModule(com.qlangtech.tis.runtime.module.action.BasicModule) AppDomainInfo(com.qlangtech.tis.manage.common.AppDomainInfo) CoreAction(com.qlangtech.tis.coredefine.module.action.CoreAction) Assert(com.qlangtech.tis.common.utils.Assert) SqlTaskNodeMeta(com.qlangtech.tis.sql.parser.SqlTaskNodeMeta) IUser(com.qlangtech.tis.manage.common.IUser) PrimaryTableMeta(com.qlangtech.tis.sql.parser.er.PrimaryTableMeta) JSONArray(org.json.JSONArray) PluginDescMeta(com.qlangtech.tis.coredefine.module.action.PluginDescMeta) SqlDataFlowTopology(com.qlangtech.tis.sql.parser.SqlTaskNodeMeta.SqlDataFlowTopology) Func(com.qlangtech.tis.manage.spring.aop.Func)

Example 5 with Func

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

Aggregations

Func (com.qlangtech.tis.manage.spring.aop.Func)64 JSONObject (com.alibaba.fastjson.JSONObject)12 DataXJobWorker (com.qlangtech.tis.datax.job.DataXJobWorker)6 File (java.io.File)6 Date (java.util.Date)6 Context (com.alibaba.citrus.turbine.Context)5 Application (com.qlangtech.tis.manage.biz.dal.pojo.Application)5 JSONObject (org.json.JSONObject)5 Validator (com.qlangtech.tis.plugin.annotation.Validator)4 IControlMsgHandler (com.qlangtech.tis.runtime.module.misc.IControlMsgHandler)4 IFieldErrorHandler (com.qlangtech.tis.runtime.module.misc.IFieldErrorHandler)4 DelegateControl4JsonPostMsgHandler (com.qlangtech.tis.runtime.module.misc.impl.DelegateControl4JsonPostMsgHandler)4 WorkFlow (com.qlangtech.tis.workflow.pojo.WorkFlow)4 JSONArray (org.json.JSONArray)4 ExecResult (com.qlangtech.tis.assemble.ExecResult)3 FullbuildPhase (com.qlangtech.tis.assemble.FullbuildPhase)3 IndexStreamCodeGenerator (com.qlangtech.tis.compiler.streamcode.IndexStreamCodeGenerator)3 DescriptorExtensionList (com.qlangtech.tis.extension.DescriptorExtensionList)3 IOException (java.io.IOException)3 Matcher (java.util.regex.Matcher)3