Browse Source

Merge pull request #15280 in DESIGN/design from fbp/release to fbp/feature

* commit 'e608dcdf85074ab8e09b04ee18c17e71cf8b888d':
  REPORT-139278 【fr-fbp冒烟】【数据源】数据连接选择没有驱动的数据库类型,检测时缺少驱动,点击取消按钮,修改的内容实际上保存成功
  REPORT-139220 【fr-fbp冒烟】【数据源】设计器批量添加数据连接,保存时偶发报错重名
fbp/feature
superman 2 months ago
parent
commit
c4c805eebd
  1. 3
      designer-base/src/main/java/com/fr/design/data/datapane/TableDataPaneListPane.java
  2. 16
      designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java

3
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) { for (ServerDataSetBean bean : deleteDatas) {
TableDataRepository.getInstance().delete(bean); TableDataRepository.getInstance().delete(bean);
} }
TableDataRepository.getInstance().invalidCache();
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} finally {
TableDataRepository.getInstance().invalidCache();
} }
} }

16
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<String> removedConnNames = new ArrayList<>(); List<String> removedConnNames = new ArrayList<>();
List<ConnectionInfoBean> addConnections = new ArrayList<>(); List<ConnectionInfoBean> addConnections = new ArrayList<>();
List<ConnectionInfoBean> updateConnection = new ArrayList<>(); List<ConnectionInfoBean> updateConnection = new ArrayList<>();
List<Connection> validConnection = new ArrayList<>(); Map<String, Connection> validConnection = new HashMap<>();
MapCompareUtils.contrastMapEntries(populatedConnectionsSnapshot, updatedMap, (entryEventKind, s, connection) -> { MapCompareUtils.contrastMapEntries(populatedConnectionsSnapshot, updatedMap, (entryEventKind, s, connection) -> {
try { try {
switch (entryEventKind) { switch (entryEventKind) {
@ -242,7 +242,7 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh
ConnectionInfoBean add = ConnectionInfoBeanHelper.createConnectionInfoBean(s, connection, true); ConnectionInfoBean add = ConnectionInfoBeanHelper.createConnectionInfoBean(s, connection, true);
if (StringUtils.isNotEmpty(add.getConnectionData())) { if (StringUtils.isNotEmpty(add.getConnectionData())) {
addConnections.add(add); addConnections.add(add);
validConnection.add(connection); validConnection.put(s, connection);
} else { } else {
FineLoggerFactory.getLogger().error("Unable to find the corresponding processor : {}", connection.getClass()); 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); ConnectionInfoBean update = ConnectionInfoBeanHelper.createConnectionInfoBean(s, connection, true);
if (StringUtils.isNotEmpty(update.getConnectionData())) { if (StringUtils.isNotEmpty(update.getConnectionData())) {
updateConnection.add(update); updateConnection.add(update);
validConnection.add(connection); validConnection.put(s, connection);
} else { } else {
FineLoggerFactory.getLogger().error("Unable to find the corresponding processor : {}", connection.getClass()); 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.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<ConnectionInfoBean> addConnections, List<String> removedConnNames, List<ConnectionInfoBean> updateConnection) throws Exception { private void alterConnections(List<ConnectionInfoBean> addConnections, List<String> removedConnNames, List<ConnectionInfoBean> updateConnection, Map<String, Connection> validConnection) throws Exception {
try { try {
for (ConnectionInfoBean bean : addConnections) { for (ConnectionInfoBean bean : addConnections) {
ConnectionRepository.getInstance().add(bean); ConnectionRepository.getInstance().add(bean);
populatedConnectionsSnapshot.put(bean.getConnectionName(), validConnection.get(bean.getConnectionName()));
} }
for (ConnectionInfoBean bean : updateConnection) { for (ConnectionInfoBean bean : updateConnection) {
ConnectionRepository.getInstance().update(bean); ConnectionRepository.getInstance().update(bean);
populatedConnectionsSnapshot.put(bean.getConnectionName(), validConnection.get(bean.getConnectionName()));
} }
for (String name : removedConnNames) { for (String name : removedConnNames) {
ConnectionRepository.getInstance().delete(new ConnectionInfoBean(name)); ConnectionRepository.getInstance().delete(new ConnectionInfoBean(name));
populatedConnectionsSnapshot.remove(name);
} }
// hades:远程环境时,由于时直接RPC调用远程修改,因此设计器本地配置需要失效 // hades:远程环境时,由于时直接RPC调用远程修改,因此设计器本地配置需要失效
if (!WorkContext.getCurrent().isLocal()) { if (!WorkContext.getCurrent().isLocal()) {
EventDispatcher.fire(RemoteConfigEvent.EDIT, "ConnectionConfig"); EventDispatcher.fire(RemoteConfigEvent.EDIT, "ConnectionConfig");
} }
ConnectionRepository.getInstance().invalidCache();
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
throw e; throw e;
} finally {
ConnectionRepository.getInstance().invalidCache();
} }
} }

Loading…
Cancel
Save