diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/TableDataPaneListPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/TableDataPaneListPane.java index 304ed35eae..706f4cb434 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/TableDataPaneListPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/TableDataPaneListPane.java @@ -336,9 +336,10 @@ public class TableDataPaneListPane extends JListControlPane implements TableData for (ServerDataSetBean bean : deleteDatas) { TableDataRepository.getInstance().delete(bean); } - TableDataRepository.getInstance().invalidCache(); } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); + } finally { + TableDataRepository.getInstance().invalidCache(); } } 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 93780213d5..b78199d6cf 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 @@ -231,7 +231,7 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh List removedConnNames = new ArrayList<>(); List addConnections = new ArrayList<>(); List updateConnection = new ArrayList<>(); - List validConnection = new ArrayList<>(); + Map validConnection = new HashMap<>(); MapCompareUtils.contrastMapEntries(populatedConnectionsSnapshot, updatedMap, (entryEventKind, s, connection) -> { try { switch (entryEventKind) { @@ -242,7 +242,7 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh ConnectionInfoBean add = ConnectionInfoBeanHelper.createConnectionInfoBean(s, connection, true); if (StringUtils.isNotEmpty(add.getConnectionData())) { addConnections.add(add); - validConnection.add(connection); + validConnection.put(s, connection); } else { FineLoggerFactory.getLogger().error("Unable to find the corresponding processor : {}", connection.getClass()); } @@ -251,7 +251,7 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh ConnectionInfoBean update = ConnectionInfoBeanHelper.createConnectionInfoBean(s, connection, true); if (StringUtils.isNotEmpty(update.getConnectionData())) { updateConnection.add(update); - validConnection.add(connection); + validConnection.put(s, connection); } else { FineLoggerFactory.getLogger().error("Unable to find the corresponding processor : {}", connection.getClass()); } @@ -297,7 +297,7 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh }); /// 先不管 //this.validateDatabaseType(validConnection); - this.alterConnections(addConnections, removedConnNames, updateConnection); + this.alterConnections(addConnections, removedConnNames, updateConnection, validConnection); } /** @@ -344,26 +344,30 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh } - private void alterConnections(List addConnections, List removedConnNames, List updateConnection) throws Exception { + private void alterConnections(List addConnections, List removedConnNames, List updateConnection, Map validConnection) throws Exception { try { for (ConnectionInfoBean bean : addConnections) { ConnectionRepository.getInstance().add(bean); + populatedConnectionsSnapshot.put(bean.getConnectionName(), validConnection.get(bean.getConnectionName())); } for (ConnectionInfoBean bean : updateConnection) { ConnectionRepository.getInstance().update(bean); + populatedConnectionsSnapshot.put(bean.getConnectionName(), validConnection.get(bean.getConnectionName())); } for (String name : removedConnNames) { ConnectionRepository.getInstance().delete(new ConnectionInfoBean(name)); + populatedConnectionsSnapshot.remove(name); } // hades:远程环境时,由于时直接RPC调用远程修改,因此设计器本地配置需要失效 if (!WorkContext.getCurrent().isLocal()) { EventDispatcher.fire(RemoteConfigEvent.EDIT, "ConnectionConfig"); } - ConnectionRepository.getInstance().invalidCache(); } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); throw e; + } finally { + ConnectionRepository.getInstance().invalidCache(); } }