|
|
@ -27,7 +27,6 @@ import com.fr.general.NameObject; |
|
|
|
import com.fr.license.database.DBTypes; |
|
|
|
import com.fr.license.database.DBTypes; |
|
|
|
import com.fr.license.database.DataBaseTypePointManager; |
|
|
|
import com.fr.license.database.DataBaseTypePointManager; |
|
|
|
import com.fr.license.exception.DataBaseNotSupportedException; |
|
|
|
import com.fr.license.exception.DataBaseNotSupportedException; |
|
|
|
import com.fr.locale.InterProviderFactory; |
|
|
|
|
|
|
|
import com.fr.log.FineLoggerFactory; |
|
|
|
import com.fr.log.FineLoggerFactory; |
|
|
|
import com.fr.report.LockItem; |
|
|
|
import com.fr.report.LockItem; |
|
|
|
import com.fr.stable.ArrayUtils; |
|
|
|
import com.fr.stable.ArrayUtils; |
|
|
@ -35,7 +34,6 @@ import com.fr.stable.Nameable; |
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
import com.fr.stable.core.PropertyChangeAdapter; |
|
|
|
import com.fr.stable.core.PropertyChangeAdapter; |
|
|
|
import com.fr.workspace.WorkContext; |
|
|
|
import com.fr.workspace.WorkContext; |
|
|
|
import com.fr.workspace.engine.exception.DriverUnExistException; |
|
|
|
|
|
|
|
import com.fr.workspace.server.database.DataBaseTypeOperator; |
|
|
|
import com.fr.workspace.server.database.DataBaseTypeOperator; |
|
|
|
import com.fr.workspace.server.entity.connection.ConnectionBean; |
|
|
|
import com.fr.workspace.server.entity.connection.ConnectionBean; |
|
|
|
import com.fr.workspace.server.repository.connection.ConnectionRepository; |
|
|
|
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 { |
|
|
|
private void alterConnections(List<ConnectionInfoBean> addConnections, List<String> removedConnNames, List<ConnectionInfoBean> updateConnection) throws Exception { |
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
try { |
|
|
|
// 处理新增 connections
|
|
|
|
for (ConnectionInfoBean bean : addConnections) { |
|
|
|
processConnections(addConnections, bean -> { |
|
|
|
|
|
|
|
ConnectionRepository.getInstance().add(bean); |
|
|
|
ConnectionRepository.getInstance().add(bean); |
|
|
|
}, "add"); |
|
|
|
} |
|
|
|
|
|
|
|
for (ConnectionInfoBean bean : updateConnection) { |
|
|
|
// 处理更新 connections
|
|
|
|
|
|
|
|
processConnections(updateConnection, bean -> { |
|
|
|
|
|
|
|
ConnectionRepository.getInstance().update(bean); |
|
|
|
ConnectionRepository.getInstance().update(bean); |
|
|
|
}, "update"); |
|
|
|
} |
|
|
|
|
|
|
|
for (String name : removedConnNames) { |
|
|
|
// 处理移除 connections
|
|
|
|
|
|
|
|
processConnections(removedConnNames, name -> { |
|
|
|
|
|
|
|
ConnectionRepository.getInstance().delete(new ConnectionInfoBean(name)); |
|
|
|
ConnectionRepository.getInstance().delete(new ConnectionInfoBean(name)); |
|
|
|
}, "delete"); |
|
|
|
} |
|
|
|
|
|
|
|
// hades:远程环境时,由于时直接RPC调用远程修改,因此设计器本地配置需要失效
|
|
|
|
// 远程环境处理逻辑
|
|
|
|
|
|
|
|
if (!WorkContext.getCurrent().isLocal()) { |
|
|
|
if (!WorkContext.getCurrent().isLocal()) { |
|
|
|
EventDispatcher.fire(RemoteConfigEvent.EDIT, "ConnectionConfig"); |
|
|
|
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) { |
|
|
|
public static void showDialog(Window parent) { |
|
|
|
try { |
|
|
|
try { |
|
|
|
final Map<String, Connection> connectionMap = ConnectionInfoBeanHelper.createConnectionMap(ConnectionRepository.getInstance().getAll()); |
|
|
|
final Map<String, Connection> connectionMap = ConnectionInfoBeanHelper.createConnectionMap(ConnectionRepository.getInstance().getAll()); |
|
|
|