From bfdd0b52bdf76c13fcf801c061c2d5d244c26050 Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Mon, 7 Oct 2024 16:28:42 +0800 Subject: [PATCH 01/14] =?UTF-8?q?REPORT-135233=20=E8=B0=83=E6=95=B4FileNod?= =?UTF-8?q?es?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/actions/file/LocalePane.java | 7 +++--- .../fr/design/file/TemplateDirTreePane.java | 4 ++-- .../com/fr/design/file/TemplateTreePane.java | 2 +- .../file/impl/DefaultTemplateResource.java | 3 +-- .../gui/itree/filetree/EnvFileTree.java | 10 ++++---- .../itree/filetree/FileNodeComparator.java | 3 +-- .../gui/itree/filetree/FileNodeConstants.java | 3 +-- .../gui/itree/filetree/TemplateDirTree.java | 5 ++-- .../gui/itree/filetree/TemplateFileTree.java | 5 ++-- .../DesignerFrameFileDealerPane.java | 4 +--- .../com/fr/design/mainframe/JTemplate.java | 3 +-- .../java/com/fr/file/FILEChooserPane.java | 3 +-- .../main/java/com/fr/file/FileNodeFILE.java | 4 ++-- .../transform/ui/TransformFileTree.java | 14 +++++------ .../boot/init/DesignWorkContextComponent.java | 18 ++++++++------- .../manager/impl/FileSearchManager.java | 23 +++++-------------- 16 files changed, 45 insertions(+), 66 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/actions/file/LocalePane.java b/designer-base/src/main/java/com/fr/design/actions/file/LocalePane.java index 634af28b9e..c97bd629d5 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/LocalePane.java +++ b/designer-base/src/main/java/com/fr/design/actions/file/LocalePane.java @@ -4,14 +4,14 @@ package com.fr.design.actions.file; -import com.fr.base.FRContext; +import com.fanruan.entity.template.TemplateListBean; +import com.fanruan.repository.TemplateRepository; import com.fr.design.dialog.BasicPane; import com.fr.design.gui.frpane.UITabbedPane; import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.itextfield.UITextField; import com.fr.file.filetree.FileNode; import com.fr.general.GeneralUtils; - import com.fr.locale.InterProviderFactory; import com.fr.log.FineLoggerFactory; import com.fr.stable.ArrayUtils; @@ -153,8 +153,7 @@ public class LocalePane extends BasicPane { } private void initCustomProperties() throws Exception { - - FileNode[] fileNodes = FRContext.getFileNodes().list(ProjectConstants.LOCALE_NAME); + FileNode[] fileNodes = TemplateRepository.getInstance().list(new TemplateListBean(ProjectConstants.LOCALE_NAME)); if (ArrayUtils.getLength(fileNodes) == 0) { return; } diff --git a/designer-base/src/main/java/com/fr/design/file/TemplateDirTreePane.java b/designer-base/src/main/java/com/fr/design/file/TemplateDirTreePane.java index 1a9fec015c..1145616e9f 100644 --- a/designer-base/src/main/java/com/fr/design/file/TemplateDirTreePane.java +++ b/designer-base/src/main/java/com/fr/design/file/TemplateDirTreePane.java @@ -1,6 +1,6 @@ package com.fr.design.file; -import com.fr.base.FRContext; +import com.fanruan.repository.TemplateRepository; import com.fr.design.border.FineBorderFactory; import com.fr.design.gui.itree.filetree.TemplateDirTree; import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; @@ -74,7 +74,7 @@ public class TemplateDirTreePane extends JPanel { * 刷新 */ public void refreshDockingView() { - templateDirTree.setFileNodeFilter(new IOFileNodeFilter(FRContext.getFileNodes().getSupportedTypes())); + templateDirTree.setFileNodeFilter(new IOFileNodeFilter(TemplateRepository.getInstance().getSupportedTypes())); templateDirTree.refreshEnv(); } diff --git a/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java b/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java index d15c65f241..4eb45fface 100644 --- a/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java +++ b/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java @@ -63,7 +63,7 @@ import java.util.Set; import java.util.concurrent.ExecutionException; import java.util.stream.Collectors; -import com.fr.workspace.server.repository.template.TemplateRepository; +import com.fanruan.repository.TemplateRepository; import com.fr.workspace.server.vcs.VcsOperator; import org.jetbrains.annotations.Nullable; diff --git a/designer-base/src/main/java/com/fr/design/file/impl/DefaultTemplateResource.java b/designer-base/src/main/java/com/fr/design/file/impl/DefaultTemplateResource.java index 96f01f231f..5c4766adc5 100644 --- a/designer-base/src/main/java/com/fr/design/file/impl/DefaultTemplateResource.java +++ b/designer-base/src/main/java/com/fr/design/file/impl/DefaultTemplateResource.java @@ -2,8 +2,7 @@ package com.fr.design.file.impl; import com.fr.file.FILE; import com.fr.workspace.WorkContext; -import com.fr.workspace.server.lock.TplOperator; -import com.fr.workspace.server.repository.template.TemplateRepository; +import com.fanruan.repository.TemplateRepository; import java.io.ByteArrayInputStream; import java.io.InputStream; diff --git a/designer-base/src/main/java/com/fr/design/gui/itree/filetree/EnvFileTree.java b/designer-base/src/main/java/com/fr/design/gui/itree/filetree/EnvFileTree.java index 1a14821d00..1d5405bd89 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itree/filetree/EnvFileTree.java +++ b/designer-base/src/main/java/com/fr/design/gui/itree/filetree/EnvFileTree.java @@ -1,6 +1,7 @@ package com.fr.design.gui.itree.filetree; -import com.fr.base.FRContext; +import com.fanruan.entity.template.TemplateListBean; +import com.fanruan.repository.TemplateRepository; import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; import com.fr.design.gui.itree.refreshabletree.RefreshableJTree; import com.fr.design.i18n.Toolkit; @@ -11,13 +12,12 @@ import com.fr.log.FineLoggerFactory; import com.fr.stable.CoreConstants; import com.fr.stable.StableUtils; import com.fr.workspace.WorkContext; -import com.fr.workspace.server.repository.template.TemplateRepository; -import javax.swing.JTree; +import javax.swing.*; import javax.swing.tree.DefaultTreeCellRenderer; import javax.swing.tree.DefaultTreeModel; import javax.swing.tree.TreePath; -import java.awt.Component; +import java.awt.*; import java.io.File; import java.util.Arrays; import java.util.HashMap; @@ -188,7 +188,7 @@ public class EnvFileTree extends RefreshableJTree { FileNode[] resFns = null; try { - resFns = WorkContext.getCurrent() == null ? new FileNode[0] : FRContext.getFileNodes().list(filePath); + resFns = WorkContext.getCurrent() == null ? new FileNode[0] : TemplateRepository.getInstance().list(new TemplateListBean(filePath)); } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } diff --git a/designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileNodeComparator.java b/designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileNodeComparator.java index 1429aac3e0..32cad14b5e 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileNodeComparator.java +++ b/designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileNodeComparator.java @@ -1,8 +1,7 @@ package com.fr.design.gui.itree.filetree; -import com.fr.base.FRContext; import com.fr.file.filetree.FileNode; -import com.fr.workspace.server.repository.template.TemplateRepository; +import com.fanruan.repository.TemplateRepository; import java.io.Serializable; import java.util.Arrays; diff --git a/designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileNodeConstants.java b/designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileNodeConstants.java index 242865aeca..13d1d2490f 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileNodeConstants.java +++ b/designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileNodeConstants.java @@ -1,6 +1,5 @@ package com.fr.design.gui.itree.filetree; -import com.fr.base.FRContext; import com.fr.base.extension.FileExtension; import com.fr.general.GeneralContext; import com.fr.plugin.context.PluginContext; @@ -10,7 +9,7 @@ import com.fr.plugin.observer.PluginEvent; import com.fr.plugin.observer.PluginEventListener; import com.fr.report.ExtraReportClassManager; import com.fr.report.fun.ReportSupportedFileProvider; -import com.fr.workspace.server.repository.template.TemplateRepository; +import com.fanruan.repository.TemplateRepository; import java.util.Arrays; import java.util.LinkedHashSet; diff --git a/designer-base/src/main/java/com/fr/design/gui/itree/filetree/TemplateDirTree.java b/designer-base/src/main/java/com/fr/design/gui/itree/filetree/TemplateDirTree.java index 82f7bc3269..57bd2170af 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itree/filetree/TemplateDirTree.java +++ b/designer-base/src/main/java/com/fr/design/gui/itree/filetree/TemplateDirTree.java @@ -1,11 +1,10 @@ package com.fr.design.gui.itree.filetree; -import com.fr.base.FRContext; import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; import com.fr.design.mainframe.manager.search.TemplateDirTreeSearchManager; import com.fr.file.filetree.FileNode; -import com.fr.workspace.server.entity.template.TemplateListBean; -import com.fr.workspace.server.repository.template.TemplateRepository; +import com.fanruan.entity.template.TemplateListBean; +import com.fanruan.repository.TemplateRepository; import java.util.Arrays; import java.util.Map; diff --git a/designer-base/src/main/java/com/fr/design/gui/itree/filetree/TemplateFileTree.java b/designer-base/src/main/java/com/fr/design/gui/itree/filetree/TemplateFileTree.java index ad36be8cd4..b939e3d9d9 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itree/filetree/TemplateFileTree.java +++ b/designer-base/src/main/java/com/fr/design/gui/itree/filetree/TemplateFileTree.java @@ -1,6 +1,5 @@ package com.fr.design.gui.itree.filetree; -import com.fr.base.FRContext; import com.fr.base.extension.FileExtension; import com.fr.design.ExtraDesignClassManager; import com.fr.design.file.NodeAuthProcessor; @@ -13,8 +12,8 @@ import com.fr.stable.ArrayUtils; import com.fr.stable.StableUtils; import com.fr.stable.collections.CollectionUtils; import com.fr.stable.project.ProjectConstants; -import com.fr.workspace.server.entity.template.TemplateListBean; -import com.fr.workspace.server.repository.template.TemplateRepository; +import com.fanruan.entity.template.TemplateListBean; +import com.fanruan.repository.TemplateRepository; import javax.swing.text.Position; import javax.swing.tree.DefaultTreeModel; diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java index 264cfc0016..c996e12622 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java @@ -52,7 +52,6 @@ import com.fr.event.Event; import com.fr.file.filetree.FileNode; import com.fr.general.ComparatorUtils; import com.fr.general.GeneralContext; -import com.fr.general.IOUtils; import com.fr.log.FineLoggerFactory; import com.fr.plugin.context.PluginContext; import com.fr.plugin.injectable.PluginModule; @@ -67,8 +66,7 @@ import com.fr.stable.project.ProjectConstants; import com.fr.third.org.apache.commons.io.FilenameUtils; import com.fr.workspace.WorkContext; -import com.fr.report.lock.LockInfoOperator; -import com.fr.workspace.server.repository.template.TemplateRepository; +import com.fanruan.repository.TemplateRepository; import javax.swing.BorderFactory; import javax.swing.JDialog; diff --git a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java index e280028646..4fba7b581d 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java @@ -101,9 +101,8 @@ import com.fr.stable.core.UUID; import com.fr.widgettheme.designer.WidgetThemeDisplayAction; import com.fr.workspace.WorkContext; import com.fr.workspace.server.lock.TplOperator; -import com.fr.workspace.server.repository.WorkplaceConstants; import com.fr.workspace.server.repository.connection.ConnectionRepository; -import com.fr.workspace.server.repository.template.TemplateRepository; +import com.fanruan.repository.TemplateRepository; import javax.swing.BorderFactory; import javax.swing.Icon; diff --git a/designer-base/src/main/java/com/fr/file/FILEChooserPane.java b/designer-base/src/main/java/com/fr/file/FILEChooserPane.java index 8ca9918274..06620ba719 100644 --- a/designer-base/src/main/java/com/fr/file/FILEChooserPane.java +++ b/designer-base/src/main/java/com/fr/file/FILEChooserPane.java @@ -22,7 +22,6 @@ import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.NodeAuthProcessor; import com.fr.design.fun.ReportSupportedFileUIProvider; import com.fr.design.gui.ibutton.UIButton; -import com.fr.design.gui.ibutton.UIButtonUI; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextfield.DefaultCompletionFilter; @@ -55,7 +54,7 @@ import com.fr.stable.project.ProjectConstants; import com.fr.workspace.WorkContext; import com.fr.workspace.Workspace; import com.fr.workspace.WorkspaceEvent; -import com.fr.workspace.server.repository.template.TemplateRepository; +import com.fanruan.repository.TemplateRepository; import javax.swing.AbstractAction; import javax.swing.AbstractListModel; diff --git a/designer-base/src/main/java/com/fr/file/FileNodeFILE.java b/designer-base/src/main/java/com/fr/file/FileNodeFILE.java index 72570935a9..168a3c315a 100644 --- a/designer-base/src/main/java/com/fr/file/FileNodeFILE.java +++ b/designer-base/src/main/java/com/fr/file/FileNodeFILE.java @@ -23,9 +23,9 @@ import com.fr.workspace.WorkContext; import com.fr.workspace.Workspace; import com.fr.workspace.WorkspaceEvent; import com.fr.workspace.server.entity.WorkResourceTempRenameStream; -import com.fr.workspace.server.entity.template.TemplateListBean; +import com.fanruan.entity.template.TemplateListBean; import com.fr.workspace.server.repository.system.WorkspaceSystemInfo; -import com.fr.workspace.server.repository.template.TemplateRepository; +import com.fanruan.repository.TemplateRepository; import javax.swing.*; import java.io.InputStream; diff --git a/designer-base/src/main/java/com/fr/nx/app/designer/transform/ui/TransformFileTree.java b/designer-base/src/main/java/com/fr/nx/app/designer/transform/ui/TransformFileTree.java index cbfcd253fc..f73a6d4870 100644 --- a/designer-base/src/main/java/com/fr/nx/app/designer/transform/ui/TransformFileTree.java +++ b/designer-base/src/main/java/com/fr/nx/app/designer/transform/ui/TransformFileTree.java @@ -1,6 +1,7 @@ package com.fr.nx.app.designer.transform.ui; -import com.fr.base.FRContext; +import com.fanruan.entity.template.TemplateListBean; +import com.fanruan.repository.TemplateRepository; import com.fr.base.extension.FileExtension; import com.fr.design.gui.itree.checkboxtree.CheckBoxTree; import com.fr.design.gui.itree.checkboxtree.CheckBoxTreeCellRenderer; @@ -10,13 +11,12 @@ import com.fr.design.remote.ui.tree.FileAuthorityTree; import com.fr.file.filetree.FileNode; import com.fr.general.ComparatorUtils; import com.fr.nx.app.designer.transform.BatchTransformUtil; +import com.fr.stable.StringUtils; import javax.swing.tree.DefaultTreeModel; import javax.swing.tree.TreeCellRenderer; import javax.swing.tree.TreePath; -import java.awt.AlphaComposite; -import java.awt.Graphics; -import java.awt.Graphics2D; +import java.awt.*; import java.awt.event.MouseEvent; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; @@ -166,10 +166,8 @@ public class TransformFileTree extends FileAuthorityTree { for (String temp : this.filter.getSupportedTypes()) { supportTypes.add(FileExtension.parse(temp)); } - FileNode[] fileNodes = FRContext.getFileNodes().list( - path, - supportTypes.toArray(new FileExtension[supportTypes.size()]) - ); + TemplateListBean bean = new TemplateListBean(path, StringUtils.EMPTY, supportTypes.toArray(new FileExtension[supportTypes.size()]), false, true, false); + FileNode[] fileNodes = TemplateRepository.getInstance().list(bean); return BatchTransformUtil.filterTransformedFile(fileNodes, transformedList); } diff --git a/designer-realize/src/main/java/com/fanruan/boot/init/DesignWorkContextComponent.java b/designer-realize/src/main/java/com/fanruan/boot/init/DesignWorkContextComponent.java index 1756a1952c..7f4f976ce8 100644 --- a/designer-realize/src/main/java/com/fanruan/boot/init/DesignWorkContextComponent.java +++ b/designer-realize/src/main/java/com/fanruan/boot/init/DesignWorkContextComponent.java @@ -1,5 +1,6 @@ package com.fanruan.boot.init; +import com.fanruan.boot.RepositorySourceRegister; import com.fanruan.carina.Carina; import com.fanruan.carina.annotions.DependsOn; import com.fanruan.carina.annotions.FineComponent; @@ -7,18 +8,14 @@ import com.fanruan.carina.annotions.Start; import com.fanruan.carina.annotions.Stop; import com.fanruan.carina.annotions.Supplemental; import com.fanruan.plugin.autonomy.AutonomyClassManagerGroup; +import com.fanruan.repository.TemplateRepository; import com.fanruan.workplace.conetxt.CompatiblePool; import com.fanruan.workplace.http.HttpConstants; import com.fanruan.workplace.http.RepositoryManager; import com.fanruan.workplace.http.WorkspaceHeartBeatShell; import com.fanruan.workplace.http.exception.DefaultRemoteExceptionHandler; -import com.fr.report.UnLockedHandler; -import com.fr.workspace.engine.exception.RemoteDesignLoginLockHandler; -import com.fr.workspace.engine.exception.RemoteDesignNoAuthHandler; -import com.fr.workspace.engine.exception.RemoteDesignPasswordNeedUpdateHandler; -import com.fr.workspace.engine.exception.RemoteDesignPasswordStrengthHandler; -import com.fr.workspace.engine.exception.RemoteDesignUserPwdErrorHandler; import com.fanruan.workplace.http.exception.RemoteExceptionConvert; +import com.fanruan.workplace.network.RemoteNetworkRepository; import com.fanruan.workplace.standard.ServerInfo; import com.fanruan.workplace.standard.ServerInfoOperator; import com.fr.base.io.FileAssistUtils; @@ -38,6 +35,7 @@ import com.fr.file.filetree.FileNodes; import com.fr.file.filetree.LocalFileNodes; import com.fr.general.build.BuildInfoOperator; import com.fr.general.build.impl.BuildInfoOperatorImpl; +import com.fr.report.UnLockedHandler; import com.fr.security.encryption.storage.StorageEncryptors; import com.fr.security.encryption.storage.StorageTransfer; import com.fr.stable.StringUtils; @@ -50,6 +48,11 @@ import com.fr.workspace.engine.FineWorkspaceFactory; import com.fr.workspace.engine.base.FineObjectPool; import com.fr.workspace.engine.client.heartbeart.FineWorkspaceHeartbeat; import com.fr.workspace.engine.client.heartbeart.WorkspaceHeartbeat; +import com.fr.workspace.engine.exception.RemoteDesignLoginLockHandler; +import com.fr.workspace.engine.exception.RemoteDesignNoAuthHandler; +import com.fr.workspace.engine.exception.RemoteDesignPasswordNeedUpdateHandler; +import com.fr.workspace.engine.exception.RemoteDesignPasswordStrengthHandler; +import com.fr.workspace.engine.exception.RemoteDesignUserPwdErrorHandler; import com.fr.workspace.engine.exception.RemoteDriverUnExistHandler; import com.fr.workspace.engine.exception.RemoteProcedureErrorHandler; import com.fr.workspace.engine.resource.FineWorkResource; @@ -60,7 +63,6 @@ import com.fr.workspace.resource.WorkResource; import com.fr.workspace.server.repository.authority.RemoteAuthorityRepository; import com.fr.workspace.server.repository.compatible.CompatibleConnectionOperator; import com.fr.workspace.server.repository.compatible.register.CompatibleRegister; -import com.fanruan.workplace.network.RemoteNetworkRepository; import com.fr.workspace.server.repository.config.ConfigRepository; import com.fr.workspace.server.repository.connection.ConnectionRepository; import com.fr.workspace.server.repository.plugin.PluginRepository; @@ -68,7 +70,6 @@ import com.fr.workspace.server.repository.resource.PublicResourceRepository; import com.fr.workspace.server.repository.resource.WorkResourceRepository; import com.fr.workspace.server.repository.system.SystemInfoRepository; import com.fr.workspace.server.repository.tabledata.TableDataRepository; -import com.fr.workspace.server.repository.template.TemplateRepository; import com.fr.workspace.server.repository.vcs.VcsRepository; import com.fr.workspace.server.repository.widget.ShareRepository; @@ -94,6 +95,7 @@ public class DesignWorkContextComponent { public void prepare() { supplementalExtra(); supplementalCommon(); + RepositorySourceRegister.registerRepositorySource(); } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/FileSearchManager.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/FileSearchManager.java index 5f358bbb5e..a5ed74e5fc 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/FileSearchManager.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/FileSearchManager.java @@ -1,6 +1,5 @@ package com.fr.design.mainframe.alphafine.search.manager.impl; -import com.fr.base.FRContext; import com.fr.base.extension.FileExtension; import com.fr.design.DesignerEnvManager; import com.fr.design.actions.help.alphafine.AlphaFineConstants; @@ -12,14 +11,12 @@ import com.fr.design.mainframe.alphafine.model.SearchResult; import com.fr.design.mainframe.alphafine.search.SearchTextBean; import com.fr.design.mainframe.alphafine.search.manager.fun.AlphaFineSearchProvider; import com.fr.file.filetree.FileNode; -import com.fr.file.filetree.FileNodes; import com.fr.general.ComparatorUtils; import com.fr.json.JSONObject; -import com.fr.rpc.ExceptionHandler; -import com.fr.rpc.RPCInvokerExceptionInfo; import com.fr.stable.StringUtils; import com.fr.stable.project.ProjectConstants; -import com.fr.workspace.WorkContext; +import com.fanruan.entity.template.TemplateListBean; +import com.fanruan.repository.TemplateRepository; import java.util.List; @@ -83,12 +80,8 @@ public class FileSearchManager implements AlphaFineSearchProvider { return lessModelList; } AlphaFineHelper.checkCancel(); - fileNodes = WorkContext.getCurrent().get(FileNodes.class, new ExceptionHandler() { - @Override - public Object callHandler(RPCInvokerExceptionInfo exceptionInfo) { - return FRContext.getFileNodes().list(ProjectConstants.REPORTLETS_NAME, AlphaFineConstants.FILE_EXTENSIONS, true); - } - }).list(ProjectConstants.REPORTLETS_NAME, AlphaFineConstants.FILE_EXTENSIONS, true, false); + TemplateListBean bean = new TemplateListBean(ProjectConstants.REPORTLETS_NAME, StringUtils.EMPTY, AlphaFineConstants.FILE_EXTENSIONS, true, false, false); + fileNodes = TemplateRepository.getInstance().list(bean); isContainCpt = true; isContainFrm = true; doSearch(this.searchText); @@ -161,12 +154,8 @@ public class FileSearchManager implements AlphaFineSearchProvider { */ private void doFileContentSearch(String searchText) { if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isContainFileContent()) { - FileNode[] fileNodes = WorkContext.getCurrent().get(FileNodes.class, new ExceptionHandler() { - @Override - public Object callHandler(RPCInvokerExceptionInfo exceptionInfo) { - return FRContext.getFileNodes().filterFiles(searchText, ProjectConstants.REPORTLETS_NAME, new FileExtension[]{FileExtension.CPT, FileExtension.FRM}, true); - } - }).filterFiles(searchText, ProjectConstants.REPORTLETS_NAME, new FileExtension[]{FileExtension.CPT, FileExtension.FRM}, true, false); + TemplateListBean bean = new TemplateListBean(ProjectConstants.REPORTLETS_NAME, searchText, new FileExtension[]{FileExtension.CPT, FileExtension.FRM}, true, false, false); + FileNode[] fileNodes = TemplateRepository.getInstance().filterFiles(bean); for (FileNode node : fileNodes) { FileModel model = new FileModel(node.getName(), node.getEnvPath()); if (!AlphaFineHelper.getFilterResult().contains(model) && !filterModelList.contains(model)) { From c1e1ae1697da058b1b18ac70c08a1a70c4cf10ce Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Mon, 7 Oct 2024 17:03:00 +0800 Subject: [PATCH 02/14] =?UTF-8?q?REPORT-135233=20=E8=B0=83=E6=95=B4TableDa?= =?UTF-8?q?taOperator=E5=92=8CConnectionOperator?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fanruan/boot/init/DesignWorkContextComponent.java | 1 - 1 file changed, 1 deletion(-) diff --git a/designer-realize/src/main/java/com/fanruan/boot/init/DesignWorkContextComponent.java b/designer-realize/src/main/java/com/fanruan/boot/init/DesignWorkContextComponent.java index 7f4f976ce8..8c679a2b79 100644 --- a/designer-realize/src/main/java/com/fanruan/boot/init/DesignWorkContextComponent.java +++ b/designer-realize/src/main/java/com/fanruan/boot/init/DesignWorkContextComponent.java @@ -61,7 +61,6 @@ import com.fr.workspace.pool.WorkRPCRegister; import com.fr.workspace.pool.WorkRPCType; import com.fr.workspace.resource.WorkResource; import com.fr.workspace.server.repository.authority.RemoteAuthorityRepository; -import com.fr.workspace.server.repository.compatible.CompatibleConnectionOperator; import com.fr.workspace.server.repository.compatible.register.CompatibleRegister; import com.fr.workspace.server.repository.config.ConfigRepository; import com.fr.workspace.server.repository.connection.ConnectionRepository; From b2b7dc484be22ca29231cd9ef4eba5a58ec5a7cf Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Mon, 7 Oct 2024 17:05:20 +0800 Subject: [PATCH 03/14] =?UTF-8?q?REPORT-135233=20=E8=B0=83=E6=95=B4ShareEm?= =?UTF-8?q?beddedConverter?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../share/generate/task/ComponentCreator.java | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/generate/task/ComponentCreator.java b/designer-form/src/main/java/com/fr/design/mainframe/share/generate/task/ComponentCreator.java index ed1c2a91db..75f7def2d9 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/generate/task/ComponentCreator.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/generate/task/ComponentCreator.java @@ -5,13 +5,13 @@ import com.fr.base.iofile.attr.ExtendSharableAttrMark; import com.fr.base.iofile.attr.SharableAttrMark; import com.fr.base.theme.TemplateTheme; import com.fr.base.theme.TemplateThemeConfig; +import com.fr.data.TableDataSource; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.share.generate.impl.AbstractComponentCreatorProcessor; import com.fr.form.main.Form; import com.fr.form.main.WidgetGatherAdapter; import com.fr.form.share.DefaultSharableWidget; -import com.fr.form.share.ShareEmbeddedConverter; import com.fr.form.share.bean.ComponentReuBean; import com.fr.form.share.editor.DefaultSharableEditor; import com.fr.form.share.editor.PlainSharableEditor; @@ -21,11 +21,14 @@ import com.fr.form.ui.Widget; import com.fr.log.FineLoggerFactory; import com.fr.stable.StringUtils; import com.fr.stable.fun.IOFileAttrMark; -import com.fr.workspace.WorkContext; +import com.fr.workspace.server.entity.tabledata.PreviewSourceBean; +import com.fr.workspace.server.entity.tabledata.TableDataBean; +import com.fr.workspace.server.repository.tabledata.TableDataRepository; import org.jetbrains.annotations.NotNull; import java.util.HashMap; import java.util.Iterator; +import java.util.List; import java.util.Map; /** @@ -112,8 +115,7 @@ public class ComponentCreator extends AbstractComponentCreatorProcessor { //内置数据集 if (tpl != null) { - ShareEmbeddedConverter embeddedConverter = WorkContext.getCurrent().get(ShareEmbeddedConverter.class); - Map map = embeddedConverter.convertToEmbeddedTableData(tpl, paraMap); + Map map = convertToEmbeddedTableData(tpl, paraMap); Iterator> iterator = map.entrySet().iterator(); while (iterator.hasNext()) { Map.Entry entry = iterator.next(); @@ -123,6 +125,16 @@ public class ComponentCreator extends AbstractComponentCreatorProcessor { return tpl; } + private Map convertToEmbeddedTableData(TableDataSource tableDataSource, Map parameterMap) throws Exception { + PreviewSourceBean bean = new PreviewSourceBean(tableDataSource, StringUtils.EMPTY, parameterMap , -1, -1 ,new String[0], new int[0]); + List beanList = TableDataRepository.getInstance().convertToEmbeddedTableData(bean); + Map ans = new HashMap<>(); + for (TableDataBean tableDataBean : beanList) { + ans.put(tableDataBean.getName(), tableDataBean.getTableData()); + } + return ans; + } + @NotNull protected DefaultSharableEditor createSharableEditor(Form form, Map paraMap, Widget widget, DefaultSharableWidget info) { From e7cc3647f4c698bb3f0ad8e27e774eaaa35f29d2 Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Mon, 7 Oct 2024 17:24:21 +0800 Subject: [PATCH 04/14] =?UTF-8?q?REPORT-135233=20=E8=B0=83=E6=95=B4LockInf?= =?UTF-8?q?oOperator?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/lock/TemplateLockInfoReSave.java | 4 +-- .../DesignerFrameFileDealerPane.java | 19 +++---------- .../fr/design/mainframe/ForbiddenPane.java | 27 +++++-------------- .../boot/init/DesignWorkContextComponent.java | 2 -- 4 files changed, 13 insertions(+), 39 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/lock/TemplateLockInfoReSave.java b/designer-base/src/main/java/com/fr/design/lock/TemplateLockInfoReSave.java index f1f927abb1..7eda9b222e 100644 --- a/designer-base/src/main/java/com/fr/design/lock/TemplateLockInfoReSave.java +++ b/designer-base/src/main/java/com/fr/design/lock/TemplateLockInfoReSave.java @@ -1,12 +1,12 @@ package com.fr.design.lock; +import com.fanruan.repository.TemplateRepository; import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.mainframe.JTemplate; import com.fr.event.Event; import com.fr.event.EventDispatcher; import com.fr.event.Listener; import com.fr.log.FineLoggerFactory; -import com.fr.report.lock.LockInfoOperator; import com.fr.stable.collections.CollectionUtils; import com.fr.workspace.WorkContext; import com.fr.workspace.Workspace; @@ -31,7 +31,7 @@ public class TemplateLockInfoReSave { return; } String[] paths = templates.stream().map(JTemplate::getPath).toArray(String[]::new); - String[] lockedPath = WorkContext.getCurrent().get(LockInfoOperator.class).lockTemplates(paths); + String[] lockedPath = TemplateRepository.getInstance().lockTemplates(paths); FineLoggerFactory.getLogger().warn("template lock failed:{}", String.join(";", lockedPath)); } }; diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java index c996e12622..d0ad936913 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java @@ -1,5 +1,6 @@ package com.fr.design.mainframe; +import com.fanruan.repository.TemplateRepository; import com.fine.theme.icon.LazyIcon; import com.fine.theme.utils.FineLayoutBuilder; import com.fine.theme.utils.FineUIStyle; @@ -58,7 +59,6 @@ import com.fr.plugin.injectable.PluginModule; import com.fr.plugin.manage.PluginFilter; import com.fr.plugin.observer.PluginEvent; import com.fr.plugin.observer.PluginEventListener; -import com.fr.report.lock.LockInfoOperator; import com.fr.stable.CoreConstants; import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; @@ -66,21 +66,10 @@ import com.fr.stable.project.ProjectConstants; import com.fr.third.org.apache.commons.io.FilenameUtils; import com.fr.workspace.WorkContext; -import com.fanruan.repository.TemplateRepository; - -import javax.swing.BorderFactory; -import javax.swing.JDialog; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.SwingConstants; +import javax.swing.*; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; -import java.awt.BorderLayout; -import java.awt.CardLayout; -import java.awt.Color; -import java.awt.Component; -import java.awt.Dimension; -import java.awt.FlowLayout; +import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyAdapter; @@ -250,7 +239,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt new Object[] {Toolkit.i18nText("Fine_Design_Template_UnLock_I_Known"), Toolkit.i18nText("Fine-Design_Basic_Button_Cancel")}, null); if (option == JOptionPane.YES_OPTION) { String path = StableUtils.pathJoin(ProjectConstants.REPORTLETS_NAME, TemplateTreePane.getInstance().getTemplateFileTree().getSelectedTemplatePath()); - boolean success = WorkContext.getCurrent().get(LockInfoOperator.class).unLockTpl(path); + boolean success = TemplateRepository.getInstance().unLockTpl(path); if (success) { FileNode fileNode = TemplateTreePane.getInstance().getFileNode(); refreshRightToolBarBy(fileNode); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/ForbiddenPane.java b/designer-base/src/main/java/com/fr/design/mainframe/ForbiddenPane.java index 482986241b..e6fe5eed68 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/ForbiddenPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/ForbiddenPane.java @@ -1,5 +1,6 @@ package com.fr.design.mainframe; +import com.fanruan.repository.TemplateRepository; import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.gui.ilable.UILabel; import com.fr.design.i18n.DesignSizeI18nManager; @@ -8,25 +9,10 @@ import com.fr.design.mainframe.guide.base.GuideView; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.IOUtils; import com.fr.log.FineLoggerFactory; -import com.fr.report.lock.LockInfoOperator; -import com.fr.workspace.WorkContext; - -import javax.swing.ImageIcon; -import javax.swing.JButton; -import javax.swing.JDialog; -import javax.swing.JFrame; -import javax.swing.JPanel; -import javax.swing.SwingWorker; -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Component; -import java.awt.Container; -import java.awt.Dimension; -import java.awt.Font; -import java.awt.Graphics; -import java.awt.Graphics2D; -import java.awt.LayoutManager; -import java.awt.RenderingHints; +import com.fr.workspace.base.UserInfo; + +import javax.swing.*; +import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -125,7 +111,8 @@ public class ForbiddenPane extends JPanel { @Override protected Boolean doInBackground() throws Exception { - return WorkContext.getCurrent().get(LockInfoOperator.class).isTplLocked(template.getEditingFILE().getPath()); + UserInfo info = TemplateRepository.getInstance().showLockInfo(template.getEditingFILE().getPath()); + return info.getTplLocked(); } @Override diff --git a/designer-realize/src/main/java/com/fanruan/boot/init/DesignWorkContextComponent.java b/designer-realize/src/main/java/com/fanruan/boot/init/DesignWorkContextComponent.java index 8c679a2b79..78dc3902b0 100644 --- a/designer-realize/src/main/java/com/fanruan/boot/init/DesignWorkContextComponent.java +++ b/designer-realize/src/main/java/com/fanruan/boot/init/DesignWorkContextComponent.java @@ -28,7 +28,6 @@ import com.fr.design.env.HttpWorkspaceConnector; import com.fr.env.operator.CommonOperatorImpl; import com.fr.esd.core.remote.ESDConfigEventOperator; import com.fr.esd.core.remote.ESDConfigEventOperatorImpl; -import com.fr.file.ConnectionOperator; import com.fr.file.TableDataOperator; import com.fr.file.TableDataOperatorImpl; import com.fr.file.filetree.FileNodes; @@ -178,7 +177,6 @@ public class DesignWorkContextComponent { WorkRPCRegister.wrap(WorkRPCType.Compatible, TableDataOperator.class, TableDataOperatorImpl.getInstance()), WorkRPCRegister.wrap(FileAssistUtilsOperator.class, new FileAssistUtils()), WorkRPCRegister.wrap(TableDataOperator.class, TableDataOperatorImpl.getInstance()), - WorkRPCRegister.wrap(ConnectionOperator.class, CompatibleConnectionOperator.getInstance()), WorkRPCRegister.wrap(BuildInfoOperator.class, new BuildInfoOperatorImpl()) ); } From 9cbdb70f458c18f622488162ba955073faf75b48 Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Mon, 7 Oct 2024 17:33:32 +0800 Subject: [PATCH 05/14] =?UTF-8?q?REPORT-135233=20=E8=B0=83=E6=95=B4DataFet?= =?UTF-8?q?cher,CommitHelper?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/javascript/EmailPane.java | 4 +--- .../main/java/com/fanruan/boot/env/DesignEnvComponent.java | 4 +--- .../com/fanruan/boot/init/DesignWorkContextComponent.java | 2 +- .../src/main/java/com/fanruan/config/LocalConfigSource.java | 2 +- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/javascript/EmailPane.java b/designer-base/src/main/java/com/fr/design/javascript/EmailPane.java index 22a1e3378c..2b7f72fa36 100644 --- a/designer-base/src/main/java/com/fr/design/javascript/EmailPane.java +++ b/designer-base/src/main/java/com/fr/design/javascript/EmailPane.java @@ -1,8 +1,6 @@ package com.fr.design.javascript; -import com.fr.base.email.EmailCenter; import com.fine.theme.utils.FineUIStyle; -import com.fr.config.EmailServerConfig; import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.constants.UIConstants; import com.fr.design.gui.icheckbox.UICheckBox; @@ -13,7 +11,7 @@ import com.fr.design.layout.TableLayout; import com.fr.js.EmailJavaScript; import com.fr.stable.StringUtils; -import com.fr.workspace.server.repository.config.ConfigRepository; +import com.fanruan.repository.ConfigRepository; import javax.swing.BorderFactory; import javax.swing.JComponent; 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 2a04889c52..385e0122be 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 @@ -2,7 +2,6 @@ package com.fanruan.boot.env; import com.fanruan.boot.FSProperties; import com.fanruan.boot.KVProperties; -import com.fanruan.boot.LoggerProperties; import com.fanruan.boot.SchedulerCoreComponent; import com.fanruan.carina.Carina; import com.fanruan.carina.annotions.FineComponent; @@ -89,7 +88,6 @@ import com.fr.stable.db.session.DBSession; import com.fr.stable.project.ProjectConstants; import com.fr.tenant.context.TenantContext; import com.fr.tenant.context.provider.CurrentTenantKey; -import com.fr.third.apache.logging.log4j.Level; import com.fr.third.apache.logging.log4j.core.config.Configurator; import com.fr.third.net.bytebuddy.implementation.MethodDelegation; import com.fr.third.net.bytebuddy.matcher.ElementMatchers; @@ -103,7 +101,7 @@ import com.fr.transaction.RemoteTransactor; import com.fr.transaction.TransactorFactory; import com.fr.workspace.WorkContext; import com.fanruan.config.LocalConfigSource; -import com.fr.workspace.server.repository.config.LocalConfigSourceShell; +import com.fanruan.repository.LocalConfigSourceShell; import java.net.URI; import java.sql.Connection; diff --git a/designer-realize/src/main/java/com/fanruan/boot/init/DesignWorkContextComponent.java b/designer-realize/src/main/java/com/fanruan/boot/init/DesignWorkContextComponent.java index 78dc3902b0..dfba3b1279 100644 --- a/designer-realize/src/main/java/com/fanruan/boot/init/DesignWorkContextComponent.java +++ b/designer-realize/src/main/java/com/fanruan/boot/init/DesignWorkContextComponent.java @@ -61,7 +61,7 @@ import com.fr.workspace.pool.WorkRPCType; import com.fr.workspace.resource.WorkResource; import com.fr.workspace.server.repository.authority.RemoteAuthorityRepository; import com.fr.workspace.server.repository.compatible.register.CompatibleRegister; -import com.fr.workspace.server.repository.config.ConfigRepository; +import com.fanruan.repository.ConfigRepository; import com.fr.workspace.server.repository.connection.ConnectionRepository; import com.fr.workspace.server.repository.plugin.PluginRepository; import com.fr.workspace.server.repository.resource.PublicResourceRepository; diff --git a/designer-realize/src/main/java/com/fanruan/config/LocalConfigSource.java b/designer-realize/src/main/java/com/fanruan/config/LocalConfigSource.java index 11301e93c1..49c27ac2a0 100644 --- a/designer-realize/src/main/java/com/fanruan/config/LocalConfigSource.java +++ b/designer-realize/src/main/java/com/fanruan/config/LocalConfigSource.java @@ -1,7 +1,7 @@ package com.fanruan.config; import com.fr.base.email.EmailCenter; -import com.fr.workspace.server.repository.config.BaseConfigSource; +import com.fanruan.repository.BaseConfigSource; /** * 本地配置资源 From be719446bfdad7affae5baacb44b902d53a8b7d5 Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Mon, 7 Oct 2024 17:37:31 +0800 Subject: [PATCH 06/14] =?UTF-8?q?REPORT-135233=20=E8=B0=83=E6=95=B4VcsAuto?= =?UTF-8?q?CleanOperator?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/actions/file/PreferencePane.java | 44 +++++-------------- .../vcs/VcsRecycleSettingHelper.java | 8 ++-- 2 files changed, 14 insertions(+), 38 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java b/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java index 1779ef20c1..1babe368ec 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java +++ b/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java @@ -35,7 +35,6 @@ import com.fr.design.gui.iprogressbar.UIProgressBarUI; import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.i18n.Toolkit; -import com.fr.design.jdk.JdkVersion; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.VerticalFlowLayout; import com.fr.design.mainframe.vcs.VcsConfigManager; @@ -55,7 +54,6 @@ import com.fr.locale.InterProviderFactory; import com.fr.log.FineLoggerFactory; import com.fr.report.ReportConfigManager; import com.fr.stable.Constants; -import com.fr.stable.os.OperatingSystem; import com.fr.third.apache.logging.log4j.Level; import com.fr.third.guava.collect.BiMap; import com.fr.third.guava.collect.HashBiMap; @@ -63,38 +61,19 @@ import com.fr.transaction.Configurations; import com.fr.transaction.Worker; import com.fr.transaction.WorkerAdaptor; import com.fr.workspace.WorkContext; +import com.fr.workspace.server.entity.vcs.VcsTaskBean; +import com.fr.workspace.server.repository.vcs.VcsRepository; import com.fr.workspace.server.vcs.VcsConfig; import com.fr.workspace.server.vcs.VcsOperator; import com.fr.workspace.server.vcs.git.config.GcConfig; -import com.fr.workspace.server.vcs.v2.scheduler.VcsAutoCleanOperator; import com.fr.workspace.server.vcs.v2.scheduler.VcsAutoCleanSchedule; import com.fr.workspace.server.vcs.v2.scheduler.VcsAutoCleanService; import org.jetbrains.annotations.NotNull; -import javax.swing.BoxLayout; -import javax.swing.ButtonGroup; -import javax.swing.JDialog; -import javax.swing.JFileChooser; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.JProgressBar; -import javax.swing.KeyStroke; -import javax.swing.ScrollPaneConstants; -import javax.swing.SwingUtilities; -import javax.swing.SwingWorker; -import javax.swing.Timer; -import javax.swing.UIManager; +import javax.swing.*; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; -import java.awt.BorderLayout; -import java.awt.CardLayout; -import java.awt.Color; -import java.awt.Component; -import java.awt.Dialog; -import java.awt.Dimension; -import java.awt.FlowLayout; -import java.awt.Font; -import java.awt.Window; +import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyAdapter; @@ -110,12 +89,9 @@ import java.util.Locale; import java.util.Map; import java.util.concurrent.ExecutionException; -import static com.fine.swing.ui.layout.Layouts.cell; -import static com.fine.swing.ui.layout.Layouts.column; -import static com.fine.swing.ui.layout.Layouts.fix; -import static com.fine.swing.ui.layout.Layouts.row; -import static com.fine.theme.utils.FineClientProperties.COMBO_BOX_TYPE; +import static com.fine.swing.ui.layout.Layouts.*; import static com.fine.theme.utils.FineClientProperties.ADAPTIVE_COMBO_BOX; +import static com.fine.theme.utils.FineClientProperties.COMBO_BOX_TYPE; import static com.fine.theme.utils.FineUIConstants.SCALE_FONT_SIZE_12; import static com.fr.design.i18n.Toolkit.i18nText; @@ -541,7 +517,7 @@ public class PreferencePane extends BasicPane { new SwingWorker() { @Override protected Boolean doInBackground() throws Exception { - return WorkContext.getCurrent().get(VcsAutoCleanOperator.class).isSupport(); + return VcsRepository.getInstance().isSupport(); } @Override protected void done() { @@ -1175,12 +1151,12 @@ public class PreferencePane extends BasicPane { if (useVcsAutoCleanScheduleCheckBox.isEnabled()) { if (useVcsAutoCleanScheduleCheckBox.isSelected()) { FineLoggerFactory.getLogger().info("[VcsV2] start auto clean!"); - WorkContext.getCurrent().get(VcsAutoCleanOperator.class).addOrUpdateVcsAutoCleanJob( + VcsRepository.getInstance().addOrUpdateVcsAutoCleanJob(new VcsTaskBean( VcsAutoCleanService.VCS_AUTO_CLEAN_JOB_NAME, getDay(autoCleanIntervalComboBox.getSelectedIndex()), - VcsAutoCleanSchedule.class); + VcsAutoCleanSchedule.class)); } else { - WorkContext.getCurrent().get(VcsAutoCleanOperator.class).stopVcsAutoCleanJob(VcsAutoCleanService.VCS_AUTO_CLEAN_JOB_NAME); + VcsRepository.getInstance().stopVcsAutoCleanJob(VcsAutoCleanService.VCS_AUTO_CLEAN_JOB_NAME); } } } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/VcsRecycleSettingHelper.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/VcsRecycleSettingHelper.java index 3e6a5bab96..db93616342 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/VcsRecycleSettingHelper.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/VcsRecycleSettingHelper.java @@ -3,9 +3,9 @@ package com.fr.design.mainframe.vcs; import com.fr.concurrent.NamedThreadFactory; import com.fr.transaction.Configurations; import com.fr.transaction.WorkerAdaptor; -import com.fr.workspace.WorkContext; +import com.fr.workspace.server.entity.vcs.VcsTaskBean; +import com.fr.workspace.server.repository.vcs.VcsRepository; import com.fr.workspace.server.vcs.VcsConfig; -import com.fr.workspace.server.vcs.v2.scheduler.VcsAutoCleanOperator; import com.fr.workspace.server.vcs.v2.scheduler.VcsAutoCleanService; import com.fr.workspace.server.vcs.v2.scheduler.VcsAutoRecycleSchedule; @@ -39,10 +39,10 @@ public class VcsRecycleSettingHelper { VcsConfig.getInstance().setV2CleanRecycleInterval(day); } }); - WorkContext.getCurrent().get(VcsAutoCleanOperator.class).addOrUpdateVcsAutoCleanJob( + VcsRepository.getInstance().addOrUpdateVcsAutoCleanJob(new VcsTaskBean( VcsAutoCleanService.VCS_AUTO_CLEAN_RECYCLE_JOB_NAME, 1, - VcsAutoRecycleSchedule.class); + VcsAutoRecycleSchedule.class)); } }); } From 4107751f056a47276c328122004a7df6a9c77570 Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Mon, 7 Oct 2024 17:39:13 +0800 Subject: [PATCH 07/14] =?UTF-8?q?REPORT-135233=20=E8=B0=83=E6=95=B4Templat?= =?UTF-8?q?eChecker?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/mainframe/check/CheckButton.java | 44 ++++++------------- 1 file changed, 14 insertions(+), 30 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/check/CheckButton.java b/designer-base/src/main/java/com/fr/design/mainframe/check/CheckButton.java index e95a105d57..9332368881 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/check/CheckButton.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/check/CheckButton.java @@ -1,32 +1,22 @@ package com.fr.design.mainframe.check; +import com.fanruan.repository.TemplateRepository; import com.fine.theme.icon.LazyIcon; import com.fine.theme.utils.FineUIUtils; import com.formdev.flatlaf.util.ScaledEmptyBorder; -import com.fr.base.BaseUtils; import com.fr.design.dialog.FineJOptionPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ilable.UILabel; -import com.fr.design.i18n.DesignSizeI18nManager; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.JTemplate; import com.fr.design.worker.save.CallbackSaveWorker; import com.fr.file.FILE; import com.fr.file.FileNodeFILE; -import com.fr.general.IOUtils; import com.fr.log.FineLoggerFactory; -import com.fr.rpc.ExceptionHandler; -import com.fr.rpc.RPCInvokerExceptionInfo; -import com.fr.workspace.WorkContext; -import com.fr.workspace.server.check.TemplateChecker; -import javax.swing.BoxLayout; -import javax.swing.JDialog; -import javax.swing.JPanel; -import javax.swing.SwingUtilities; -import javax.swing.SwingWorker; -import java.awt.BorderLayout; +import javax.swing.*; +import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.WindowAdapter; @@ -34,14 +24,9 @@ import java.awt.event.WindowEvent; import java.util.Set; import java.util.concurrent.ExecutionException; -import static com.fine.swing.ui.layout.Layouts.cell; -import static com.fine.swing.ui.layout.Layouts.column; -import static com.fine.swing.ui.layout.Layouts.flex; -import static com.fine.swing.ui.layout.Layouts.row; +import static com.fine.swing.ui.layout.Layouts.*; import static com.fr.design.dialog.FineJOptionPane.showConfirmDialog; -import static javax.swing.JOptionPane.OK_CANCEL_OPTION; -import static javax.swing.JOptionPane.OK_OPTION; -import static javax.swing.JOptionPane.WARNING_MESSAGE; +import static javax.swing.JOptionPane.*; public class CheckButton extends UIButton { @@ -174,16 +159,15 @@ public class CheckButton extends UIButton { private Set check(JTemplate jtemplate) { String path = jtemplate.getEditingFILE().getEnvFullName(); - Set fontSet = WorkContext.getCurrent().get(TemplateChecker.class, new ExceptionHandler() { - - @Override - public Void callHandler(RPCInvokerExceptionInfo rpcInvokerExceptionInfo) { - imageLabel.setIcon(new LazyIcon("error", 20)); - message.setText("" + Toolkit.i18nText("Fine_Designer_Check_Font_Upgrade") + ""); - okButton.setEnabled(true); - return null; - } - }).checkFont(path); + Set fontSet = null; + try { + fontSet = TemplateRepository.getInstance().checkFont(path); + } catch (Exception e) { + imageLabel.setIcon(new LazyIcon("error", 20)); + message.setText("" + Toolkit.i18nText("Fine_Designer_Check_Font_Upgrade") + ""); + okButton.setEnabled(true); + return null; + } return fontSet; } From 26a22893b39f1193f47f049ac902f098b6567d49 Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Mon, 7 Oct 2024 17:41:06 +0800 Subject: [PATCH 08/14] =?UTF-8?q?REPORT-135233=20=E8=B0=83=E6=95=B4Organiz?= =?UTF-8?q?ationOperator?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../setting/TableDataDesensitizationTablePane.java | 12 ++++-------- .../com/fr/design/roleAuthority/RoleDataWrapper.java | 2 +- .../desensitization/model/UpdateDataWorker.java | 7 +++---- 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/setting/TableDataDesensitizationTablePane.java b/designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/setting/TableDataDesensitizationTablePane.java index 6473a02d07..870dc7ff5b 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/setting/TableDataDesensitizationTablePane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/setting/TableDataDesensitizationTablePane.java @@ -1,6 +1,5 @@ package com.fr.design.data.datapane.preview.desensitization.view.setting; -import com.fr.base.operator.org.OrganizationOperator; import com.fr.data.desensitize.base.DesensitizationTableData; import com.fr.data.desensitize.base.TableDataDesensitizationItem; import com.fr.data.desensitize.rule.DesensitizationRuleManager; @@ -11,13 +10,10 @@ import com.fr.design.data.tabledata.tabledatapane.loading.TipsPane; import com.fr.design.gui.itableeditorpane.UITableEditorPane; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.log.FineLoggerFactory; -import com.fr.workspace.WorkContext; +import com.fr.workspace.server.repository.authority.RemoteAuthorityRepository; -import javax.swing.JPanel; -import javax.swing.SwingWorker; -import java.awt.BorderLayout; -import java.awt.CardLayout; -import java.awt.Component; +import javax.swing.*; +import java.awt.*; import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; @@ -91,7 +87,7 @@ public class TableDataDesensitizationTablePane extends JPanel { // 获取当前数据集的所有列名 columnNames.addAll(TableDataPreviewDesensitizeManager.getInstance().getColumnNamesByTableData(tableData)); // 获取当前所有用户组 - roleMap.putAll(WorkContext.getCurrent().get(OrganizationOperator.class).getAllRoles4Desensitization()); + roleMap.putAll(RemoteAuthorityRepository.getInstance().getAllRoles4Desensitization()); // 获取当前最新的所有规则 latestRules.putAll(DesensitizationRuleManager.getInstance().getAllRules()); return null; diff --git a/designer-base/src/main/java/com/fr/design/roleAuthority/RoleDataWrapper.java b/designer-base/src/main/java/com/fr/design/roleAuthority/RoleDataWrapper.java index 1cc7dd0247..b447fec1a3 100644 --- a/designer-base/src/main/java/com/fr/design/roleAuthority/RoleDataWrapper.java +++ b/designer-base/src/main/java/com/fr/design/roleAuthority/RoleDataWrapper.java @@ -1 +1 @@ -package com.fr.design.roleAuthority; import com.fr.base.FRContext; import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; import com.fr.design.gui.itree.refreshabletree.loader.ChildrenNodesLoader; import com.fr.log.FineLoggerFactory; import java.util.ArrayList; import java.util.Collections; import java.util.List; /** * 将权限细粒度的角色数据包装一下,区分报表平台管理角色和数据决策系统角色 *

* Author : daisy * Date: 13-8-30 * Time: 下午3:42 */ public class RoleDataWrapper implements ChildrenNodesLoader { private List rolelist = new ArrayList(); private String roleTypename = null; public RoleDataWrapper(String roleName) { roleTypename = roleName; } /** * 在此计算并获得与管理类型相对应的 */ private void calculateRoleList() { try { Collections.addAll(rolelist, FRContext.getOrganizationOperator().getRoleGroup()); } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } } //加载所有的角色列表 public ExpandMutableTreeNode[] load() { calculateRoleList(); return this.load(this.rolelist); } //从workbook中读取的角色列表 public ExpandMutableTreeNode[] load(List rolelist) { this.rolelist = rolelist; ExpandMutableTreeNode[] res = new ExpandMutableTreeNode[rolelist.size()]; for (int i = 0; i < res.length; i++) { res[i] = new ExpandMutableTreeNode(rolelist.get(i)); } return res; } public String getRoleTypename(){ return roleTypename; } } \ No newline at end of file +package com.fr.design.roleAuthority; import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; import com.fr.design.gui.itree.refreshabletree.loader.ChildrenNodesLoader; import com.fr.log.FineLoggerFactory; import com.fr.workspace.server.repository.authority.RemoteAuthorityRepository; import java.util.ArrayList; import java.util.Collections; import java.util.List; /** * 将权限细粒度的角色数据包装一下,区分报表平台管理角色和数据决策系统角色 *

* Author : daisy * Date: 13-8-30 * Time: 下午3:42 */ public class RoleDataWrapper implements ChildrenNodesLoader { private List rolelist = new ArrayList(); private String roleTypename = null; public RoleDataWrapper(String roleName) { roleTypename = roleName; } /** * 在此计算并获得与管理类型相对应的 */ private void calculateRoleList() { try { Collections.addAll(rolelist, RemoteAuthorityRepository.getInstance().getRoleGroup()); } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } } //加载所有的角色列表 public ExpandMutableTreeNode[] load() { calculateRoleList(); return this.load(this.rolelist); } //从workbook中读取的角色列表 public ExpandMutableTreeNode[] load(List rolelist) { this.rolelist = rolelist; ExpandMutableTreeNode[] res = new ExpandMutableTreeNode[rolelist.size()]; for (int i = 0; i < res.length; i++) { res[i] = new ExpandMutableTreeNode(rolelist.get(i)); } return res; } public String getRoleTypename(){ return roleTypename; } } \ No newline at end of file diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/desensitization/model/UpdateDataWorker.java b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/desensitization/model/UpdateDataWorker.java index d60e9a2c82..8a237d4d9c 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/desensitization/model/UpdateDataWorker.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/desensitization/model/UpdateDataWorker.java @@ -1,12 +1,11 @@ package com.fr.design.mainframe.cell.settingpane.desensitization.model; -import com.fr.base.operator.org.OrganizationOperator; import com.fr.data.desensitize.rule.DesensitizationRuleManager; import com.fr.data.desensitize.rule.base.DesensitizationRule; import com.fr.data.desensitize.rule.base.DesensitizationRuleSource; -import com.fr.workspace.WorkContext; +import com.fr.workspace.server.repository.authority.RemoteAuthorityRepository; -import javax.swing.SwingWorker; +import javax.swing.*; import java.util.HashMap; import java.util.Map; import java.util.concurrent.ExecutionException; @@ -26,7 +25,7 @@ public class UpdateDataWorker extends SwingWorker, Void> { @Override protected Map doInBackground() { Map result = new HashMap<>(); - Map allRoles = WorkContext.getCurrent().get(OrganizationOperator.class).getAllRoles4Desensitization(); + Map allRoles = RemoteAuthorityRepository.getInstance().getAllRoles4Desensitization(); Map> allRules = DesensitizationRuleManager.getInstance().getAllRules(); result.put(ROLE_KEY, allRoles); From b44b2fbc38f7ff8baa8cffec2a3328be52ee2f64 Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Mon, 7 Oct 2024 20:36:58 +0800 Subject: [PATCH 09/14] =?UTF-8?q?REPORT-135233=20=E8=B0=83=E6=95=B4Templat?= =?UTF-8?q?eExportOperator?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../actions/file/export/AbstractExportAction.java | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java b/designer-base/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java index 7dc25799f3..f669403db5 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java @@ -1,5 +1,7 @@ package com.fr.design.actions.file.export; +import com.fanruan.entity.template.TemplateExportBean; +import com.fanruan.repository.TemplateRepository; import com.fr.design.actions.JTemplateAction; import com.fr.design.base.mode.DesignModeContext; import com.fr.design.dialog.FineJOptionPane; @@ -18,12 +20,8 @@ import com.fr.log.FineLoggerFactory; import com.fr.stable.StringUtils; import com.fr.stable.project.ProjectConstants; import com.fr.third.jodd.io.FileNameUtil; -import com.fr.workspace.WorkContext; -import com.fr.workspace.server.exporter.TemplateExportOperator; -import javax.swing.JOptionPane; -import javax.swing.SwingWorker; -import javax.swing.UIManager; +import javax.swing.*; import java.awt.event.ActionEvent; import java.io.OutputStream; import java.util.Map; @@ -215,9 +213,7 @@ public abstract class AbstractExportAction> extends JT path = path.substring(ProjectConstants.REPORTLETS_NAME.length()); } - byte[] contents = - WorkContext.getCurrent().get(TemplateExportOperator.class) - .export(exportKey(), exportType(), null, path, para); + byte[] contents = TemplateRepository.getInstance().export(new TemplateExportBean().setKey(exportKey()).setType(exportType()).setPath(path).setParas(para)); outputStream.write(contents); } From b12d108a7ce07a42afe28022cf7faa0d0bd91b22 Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Mon, 7 Oct 2024 20:42:54 +0800 Subject: [PATCH 10/14] =?UTF-8?q?REPORT-135233=20=E8=B0=83=E6=95=B4DataBas?= =?UTF-8?q?eTypeOperator?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../datapane/connect/ConnectionListPane.java | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) 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 3b0f601926..48a09ba695 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 @@ -1,10 +1,8 @@ package com.fr.design.data.datapane.connect; -import com.fanruan.config.impl.data.ConnectionConfigProviderFactory; -import com.fanruan.config.impl.data.ConnectionConfigWriterFactory; +import com.fine.theme.icon.LazyIcon; import com.fine.theme.utils.FineUIScale; import com.fr.config.remote.RemoteConfigEvent; -import com.fine.theme.icon.LazyIcon; import com.fr.data.impl.Connection; import com.fr.data.impl.JDBCDatabaseConnection; import com.fr.data.impl.JNDIDatabaseConnection; @@ -34,14 +32,12 @@ 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.server.database.DataBaseTypeOperator; -import com.fr.workspace.server.entity.connection.ConnectionBean; +import com.fr.workspace.server.repository.WorkplaceConstants; import com.fr.workspace.server.repository.connection.ConnectionRepository; import org.jetbrains.annotations.NotNull; -import javax.swing.JOptionPane; -import javax.swing.SwingWorker; -import java.awt.Window; +import javax.swing.*; +import java.awt.*; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; @@ -86,7 +82,7 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh SwingWorker, Void> getSupportedTypesWorker = new SwingWorker, Void>() { @Override protected List doInBackground() { - return WorkContext.getCurrent().get(DataBaseTypeOperator.class).getSupportedDatabaseTypes(); + return WorkplaceConstants.getSupportedDatabaseTypes(); } @Override @@ -181,7 +177,7 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh JNDIDatabaseConnection.class, DatabaseConnectionPane.JNDI.class ); NameableCreator[] creators; - if (WorkContext.getCurrent().get(DataBaseTypeOperator.class).limitDatabaseType()) { + if (WorkplaceConstants.isLimitDatabaseType()) { // 不支持JNDI,屏蔽接口 creators = new NameableCreator[]{jdbc}; } else { From cfc652829739b17be13a72b38e77c71f99ffed86 Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Mon, 7 Oct 2024 20:51:35 +0800 Subject: [PATCH 11/14] =?UTF-8?q?REPORT-135233=20=E8=B0=83=E6=95=B4TplOper?= =?UTF-8?q?ator?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/file/MultiTemplateTabPane.java | 26 +++++-------------- .../com/fr/design/mainframe/JTemplate.java | 15 ++++------- .../vcs/common/VcsCacheFileNodeFile.java | 9 +++---- .../com/fr/design/utils/TemplateUtils.java | 14 +++++----- 4 files changed, 22 insertions(+), 42 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/file/MultiTemplateTabPane.java b/designer-base/src/main/java/com/fr/design/file/MultiTemplateTabPane.java index 8bedd19c96..0c8d62d587 100644 --- a/designer-base/src/main/java/com/fr/design/file/MultiTemplateTabPane.java +++ b/designer-base/src/main/java/com/fr/design/file/MultiTemplateTabPane.java @@ -1,6 +1,7 @@ package com.fr.design.file; +import com.fanruan.repository.TemplateRepository; import com.fine.swing.ui.layout.Layouts; import com.fine.swing.ui.layout.Row; import com.fine.theme.icon.LazyIcon; @@ -11,8 +12,8 @@ import com.fr.base.vcs.DesignerMode; import com.fr.design.ExtraDesignClassManager; import com.fr.design.actions.UpdateAction; import com.fr.design.actions.file.LocateAction; -import com.fr.design.cache.DesignCacheManager; import com.fr.design.actions.template.NewWorkBookToolButtonAction; +import com.fr.design.cache.DesignCacheManager; import com.fr.design.constants.UIConstants; import com.fr.design.dialog.FineJOptionPane; import com.fr.design.fun.MenuHandler; @@ -37,20 +38,9 @@ import com.fr.general.IOUtils; import com.fr.log.FineLoggerFactory; import com.fr.stable.collections.combination.Pair; import com.fr.third.javax.annotation.Nonnull; -import com.fr.workspace.WorkContext; -import com.fr.workspace.server.lock.TplOperator; - -import javax.swing.Icon; -import javax.swing.JButton; -import javax.swing.JOptionPane; -import javax.swing.JSeparator; -import javax.swing.SwingUtilities; -import javax.swing.ToolTipManager; -import java.awt.AWTEvent; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.FlowLayout; -import java.awt.Graphics; + +import javax.swing.*; +import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; @@ -66,9 +56,7 @@ import static com.fine.theme.utils.FineUIScale.scale; import static com.fine.theme.utils.FineUIStyle.BUTTON_TAB_ACTION; import static com.formdev.flatlaf.FlatClientProperties.BUTTON_TYPE; import static com.fr.design.dialog.FineJOptionPane.showConfirmDialog; -import static javax.swing.JOptionPane.OK_CANCEL_OPTION; -import static javax.swing.JOptionPane.OK_OPTION; -import static javax.swing.JOptionPane.WARNING_MESSAGE; +import static javax.swing.JOptionPane.*; /** * 模版Tab组件 @@ -413,7 +401,7 @@ public class MultiTemplateTabPane extends Row { // 只有是环境内的文件,才执行释放锁 if (file != null && file.isEnvFile()) { // release lock - WorkContext.getCurrent().get(TplOperator.class).closeAndFreeFile(file.getPath()); + TemplateRepository.getInstance().close(file.getPath()); } } } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java index 4fba7b581d..159bcbe282 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java @@ -2,6 +2,7 @@ package com.fr.design.mainframe; import com.fanruan.datasource.web.bean.ConnectionAuthorityConfigBean; import com.fanruan.product.ProductConstants; +import com.fanruan.repository.TemplateRepository; import com.fine.theme.icon.LazyIcon; import com.fr.base.Parameter; import com.fr.base.TRL; @@ -100,17 +101,11 @@ import com.fr.stable.StringUtils; import com.fr.stable.core.UUID; import com.fr.widgettheme.designer.WidgetThemeDisplayAction; import com.fr.workspace.WorkContext; -import com.fr.workspace.server.lock.TplOperator; import com.fr.workspace.server.repository.connection.ConnectionRepository; -import com.fanruan.repository.TemplateRepository; -import javax.swing.BorderFactory; -import javax.swing.Icon; -import javax.swing.JComponent; -import javax.swing.JOptionPane; -import javax.swing.SwingConstants; +import javax.swing.*; import javax.swing.undo.UndoManager; -import java.awt.BorderLayout; +import java.awt.*; import java.io.ByteArrayOutputStream; import java.nio.file.Paths; import java.util.Arrays; @@ -936,12 +931,12 @@ public abstract class JTemplate> // 目标本地文件 !editingFILE.isEnvFile() || // 目标远程文件 - WorkContext.getCurrent().get(TplOperator.class).saveAs(editingFILE.getPath()); + TemplateRepository.getInstance().saveAs(editingFILE.getPath()); if (lockedTarget) { boolean saved = saveNewFile(editingFILE, oldName); // 目标文件保存成功并且源文件不一致的情况下,把源文件锁释放掉 if (saved && !ComparatorUtils.equals(editingFILE.getPath(), sourceFile.getPath())) { - WorkContext.getCurrent().get(TplOperator.class).closeAndFreeFile(sourceFile.getPath()); + TemplateRepository.getInstance().close(sourceFile.getPath()); } return saved; } else { diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsCacheFileNodeFile.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsCacheFileNodeFile.java index 16062c2936..e6bb0981ea 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsCacheFileNodeFile.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsCacheFileNodeFile.java @@ -1,14 +1,13 @@ package com.fr.design.mainframe.vcs.common; -import com.fr.io.FineEncryptUtils; +import com.fanruan.repository.TemplateRepository; import com.fr.base.io.XMLEncryptUtils; import com.fr.file.FileNodeFILE; import com.fr.file.filetree.FileNode; import com.fr.general.ComparatorUtils; +import com.fr.io.FineEncryptUtils; import com.fr.stable.StableUtils; -import com.fr.workspace.WorkContext; import com.fr.workspace.resource.WorkResourceOutputStream; -import com.fr.workspace.server.lock.TplOperator; import com.fr.workspace.server.vcs.filesystem.VcsFileSystem; import java.io.ByteArrayInputStream; @@ -43,9 +42,7 @@ public class VcsCacheFileNodeFile extends FileNodeFILE { return null; } InputStream in = new ByteArrayInputStream( - WorkContext.getCurrent().get(TplOperator.class).readAndLockFile( - StableUtils.pathJoin(vcsCacheDir, envPath.substring(vcsCacheDir.length() + 1)) - ) + TemplateRepository.getInstance().open( StableUtils.pathJoin(vcsCacheDir, envPath.substring(vcsCacheDir.length() + 1))) ); return envPath.endsWith(".cpt") || envPath.endsWith(".frm") diff --git a/designer-base/src/main/java/com/fr/design/utils/TemplateUtils.java b/designer-base/src/main/java/com/fr/design/utils/TemplateUtils.java index ff0afe1e9a..af86bb9045 100644 --- a/designer-base/src/main/java/com/fr/design/utils/TemplateUtils.java +++ b/designer-base/src/main/java/com/fr/design/utils/TemplateUtils.java @@ -1,5 +1,7 @@ package com.fr.design.utils; +import com.fanruan.product.ProductConstants; +import com.fanruan.repository.TemplateRepository; import com.fr.base.extension.FileExtension; import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.file.TemplateTreePane; @@ -15,13 +17,11 @@ import com.fr.file.filter.ChooseFileFilter; import com.fr.log.FineLoggerFactory; import com.fr.stable.ArrayUtils; import com.fr.stable.CoreConstants; -import com.fanruan.product.ProductConstants; import com.fr.stable.StringUtils; import com.fr.workspace.WorkContext; -import com.fr.workspace.server.lock.TplOperator; import org.jetbrains.annotations.Nullable; -import javax.swing.SwingWorker; +import javax.swing.*; import java.io.OutputStream; import java.util.ArrayList; import java.util.List; @@ -141,7 +141,7 @@ public class TemplateUtils { OutputStream out = null; try { // 加锁 - boolean saveAsLock = WorkContext.getCurrent().get(TplOperator.class).saveAs(file.getPath()); + boolean saveAsLock = TemplateRepository.getInstance().saveAs(file.getPath()); if (!saveAsLock) { // 加锁失败时,直接返回 throw new RuntimeException("[RemoteDesign] back up template file failed"); @@ -155,7 +155,7 @@ public class TemplateUtils { } } finally { // 解锁 - WorkContext.getCurrent().get(TplOperator.class).closeAndFreeFile(file.getPath()); + TemplateRepository.getInstance().close(file.getPath()); } } return true; @@ -182,12 +182,12 @@ public class TemplateUtils { //判断一下要保存的副本文件是否已打开 int index = HistoryTemplateListCache.getInstance().contains(file); if (index != -1) { - WorkContext.getCurrent().get(TplOperator.class).closeAndFreeFile(file.getPath()); + TemplateRepository.getInstance().close(file.getPath()); needCloseTemplate.add(HistoryTemplateListCache.getInstance().getHistoryList().get(index)); } if (JTemplate.isValid(template)) { //给要关闭的模板解锁 - WorkContext.getCurrent().get(TplOperator.class).closeAndFreeFile(template.getPath()); + TemplateRepository.getInstance().close(template.getPath()); needCloseTemplate.add(template); } return needCloseTemplate; From 3a8e944ad60230ea56dcc5b49a57743f72930e1d Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Mon, 7 Oct 2024 20:55:52 +0800 Subject: [PATCH 12/14] =?UTF-8?q?REPORT-135233=20=E8=B0=83=E6=95=B4Decisio?= =?UTF-8?q?nOperator?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/remote/ui/CustomRoleManagerPane.java | 14 ++++---------- .../com/fr/design/remote/ui/UserManagerPane.java | 13 ++++--------- 2 files changed, 8 insertions(+), 19 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/remote/ui/CustomRoleManagerPane.java b/designer-base/src/main/java/com/fr/design/remote/ui/CustomRoleManagerPane.java index 3a0bc12672..a035153e5a 100644 --- a/designer-base/src/main/java/com/fr/design/remote/ui/CustomRoleManagerPane.java +++ b/designer-base/src/main/java/com/fr/design/remote/ui/CustomRoleManagerPane.java @@ -1,21 +1,15 @@ package com.fr.design.remote.ui; -import com.fine.theme.utils.FineUIUtils; -import com.fr.design.border.UITitledBorder; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.remote.ui.list.AddedMemberListCellRender; import com.fr.design.remote.ui.list.AddingMemberListCellRender; import com.fr.design.remote.ui.list.cell.AddedCustomRoleListCellRender; import com.fr.design.remote.ui.list.cell.AddingCustomRoleListCellRender; -import com.fr.workspace.WorkContext; import com.fr.workspace.server.authority.RemoteDesignMember; -import com.fr.workspace.server.authority.decision.DecisionOperator; +import com.fr.workspace.server.repository.authority.RemoteAuthorityRepository; -import javax.swing.BorderFactory; -import javax.swing.JPanel; -import javax.swing.border.EmptyBorder; -import java.awt.BorderLayout; +import javax.swing.*; import java.util.Collection; @@ -64,11 +58,11 @@ public class CustomRoleManagerPane extends AbstractManagerPane { @Override protected Collection getMembers(String userName, String keyWord){ - return WorkContext.getCurrent().get(DecisionOperator.class).getCustoms(userName, keyWord); + return RemoteAuthorityRepository.getInstance().getCustoms(userName, keyWord, 1, 50); } @Override protected Collection getMembers(String userName, String keyWord, int pageNum, int count){ - return WorkContext.getCurrent().get(DecisionOperator.class).getCustoms(userName, keyWord, pageNum, count); + return RemoteAuthorityRepository.getInstance().getCustoms(userName, keyWord, pageNum, count); } } diff --git a/designer-base/src/main/java/com/fr/design/remote/ui/UserManagerPane.java b/designer-base/src/main/java/com/fr/design/remote/ui/UserManagerPane.java index 25ab410615..963ddddd18 100644 --- a/designer-base/src/main/java/com/fr/design/remote/ui/UserManagerPane.java +++ b/designer-base/src/main/java/com/fr/design/remote/ui/UserManagerPane.java @@ -1,20 +1,15 @@ package com.fr.design.remote.ui; -import com.fr.design.border.UITitledBorder; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.remote.ui.list.AddedMemberListCellRender; import com.fr.design.remote.ui.list.AddingMemberListCellRender; import com.fr.design.remote.ui.list.cell.AddedUserListCellRender; import com.fr.design.remote.ui.list.cell.AddingUserListCellRender; -import com.fr.workspace.WorkContext; import com.fr.workspace.server.authority.RemoteDesignMember; -import com.fr.workspace.server.authority.decision.DecisionOperator; +import com.fr.workspace.server.repository.authority.RemoteAuthorityRepository; -import javax.swing.BorderFactory; -import javax.swing.JPanel; -import javax.swing.border.EmptyBorder; -import java.awt.BorderLayout; +import javax.swing.*; import java.util.Collection; @@ -63,11 +58,11 @@ public class UserManagerPane extends AbstractManagerPane { @Override protected Collection getMembers(String userName, String keyWord){ - return WorkContext.getCurrent().get(DecisionOperator.class).getMembers(userName, keyWord); + return RemoteAuthorityRepository.getInstance().getMembers(userName, keyWord, 1, 50); } @Override protected Collection getMembers(String userName, String keyWord, int pageNum, int count){ - return WorkContext.getCurrent().get(DecisionOperator.class).getMembers(userName, keyWord, pageNum, count); + return RemoteAuthorityRepository.getInstance().getMembers(userName, keyWord, pageNum, count); } } \ No newline at end of file From ceb90ba2974177cd68fb6984dfb69a2a45bbbb5e Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Mon, 7 Oct 2024 20:58:25 +0800 Subject: [PATCH 13/14] =?UTF-8?q?REPORT-135233=20=E8=B0=83=E6=95=B4Authori?= =?UTF-8?q?tyOperator?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/remote/action/RemoteDesignAuthManagerAction.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/remote/action/RemoteDesignAuthManagerAction.java b/designer-base/src/main/java/com/fr/design/remote/action/RemoteDesignAuthManagerAction.java index 5b00029226..397308f037 100644 --- a/designer-base/src/main/java/com/fr/design/remote/action/RemoteDesignAuthManagerAction.java +++ b/designer-base/src/main/java/com/fr/design/remote/action/RemoteDesignAuthManagerAction.java @@ -12,7 +12,7 @@ import com.fr.report.DesignAuthority; import com.fr.report.constant.RoleType; import com.fr.stable.ArrayUtils; import com.fr.workspace.WorkContext; -import com.fr.workspace.server.authority.AuthorityOperator; +import com.fr.workspace.server.repository.authority.RemoteAuthorityRepository; import java.awt.event.ActionEvent; import java.util.ArrayList; @@ -41,7 +41,7 @@ public class RemoteDesignAuthManagerAction extends UpdateAction { if (!WorkContext.getCurrent().isLocal()) { try { // 远程设计获取全部设计成员的权限列表 - DesignAuthority[] authorities = WorkContext.getCurrent().get(AuthorityOperator.class).getAuthorities(); + DesignAuthority[] authorities = RemoteAuthorityRepository.getInstance().getAllAuthorities(); List userAuthorities = new ArrayList(); List customAuthorities = new ArrayList(); if (authorities != null) { @@ -75,7 +75,7 @@ public class RemoteDesignAuthManagerAction extends UpdateAction { if (!WorkContext.getCurrent().isLocal()) { boolean success = false; try { - success = WorkContext.getCurrent().get(AuthorityOperator.class).updateAuthorities(authorities); + success = RemoteAuthorityRepository.getInstance().updateAuthorities(authorities); } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } From 4ab941d6669a7291ca21b03653f81b3d7093c373 Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Tue, 8 Oct 2024 10:31:10 +0800 Subject: [PATCH 14/14] =?UTF-8?q?REPORT-135233=20=E8=B0=83=E6=95=B4VcsOper?= =?UTF-8?q?ator?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/actions/file/PreferencePane.java | 3 +- .../com/fr/design/file/TemplateTreePane.java | 26 ++++------- .../mainframe/vcs/VcsOperatorWorker.java | 20 +++++---- .../mainframe/vcs/common/VcsHelper.java | 45 +++++++++---------- .../vcs/ui/EditFileVersionDialog.java | 19 ++++---- .../vcs/ui/FileVersionCellEditor.java | 5 ++- .../mainframe/vcs/ui/FileVersionDialog.java | 18 +++----- .../mainframe/vcs/ui/FileVersionRowPanel.java | 20 ++++----- .../mainframe/vcs/ui/FileVersionsPanel.java | 16 +++---- .../design/mainframe/vcs/ui/RecyclePane.java | 11 ++--- .../mainframe/vcs/ui/VcsCenterPane.java | 13 ++---- .../design/mainframe/vcs/ui/VcsNewPane.java | 21 +++------ 12 files changed, 90 insertions(+), 127 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java b/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java index 1babe368ec..b526b6ae2b 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java +++ b/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java @@ -64,7 +64,6 @@ import com.fr.workspace.WorkContext; import com.fr.workspace.server.entity.vcs.VcsTaskBean; import com.fr.workspace.server.repository.vcs.VcsRepository; import com.fr.workspace.server.vcs.VcsConfig; -import com.fr.workspace.server.vcs.VcsOperator; import com.fr.workspace.server.vcs.git.config.GcConfig; import com.fr.workspace.server.vcs.v2.scheduler.VcsAutoCleanSchedule; import com.fr.workspace.server.vcs.v2.scheduler.VcsAutoCleanService; @@ -1214,7 +1213,7 @@ public class PreferencePane extends BasicPane { @Override protected Boolean doInBackground() { - size = WorkContext.getCurrent().get(VcsOperator.class).immediatelyGc(); + size = VcsRepository.getInstance().immediatelyGc(); return true; } diff --git a/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java b/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java index 4eb45fface..262da62117 100644 --- a/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java +++ b/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java @@ -3,6 +3,7 @@ */ package com.fr.design.file; +import com.fanruan.repository.TemplateRepository; import com.fr.design.ExtraDesignClassManager; import com.fr.design.cache.DesignCacheManager; import com.fr.design.dialog.FineJOptionPane; @@ -11,10 +12,10 @@ import com.fr.design.gui.itree.filetree.TemplateFileTree; import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.lock.LockInfoDialog; import com.fr.design.lock.LockInfoUtils; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerFrameFileDealerPane; -import com.fr.design.lock.LockInfoDialog; import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.manager.search.TemplateTreeSearchManager; import com.fr.design.mainframe.manager.search.searcher.control.pane.TemplateSearchRemindPane; @@ -27,25 +28,20 @@ import com.fr.form.fit.web.editpreview.FileLockStateObservable; import com.fr.general.ComparatorUtils; import com.fr.general.IOUtils; import com.fr.log.FineLoggerFactory; -import com.fr.workspace.base.UserInfo; import com.fr.stable.ArrayUtils; import com.fr.stable.CoreConstants; import com.fr.stable.StableUtils; import com.fr.stable.project.ProjectConstants; import com.fr.workspace.WorkContext; +import com.fr.workspace.base.UserInfo; +import com.fr.workspace.server.repository.vcs.VcsRepository; +import org.jetbrains.annotations.Nullable; -import java.util.UUID; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.SwingUtilities; -import javax.swing.SwingWorker; -import javax.swing.ToolTipManager; +import javax.swing.*; import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.TreeNode; import javax.swing.tree.TreePath; -import java.awt.BorderLayout; -import java.awt.Desktop; -import java.awt.Dimension; +import java.awt.*; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.awt.event.MouseAdapter; @@ -60,14 +56,10 @@ import java.util.Objects; import java.util.Observable; import java.util.Observer; import java.util.Set; +import java.util.UUID; import java.util.concurrent.ExecutionException; import java.util.stream.Collectors; -import com.fanruan.repository.TemplateRepository; -import com.fr.workspace.server.vcs.VcsOperator; -import org.jetbrains.annotations.Nullable; - - import static javax.swing.JOptionPane.WARNING_MESSAGE; import static javax.swing.JOptionPane.YES_NO_OPTION; @@ -408,7 +400,7 @@ public class TemplateTreePane extends JPanel implements FileOperations { if (nodeFILE.exists()) { if (!VcsHelper.getInstance().isLegacyMode()) { try { - WorkContext.getCurrent().get(VcsOperator.class).recycleVersion(VcsHelper.getInstance().getCurrentUsername(), nodeFILE.getPath()); + VcsRepository.getInstance().recycleVersion(VcsHelper.getInstance().getCurrentUsername(), nodeFILE.getPath()); } catch (Exception e) { FineLoggerFactory.getLogger().error("[VcsV2] recycle {} failed", nodeFILE.getName()); } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/VcsOperatorWorker.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/VcsOperatorWorker.java index 799abcf17c..99c1187bc3 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/VcsOperatorWorker.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/VcsOperatorWorker.java @@ -9,12 +9,12 @@ import com.fr.log.FineLoggerFactory; import com.fr.report.entity.VcsEntity; import com.fr.stable.StringUtils; import com.fr.workspace.WorkContext; +import com.fr.workspace.server.entity.vcs.VcsBean; +import com.fr.workspace.server.repository.vcs.VcsRepository; import com.fr.workspace.server.vcs.VcsOperator; import com.fr.workspace.server.vcs.v2.VcsTaskResult; -import javax.swing.SwingUtilities; -import javax.swing.SwingWorker; -import java.util.ArrayList; +import javax.swing.*; import java.util.List; import java.util.concurrent.ExecutionException; @@ -108,7 +108,7 @@ public class VcsOperatorWorker { VcsProcessFailedWrapper wrapper = new VcsProcessFailedWrapper(); startProcess(vcsEntities, wrapper, (vcsEntity, operator) -> { String fileName = vcsEntity.getFilename(); - VcsTaskResult result = operator.restoreVersion(fileName); + VcsTaskResult result = VcsRepository.getInstance().restoreVersion(fileName); if (!result.isSuccess()) { wrapper.addFailedEntity(vcsEntity); } @@ -129,9 +129,9 @@ public class VcsOperatorWorker { String fileName = vcsEntity.getFilename(); VcsTaskResult result; if (all) { - result = operator.deleteVersionForRecycle(fileName); + result = VcsRepository.getInstance().deleteVersionForRecycle(fileName); } else { - result = operator.deleteVersion(fileName, vcsEntity.getVersion(), VcsEntity.CommitType.TYPE_DEFAULT); + result = VcsRepository.getInstance().deleteVersion(new VcsBean(new VcsEntity(null, null, fileName, null, null, vcsEntity.getVersion(), 0, VcsEntity.CommitType.TYPE_DEFAULT))); } if (!result.isSuccess()) { wrapper.addFailedEntity(vcsEntity); @@ -148,7 +148,7 @@ public class VcsOperatorWorker { */ public void doDelete(VcsEntity entity, VcsTableOperatorListener listener) { String fileName = entity.getFilename(); - start4Single(entity, (vcsEntity, operator) -> operator.deleteVersionForRecycle(fileName), fileName + everyFailedStr, listener); + start4Single(entity, (vcsEntity, operator) -> VcsRepository.getInstance().deleteVersionForRecycle(fileName), fileName + everyFailedStr, listener); } /** @@ -160,7 +160,9 @@ public class VcsOperatorWorker { String fileName = entity.getFilename(); int version = entity.getVersion(); VcsEntity.CommitType commitType = entity.getCommitType(); - start4Single(entity, (vcsEntity, operator) -> operator.deleteVersion(fileName, version, commitType), fileName + everyFailedStr, listener); + start4Single(entity, (vcsEntity, operator) -> + VcsRepository.getInstance().deleteVersion(new VcsBean(new VcsEntity(null, null, fileName, null, null, version, 0, commitType))), + fileName + everyFailedStr, listener); } @@ -171,7 +173,7 @@ public class VcsOperatorWorker { */ public void updateEntityAnnotation(VcsEntity entity, VcsTableOperatorListener listener) { start4Single(entity, (vcsEntity, operator) -> { - operator.updateVersion(entity); + VcsRepository.getInstance().updateVersion(new VcsBean(entity)); return new VcsTaskResult(true); }, everyFailedStr, listener); } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java index 15787348fe..082faf09fd 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java @@ -24,19 +24,19 @@ import com.fr.plugin.manage.PluginManager; import com.fr.report.entity.VcsEntity; import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; -import com.fr.stable.project.ProjectConstants; import com.fr.workspace.WorkContext; import com.fr.workspace.Workspace; import com.fr.workspace.WorkspaceEvent; +import com.fr.workspace.server.entity.vcs.VcsBean; +import com.fr.workspace.server.entity.vcs.VcsQuery; +import com.fr.workspace.server.repository.vcs.VcsRepository; import com.fr.workspace.server.vcs.VcsFileUtils; import com.fr.workspace.server.vcs.VcsOperator; -import com.fr.workspace.server.vcs.filesystem.VcsFileSystem; import com.fr.workspace.server.vcs.git.config.GcConfig; -import javax.swing.Icon; -import javax.swing.SwingUtilities; +import javax.swing.*; import javax.swing.border.EmptyBorder; -import java.awt.Color; +import java.awt.*; import java.util.List; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; @@ -84,7 +84,7 @@ public class VcsHelper implements JTemplateActionListener { // 开了设计器启动页面时一开始取不到VcsOperator,通过下面的切换环境事件再取,这边判断下 if (op != null) { try { - legacyMode = op.isLegacyMode(); + legacyMode = VcsRepository.getInstance().isLegacyMode(); root = WorkContext.getCurrent().isLocal() || WorkContext.getCurrent().isRoot(); } catch (Exception e) { legacyMode = true; @@ -96,7 +96,7 @@ public class VcsHelper implements JTemplateActionListener { @Override protected void on(Event event) { try { - legacyMode = WorkContext.getCurrent().get(VcsOperator.class).isLegacyMode(); + legacyMode = VcsRepository.getInstance().isLegacyMode(); FineLoggerFactory.getLogger().info("[VcsHelper] legacyMode:{}", legacyMode); } catch (Exception e) { //保险起见走老逻辑 @@ -217,22 +217,22 @@ public class VcsHelper implements JTemplateActionListener { public void run() { String fileName = getEditingFilename(); VcsOperator operator = WorkContext.getCurrent().get(VcsOperator.class); - VcsEntity entity = operator.getFileVersionByIndex(fileName, 0); + VcsEntity entity = VcsRepository.getInstance().getVersion(new VcsQuery(fileName, 0, null, null)); boolean replace = needDeleteVersion(entity); int latestFileVersion = 0; if (entity != null) { latestFileVersion = entity.getVersion(); } if (jt.getEditingFILE() instanceof VcsCacheFileNodeFile) { - operator.saveVersionFromCache(getCurrentUsername(), fileName, StringUtils.EMPTY, latestFileVersion + 1, replace); + VcsRepository.getInstance().saveVersionFromCache(new VcsBean(new VcsEntity(getCurrentUsername(), StringUtils.EMPTY, fileName, null, null, latestFileVersion + 1), replace)); String path = DesignerFrameFileDealerPane.getInstance().getSelectedOperation().getFilePath(); - List updatedList = WorkContext.getCurrent().get(VcsOperator.class).getVersions(path.replaceFirst(VCS_FILE_SLASH, StringUtils.EMPTY)); + List updatedList = VcsRepository.getInstance().getVersions(new VcsQuery(path.replaceFirst(VCS_FILE_SLASH, StringUtils.EMPTY))); SwingUtilities.invokeLater(() -> FileVersionTable.getInstance().updateModel(1, updatedList)); } else { - operator.saveVersion(getCurrentUsername(), fileName, StringUtils.EMPTY, latestFileVersion + 1, replace); + VcsRepository.getInstance().saveVersion(new VcsBean(new VcsEntity(getCurrentUsername(), StringUtils.EMPTY, fileName, null, null, latestFileVersion + 1), replace).setUseVersion(true)); } if (GcConfig.getInstance().isGcEnable()) { - operator.gc(); + VcsRepository.getInstance().gc(); } } @@ -252,21 +252,20 @@ public class VcsHelper implements JTemplateActionListener { moveVcs.execute(new Runnable() { @Override public void run() { - VcsOperator operator = WorkContext.getCurrent().get(VcsOperator.class); String oldPath = oldName.replaceFirst(VCS_FILE_SLASH, StringUtils.EMPTY); - List oldVcsEntities = operator.getVersions(oldPath); + List oldVcsEntities = VcsRepository.getInstance().getVersions(new VcsQuery(oldPath)); String replaceName = newName.replaceFirst(VCS_FILE_SLASH, StringUtils.EMPTY); for (VcsEntity oldVcsEntity : oldVcsEntities) { if (!VcsHelper.getInstance().isLegacyMode()) { - operator.renameVersion(oldVcsEntity, replaceName); + VcsRepository.getInstance().renameVersion(new VcsBean(oldVcsEntity, replaceName)); } else { - operator.saveVersion(oldVcsEntity.getUsername(), replaceName, oldVcsEntity.getCommitMsg(), oldVcsEntity.getVersion()); - operator.deleteVersion(oldPath, oldVcsEntity.getVersion()); + VcsRepository.getInstance().saveVersion(new VcsBean(new VcsEntity(oldVcsEntity.getUsername(), oldVcsEntity.getCommitMsg(), replaceName, null, null, oldVcsEntity.getVersion())).setUseVersion(true)); + VcsRepository.getInstance().deleteVersion(new VcsBean(new VcsEntity(null, null, oldPath, null, null, oldVcsEntity.getVersion()))); } } FineLoggerFactory.getLogger().debug("moveVcs success. from {} to {}", oldName, replaceName); if (GcConfig.getInstance().isGcEnable() && VcsHelper.getInstance().isLegacyMode()) { - operator.gc(); + VcsRepository.getInstance().gc(); } } }); @@ -314,7 +313,7 @@ public class VcsHelper implements JTemplateActionListener { public void fireAutoSaveVcs(final JTemplate jt) { String fileName = getEditingFilename(); VcsOperator operator = WorkContext.getCurrent().get(VcsOperator.class); - VcsEntity entity = operator.getFileVersionByIndex(fileName, 0); + VcsEntity entity = VcsRepository.getInstance().getVersion(new VcsQuery(fileName, 0, null, null)); boolean replace = needDeleteVersion(entity); int latestFileVersion = 0; if (entity != null) { @@ -327,22 +326,22 @@ public class VcsHelper implements JTemplateActionListener { private void doSave(JTemplate jt, String fileName, int latestFileVersion, boolean replace, VcsOperator operator) { if (jt.getEditingFILE() instanceof VcsCacheFileNodeFile) { - operator.saveVersionFromCache(getCurrentUsername(), fileName, StringUtils.EMPTY, latestFileVersion + 1, replace); + VcsRepository.getInstance().saveVersionFromCache(new VcsBean(new VcsEntity(getCurrentUsername(), StringUtils.EMPTY, fileName, null, null, latestFileVersion + 1), replace)); String path = DesignerFrameFileDealerPane.getInstance().getSelectedOperation().getFilePath(); - List updatedList = WorkContext.getCurrent().get(VcsOperator.class).getVersions(path.replaceFirst(VCS_FILE_SLASH, StringUtils.EMPTY)); + List updatedList = VcsRepository.getInstance().getVersions(new VcsQuery(path.replaceFirst(VCS_FILE_SLASH, StringUtils.EMPTY))); SwingUtilities.invokeLater(() -> FileVersionTable.getInstance().updateModel(1, updatedList)); } else { autoSave(jt, getCurrentUsername(), fileName, latestFileVersion + 1, replace, operator); } if (GcConfig.getInstance().isGcEnable()) { - operator.gc(); + VcsRepository.getInstance().gc(); } } private void autoSave(JTemplate jt, String currentUsername, String fileName, int nowVersion, boolean replace, VcsOperator operator) { try { if (JTemplate.isValid(jt) && !jt.isALLSaved()) { - operator.autoSave(currentUsername, fileName, StringUtils.EMPTY, nowVersion, jt.exportData(), replace); + VcsRepository.getInstance().autoSave(new VcsBean(new VcsEntity(currentUsername, StringUtils.EMPTY, fileName, null, null, nowVersion), replace, jt.exportData())); } } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage()); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/EditFileVersionDialog.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/EditFileVersionDialog.java index db92ab3eef..64568feac4 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/EditFileVersionDialog.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/EditFileVersionDialog.java @@ -18,14 +18,12 @@ import com.fr.design.mainframe.DesignerFrameFileDealerPane; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.report.entity.VcsEntity; import com.fr.stable.StringUtils; -import com.fr.workspace.WorkContext; -import com.fr.workspace.server.vcs.VcsOperator; - -import javax.swing.JPanel; -import java.awt.BorderLayout; -import java.awt.Component; -import java.awt.Dimension; -import java.awt.Frame; +import com.fr.workspace.server.entity.vcs.VcsBean; +import com.fr.workspace.server.entity.vcs.VcsQuery; +import com.fr.workspace.server.repository.vcs.VcsRepository; + +import javax.swing.*; +import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -118,11 +116,12 @@ public class EditFileVersionDialog extends UIDialog { */ public void doOK() { entity.setCommitMsg(msgTestArea.getText()); - WorkContext.getCurrent().get(VcsOperator.class).updateVersion(entity); + VcsRepository.getInstance().updateVersion(new VcsBean(entity)); setVisible(false); String path = DesignerFrameFileDealerPane.getInstance().getSelectedOperation().getFilePath(); FileVersionTable table = FileVersionTable.getInstance(); - table.updateModel(table.getSelectedRow(), WorkContext.getCurrent().get(VcsOperator.class).getVersions(path.replaceFirst("/", StringUtils.EMPTY))); + + table.updateModel(table.getSelectedRow(), VcsRepository.getInstance().getVersions(new VcsQuery(path.replaceFirst("/", StringUtils.EMPTY)))); } public UITextArea getMsgTestArea() { diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionCellEditor.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionCellEditor.java index 8cff3ffbb1..7d161ead0d 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionCellEditor.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionCellEditor.java @@ -13,6 +13,7 @@ import com.fr.report.entity.VcsEntity; import com.fr.stable.AssistUtils; import com.fr.stable.StringUtils; import com.fr.workspace.WorkContext; +import com.fr.workspace.server.repository.vcs.VcsRepository; import com.fr.workspace.server.vcs.VcsOperator; import javax.swing.AbstractCellEditor; @@ -43,10 +44,10 @@ public class FileVersionCellEditor extends AbstractCellEditor implements TableCe return editor; } else if (row == 0) { String path = DesignerFrameFileDealerPane.getInstance().getSelectedOperation().getFilePath(); - fileOfVersion = vcsOperator.getFileOfCurrent(path.replaceFirst("/", "")); + fileOfVersion = VcsRepository.getInstance().getFileOfCurrent(path.replaceFirst("/", "")); } else { renderAndEditor.update((VcsEntity) value); - fileOfVersion = vcsOperator.getFileOfFileVersion(((VcsEntity) value).getFilename(), ((VcsEntity) value).getVersion()); + fileOfVersion = VcsRepository.getInstance().getFileOfFileVersion(((VcsEntity) value).getFilename(), ((VcsEntity) value).getVersion(), StringUtils.EMPTY); } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionDialog.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionDialog.java index f023b6b92f..57b9d27d5f 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionDialog.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionDialog.java @@ -1,6 +1,5 @@ package com.fr.design.mainframe.vcs.ui; -import com.fr.analysis.cloud.DateUtils; import com.fr.design.dialog.UIDialog; import com.fr.design.editor.editor.DateEditor; import com.fr.design.gui.date.UIDatePicker; @@ -11,18 +10,11 @@ import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.vcs.common.VcsHelper; import com.fr.report.entity.VcsEntity; import com.fr.stable.StringUtils; -import com.fr.workspace.WorkContext; -import com.fr.workspace.server.vcs.VcsOperator; +import com.fr.workspace.server.entity.vcs.VcsQuery; +import com.fr.workspace.server.repository.vcs.VcsRepository; -import javax.swing.AbstractAction; -import javax.swing.BorderFactory; -import javax.swing.Box; -import javax.swing.JPanel; -import java.awt.BorderLayout; -import java.awt.Dimension; -import java.awt.FlowLayout; -import java.awt.Frame; -import java.awt.Window; +import javax.swing.*; +import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Calendar; @@ -70,7 +62,7 @@ public class FileVersionDialog extends UIDialog { Date editorDate = dateEditor.getValue(); Date start = editorDate == null ? new Date(0) : editorDate; Date end = editorDate == null ? getLastHour() : new Date(start.getTime() + DELAY); - List vcsEntities = WorkContext.getCurrent().get(VcsOperator.class).getFilterVersions(fileName, start, end, textField.getText()); + List vcsEntities = VcsRepository.getInstance().getVersions(new VcsQuery(fileName, start, end, textField.getText())); FileVersionTable.getInstance().updateModel(1, vcsEntities); } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionRowPanel.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionRowPanel.java index 2bd441c19e..b6dce1fd8f 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionRowPanel.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionRowPanel.java @@ -10,19 +10,16 @@ import com.fr.design.mainframe.vcs.common.VcsHelper; import com.fr.log.FineLoggerFactory; import com.fr.report.entity.VcsEntity; import com.fr.stable.StringUtils; -import com.fr.workspace.WorkContext; -import com.fr.workspace.server.vcs.VcsOperator; +import com.fr.workspace.server.entity.vcs.VcsBean; +import com.fr.workspace.server.entity.vcs.VcsQuery; +import com.fr.workspace.server.repository.vcs.VcsRepository; -import javax.swing.Box; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.SwingConstants; +import javax.swing.*; import javax.swing.text.BadLocationException; import javax.swing.text.Style; import javax.swing.text.StyleConstants; import javax.swing.text.StyledDocument; -import java.awt.BorderLayout; -import java.awt.Color; +import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.text.SimpleDateFormat; @@ -65,7 +62,7 @@ public class FileVersionRowPanel extends JPanel { if (FineJOptionPane.showConfirmDialog(null, Toolkit.i18nText("Fine-Design_Vcs_Version_Revert_Confirm"), Toolkit.i18nText("Fine-Design_Vcs_Version_Revert_Title"), JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) { vcsEntity.setUsername(VcsHelper.getInstance().getCurrentUsername()); - WorkContext.getCurrent().get(VcsOperator.class).rollbackTo(vcsEntity); + VcsRepository.getInstance().rollbackTo(new VcsBean(vcsEntity)); FileVersionsPanel.getInstance().exitVcs(vcsEntity.getFilename()); } } @@ -79,14 +76,15 @@ public class FileVersionRowPanel extends JPanel { if (FineJOptionPane.showConfirmDialog(null, Toolkit.i18nText("Fine-Design_Vcs_Delete-Confirm"), Toolkit.i18nText("Fine-Design_Vcs_Remove"), JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) { try { - WorkContext.getCurrent().get(VcsOperator.class).deleteVersion(vcsEntity.getFilename(), vcsEntity.getVersion()); + VcsRepository.getInstance().deleteVersion(new VcsBean(new VcsEntity(null, null, vcsEntity.getFilename(), null, null, vcsEntity.getVersion()))); } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage()); } FileVersionTable table = (FileVersionTable) (FileVersionRowPanel.this.getParent()); String path = DesignerFrameFileDealerPane.getInstance().getSelectedOperation().getFilePath(); try { - table.updateModel(table.getSelectedRow() - 1, WorkContext.getCurrent().get(VcsOperator.class).getVersions(path.replaceFirst("/", ""))); + table.updateModel(table.getSelectedRow() - 1, + VcsRepository.getInstance().getVersions(new VcsQuery(path.replaceFirst("/", "")))); } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage()); } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionsPanel.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionsPanel.java index 58393a3067..3207c1fbc2 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionsPanel.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionsPanel.java @@ -20,14 +20,11 @@ import com.fr.file.FileNodeFILE; import com.fr.file.filetree.FileNode; import com.fr.stable.StableUtils; import com.fr.stable.project.ProjectConstants; -import com.fr.workspace.WorkContext; -import com.fr.workspace.server.vcs.VcsOperator; - -import javax.swing.BorderFactory; -import javax.swing.Box; -import javax.swing.SwingConstants; -import java.awt.BorderLayout; -import java.awt.Dimension; +import com.fr.workspace.server.entity.vcs.VcsQuery; +import com.fr.workspace.server.repository.vcs.VcsRepository; + +import javax.swing.*; +import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -134,7 +131,8 @@ public class FileVersionsPanel extends BasicPane { } titleLabel.setText(filename); String path = DesignerFrameFileDealerPane.getInstance().getSelectedOperation().getFilePath(); - FileVersionTable.getInstance().updateModel(1, WorkContext.getCurrent().get(VcsOperator.class).getVersions(path.replaceFirst("/", ""))); + + FileVersionTable.getInstance().updateModel(1, VcsRepository.getInstance().getVersions(new VcsQuery(path.replaceFirst("/", "")))); } public void showFileVersionsPane() { diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/RecyclePane.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/RecyclePane.java index aca6ad2409..d89838e362 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/RecyclePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/RecyclePane.java @@ -11,20 +11,17 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.DesignerContext; -import com.fr.design.mainframe.vcs.VcsOperatorWorker; import com.fr.design.mainframe.vcs.TableEntity; import com.fr.design.mainframe.vcs.TableValueOperator; +import com.fr.design.mainframe.vcs.VcsOperatorWorker; import com.fr.design.mainframe.vcs.VcsProcessFailedWrapper; import com.fr.design.mainframe.vcs.VcsTableEntity; import com.fr.design.mainframe.vcs.VcsTableOperatorListener; import com.fr.report.entity.VcsEntity; import com.fr.stable.StringUtils; -import com.fr.workspace.WorkContext; -import com.fr.workspace.server.vcs.VcsOperator; +import com.fr.workspace.server.repository.vcs.VcsRepository; -import javax.swing.Icon; -import javax.swing.JOptionPane; -import javax.swing.JPanel; +import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -101,7 +98,7 @@ public class RecyclePane extends AbstractSupportSelectTablePane @Override protected List getTableList() { - List entityList = WorkContext.getCurrent().get(VcsOperator.class).getRecycleEntities(); + List entityList = VcsRepository.getInstance().getRecycleEntities(); List tableEntities = new ArrayList<>(); for (VcsEntity entity : entityList) { tableEntities.add(new VcsTableEntity(entity)); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsCenterPane.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsCenterPane.java index b95b35b7de..d9d67e4dff 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsCenterPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsCenterPane.java @@ -9,7 +9,6 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.vcs.VcsOperatorWorker; - import com.fr.design.mainframe.vcs.VcsTableEntity; import com.fr.design.mainframe.vcs.VcsTableOperatorListener; import com.fr.design.mainframe.vcs.common.VcsCloseTemplateHelper; @@ -17,15 +16,9 @@ import com.fr.file.FileNodeFILE; import com.fr.file.filetree.FileNode; import com.fr.report.entity.VcsEntity; import com.fr.stable.StringUtils; -import com.fr.workspace.WorkContext; -import com.fr.workspace.server.vcs.VcsOperator; +import com.fr.workspace.server.repository.vcs.VcsRepository; -import javax.swing.Icon; -import javax.swing.JComponent; -import javax.swing.JOptionPane; -import javax.swing.JTable; -import javax.swing.SwingWorker; -import javax.swing.UIManager; +import javax.swing.*; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.util.ArrayList; @@ -211,7 +204,7 @@ public class VcsCenterPane extends VcsNewPane { @Override protected List getTableList() { - List entities = WorkContext.getCurrent().get(VcsOperator.class).getEveryVersion(); + List entities = VcsRepository.getInstance().getEveryVersion(); List tableEntities = new ArrayList<>(); for (VcsEntity entity : entities) { tableEntities.add(new VcsTableEntity(entity)); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsNewPane.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsNewPane.java index f0615bfa49..5a413cf954 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsNewPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsNewPane.java @@ -1,7 +1,6 @@ package com.fr.design.mainframe.vcs.ui; import com.fine.theme.icon.LazyIcon; -import com.fr.base.svg.IconUtils; import com.fr.design.dialog.FineJOptionPane; import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.file.MultiTemplateTabPane; @@ -18,8 +17,6 @@ import com.fr.design.mainframe.vcs.common.VcsCacheFileNodeFile; import com.fr.design.mainframe.vcs.common.VcsHelper; import com.fr.file.FileNodeFILE; import com.fr.file.filetree.FileNode; -import com.fr.file.filetree.FileNodes; -import com.fr.io.utils.ResourceIOUtils; import com.fr.report.InconsistentLockException; import com.fr.report.entity.VcsEntity; import com.fr.stable.StableUtils; @@ -27,16 +24,13 @@ import com.fr.stable.StringUtils; import com.fr.stable.project.ProjectConstants; import com.fr.workspace.WorkContext; import com.fr.workspace.resource.WorkResource; +import com.fr.workspace.server.entity.vcs.VcsBean; +import com.fr.workspace.server.entity.vcs.VcsQuery; +import com.fr.workspace.server.repository.vcs.VcsRepository; import com.fr.workspace.server.vcs.VcsFileUtils; -import com.fr.workspace.server.vcs.VcsOperator; import com.fr.workspace.server.vcs.v2.VcsTaskResult; -import javax.swing.Icon; -import javax.swing.JComponent; -import javax.swing.JOptionPane; -import javax.swing.JTable; -import javax.swing.SwingWorker; -import javax.swing.UIManager; +import javax.swing.*; import java.awt.*; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; @@ -196,7 +190,7 @@ public class VcsNewPane extends RecyclePane { //step1.设置还原的用户名 entity.setUsername(VcsHelper.getInstance().getCurrentUsername()); //step2.rollback到指定版本 - WorkContext.getCurrent().get(VcsOperator.class).rollbackTo(entity); + VcsRepository.getInstance().rollbackTo(new VcsBean(entity)); //最里面的文件系统的write会吞异常,这边就一直默认成功吧,日志里会体现失败的情况 return new VcsTaskResult(true); } @@ -294,8 +288,7 @@ public class VcsNewPane extends RecyclePane { @Override protected String doInBackground() throws Exception { //step1.将指定版本的历史文件读取出来,加上前缀放到cache中 - VcsOperator vcsOperator = WorkContext.getCurrent().get(VcsOperator.class); - String fileOfVersion = vcsOperator.getFileOfFileVersion( + String fileOfVersion = VcsRepository.getInstance().getFileOfFileVersion( entity.getFilename(), entity.getVersion(), Toolkit.i18nText("Fine-Design_Vcs_Prefix", entity.getVersion())); @@ -320,7 +313,7 @@ public class VcsNewPane extends RecyclePane { @Override protected List getTableList() { - List entityList = WorkContext.getCurrent().get(VcsOperator.class).getVersions(VcsFileUtils.dealWithFilePath(filePath)); + List entityList = VcsRepository.getInstance().getVersions(new VcsQuery(VcsFileUtils.dealWithFilePath(filePath))); List tableEntities = new ArrayList<>(); for (VcsEntity entity : entityList) { tableEntities.add(new VcsTableEntity(entity));