@ -231,7 +231,7 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh
List < String > removedConnNames = new ArrayList < > ( ) ;
List < ConnectionInfoBean > addConnections = 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 ) - > {
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,17 +344,20 @@ 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 {
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 ( ) ) {