diff --git a/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java b/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java index 4761002648..e2a08bbbc3 100644 --- a/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java +++ b/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java @@ -180,8 +180,9 @@ public class EnvChangeEntrance { private boolean doSwitch2Env(final String envName, PopTipStrategy strategy) { DesignerWorkspaceInfo selectedEnv = getSelectedEnv(envName); - EnvBackupHelper.getInstance().backup(); + try { + EnvBackupHelper.getInstance().backup(); Workspace workspace = DesignerWorkspaceGenerator.generate(selectedEnv); if (notValid(workspace, selectedEnv)) { return false; diff --git a/designer-base/src/main/java/com/fr/design/actions/server/GlobalTableDataAction.java b/designer-base/src/main/java/com/fr/design/actions/server/GlobalTableDataAction.java index 34daece1dd..138ab32295 100644 --- a/designer-base/src/main/java/com/fr/design/actions/server/GlobalTableDataAction.java +++ b/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 beans = TableDataRepository.getInstance().getAllTableData(); final Map connectionMap = ConnectionInfoBeanHelper.createConnectionMap(ConnectionRepository.getInstance().getAll()); final Map tableDataMap = new HashMap<>(); - try { - for (ServerDataSetBean bean : beans) { + for (ServerDataSetBean bean : beans) { + try { tableDataMap.put(bean.getDatasetName() , TableDataBeanHelper.getTableDataSet(connectionMap, bean.getDatasetType(), bean.getDatasetData())); + } catch (Exception e) { + FineLoggerFactory.getLogger().error("[TableData] getTableData :{} failed!", bean.getDatasetName(), e); } - } catch (Exception e) { - throw new RuntimeException(e); } - final TableDataManagerPane globalTableDataPane = new TableDataManagerPane() { public void complete() { populate(tableDataMap); diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java index a7f606a141..fed8b1269e 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java +++ b/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 removedConnNames, List 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 connectionMap = ConnectionInfoBeanHelper.createConnectionMap(ConnectionRepository.getInstance().getAll()); diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/preview/ConnectionInfoBeanHelper.java b/designer-base/src/main/java/com/fr/design/data/datapane/preview/ConnectionInfoBeanHelper.java index 33e085beb3..2fb5832c57 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/preview/ConnectionInfoBeanHelper.java +++ b/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; } /** diff --git a/designer-base/src/main/java/com/fr/design/gui/ilist/TableViewList.java b/designer-base/src/main/java/com/fr/design/gui/ilist/TableViewList.java index 682e68be7d..652fa23a4f 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ilist/TableViewList.java +++ b/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(); }