Search in sources :

Example 1 with Option

use of com.qlangtech.tis.manage.common.Option in project tis by qlangtech.

the class Appselectboxcontrol method execute.

public void execute(Context context) throws Exception {
    // ${contextid}
    // if (context.get("contextid") == null) {
    // context.put("contextid", StringUtils.EMPTY);
    // }
    AppOptionsList optionslist = (AppOptionsList) this.getRequest().getAttribute(key);
    if (optionslist == null) {
        final List<Option> bizlist = this.getBizLineList();
        List<Option> applist = null;
        AppDomainInfo domain = this.getAppDomain();
        if (!(domain instanceof Nullable)) {
            // if (bizid != null) {
            applist = this.getAppList(domain.getDptid());
        // }
        }
        optionslist = new AppOptionsList(bizlist, applist);
        this.getRequest().setAttribute(key, optionslist);
    }
    context.put("bizlinelist", optionslist.bizlinelist);
    context.put("applist", optionslist.applist);
}
Also used : AppDomainInfo(com.qlangtech.tis.manage.common.AppDomainInfo) Option(com.qlangtech.tis.manage.common.Option) Nullable(com.qlangtech.tis.pubhook.common.Nullable)

Example 2 with Option

use of com.qlangtech.tis.manage.common.Option in project tis by qlangtech.

the class OfflineManager method getUsableDbNames.

/**
 * description: 获取所有的工作流数据库 date: 2:30 PM 4/28/2017
 */
public List<Option> getUsableDbNames() {
    DatasourceDbCriteria criteria = new DatasourceDbCriteria();
    criteria.createCriteria();
    List<DatasourceDb> dbList = workflowDAOFacade.getDatasourceDbDAO().selectByExample(criteria);
    List<Option> dbNameList = new LinkedList<>();
    for (DatasourceDb datasourceDb : dbList) {
        dbNameList.add(new Option(datasourceDb.getName(), String.valueOf(datasourceDb.getId())));
    }
    return dbNameList;
}
Also used : Option(com.qlangtech.tis.manage.common.Option)

Example 3 with Option

use of com.qlangtech.tis.manage.common.Option in project tis by qlangtech.

the class PluginAction method doGetInstalledPlugins.

/**
 * 取得已经安装的插件
 *
 * @param context
 */
public void doGetInstalledPlugins(Context context) {
    List<String> extendpoint = getExtendpointParam();
    PluginManager pluginManager = TIS.get().getPluginManager();
    JSONArray response = new JSONArray();
    JSONObject pluginInfo = null;
    UpdateSite.Plugin info = null;
    for (PluginWrapper plugin : pluginManager.getPlugins()) {
        pluginInfo = new JSONObject();
        pluginInfo.put("installed", true);
        info = plugin.getInfo();
        if (info != null) {
            // pluginInfo.put("meta", info);
            pluginInfo.put("releaseTimestamp", info.releaseTimestamp);
            pluginInfo.put("excerpt", info.excerpt);
        }
        if (CollectionUtils.isNotEmpty(extendpoint)) {
            if (info == null) {
                continue;
            }
            if (!CollectionUtils.containsAny(info.extendPoints.keySet(), extendpoint)) {
                continue;
            }
            pluginInfo.put("extendPoints", info.extendPoints);
        }
        if (filterPlugin(plugin)) {
            continue;
        }
        pluginInfo.put("name", plugin.getShortName());
        pluginInfo.put("version", plugin.getVersion());
        pluginInfo.put("title", plugin.getDisplayName());
        pluginInfo.put("active", plugin.isActive());
        pluginInfo.put("enabled", plugin.isEnabled());
        // pluginInfo.put("bundled", plugin.isBundled);
        pluginInfo.put("deleted", plugin.isDeleted());
        pluginInfo.put("downgradable", plugin.isDowngradable());
        pluginInfo.put("website", plugin.getUrl());
        List<PluginWrapper.Dependency> dependencies = plugin.getDependencies();
        if (dependencies != null && !dependencies.isEmpty()) {
            Option o = null;
            List<Option> dependencyMap = Lists.newArrayList();
            for (PluginWrapper.Dependency dependency : dependencies) {
                o = new Option(dependency.shortName, dependency.version);
                dependencyMap.add(o);
            }
            pluginInfo.put("dependencies", dependencyMap);
        } else {
            pluginInfo.put("dependencies", Collections.emptyList());
        }
        response.add(pluginInfo);
    }
    this.setBizResult(context, response);
}
Also used : JSONArray(com.alibaba.fastjson.JSONArray) JSONObject(com.alibaba.fastjson.JSONObject) Option(com.qlangtech.tis.manage.common.Option) UpdateSite(com.qlangtech.tis.extension.model.UpdateSite)

Example 4 with Option

use of com.qlangtech.tis.manage.common.Option in project plugins by qlangtech.

the class FlinkDescriptor method addFieldDescriptor.

