use of com.qlangtech.tis.plugin.ds.DataSourceMeta 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