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);
}
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;
}
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);
}
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));
}
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());
}
Aggregations