protected void addFieldDescriptor(String fieldName, ConfigOption<?> configOption) {
    Description desc = configOption.description();
    HtmlFormatter htmlFormatter = new HtmlFormatter();
    Object d = configOption.defaultValue();
    StringBuffer helperContent = new StringBuffer(htmlFormatter.format(desc));
    Class<?> targetClazz = configOption.getClazz();
    List<Option> opts = null;
    if (targetClazz == Duration.class) {
        if (d != null) {
            d = ((Duration) d).getSeconds();
        }
        helperContent.append("\n\n 单位:`秒`");
    } else if (targetClazz.isEnum()) {
        List<Enum> enums = EnumUtils.getEnumList((Class<Enum>) targetClazz);
        opts = enums.stream().map((e) -> new Option(e.name())).collect(Collectors.toList());
    } else if (targetClazz == Boolean.class) {
        opts = Lists.newArrayList(new Option("是", true), new Option("否", false));
    }
    this.addFieldDescriptor(fieldName, d, helperContent.toString(), Optional.ofNullable(opts));
}
Also used : List(java.util.List) Lists(com.google.common.collect.Lists) EnumUtils(org.apache.commons.lang3.EnumUtils) Duration(java.time.Duration) Descriptor(com.qlangtech.tis.extension.Descriptor) Description(org.apache.flink.configuration.description.Description) Optional(java.util.Optional) Option(com.qlangtech.tis.manage.common.Option) ConfigOption(org.apache.flink.configuration.ConfigOption) Collectors(java.util.stream.Collectors) Describable(com.qlangtech.tis.extension.Describable) HtmlFormatter(org.apache.flink.configuration.description.HtmlFormatter) Description(org.apache.flink.configuration.description.Description) Option(com.qlangtech.tis.manage.common.Option) ConfigOption(org.apache.flink.configuration.ConfigOption) List(java.util.List) HtmlFormatter(org.apache.flink.configuration.description.HtmlFormatter)

Example 5 with Option

use of com.qlangtech.tis.manage.common.Option in project plugins by qlangtech.

the class SelectedTab method getContextTableCols.

public static List<Option> getContextTableCols(Function<List<ColumnMetaData>, Stream<ColumnMetaData>> func) {
    SuFormProperties.SuFormGetterContext context = SuFormProperties.subFormGetterProcessThreadLocal.get();
    if (context == null || context.plugin == null) {
        return Collections.emptyList();
    }
    Describable plugin = Objects.requireNonNull(context.plugin, "context.plugin can not be null");
    if (!(plugin instanceof DataSourceMeta)) {
        throw new IllegalStateException("plugin must be type of " + DataSourceMeta.class.getName() + ", now type of " + plugin.getClass().getName());
    }
    DataSourceMeta dsMeta = (DataSourceMeta) plugin;
    List<ColumnMetaData> cols = context.getContextAttr(KEY_TABLE_COLS, (key) -> dsMeta.getTableMetadata(context.getSubFormIdentityField()));
    return func.apply(cols).map((c) -> c).collect(Collectors.toList());
}
Also used : StringUtils(org.apache.commons.lang.StringUtils) DataSourceMeta(com.qlangtech.tis.plugin.ds.DataSourceMeta) ISelectedTab(com.qlangtech.tis.plugin.ds.ISelectedTab) LoggerFactory(org.slf4j.LoggerFactory) Option(com.qlangtech.tis.manage.common.Option) FormField(com.qlangtech.tis.plugin.annotation.FormField) ColumnMetaData(com.qlangtech.tis.plugin.ds.ColumnMetaData) Function(java.util.function.Function) Context(com.alibaba.citrus.turbine.Context) Lists(com.google.common.collect.Lists) CollectionUtils(org.apache.commons.collections.CollectionUtils) FormFieldType(com.qlangtech.tis.plugin.annotation.FormFieldType) Validator(com.qlangtech.tis.plugin.annotation.Validator) TISExtension(com.qlangtech.tis.extension.TISExtension) Logger(org.slf4j.Logger) Descriptor(com.qlangtech.tis.extension.Descriptor) IdentityName(com.qlangtech.tis.plugin.IdentityName) Collectors(java.util.stream.Collectors) Objects(java.util.Objects) List(java.util.List) DataxReader(com.qlangtech.tis.datax.impl.DataxReader) Stream(java.util.stream.Stream) IControlMsgHandler(com.qlangtech.tis.runtime.module.misc.IControlMsgHandler) Optional(java.util.Optional) SuFormProperties(com.qlangtech.tis.extension.impl.SuFormProperties) Collections(java.util.Collections) Describable(com.qlangtech.tis.extension.Describable) Describable(com.qlangtech.tis.extension.Describable) SuFormProperties(com.qlangtech.tis.extension.impl.SuFormProperties) ColumnMetaData(com.qlangtech.tis.plugin.ds.ColumnMetaData) DataSourceMeta(com.qlangtech.tis.plugin.ds.DataSourceMeta)

Aggregations

Option (com.qlangtech.tis.manage.common.Option)11 Collectors (java.util.stream.Collectors)5 Lists (com.google.common.collect.Lists)4 Context (com.alibaba.citrus.turbine.Context)3 Describable (com.qlangtech.tis.extension.Describable)3 Descriptor (com.qlangtech.tis.extension.Descriptor)3 ISelectedTab (com.qlangtech.tis.plugin.ds.ISelectedTab)3 List (java.util.List)3 JSONArray (com.alibaba.fastjson.JSONArray)2 JSONObject (com.alibaba.fastjson.JSONObject)2 TIS (com.qlangtech.tis.TIS)2 DataxReader (com.qlangtech.tis.datax.impl.DataxReader)2 SuFormProperties (com.qlangtech.tis.extension.impl.SuFormProperties)2 GroovyShellEvaluate (com.qlangtech.tis.extension.util.GroovyShellEvaluate)2 IdentityName (com.qlangtech.tis.plugin.IdentityName)2 FormField (com.qlangtech.tis.plugin.annotation.FormField)2 FormFieldType (com.qlangtech.tis.plugin.annotation.FormFieldType)2 Validator (com.qlangtech.tis.plugin.annotation.Validator)2 IControlMsgHandler (com.qlangtech.tis.runtime.module.misc.IControlMsgHandler)2 java.util (java.util)2