|
|
@ -1,13 +1,13 @@ |
|
|
|
package com.fr.design.data.datapane.auth; |
|
|
|
package com.fr.design.data.datapane.auth; |
|
|
|
|
|
|
|
|
|
|
|
import com.fr.base.TableData; |
|
|
|
import com.fr.base.TableData; |
|
|
|
|
|
|
|
import com.fr.data.impl.Connection; |
|
|
|
import com.fr.data.impl.DBTableData; |
|
|
|
import com.fr.data.impl.DBTableData; |
|
|
|
import com.fr.decision.base.util.CollectionUtil; |
|
|
|
import com.fr.data.impl.NameDatabaseConnection; |
|
|
|
import com.fr.stable.collections.CollectionUtils; |
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
import com.fr.workspace.WorkContext; |
|
|
|
import com.fr.workspace.WorkContext; |
|
|
|
import com.fr.workspace.server.connection.DBConnectAuth; |
|
|
|
import com.fr.workspace.server.connection.DBConnectAuth; |
|
|
|
|
|
|
|
|
|
|
|
import javax.swing.SwingWorker; |
|
|
|
|
|
|
|
import java.util.Collection; |
|
|
|
import java.util.Collection; |
|
|
|
import java.util.Collections; |
|
|
|
import java.util.Collections; |
|
|
|
|
|
|
|
|
|
|
@ -37,4 +37,21 @@ public class TableDataAuthHelper { |
|
|
|
Collection<String> noAuthConnections = WorkContext.getCurrent().get(DBConnectAuth.class).getNoAuthConnections(); |
|
|
|
Collection<String> noAuthConnections = WorkContext.getCurrent().get(DBConnectAuth.class).getNoAuthConnections(); |
|
|
|
return noAuthConnections == null ? Collections.emptyList() : noAuthConnections; |
|
|
|
return noAuthConnections == null ? Collections.emptyList() : noAuthConnections; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 通过数据集获取其数据连接的名称 |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* 注意: |
|
|
|
|
|
|
|
* 1. Connection接口本身是不提供名称的,只有我们内部为了使用方便,将其包装成了NameDataBaseConnection |
|
|
|
|
|
|
|
* 如果不是NameDataBaseConnection类型,则无名称,因此这里只能用判断类型的方式获取名称 |
|
|
|
|
|
|
|
* 2. 仅支持DBTableData获取连接名 |
|
|
|
|
|
|
|
* @return |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public static String getConnectionNameByDBTableData(DBTableData tableData) { |
|
|
|
|
|
|
|
Connection database = tableData.getDatabase(); |
|
|
|
|
|
|
|
if (database instanceof NameDatabaseConnection) { |
|
|
|
|
|
|
|
return ((NameDatabaseConnection) database).getName(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return StringUtils.EMPTY; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|