|
|
|
@ -27,7 +27,6 @@ import com.fr.general.NameObject;
|
|
|
|
|
import com.fr.license.database.DBTypes; |
|
|
|
|
import com.fr.license.database.DataBaseTypePointManager; |
|
|
|
|
import com.fr.license.exception.DataBaseNotSupportedException; |
|
|
|
|
import com.fr.locale.InterProviderFactory; |
|
|
|
|
import com.fr.log.FineLoggerFactory; |
|
|
|
|
import com.fr.report.LockItem; |
|
|
|
|
import com.fr.stable.ArrayUtils; |
|
|
|
@ -35,7 +34,6 @@ import com.fr.stable.Nameable;
|
|
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
|
import com.fr.stable.core.PropertyChangeAdapter; |
|
|
|
|
import com.fr.workspace.WorkContext; |
|
|
|
|
import com.fr.workspace.engine.exception.DriverUnExistException; |
|
|
|
|
import com.fr.workspace.server.database.DataBaseTypeOperator; |
|
|
|
|
import com.fr.workspace.server.entity.connection.ConnectionBean; |
|
|
|
|
import com.fr.workspace.server.repository.connection.ConnectionRepository; |
|
|
|
@ -351,23 +349,18 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void alterConnections(List<ConnectionInfoBean> addConnections, List<String> removedConnNames, List<ConnectionInfoBean> updateConnection) throws Exception { |
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
// 处理新增 connections
|
|
|
|
|
processConnections(addConnections, bean -> { |
|
|
|
|
for (ConnectionInfoBean bean : addConnections) { |
|
|
|
|
ConnectionRepository.getInstance().add(bean); |
|
|
|
|
}, "add"); |
|
|
|
|
|
|
|
|
|
// 处理更新 connections
|
|
|
|
|
processConnections(updateConnection, bean -> { |
|
|
|
|
} |
|
|
|
|
for (ConnectionInfoBean bean : updateConnection) { |
|
|
|
|
ConnectionRepository.getInstance().update(bean); |
|
|
|
|
}, "update"); |
|
|
|
|
|
|
|
|
|
// 处理移除 connections
|
|
|
|
|
processConnections(removedConnNames, name -> { |
|
|
|
|
} |
|
|
|
|
for (String name : removedConnNames) { |
|
|
|
|
ConnectionRepository.getInstance().delete(new ConnectionInfoBean(name)); |
|
|
|
|
}, "delete"); |
|
|
|
|
|
|
|
|
|
// 远程环境处理逻辑
|
|
|
|
|
} |
|
|
|
|
// hades:远程环境时,由于时直接RPC调用远程修改,因此设计器本地配置需要失效
|
|
|
|
|
if (!WorkContext.getCurrent().isLocal()) { |
|
|
|
|
EventDispatcher.fire(RemoteConfigEvent.EDIT, "ConnectionConfig"); |
|
|
|
|
} |
|
|
|
@ -377,31 +370,6 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private <T> void processConnections(List<T> connections, ThrowingConsumer<T> action, String actionType) throws Exception { |
|
|
|
|
for (T item : connections) { |
|
|
|
|
try { |
|
|
|
|
action.accept(item); |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
String errorConnectionName = (item instanceof ConnectionInfoBean) |
|
|
|
|
? ((ConnectionInfoBean) item).getConnectionName() |
|
|
|
|
: item.toString(); |
|
|
|
|
if (e instanceof DriverUnExistException) { |
|
|
|
|
throw new DriverUnExistException(InterProviderFactory.getProvider().getLocText("Fine-Core_Data_Connection") + errorConnectionName |
|
|
|
|
+ InterProviderFactory.getProvider().getLocText("Fine-Core_Driver_Not_Found")); |
|
|
|
|
} |
|
|
|
|
throw e; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 抛异常的函数式接口 |
|
|
|
|
*/ |
|
|
|
|
@FunctionalInterface |
|
|
|
|
interface ThrowingConsumer<T> { |
|
|
|
|
void accept(T t) throws Exception; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static void showDialog(Window parent) { |
|
|
|
|
try { |
|
|
|
|
final Map<String, Connection> connectionMap = ConnectionInfoBeanHelper.createConnectionMap(ConnectionRepository.getInstance().getAll()); |
|
|
|
|