Search in sources :

Example 51 with Func

use of com.qlangtech.tis.manage.spring.aop.Func in project tis by qlangtech.

the class AddAppAction method doUpdate.

/**
 * 更新应用
 */
@Func(PermissionConstant.APP_UPDATE)
public // Navigator nav,
void doUpdate(Context context) {
    Application form = new Application();
    context.put("app", form);
    Integer bizid = this.getInt("bizid");
    final Integer appid = this.getInt("appid");
    Assert.assertNotNull(bizid);
    Assert.assertNotNull(appid);
    form.setAppId(appid);
    DepartmentCriteria criteria = new DepartmentCriteria();
    criteria.createCriteria().andDptIdEqualTo(bizid).andLeafEqualTo(BooleanYorNConvertCallback.YES);
    List<Department> depatment = this.getDepartmentDAO().selectByExample(criteria);
    Assert.assertTrue("dptid:" + bizid + " depatment can not be null ", depatment.size() == 1);
    for (Department d : depatment) {
        form.setDptId(d.getDptId());
        form.setDptName(d.getFullName());
    }
    form.setProjectName(this.getString(SchemaAction.FIELD_PROJECT_NAME));
    form.setRecept(this.getString("recept"));
    if (!isAppNameValid(this, context, SchemaAction.FIELD_PROJECT_NAME, form)) {
        return;
    }
    // 是否使用自动部署新方案
    form.setIsAutoDeploy("true".equalsIgnoreCase(this.getString("isautodeploy")));
    if (!validateAppForm(context, form)) {
        return;
    }
    IAppsFetcher fetcher = getAppsFetcher();
    fetcher.update(form, new CriteriaSetter() {

        @Override
        public void set(Criteria criteria) {
            criteria.andAppIdEqualTo(appid);
        }
    });
    this.addActionMessage(context, "已经成功更新应用[" + form.getProjectName() + "]");
}
Also used : CriteriaSetter(com.qlangtech.tis.manage.common.apps.AppsFetcher.CriteriaSetter) Criteria(com.qlangtech.tis.manage.biz.dal.pojo.ApplicationCriteria.Criteria) IAppsFetcher(com.qlangtech.tis.manage.common.apps.IAppsFetcher) Func(com.qlangtech.tis.manage.spring.aop.Func)

Example 52 with Func

use of com.qlangtech.tis.manage.spring.aop.Func in project tis by qlangtech.

the class AddAppAction method doGetCreateAppMasterData.

/**
 * 创建业务流程中所需要的系统表信息,在這個方法中全部取得
 *
 * @param context
 * @throws Exception
 */
@Func(PermissionConstant.APP_ADD)
public void doGetCreateAppMasterData(Context context) throws Exception {
    Map<String, Object> masterData = Maps.newHashMap();
    boolean justbizLine = this.getBoolean("justbizLine");
    masterData.put("bizlinelist", this.getBizLineList());
    if (!justbizLine) {
        final List<Option> verList = new ArrayList<>();
        for (LuceneVersion v : LuceneVersion.values()) {
            verList.add(new Option(v.getKey(), v.getKey()));
        }
        masterData.put("tplenum", verList);
        masterData.put("usableWorkflow", this.offlineManager.getUsableWorkflow());
    }
    this.setBizResult(context, masterData);
}
Also used : LuceneVersion(com.qlangtech.tis.fullbuild.indexbuild.LuceneVersion) Func(com.qlangtech.tis.manage.spring.aop.Func)

Example 53 with Func

use of com.qlangtech.tis.manage.spring.aop.Func in project tis by qlangtech.

the class AddAppAction method doCreateCollection.

/**
 * 创建索引,不在数据库中添加记录<br>
 * 当一个索引创建之后又被删除了,又需要重新创建就需要需执行该流程了
 *
 * @param context
 * @throws Exception
 */
@Func(PermissionConstant.APP_ADD)
public void doCreateCollection(Context context) throws Exception {
    CreateIndexConfirmModel confiemModel = parseJsonPost(CreateIndexConfirmModel.class);
    confiemModel.setTplAppId(getTemplateApp(this).getAppId());
    SchemaResult schemaResult = this.parseSchema(context, ISchemaPluginContext.NULL, confiemModel);
    this.createCollection(context, confiemModel, schemaResult, (ctx, app, publishSnapshotId, schemaContent) -> {
        CreateSnapshotResult result = new CreateSnapshotResult();
        result.setSuccess(true);
        Application a = getApplicationDAO().selectByName(app.getProjectName());
        if (a == null) {
            throw new IllegalStateException("appname:" + app.getProjectName() + " relevant app can not be find in DB");
        }
        result.setNewSnapshotId(getPublishSnapshotId(this.getServerGroupDAO(), a));
        return result;
    });
}
Also used : SchemaResult(com.qlangtech.tis.solrdao.SchemaResult) Func(com.qlangtech.tis.manage.spring.aop.Func)

Example 54 with Func

use of com.qlangtech.tis.manage.spring.aop.Func in project tis by qlangtech.

the class SchemaAction method doToggleEsStupidModel.

/**
 * ES:高级视图模式下保存到缓存(点击小白模式)
 */
@Func(value = PermissionConstant.APP_SCHEMA_UPDATE, sideEffect = false)
public void doToggleEsStupidModel(Context context) throws Exception {
    // 整段xml文本
    com.alibaba.fastjson.JSONObject body = this.parseJsonPost();
    ISearchEngineTypeTransfer typeTransfer = ISearchEngineTypeTransfer.load(this, body.getString(DataxUtils.DATAX_NAME));
    // final String content = body.getString("content");
    // byte[] schemaContent = body.getString("content").getBytes(TisUTF8.get());
    // JSONArray fields = JSON.parseArray(content);
    writerStructFields(context, body, typeTransfer);
}
Also used : JSONObject(com.alibaba.fastjson.JSONObject) ISearchEngineTypeTransfer(com.qlangtech.tis.datax.ISearchEngineTypeTransfer) Func(com.qlangtech.tis.manage.spring.aop.Func)

Example 55 with Func

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