From 12f3f8d6f6f781340eaa766882b2f91f96b8b959 Mon Sep 17 00:00:00 2001 From: hades Date: Wed, 17 Jul 2024 16:32:15 +0800 Subject: [PATCH 1/8] =?UTF-8?q?KERNEL-18926=20=E4=BF=AE=E6=94=B9=E5=8C=85?= =?UTF-8?q?=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 68faad52e5..32fb467cd4 100644 --- a/build.gradle +++ b/build.gradle @@ -107,7 +107,7 @@ allprojects { implementation 'com.fr.activator:fine-activator:' + frVersion implementation 'com.fr.datasource:fine-datasource-api:' + fdlVersion implementation 'com.fr.datasource:fine-datasource-core:' + fdlVersion - implementation 'com.fr.datasource:fine-datasource-dec:' + fdlVersion + implementation 'com.fr.datasource:fine-datasource-web:' + fdlVersion implementation 'com.fr.decision:decision-i18n:' + frVersion implementation 'com.fr.report:engine-report:' + frDevVersion implementation 'com.fr.report:engine-x:' + frDevVersion From 01601bd9fd57026c870a6f5682a90479c4e9b0e2 Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Thu, 18 Jul 2024 10:00:53 +0800 Subject: [PATCH 2/8] =?UTF-8?q?REPORT-114391=20=E3=80=90=E5=BE=AE=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E9=80=82=E9=85=8D=E3=80=91=E8=BF=9C=E7=A8=8B&?= =?UTF-8?q?=E6=9C=AC=E5=9C=B0=E8=AE=BE=E8=AE=A1=E5=99=A8=E8=83=BD=E5=A4=9F?= =?UTF-8?q?=E6=AD=A3=E5=B8=B8=E5=90=AF=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/backup/EnvBackupHelper.java | 5 ++ .../connect/ConnectionComboBoxPanel.java | 6 +- .../datapane/connect/ConnectionListPane.java | 83 ++++++++----------- .../data/datapane/connect/JDBCDefPane.java | 4 +- .../connect/LocalConnectionSource.java | 67 +++++++++++++++ .../fr/design/gui/ilist/TableViewList.java | 13 ++- .../fanruan/boot/env/DesignEnvComponent.java | 19 +++-- .../function/DesignDatasourceComponent.java | 3 + 8 files changed, 138 insertions(+), 62 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/data/datapane/connect/LocalConnectionSource.java diff --git a/designer-base/src/main/java/com/fr/design/backup/EnvBackupHelper.java b/designer-base/src/main/java/com/fr/design/backup/EnvBackupHelper.java index 6ea52fd764..bb9575ea19 100644 --- a/designer-base/src/main/java/com/fr/design/backup/EnvBackupHelper.java +++ b/designer-base/src/main/java/com/fr/design/backup/EnvBackupHelper.java @@ -5,6 +5,7 @@ import com.fanruan.config.realm.ConfigRepositoryFactory; import com.fanruan.config.realm.local.LocalConfigRepositoryBuilder; import com.fr.design.ConfigHelper; import com.fr.design.mem.MemConfigBackupManager; +import com.fr.design.mem.MemConfigRepositoryBuilder; import com.fr.log.FineLoggerFactory; import com.fr.workspace.WorkContext; import com.fr.workspace.Workspace; @@ -71,6 +72,10 @@ public class EnvBackupHelper { } else { // 如果是切到远程,先暂时用备份的内存配置,成功后再转到新配置,失败则切回原内存配置 MemConfigBackupManager.getInstance().startSwitch(); + if (local) { + // 原来不是远程,需要先切一下内存配置框架 + ConfigRepositoryFactory.getInstance().registerConfigRepositoryBuilder(new MemConfigRepositoryBuilder()); + } } } 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 28f9b0d507..cafae19695 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,8 +13,8 @@ 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.connection.DBConnectAuth; import com.fr.workspace.server.repository.authority.RemoteAuthorityRepository; +import com.fr.workspace.server.repository.connection.ConnectionRepository; import javax.swing.SwingUtilities; import java.awt.Dimension; @@ -80,7 +80,7 @@ public class ConnectionComboBoxPanel extends ItemEditableComboBoxPanel { * 刷新ComboBox.items */ protected Iterator items() { - Iterator nameIt = ConnectionConfigProviderFactory.getConfigProvider().getConnections().keySet().iterator(); + Iterator nameIt = ConnectionRepository.getInstance().getConnNames().iterator(); Collection noAuthConnections = RemoteAuthorityRepository.getInstance().getNoAuthConnections(); @@ -94,7 +94,7 @@ public class ConnectionComboBoxPanel extends ItemEditableComboBoxPanel { if (noAuthConnections.contains(conName)) { continue; } - Connection connection = ConnectionConfigProviderFactory.getConfigProvider().getConnection(conName); + Connection connection = ConnectionRepository.getInstance().getByName(conName).getConnection(); // nameList依赖items方法初始化,父类ItemEditableComboBoxPanel里异步执行item方法 filterConnection(connection, conName, nameList); } diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java index fd10c25fdf..94debc6c5b 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java @@ -3,12 +3,11 @@ package com.fr.design.data.datapane.connect; import com.fanruan.config.impl.data.ConnectionConfigProviderFactory; import com.fanruan.config.impl.data.ConnectionConfigWriterFactory; import com.fr.config.remote.RemoteConfigEvent; -import com.fr.data.driver.DriverClassNotFoundException; import com.fr.data.impl.Connection; import com.fr.data.impl.JDBCDatabaseConnection; import com.fr.data.impl.JNDIDatabaseConnection; -import com.fr.data.metric.utils.DatabaseConnectionMetricHandler; -import com.fr.data.operator.DataOperator; +import com.fr.decision.webservice.bean.datasource.ConnectionInfoBean; +import com.fr.decision.webservice.v10.datasource.connection.processor.impl.ConnectionProcessorFactory; import com.fr.design.ExtraDesignClassManager; import com.fr.design.data.MapCompareUtils; import com.fr.design.dialog.BasicDialog; @@ -219,27 +218,25 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh Arrays.stream(res).map(n -> (NameObject) n).forEach(no -> updatedMap.put(no.getName(), (Connection) no.getObject())); List removedConnNames = new ArrayList<>(); - List addConnections = new ArrayList<>(); - List updateConnection = new ArrayList<>(); + List addConnections = new ArrayList<>(); + List updateConnection = new ArrayList<>(); MapCompareUtils.contrastMapEntries(populatedConnectionsSnapshot, updatedMap, (entryEventKind, s, connection) -> { - switch (entryEventKind) { - case REMOVED: - removedConnNames.add(s); - break; - case ADDED: - addConnections.add(new ConnectionBean(connection, s)); - if (connection instanceof JDBCDatabaseConnection) { - DatabaseConnectionMetricHandler.handleSaveConnection((JDBCDatabaseConnection) connection, null); - } - break; - case UPDATED: - updateConnection.add(new ConnectionBean(connection, s)); - if (connection instanceof JDBCDatabaseConnection) { - DatabaseConnectionMetricHandler.handleSaveConnection((JDBCDatabaseConnection) connection, null); - } - break; - default: - break; + try { + switch (entryEventKind) { + case REMOVED: + removedConnNames.add(s); + break; + case ADDED: + addConnections.add(ConnectionProcessorFactory.createConnectionInfoBean(s, connection)); + break; + case UPDATED: + updateConnection.add(ConnectionProcessorFactory.createConnectionInfoBean(s, connection)); + break; + default: + break; + } + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); } }, new MapCompareUtils.UpdateRule() { @Override @@ -269,23 +266,22 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh } }); - List validateBeans = new ArrayList<>(); + List validateBeans = new ArrayList<>(); validateBeans.addAll(addConnections); validateBeans.addAll(updateConnection); this.validateDatabaseType(validateBeans); - this.validateConnections(validateBeans); - this.alterConnections(new BatchConnectionModifyBean(addConnections, removedConnNames, updateConnection)); + this.alterConnections(addConnections, removedConnNames, updateConnection); } /** * 校验是否支持所有新增和修改数据连接的数据库类型 */ - public void validateDatabaseType(@NotNull List addedOrUpdatedConnections) { + public void validateDatabaseType(@NotNull List addedOrUpdatedConnections) throws Exception { Set notSupportedConnections = new HashSet<>(); if (!addedOrUpdatedConnections.isEmpty()) { - for (ConnectionBean bean : addedOrUpdatedConnections) { - Connection connection = bean.getConnection(); - // 仅校验jdbc连接,其他插件数据连接不进行校验 + for (ConnectionInfoBean bean : addedOrUpdatedConnections) { + Connection connection = ConnectionProcessorFactory.createConnection(bean); + // 仅校验jdbc连接,其他插件数据连接不进行校验; if (connection instanceof JDBCDatabaseConnection) { DBTypes dataBaseTypePoint = DataBaseTypePointManager.getInstance().getDataBaseTypePoint(connection.getDriver(), connection.feature()); if (connectionIsNotSupported(connection, dataBaseTypePoint)) { @@ -322,25 +318,18 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh } - private void validateConnections(List addedOrUpdatedConnections) throws Exception { - - for (ConnectionBean connectionBean : addedOrUpdatedConnections) { - Connection connection = connectionBean.getConnection(); - try { - ConnectionRepository.getInstance().validSettings(new com.fr.workspace.server.entity.connection.ConnectionBean(connection)); - } catch (DriverClassNotFoundException e) { - FineLoggerFactory.getLogger().info(e.getMessage()); - } catch (Exception e) { - throw new SQLException(Toolkit.i18nText("Fine-Design_Basic_Database_Connection_Invalid_Config", connectionBean.getName()) + ", " + e.getMessage(), e.getCause()); - } - } - - } - - private void alterConnections(BatchConnectionModifyBean bean) { + private void alterConnections(List addConnections, List removedConnNames, List updateConnection) { try { - ConnectionRepository.getInstance().save(bean); + for (ConnectionInfoBean bean : addConnections) { + ConnectionRepository.getInstance().add(bean); + } + for (ConnectionInfoBean bean : updateConnection) { + ConnectionRepository.getInstance().update(bean); + } + for (String name : removedConnNames) { + ConnectionRepository.getInstance().delete(new ConnectionInfoBean(name)); + } // hades:远程环境时,由于时直接RPC调用远程修改,因此设计器本地配置需要失效 if (!WorkContext.getCurrent().isLocal()) { EventDispatcher.fire(RemoteConfigEvent.EDIT, "ConnectionConfig"); diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCDefPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCDefPane.java index e8c7c17b8e..988ad0c94a 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCDefPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCDefPane.java @@ -451,8 +451,8 @@ public class JDBCDefPane extends JPanel { jdbcDatabase.setPassword(new String(this.passwordTextField.getPassword()).trim()); jdbcDatabase.setOriginalCharsetName(this.originalCharSet); if (this.charSetComboBox.getSelectedIndex() == 0) { - jdbcDatabase.setNewCharsetName(null); - jdbcDatabase.setOriginalCharsetName(null); + jdbcDatabase.setNewCharsetName(StringUtils.EMPTY); + jdbcDatabase.setOriginalCharsetName(StringUtils.EMPTY); } else { jdbcDatabase.setNewCharsetName(EncodeConstants.ENCODING_GBK); jdbcDatabase.setOriginalCharsetName(((String) this.charSetComboBox.getSelectedItem())); 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 new file mode 100644 index 0000000000..0935de229d --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/LocalConnectionSource.java @@ -0,0 +1,67 @@ +package com.fr.design.data.datapane.connect; + +import com.fr.data.driver.DriverClassNotFoundException; +import com.fr.data.impl.Connection; +import com.fr.decision.webservice.bean.datasource.ConnectionInfoBean; +import com.fr.decision.webservice.v10.datasource.connection.processor.impl.ConnectionProcessorFactory; +import com.fr.design.i18n.Toolkit; +import com.fr.log.FineLoggerFactory; +import com.fr.workspace.server.repository.connection.BaseConnectionSource; +import java.sql.SQLException; + +/** + * 本地Connection资源操作 + * + * @author Destiny.Lin + * @since 11.0 + * Created on 2024/5/29 + */ +public class LocalConnectionSource extends BaseConnectionSource { + + @Override + public void add(ConnectionInfoBean bean) throws Exception { + Connection connection = ConnectionProcessorFactory.createConnection(bean); + validate(bean.getConnectionName(), connection); + ConnectionProcessorFactory.addConnection(bean); + } + + @Override + public void delete(ConnectionInfoBean bean) throws Exception { + ConnectionProcessorFactory.deleteConnection(bean.getConnectionName()); + } + + @Override + public void update(ConnectionInfoBean bean) throws Exception { + Connection connection = ConnectionProcessorFactory.createConnection(bean); + validate(bean.getConnectionName(), connection); + ConnectionProcessorFactory.updateConnection(bean.getConnectionName(), bean); + } + + @Override + public boolean lock(String str) { + // 本地默认锁定成功,让其执行后续动作 + return true; + } + + @Override + public boolean unlock(String str) { + // 本地默认解锁成功 + return true; + } + + @Override + public boolean isLock(String str) { + // 本地默认未锁定 + return false; + } + + private void validate(String name, Connection connection) throws SQLException { + try { + connection.validateSettings(); + } catch (DriverClassNotFoundException e) { + FineLoggerFactory.getLogger().info(e.getMessage()); + } catch (Exception e) { + throw new SQLException(Toolkit.i18nText("Fine-Design_Basic_Database_Connection_Invalid_Config", name) + ", " + e.getMessage(), e.getCause()); + } + } +} diff --git a/designer-base/src/main/java/com/fr/design/gui/ilist/TableViewList.java b/designer-base/src/main/java/com/fr/design/gui/ilist/TableViewList.java index ab5c67678e..83b7008a7e 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ilist/TableViewList.java +++ b/designer-base/src/main/java/com/fr/design/gui/ilist/TableViewList.java @@ -15,6 +15,8 @@ import com.fr.general.ComparatorUtils; import com.fr.log.FineLoggerFactory; import com.fr.stable.ArrayUtils; import com.fr.stable.StringUtils; +import com.fr.workspace.server.entity.connection.ConnectionBean; +import com.fr.workspace.server.repository.connection.ConnectionRepository; import javax.swing.DefaultListCellRenderer; import javax.swing.DefaultListModel; @@ -95,13 +97,18 @@ public class TableViewList extends UIList { @Override protected DefaultListModel doInBackground() throws Exception { - Connection datasource = ConnectionConfigProviderFactory.getConfigProvider().getConnection(databaseName); + Connection datasource = ConnectionRepository.getInstance().getByName(databaseName).getConnection(); boolean status = false; int count = 3; //总共给3次连接的机会 while (!status && count > 0) { - status = DataOperator.getInstance().testConnection(datasource); - count--; + try { + ConnectionRepository.getInstance().testConnection(new ConnectionBean(datasource)); + status = true; + break; + } catch (Exception e) { + count--; + } } if (!status) { throw new Exception(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Database_Connection_Failed")); diff --git a/designer-realize/src/main/java/com/fanruan/boot/env/DesignEnvComponent.java b/designer-realize/src/main/java/com/fanruan/boot/env/DesignEnvComponent.java index 0621a6a7ae..700fc12258 100644 --- a/designer-realize/src/main/java/com/fanruan/boot/env/DesignEnvComponent.java +++ b/designer-realize/src/main/java/com/fanruan/boot/env/DesignEnvComponent.java @@ -26,6 +26,7 @@ import com.fanruan.kv.factory.KVStoreFactory; import com.fanruan.kv.manager.CarinaKVManager; import com.fanruan.kv.store.KVStore; import com.fanruan.kv.store.KVStoreHolder; +import com.fanruan.workplace.http.RepositoryManager; import com.fr.cbb.dialect.security.InsecurityElementFactory; import com.fr.cluster.ClusterBridge; import com.fr.cluster.lock.ClusterLock; @@ -48,11 +49,6 @@ import com.fr.config.holder.ValidateConfigManger; import com.fr.config.impl.ConfConfigProviderImpl; import com.fr.config.impl.ConfigInsecurityElementProviderImpl; import com.fr.decision.service.context.ServiceContext; -import com.fr.decision.webservice.v10.datasource.connection.processor.impl.ConnectionPluginProcessor; -import com.fr.decision.webservice.v10.datasource.connection.processor.impl.ConnectionProcessorFactory; -import com.fr.decision.webservice.v10.datasource.connection.processor.impl.JDBCConnectionProcessor; -import com.fr.decision.webservice.v10.datasource.connection.processor.impl.JDYConnectionProcessor; -import com.fr.decision.webservice.v10.datasource.connection.processor.impl.JNDIConnectionProcessor; import com.fr.design.backup.EnvBackupHelper; import com.fr.env.detect.EnvDetectorCenter; import com.fr.event.EventDispatcher; @@ -79,6 +75,7 @@ import com.fr.scheduler.QuartzContext; import com.fr.scheduler.SchedulerEvent; import com.fr.scheduler.tenant.ScheduleThreadCurrentTenantProvider; import com.fr.security.encryption.EncryptionInitialization; +import com.fr.security.encryption.SystemEncryptionManager; import com.fr.security.encryption.core.EncryptionScaffold; import com.fr.security.encryption.provider.SecuritySeedProvider; import com.fr.security.encryption.storage.keys.LoadSeedSecurityKey; @@ -273,11 +270,11 @@ public class DesignEnvComponent { private void startFileServer() throws Exception { if (WorkContext.getCurrent().isLocal()) { // 设计器远程下不需要文件系统,走PublicRepo的接口,本地下走基础的磁盘读写 - LocalFileRepository localFileRepository = new LocalFileRepository(ProjectConstants.LOCAL_ENV, ServiceContext.getWebInfPath()); + LocalFileRepository.getSingleton().setWorkRoot(ServiceContext.getWebInfPath()); ResourceRepository realRepo = RepositoryFactory.getRepo(); FSProperties fsProperties = Carina.properties(FSProperties.class); FileServer.init( - new ResourceRepositoryWrapper(localFileRepository, StringUtils.EMPTY), + new ResourceRepositoryWrapper(LocalFileRepository.getSingleton(), StringUtils.EMPTY), new ResourceRepositoryWrapper(realRepo, StringUtils.EMPTY), new ResourceRepositoryWrapper(realRepo, StringUtils.EMPTY), new ResourceRepositoryWrapper(realRepo.generateTenantsSharedRepo(fsProperties.getTenantsSharedNamespace()), StringUtils.EMPTY)); @@ -383,6 +380,9 @@ public class DesignEnvComponent { } }); LoadSeedSecurityKey.getInstance().init(); + } else { + // 远程也先写死加解密,放在内存中就好,fbp那边暂时没有提供扩展,两边都是写死的,等他们提供扩展后设计器再适配 + SystemEncryptionManager.getInstance().restore(); } } @@ -403,5 +403,10 @@ public class DesignEnvComponent { private void startEnvPrepare() { EnvDetectorCenter.getInstance().init(); + if (WorkContext.getCurrent().isLocal()) { + // 如果是切回本地,要初始化成本地仓库 + // 如果是切回远程,会在用户创建的时候就同步初始化远程仓库 + RepositoryManager.getInstance().initLocalRepository(); + } } } diff --git a/designer-realize/src/main/java/com/fanruan/boot/env/function/DesignDatasourceComponent.java b/designer-realize/src/main/java/com/fanruan/boot/env/function/DesignDatasourceComponent.java index c6f277535d..a4a84e1063 100644 --- a/designer-realize/src/main/java/com/fanruan/boot/env/function/DesignDatasourceComponent.java +++ b/designer-realize/src/main/java/com/fanruan/boot/env/function/DesignDatasourceComponent.java @@ -15,7 +15,9 @@ import com.fr.decision.webservice.v10.datasource.connection.processor.impl.Conne import com.fr.decision.webservice.v10.datasource.connection.processor.impl.JDBCConnectionProcessor; import com.fr.decision.webservice.v10.datasource.connection.processor.impl.JDYConnectionProcessor; import com.fr.decision.webservice.v10.datasource.connection.processor.impl.JNDIConnectionProcessor; +import com.fr.design.data.datapane.connect.LocalConnectionSource; import com.fr.workspace.server.repository.connection.ConnectionWriterShell; +import com.fr.workspace.server.repository.connection.LocalConnectionShell; /** @@ -40,6 +42,7 @@ public class DesignDatasourceComponent extends DatasourceComponent { ConnectionProcessorFactory.register(JNDIConnectionProcessor.KEY); ConnectionProcessorFactory.register(ConnectionPluginProcessor.KEY); ConnectionProcessorFactory.register(JDYConnectionProcessor.KEY); + Carina.getApplicationContext().singleton(LocalConnectionShell.class).set(new LocalConnectionSource()); } /** From b78b95630d99915f0f7a3162afb367e9afbb4a49 Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Thu, 18 Jul 2024 10:18:20 +0800 Subject: [PATCH 3/8] =?UTF-8?q?REPORT-114391=20=E3=80=90=E5=BE=AE=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E9=80=82=E9=85=8D=E3=80=91=E8=BF=9C=E7=A8=8B&?= =?UTF-8?q?=E6=9C=AC=E5=9C=B0=E8=AE=BE=E8=AE=A1=E5=99=A8=E8=83=BD=E5=A4=9F?= =?UTF-8?q?=E6=AD=A3=E5=B8=B8=E5=90=AF=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 68faad52e5..7898822029 100644 --- a/build.gradle +++ b/build.gradle @@ -79,17 +79,28 @@ allprojects { // 认证前端依赖 implementation 'com.fr.cbb:fine-cbb-common:' + cbbVersion implementation 'com.fr.auth:fine-auth-webui:' + apiVersion + // 门户 + implementation 'com.fr.portal:fine-portal:' + apiVersion implementation 'com.fr.portal:fine-portal-api:' + apiVersion + // cbb implementation 'com.fr.essential:fine-essential:' + cbbVersion implementation 'com.fr.cbb:fine-universal-skeleton:' + cbbVersion + // plugin implementation 'com.fr.plugin:fine-plugin-api:' + apiVersion implementation 'com.fr.plugin:fine-plugin:' + apiVersion + // 远程设计 + implementation 'com.fr.workplace:workplace:' + apiVersion implementation 'com.fr.workplace:workplace-api:' + apiVersion + // 底座 implementation 'com.fr.carina:fine-carina:' + apiVersion + // auth + implementation 'com.fr.auth:fine-auth:' + apiVersion implementation 'com.fr.auth:fine-auth-api:' + apiVersion + // lic implementation 'com.fr.license:fine-license-api:' + apiVersion - implementation 'com.fr.workplace:workplace:' + apiVersion + // cluster implementation 'com.fr.cluster:fine-cluster-api:' + apiVersion + // messenger implementation 'com.fr.messenger:fine-messenger:' + carinaVersion implementation 'com.install4j:install4j-runtime:8.0.4' implementation 'com.fr.third:jxbrowser:6.23' From 06f8fd78a829c7552e6c0713f0429973bd7bf2dc Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Thu, 18 Jul 2024 17:15:22 +0800 Subject: [PATCH 4/8] =?UTF-8?q?REPORT-114391=20=E3=80=90=E5=BE=AE=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E9=80=82=E9=85=8D=E3=80=91=E8=BF=9C=E7=A8=8B&?= =?UTF-8?q?=E6=9C=AC=E5=9C=B0=E8=AE=BE=E8=AE=A1=E5=99=A8=E8=83=BD=E5=A4=9F?= =?UTF-8?q?=E6=AD=A3=E5=B8=B8=E5=90=AF=E5=8A=A8=20=E9=80=82=E9=85=8D?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E8=BF=9E=E6=8E=A5+=E5=9C=B0=E5=9B=BE?= =?UTF-8?q?=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/backup/DesignContext.java | 15 +++++++++++++-- .../java/com/fr/design/utils/DesignUtils.java | 2 +- .../chart/map/server/ChartMapEditorAction.java | 5 ++--- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/backup/DesignContext.java b/designer-base/src/main/java/com/fr/design/backup/DesignContext.java index bdb739b339..e2aebc14db 100644 --- a/designer-base/src/main/java/com/fr/design/backup/DesignContext.java +++ b/designer-base/src/main/java/com/fr/design/backup/DesignContext.java @@ -2,8 +2,8 @@ package com.fr.design.backup; import com.fanruan.carina.context.CarinaApplicationContext; import com.fanruan.carina.standard.PartitionManager; -import com.fanruan.carina.standard.PartitionManagerImpl; -import com.fr.start.server.EmptyServletContext; +import com.fr.log.FineLoggerFactory; +import com.fr.stable.StringUtils; import javax.servlet.ServletContext; @@ -17,7 +17,9 @@ import java.util.Properties; * Created on 2024/5/14 */ public class DesignContext extends CarinaApplicationContext { + public static final String WEB_INF = "\\WEB-INF"; private String designWebInfPath; + private String designDataPath; public DesignContext(ServletContext servletContext, PartitionManager manager, Properties carinaApplicationProperties) { @@ -36,5 +38,14 @@ public class DesignContext extends CarinaApplicationContext { public void setDesignWebInfPath(String designWebInfPath) { this.designWebInfPath = designWebInfPath; + if (StringUtils.isNotEmpty(this.designWebInfPath)) { + this.designDataPath = this.designWebInfPath.replace(WEB_INF, StringUtils.EMPTY); + } + FineLoggerFactory.getLogger().info("[DesignContext] designWebInfPath:{}, designDataPath:{}", this.designWebInfPath, this.designDataPath); + } + + @Override + public String getDataPath() { + return designDataPath; } } diff --git a/designer-base/src/main/java/com/fr/design/utils/DesignUtils.java b/designer-base/src/main/java/com/fr/design/utils/DesignUtils.java index 90702e6af2..03c60ba6ec 100644 --- a/designer-base/src/main/java/com/fr/design/utils/DesignUtils.java +++ b/designer-base/src/main/java/com/fr/design/utils/DesignUtils.java @@ -438,7 +438,7 @@ public class DesignUtils { } private static String getWebBrowserPath() { - String urlPath = WorkContext.getCurrent().getPath() + HttpConstants.FR; + String urlPath = WorkContext.getCurrent().getPath() + HttpConstants.PUBLIC; DesignerEnvProcessor processor = ExtraDesignClassManager.getInstance().getSingle(DesignerEnvProcessor.XML_TAG); if (processor != null) { //cas访问的时候, url要处理下. diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/server/ChartMapEditorAction.java b/designer-chart/src/main/java/com/fr/van/chart/map/server/ChartMapEditorAction.java index bb854f8a81..249c92b397 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/server/ChartMapEditorAction.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/server/ChartMapEditorAction.java @@ -1,10 +1,9 @@ package com.fr.van.chart.map.server; +import com.fanruan.workplace.http.HttpConstants; import com.fr.base.ServerConfig; -import com.fr.base.svg.IconUtils; import com.fr.design.DesignerEnvManager; import com.fr.design.actions.UpdateAction; -import com.fr.general.GeneralContext; import com.fr.start.ServerStarter; import com.fr.start.server.DesignEmbedHelper; @@ -26,7 +25,7 @@ public class ChartMapEditorAction extends UpdateAction { int port = DesignerEnvManager.getEnvManager().getEmbedServerPort(); String web = DesignEmbedHelper.getAppFolderName(); String serverlet = ServerConfig.getInstance().getServletName(); - ServerStarter.browserURLWithLocalEnv(WorkContext.getCurrent().isLocal() ? String.format("http://localhost:%d/%s/%s/map/edit", port, web, serverlet) : WorkContext.getCurrent().getPath() + "/map/edit"); + ServerStarter.browserURLWithLocalEnv(WorkContext.getCurrent().isLocal() ? String.format("http://localhost:%d/%s/%s/map/edit", port, web, serverlet) : WorkContext.getCurrent().getPath() + HttpConstants.PUBLIC + "/map/edit"); } } From e4a1d49870a0577b62b7a5b47b5e88811a9298f4 Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Fri, 19 Jul 2024 11:57:16 +0800 Subject: [PATCH 5/8] =?UTF-8?q?REPORT-114391=20=E3=80=90=E5=BE=AE=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E9=80=82=E9=85=8D=E3=80=91=E8=BF=9C=E7=A8=8B&?= =?UTF-8?q?=E6=9C=AC=E5=9C=B0=E8=AE=BE=E8=AE=A1=E5=99=A8=E8=83=BD=E5=A4=9F?= =?UTF-8?q?=E6=AD=A3=E5=B8=B8=E5=90=AF=E5=8A=A8=20=E5=AE=8C=E5=96=84?= =?UTF-8?q?=E9=83=A8=E5=88=86=E4=BB=A3=E7=A0=81+=E5=B1=8F=E8=94=BDfrm?= =?UTF-8?q?=E5=85=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/actions/file/WebPreviewUtils.java | 4 ++- .../java/com/fr/design/utils/DesignUtils.java | 17 ++++++--- .../versioncheck/VersionCheckUtils.java | 35 ++++++++++--------- .../com/fr/start/server/FineEmbedServer.java | 3 +- .../boot/env/function/DesignComponent.java | 4 +-- 5 files changed, 38 insertions(+), 25 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/actions/file/WebPreviewUtils.java b/designer-base/src/main/java/com/fr/design/actions/file/WebPreviewUtils.java index 2503db1de2..3d98fe18dc 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/WebPreviewUtils.java +++ b/designer-base/src/main/java/com/fr/design/actions/file/WebPreviewUtils.java @@ -1,5 +1,6 @@ package com.fr.design.actions.file; +import com.fanruan.workplace.http.HttpConstants; import com.fr.design.base.mode.DesignModeContext; import com.fr.design.fun.PreviewProvider; import com.fr.design.i18n.Toolkit; @@ -158,7 +159,8 @@ public final class WebPreviewUtils { DesignUtils.visitEnvServerByParameters( baseRoute, parameterNameList.toArray(new String[0]), - parameterValueList.toArray(new String[0]) + parameterValueList.toArray(new String[0]), + HttpConstants.FR ); } else { int selVal = showConfirmDialog( diff --git a/designer-base/src/main/java/com/fr/design/utils/DesignUtils.java b/designer-base/src/main/java/com/fr/design/utils/DesignUtils.java index 03c60ba6ec..afe21e2ccb 100644 --- a/designer-base/src/main/java/com/fr/design/utils/DesignUtils.java +++ b/designer-base/src/main/java/com/fr/design/utils/DesignUtils.java @@ -405,6 +405,16 @@ public class DesignUtils { * @param values 参数值 */ public static void visitEnvServerByParameters(String baseRoute, String[] names, String[] values) { + visitEnvServerByParameters(baseRoute, names, values, HttpConstants.PUBLIC); + } + + /** + * 访问服务器环境 + * + * @param names 参数名字 + * @param values 参数值 + */ + public static void visitEnvServerByParameters(String baseRoute, String[] names, String[] values, String serverType) { int len = Math.min(ArrayUtils.getLength(names), ArrayUtils.getLength(values)); String[] nameValuePairs = new String[len]; for (int i = 0; i < len; i++) { @@ -417,10 +427,9 @@ public class DesignUtils { "=" + CommonCodeUtils.encodeURIComponent(CommonCodeUtils.encodeURIComponent(value)); } String postfixOfUri = (nameValuePairs.length > 0 ? "?" + StableUtils.join(nameValuePairs, "&") : StringUtils.EMPTY); - if (!WorkContext.getCurrent().isLocal()) { try { - String urlPath = getWebBrowserPath(); + String urlPath = getWebBrowserPath(serverType); Desktop.getDesktop().browse(new URI(urlPath + baseRoute + postfixOfUri)); } catch (Exception e) { FineLoggerFactory.getLogger().error("cannot open the url Successful", e); @@ -437,8 +446,8 @@ public class DesignUtils { } } - private static String getWebBrowserPath() { - String urlPath = WorkContext.getCurrent().getPath() + HttpConstants.PUBLIC; + private static String getWebBrowserPath(String serverPath) { + String urlPath = WorkContext.getCurrent().getPath() + serverPath; DesignerEnvProcessor processor = ExtraDesignClassManager.getInstance().getSingle(DesignerEnvProcessor.XML_TAG); if (processor != null) { //cas访问的时候, url要处理下. diff --git a/designer-base/src/main/java/com/fr/design/versioncheck/VersionCheckUtils.java b/designer-base/src/main/java/com/fr/design/versioncheck/VersionCheckUtils.java index e66d5923f8..0d10600b64 100644 --- a/designer-base/src/main/java/com/fr/design/versioncheck/VersionCheckUtils.java +++ b/designer-base/src/main/java/com/fr/design/versioncheck/VersionCheckUtils.java @@ -113,23 +113,24 @@ public class VersionCheckUtils { } public static void showVersionCheckDialog(String envName) { - new SwingWorker() { - @Override - protected Boolean doInBackground() { - return !VersionCheckUtils.versionCheck(envName); - } - - @Override - protected void done() { - try { - if (get()) { - showNotificationDialog(envName); - } - } catch (Exception e) { - FineLoggerFactory.getLogger().warn(e.getMessage(), e); - } - } - }.execute(); + /// 环境检测类都先屏蔽 +// new SwingWorker() { +// @Override +// protected Boolean doInBackground() { +// return !VersionCheckUtils.versionCheck(envName); +// } +// +// @Override +// protected void done() { +// try { +// if (get()) { +// showNotificationDialog(envName); +// } +// } catch (Exception e) { +// FineLoggerFactory.getLogger().warn(e.getMessage(), e); +// } +// } +// }.execute(); } private static void showNotificationDialog(String envName) { diff --git a/designer-base/src/main/java/com/fr/start/server/FineEmbedServer.java b/designer-base/src/main/java/com/fr/start/server/FineEmbedServer.java index 40a95758b5..fc3d2a4e46 100644 --- a/designer-base/src/main/java/com/fr/start/server/FineEmbedServer.java +++ b/designer-base/src/main/java/com/fr/start/server/FineEmbedServer.java @@ -2,6 +2,7 @@ package com.fr.start.server; import com.fanruan.carina.Carina; import com.fr.event.EventDispatcher; +import com.fr.workspace.WorkContext; /** * Created by juhaoyu on 2018/6/6. @@ -38,7 +39,7 @@ public abstract class FineEmbedServer { public static boolean isRunning() { - return Carina.partition("fine_report") != null && Carina.partition("fine_report").getReady(); + return (Carina.partition("fine_report") != null && Carina.partition("fine_report").getReady()) || !WorkContext.getCurrent().isLocal(); } public static boolean isOnStarting() { diff --git a/designer-realize/src/main/java/com/fanruan/boot/env/function/DesignComponent.java b/designer-realize/src/main/java/com/fanruan/boot/env/function/DesignComponent.java index 0afc229a09..d55b4a4fbd 100644 --- a/designer-realize/src/main/java/com/fanruan/boot/env/function/DesignComponent.java +++ b/designer-realize/src/main/java/com/fanruan/boot/env/function/DesignComponent.java @@ -455,8 +455,8 @@ public class DesignComponent { private static void formDesignerRegister() { StableFactory.registerMarkedObject(DesignToolbarProvider.STRING_MARKED, WidgetToolBarPane.getInstance()); - - DesignModuleFactory.registerNewFormActionClass(NewFormAction.class); + /// REPORT-127453 屏蔽frm入口 + // DesignModuleFactory.registerNewFormActionClass(NewFormAction.class); DesignModuleFactory.registerReplaceActionClass(ITReplaceAction.class); DesignModuleFactory.registerFormParaDesignerClass(FormParaDesigner.class); DesignModuleFactory.registerParaPropertyPaneClass(ParameterPropertyPane.class); From 47f2e189eea2eeb67e6804b855770013637d1864 Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Fri, 19 Jul 2024 15:52:55 +0800 Subject: [PATCH 6/8] =?UTF-8?q?REPORT-114391=20=E3=80=90=E5=BE=AE=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E9=80=82=E9=85=8D=E3=80=91=E8=BF=9C=E7=A8=8B&?= =?UTF-8?q?=E6=9C=AC=E5=9C=B0=E8=AE=BE=E8=AE=A1=E5=99=A8=E8=83=BD=E5=A4=9F?= =?UTF-8?q?=E6=AD=A3=E5=B8=B8=E5=90=AF=E5=8A=A8=20=E9=A2=84=E7=95=99token?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3+=E5=AE=8C=E5=96=84=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/env/HttpWorkspaceConnector.java | 1 + 1 file changed, 1 insertion(+) diff --git a/designer-base/src/main/java/com/fr/design/env/HttpWorkspaceConnector.java b/designer-base/src/main/java/com/fr/design/env/HttpWorkspaceConnector.java index f45964508c..4c4d7c9429 100644 --- a/designer-base/src/main/java/com/fr/design/env/HttpWorkspaceConnector.java +++ b/designer-base/src/main/java/com/fr/design/env/HttpWorkspaceConnector.java @@ -74,6 +74,7 @@ public class HttpWorkspaceConnector implements WorkspaceConnector { bean.setUsername(connectionInfo.getUserName()); bean.setPassword(connectionInfo.getPassword()); bean.setEncrypted(false); + bean.setValidity(-2); return bean; } } \ No newline at end of file From d078e947dddc70ecd43f1dabb7aeb6ba973ac82d Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Sun, 21 Jul 2024 17:26:26 +0800 Subject: [PATCH 7/8] =?UTF-8?q?REPORT-114391=20=E3=80=90=E5=BE=AE=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E9=80=82=E9=85=8D=E3=80=91=E8=BF=9C=E7=A8=8B&?= =?UTF-8?q?=E6=9C=AC=E5=9C=B0=E8=AE=BE=E8=AE=A1=E5=99=A8=E8=83=BD=E5=A4=9F?= =?UTF-8?q?=E6=AD=A3=E5=B8=B8=E5=90=AF=E5=8A=A8=20=E5=AE=8C=E5=96=84?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E9=9B=86=E4=B8=8E=E6=95=B0=E6=8D=AE=E8=BF=9E?= =?UTF-8?q?=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/actions/server/GlobalTableDataAction.java | 8 +++++++- .../data/tabledata/tabledatapane/DBTableDataPane.java | 4 ++-- .../main/java/com/fr/design/gui/ilist/TableViewList.java | 2 +- 3 files changed, 10 insertions(+), 4 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 11d30f6dba..82a1fdd252 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 @@ -22,6 +22,8 @@ import com.fr.esd.event.DsNameTarget; import com.fr.esd.event.StrategyEventsNotifier; import com.fr.report.LockItem; +import com.fr.workspace.server.entity.tabledata.TableDataBean; +import com.fr.workspace.server.repository.tabledata.TableDataRepository; import javax.swing.KeyStroke; import java.awt.Dimension; @@ -75,7 +77,11 @@ public class GlobalTableDataAction extends UpdateAction implements ResponseDataS } // 锁定成功,执行后续操作 final DesignerFrame designerFrame = DesignerContext.getDesignerFrame(); - final Map tableDataMap = TableDataConfigProviderFactory.getInstance().getTableDatas(); + final TableDataBean[] beans = TableDataRepository.getInstance().getAllTableData(); + final Map tableDataMap = new HashMap<>(); + for (TableDataBean bean : beans) { + tableDataMap.put(bean.getTableData().getName() , bean.getTableData()); + } final TableDataManagerPane globalTableDataPane = new TableDataManagerPane() { public void complete() { populate(tableDataMap); diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java index d0ffd7f22c..37d0532a6c 100644 --- a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java +++ b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java @@ -295,8 +295,8 @@ public class DBTableDataPane extends AbstractTableDataPane implemen private void refreshParameters() { String[] paramTexts = new String[2]; - paramTexts[0] = SqlUtils.tryPureSqlText(this.sqlTextPane.getText()); - paramTexts[1] = SqlUtils.tryPureSqlText(this.pageQuery); + paramTexts[0] = SqlUtils.clearSqlComments(this.sqlTextPane.getText()); + paramTexts[1] = SqlUtils.clearSqlComments(this.pageQuery); List existParameterList = this.editorPane.update(); Parameter[] ps = (existParameterList == null) ? new Parameter[0] : existParameterList.toArray(new Parameter[0]); diff --git a/designer-base/src/main/java/com/fr/design/gui/ilist/TableViewList.java b/designer-base/src/main/java/com/fr/design/gui/ilist/TableViewList.java index 83b7008a7e..b87af71fab 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ilist/TableViewList.java +++ b/designer-base/src/main/java/com/fr/design/gui/ilist/TableViewList.java @@ -161,7 +161,7 @@ public class TableViewList extends UIList { */ private DefaultListModel processDataInAnotherThread(String databaseName, String searchFilter, String... typesFilter) throws Exception { DefaultListModel defaultListModel = new DefaultListModel(); - Connection datasource = ConnectionConfigProviderFactory.getConfigProvider().getConnection(databaseName); + Connection datasource = ConnectionRepository.getInstance().getByName(databaseName).getConnection(); if (datasource == null) { return defaultListModel; } From 879caddc57fa2ce95881f7dab388a9422e06be82 Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Mon, 22 Jul 2024 09:35:52 +0800 Subject: [PATCH 8/8] =?UTF-8?q?REPORT-114391=20=E3=80=90=E5=BE=AE=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E9=80=82=E9=85=8D=E3=80=91=E8=BF=9C=E7=A8=8B&?= =?UTF-8?q?=E6=9C=AC=E5=9C=B0=E8=AE=BE=E8=AE=A1=E5=99=A8=E8=83=BD=E5=A4=9F?= =?UTF-8?q?=E6=AD=A3=E5=B8=B8=E5=90=AF=E5=8A=A8=20=E8=A1=A5=E5=85=85?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E9=9B=86=E7=9A=84bean=E7=9A=84=E5=B1=9E?= =?UTF-8?q?=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/actions/server/GlobalTableDataAction.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 82a1fdd252..c4606b2645 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 @@ -80,7 +80,7 @@ public class GlobalTableDataAction extends UpdateAction implements ResponseDataS final TableDataBean[] beans = TableDataRepository.getInstance().getAllTableData(); final Map tableDataMap = new HashMap<>(); for (TableDataBean bean : beans) { - tableDataMap.put(bean.getTableData().getName() , bean.getTableData()); + tableDataMap.put(bean.getName() , bean.getTableData()); } final TableDataManagerPane globalTableDataPane = new TableDataManagerPane() { public void complete() {