From 917cba3f70f14e738fa8bf65166fb1a26f9353cd Mon Sep 17 00:00:00 2001 From: Anner Date: Fri, 16 Aug 2024 19:33:21 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A0JIRA=20fix:=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E6=89=93=E5=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fanruan/data/ConnectionConfigWrapper.java | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/designer-realize/src/main/java/com/fanruan/data/ConnectionConfigWrapper.java b/designer-realize/src/main/java/com/fanruan/data/ConnectionConfigWrapper.java index ac898903e8..6f8dec4d1f 100644 --- a/designer-realize/src/main/java/com/fanruan/data/ConnectionConfigWrapper.java +++ b/designer-realize/src/main/java/com/fanruan/data/ConnectionConfigWrapper.java @@ -4,6 +4,7 @@ import com.fanruan.config.impl.data.ConnectionConfigProvider; import com.fanruan.config.impl.data.ConnectionConfigWriter; import com.fr.data.impl.Connection; import com.fr.file.ConnectionConfig; +import com.fr.log.FineLoggerFactory; import com.fr.transaction.Configurations; import com.fr.transaction.WorkerAdaptor; import org.jetbrains.annotations.NotNull; @@ -140,7 +141,24 @@ public class ConnectionConfigWrapper implements ConnectionConfigProvider, Connec } }); } - + + @Override + public boolean updateConnection(String oldName, String connName, Connection connection) { + try { + Configurations.update(new WorkerAdaptor(ConnectionConfig.class) { + @Override + public void run() { + ConnectionConfig.getInstance().removeConnection(oldName); + ConnectionConfig.getInstance().addConnection(connName, connection); + } + }); + return true; + } catch (Exception e) { + FineLoggerFactory.getLogger().error("update old connection fail , old name is {} , new name is {}", oldName, connection); + } + return false; + } + @Override public boolean isPutPermitted() { return ConnectionConfig.getInstance().isPutPermitted();