From 679617e66f6b7b5369c55a7fe5c871697773b423 Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Thu, 8 Aug 2024 19:40:48 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-114392=20FR-FBP=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E6=9C=AC=E5=9C=B0=E8=AE=BE=E8=AE=A1=E9=80=82=E9=85=8D=20?= =?UTF-8?q?=E9=80=82=E9=85=8D=E6=95=B0=E6=8D=AE=E4=B8=AD=E5=BF=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../actions/server/GlobalTableDataAction.java | 19 +++++++++++--- .../connect/ConnectionComboBoxPanel.java | 13 ++++------ .../connect/LocalConnectionSource.java | 26 ++++++++++++++----- .../mainframe/share/ComponentShareUtil.java | 3 ++- 4 files changed, 41 insertions(+), 20 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/actions/server/GlobalTableDataAction.java b/designer-base/src/main/java/com/fr/design/actions/server/GlobalTableDataAction.java index c4606b2645..0e08f3bb39 100644 --- a/designer-base/src/main/java/com/fr/design/actions/server/GlobalTableDataAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/server/GlobalTableDataAction.java @@ -1,7 +1,8 @@ package com.fr.design.actions.server; -import com.fanruan.config.impl.data.TableDataConfigProviderFactory; import com.fr.base.TableData; +import com.fr.decision.webservice.bean.dataset.ServerDataSetBean; +import com.fr.decision.webservice.v10.datasource.dataset.processor.impl.DataSetProcessorFactory; import com.fr.design.DesignModelAdapter; import com.fr.design.actions.UpdateAction; import com.fr.design.data.DesignTableDataManager; @@ -22,6 +23,7 @@ import com.fr.esd.event.DsNameTarget; import com.fr.esd.event.StrategyEventsNotifier; import com.fr.report.LockItem; +import com.fr.security.encryption.transmission.TransmissionEncryptionManager; import com.fr.workspace.server.entity.tabledata.TableDataBean; import com.fr.workspace.server.repository.tabledata.TableDataRepository; @@ -29,6 +31,7 @@ import javax.swing.KeyStroke; import java.awt.Dimension; import java.awt.event.ActionEvent; import java.util.HashMap; +import java.util.List; import java.util.Map; /** @@ -77,11 +80,19 @@ public class GlobalTableDataAction extends UpdateAction implements ResponseDataS } // 锁定成功,执行后续操作 final DesignerFrame designerFrame = DesignerContext.getDesignerFrame(); - final TableDataBean[] beans = TableDataRepository.getInstance().getAllTableData(); + final List beans = TableDataRepository.getInstance().getAllTableData(); final Map tableDataMap = new HashMap<>(); - for (TableDataBean bean : beans) { - tableDataMap.put(bean.getName() , bean.getTableData()); + try { + TransmissionEncryptionManager.setTransEncryptionLevel(1); + for (ServerDataSetBean bean : beans) { + tableDataMap.put(bean.getDatasetName() , DataSetProcessorFactory.getTableDataSet(bean.getDatasetType(), bean.getDatasetData())); + } + } catch (Exception e) { + throw new RuntimeException(e); + } finally { + TransmissionEncryptionManager.removeTransEncryptionLevel(); } + final TableDataManagerPane globalTableDataPane = new TableDataManagerPane() { public void complete() { populate(tableDataMap); diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java index cafae19695..3067aeacb3 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java @@ -13,6 +13,7 @@ import com.fr.design.gui.ibutton.UILockButton; import com.fr.report.LockItem; import com.fr.stable.StringUtils; import com.fr.workspace.WorkContext; +import com.fr.workspace.server.entity.connection.ConnectionBean; import com.fr.workspace.server.repository.authority.RemoteAuthorityRepository; import com.fr.workspace.server.repository.connection.ConnectionRepository; @@ -80,8 +81,6 @@ public class ConnectionComboBoxPanel extends ItemEditableComboBoxPanel { * 刷新ComboBox.items */ protected Iterator items() { - Iterator nameIt = ConnectionRepository.getInstance().getConnNames().iterator(); - Collection noAuthConnections = RemoteAuthorityRepository.getInstance().getNoAuthConnections(); nameList = new ArrayList<>(); @@ -89,16 +88,14 @@ public class ConnectionComboBoxPanel extends ItemEditableComboBoxPanel { if (noAuthConnections == null) { return nameList.iterator(); } - while (nameIt.hasNext()) { - String conName = nameIt.next(); + List beans = ConnectionRepository.getInstance().getAll(); + for (ConnectionBean bean : beans) { + String conName = bean.getName(); if (noAuthConnections.contains(conName)) { continue; } - Connection connection = ConnectionRepository.getInstance().getByName(conName).getConnection(); - // nameList依赖items方法初始化,父类ItemEditableComboBoxPanel里异步执行item方法 - filterConnection(connection, conName, nameList); + filterConnection(bean.getConnection(), conName, nameList); } - return nameList.iterator(); } diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/LocalConnectionSource.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/LocalConnectionSource.java index 6b97e539c2..25e9da20d6 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/LocalConnectionSource.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/LocalConnectionSource.java @@ -24,16 +24,22 @@ public class LocalConnectionSource extends BaseConnectionSource { try { // 暂时这么处理,后续最好拉到外层包装一下 TransmissionEncryptionManager.setTransEncryptionLevel(1); - dataOperator.testConnectionWithException(ConnectionProcessorFactory.createConnection(database)); + ConnectionProcessorFactory.testConnectionWithSchemaReturn(database); } finally { TransmissionEncryptionManager.removeTransEncryptionLevel(); } } @Override public void add(ConnectionInfoBean bean) throws Exception { - Connection connection = ConnectionProcessorFactory.createConnection(bean); - validate(bean.getConnectionName(), connection); - ConnectionProcessorFactory.addConnection(bean); + try { + TransmissionEncryptionManager.setTransEncryptionLevel(1); + Connection connection = ConnectionProcessorFactory.createConnection(bean); + validate(bean.getConnectionName(), connection); + ConnectionProcessorFactory.addConnection(bean); + } finally { + TransmissionEncryptionManager.removeTransEncryptionLevel(); + } + } @Override @@ -43,9 +49,15 @@ public class LocalConnectionSource extends BaseConnectionSource { @Override public void update(ConnectionInfoBean bean) throws Exception { - Connection connection = ConnectionProcessorFactory.createConnection(bean); - validate(bean.getConnectionName(), connection); - ConnectionProcessorFactory.updateConnection(bean.getConnectionName(), bean); + try { + TransmissionEncryptionManager.setTransEncryptionLevel(1); + Connection connection = ConnectionProcessorFactory.createConnection(bean); + validate(bean.getConnectionName(), connection); + ConnectionProcessorFactory.updateConnection(bean.getConnectionName(), bean); + } finally { + TransmissionEncryptionManager.removeTransEncryptionLevel(); + } + } @Override diff --git a/designer-base/src/main/java/com/fr/design/mainframe/share/ComponentShareUtil.java b/designer-base/src/main/java/com/fr/design/mainframe/share/ComponentShareUtil.java index 2445826128..24f2407b29 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/share/ComponentShareUtil.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/share/ComponentShareUtil.java @@ -11,6 +11,7 @@ import com.fr.design.DesignerCloudURLManager; import com.fr.general.locale.LocaleCenter; import com.fr.general.locale.LocaleMark; import com.fr.workspace.WorkContext; +import com.fr.workspace.server.repository.widget.ShareRepository; /** * Created by kerry on 2021/10/27 @@ -45,7 +46,7 @@ public class ComponentShareUtil { */ public static boolean hasTouched() { String sharePath = ComponentPath.SHARE_PATH.path(); - String[] components = WorkContext.getWorkResource().list(sharePath, new ReuFilter()); + String[] components = ShareRepository.getInstance().getComponents(sharePath); return components != null && components.length > 6; }