use of com.qlangtech.tis.manage.common.Option in project plugins by qlangtech.
the class HudiTableMeta method getHistoryBatchs.
public static List<Option> getHistoryBatchs(ITISFileSystem fs, IHiveConnGetter hiveConn) {
IPath path = fs.getPath(fs.getRootDir(), hiveConn.getDbName());
List<IPathInfo> child = fs.listChildren(path);
return child.stream().map((c) -> new Option(c.getName())).collect(Collectors.toList());
}
use of com.qlangtech.tis.manage.common.Option in project plugins by qlangtech.
the class PluginItems method getExistDbs.
public static List<Option> getExistDbs(String... extendClass) {
Set<String> extendClazzs = Sets.newHashSet("MySQL-V5", "MySQL-V8");
for (String sourceType : extendClass) {
if (extendClazzs.contains(sourceType)) {
return Collections.singletonList(new Option(DB_NAME, DB_NAME));
// Assert.fail("param:" + sourceType + " must contain in:" + extendClazzs.stream().collect(Collectors.joining(",")));
}
}
Set<String> mongoDBextendClazzs = Sets.newHashSet("MongoDB");
for (String sourceType : extendClass) {
if (mongoDBextendClazzs.contains(sourceType)) {
return Collections.singletonList(new Option(DB_MONGODB_NAME, DB_MONGODB_NAME));
// Assert.fail("param:" + sourceType + " must contain in:" + extendClazzs.stream().collect(Collectors.joining(",")));
}
}
for (String sourceType : extendClass) {
if ("TiDB".equals(sourceType)) {
return Collections.singletonList(new Option(DB_TIDB_NAME, DB_TIDB_NAME));
// Assert.fail("param:" + sourceType + " must contain in:" + extendClazzs.stream().collect(Collectors.joining(",")));
}
}
for (String sourceType : extendClass) {
if ("ClickHouse".equals(sourceType)) {
return Collections.singletonList(new Option(DB_CLICKHOUSE_NAME, DB_CLICKHOUSE_NAME));
// Assert.fail("param:" + sourceType + " must contain in:" + extendClazzs.stream().collect(Collectors.joining(",")));
}
}
for (String sourceType : extendClass) {
if ("Cassandra".equals(sourceType)) {
return Collections.singletonList(new Option(DB_CASSANDRA_NAME, DB_CASSANDRA_NAME));
// Assert.fail("param:" + sourceType + " must contain in:" + extendClazzs.stream().collect(Collectors.joining(",")));
}
}
for (String sourceType : extendClass) {
if ("PostgreSQL".equals(sourceType)) {
return Collections.singletonList(new Option(DB_POSTGRE_SQL, DB_POSTGRE_SQL));
// Assert.fail("param:" + sourceType + " must contain in:" + extendClazzs.stream().collect(Collectors.joining(",")));
}
}
for (String sourceType : extendClass) {
if ("SqlServer".equals(sourceType)) {
return Collections.singletonList(new Option(DB_SQL_Server, DB_SQL_Server));
// Assert.fail("param:" + sourceType + " must contain in:" + extendClazzs.stream().collect(Collectors.joining(",")));
}
}
for (String sourceType : extendClass) {
if ("Oracle".equals(sourceType)) {
return Collections.singletonList(new Option(DB_SQL_DORIS, DB_SQL_DORIS));
// Assert.fail("param:" + sourceType + " must contain in:" + extendClazzs.stream().collect(Collectors.joining(",")));
}
}
for (String sourceType : extendClass) {
if ("Doris".equals(sourceType)) {
return Collections.singletonList(new Option(DB_SQL_ORACLE, DB_SQL_ORACLE));
// Assert.fail("param:" + sourceType + " must contain in:" + extendClazzs.stream().collect(Collectors.joining(",")));
}
}
for (String sourceType : extendClass) {
if ("StarRocks".equals(sourceType)) {
return Collections.singletonList(new Option(DB_SQL_StarRocks, DB_SQL_StarRocks));
// Assert.fail("param:" + sourceType + " must contain in:" + extendClazzs.stream().collect(Collectors.joining(",")));
}
}
throw new IllegalStateException("param:" + Arrays.stream(extendClass).collect(Collectors.joining(",")) + " must contain is illegal");
}
use of com.qlangtech.tis.manage.common.Option in project tis by qlangtech.
the class Descriptor method resolveEnumProp.
// public static JSONArray resolveEnumProp(Descriptor descriptor, PropertyType propType) {
// return resolveEnumProp(descriptor, propType.extraProp);
// }
private static JSONArray resolveEnumProp(Descriptor descriptor, PluginExtraProps.Props fieldExtraProps) {
Object anEnum = fieldExtraProps.getProps().get(KEY_ENUM_PROP);
// if (anEnum == null) {
// throw new IllegalStateException("fieldName:" + f.getName() + " relevant enum descriptor in json config can not be null");
// }
JSONArray enums = new JSONArray();
if (anEnum != null && anEnum instanceof String) {
// ]
try {
GroovyShellEvaluate.descriptorThreadLocal.set(descriptor);
fieldExtraProps.getProps().put(KEY_ENUM_PROP, GroovyShellEvaluate.scriptEval((String) anEnum, (opts) -> {
return Option.toJson((List<Option>) opts);
}));
} finally {
GroovyShellEvaluate.descriptorThreadLocal.remove();
}
}
return enums;
}
use of com.qlangtech.tis.manage.common.Option in project tis by qlangtech.
the class PluginItems method getExistDbs.
/**
* datax中显示已由数据源使用 <br>
* must call form Descriptor
*
* @param extendClass
* @return
*/
public static List<Option> getExistDbs(String... extendClass) {
if (OfflineDatasourceAction.existDbs != null) {
return OfflineDatasourceAction.existDbs;
}
if (extendClass == null || extendClass.length < 1) {
throw new IllegalArgumentException("param extendClass can not be null");
}
Descriptor descriptor = GroovyShellEvaluate.descriptorThreadLocal.get();
Objects.requireNonNull(descriptor, "descriptor can not be null");
if (dbUpdateEventObservers.add(descriptor)) {
// 当有数据源更新时需要将descriptor的属性重新更新一下
addPluginItemsSaveObserver(new PluginItemsSaveObserver() {
@Override
public void afterSaved(PluginItemsSaveEvent event) {
if (event.heteroEnum == HeteroEnum.DATASOURCE) {
descriptor.cleanPropertyTypes();
}
}
});
}
IWorkflowDAOFacade wfFacade = BasicServlet.getBeanByType(ServletActionContext.getServletContext(), IWorkflowDAOFacade.class);
Objects.requireNonNull(wfFacade, "wfFacade can not be null");
DatasourceDbCriteria dbCriteria = new DatasourceDbCriteria();
// Lists.newArrayList(extendClass).stre;
List<String> extendClazzs = Lists.newArrayList();
for (String type : extendClass) {
extendClazzs.add(StringUtils.lowerCase(type));
}
dbCriteria.createCriteria().andExtendClassIn(extendClazzs);
List<com.qlangtech.tis.workflow.pojo.DatasourceDb> dbs = wfFacade.getDatasourceDbDAO().selectByExample(dbCriteria);
return dbs.stream().map((db) -> new Option(db.getName(), db.getName())).collect(Collectors.toList());
}
use of com.qlangtech.tis.manage.common.Option in project tis by qlangtech.
the class UserAction method doGetChildDpt.
/**
* get child department
*
* @param context
*/
public void doGetChildDpt(Context context) {
Integer dptid = this.getInt("pid");
DepartmentCriteria query = new DepartmentCriteria();
query.createCriteria().andParentIdEqualTo(dptid);
List<Option> result = new ArrayList<Option>();
for (Department dpt : this.getDepartmentDAO().selectByExample(query)) {
result.add(new Option(dpt.getName(), String.valueOf(dpt.getDptId())));
}
context.put(AjaxValve.BIZ_RESULT, result);
}
Aggregations