Browse Source

REPORT-134411 DataOperatorProvider接口适配Connection

fbp/release
Destiny.Lin 2 months ago
parent
commit
cb4eefd1be
  1. 8
      designer-base/src/main/java/com/fr/design/actions/server/GlobalTableDataAction.java
  2. 19
      designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java
  3. 9
      designer-base/src/main/java/com/fr/design/data/datapane/preview/ConnectionInfoBeanHelper.java
  4. 6
      designer-base/src/main/java/com/fr/design/gui/ilist/TableViewList.java

8
designer-base/src/main/java/com/fr/design/actions/server/GlobalTableDataAction.java

@ -25,6 +25,7 @@ import com.fr.esd.event.DSMapping;
import com.fr.esd.event.DsNameTarget;
import com.fr.esd.event.StrategyEventsNotifier;
import com.fr.log.FineLoggerFactory;
import com.fr.report.LockItem;
import com.fr.security.encryption.transmission.TransmissionEncryptionManager;
import com.fr.workspace.server.repository.connection.ConnectionRepository;
@ -86,14 +87,13 @@ public class GlobalTableDataAction extends UpdateAction implements ResponseDataS
final List<ServerDataSetBean> beans = TableDataRepository.getInstance().getAllTableData();
final Map<String, Connection> connectionMap = ConnectionInfoBeanHelper.createConnectionMap(ConnectionRepository.getInstance().getAll());
final Map<String, TableData> tableDataMap = new HashMap<>();
try {
for (ServerDataSetBean bean : beans) {
try {
tableDataMap.put(bean.getDatasetName() , TableDataBeanHelper.getTableDataSet(connectionMap, bean.getDatasetType(), bean.getDatasetData()));
}
} catch (Exception e) {
throw new RuntimeException(e);
FineLoggerFactory.getLogger().error("[TableData] getTableData :{} failed!", bean.getDatasetName(), e);
}
}
final TableDataManagerPane globalTableDataPane = new TableDataManagerPane() {
public void complete() {
populate(tableDataMap);

19
designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java

@ -349,25 +349,6 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh
}
}
private boolean saveByOldWay(List<String> removedConnNames, List<ConnectionBean> addedOrUpdatedConnections) {
final int remaining = ConnectionConfigProviderFactory.getConfigProvider().getRemainingCon(removedConnNames.size(), addedOrUpdatedConnections.size());
try {
removedConnNames.forEach(n -> ConnectionConfigWriterFactory.getConfigWriter().removeConnection(n));
int innerRemaining = remaining;
for (ConnectionBean cb : addedOrUpdatedConnections) {
if (innerRemaining > 0) {
ConnectionConfigWriterFactory.getConfigWriter().addConnectionWithoutCheck(cb.getName(), cb.getConnection());
innerRemaining--;
} else {
break;
}
}
return true;
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
return false;
}
public static void showDialog(Window parent) {
final Map<String, Connection> connectionMap = ConnectionInfoBeanHelper.createConnectionMap(ConnectionRepository.getInstance().getAll());

9
designer-base/src/main/java/com/fr/design/data/datapane/preview/ConnectionInfoBeanHelper.java

@ -82,16 +82,19 @@ public class ConnectionInfoBeanHelper {
* 根据bean创建连接
*/
public static Connection createConnection(ConnectionInfoBean infoBean) {
Connection connection = null;
try {
if (JDBCConnectionProcessor.KEY.acceptConnectionTypes().contains(infoBean.getConnectionType())) {
return createJDBCConnection(infoBean);
connection = createJDBCConnection(infoBean);
} else {
return ConnectionProcessorFactory.createConnection(infoBean, true);
connection = ConnectionProcessorFactory.createConnection(infoBean, true);
}
connection.setConnectionName(infoBean.getConnectionName());
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
return null;
return connection;
}
return connection;
}
/**

6
designer-base/src/main/java/com/fr/design/gui/ilist/TableViewList.java

@ -144,7 +144,7 @@ public class TableViewList extends UIList {
}
private void clearCache(Connection datasource) {
String[] schemas = DataCoreUtils.getDatabaseSchema(datasource);
String[] schemas = DataCoreUtils.getDatabaseSchemaByName(datasource);
schemas = (schemas == null || schemas.length == 0) ? new String[]{null} : schemas;
for (String schema : schemas) {
doClearCache(datasource, schema);
@ -172,12 +172,12 @@ public class TableViewList extends UIList {
if (datasource == null) {
return defaultListModel;
}
String[] schemas = DataCoreUtils.getDatabaseSchema(datasource);
String[] schemas = DataCoreUtils.getDatabaseSchemaByName(datasource);
searchFilter = searchFilter.toLowerCase();
boolean isOracleSystemSpace = DesignerEnvManager.getEnvManager().isOracleSystemSpace();
// oracle不勾选显示所有表,则只显示用户下的(包括存储过程和table表)
DataBaseDetail detail = DataOperator.getInstance().getDataBaseDetail(datasource, isOracleSystemSpace);
DataBaseDetail detail = DataOperator.getInstance().getDataBaseDetail(databaseName, isOracleSystemSpace);
if (ArrayUtils.isNotEmpty(detail.getSchemas())) {
schemas = detail.getSchemas();
}

Loading…
Cancel
Save