Browse Source

Merge pull request #14986 in DESIGN/design from fbp/release to fbp/feature

* commit 'b09cf5abd277f3a9a14838a088e122e0cfb886e7':
  REPORT-135233 调整VcsOperator
  REPORT-135233 调整AuthorityOperator
  REPORT-135233 调整DecisionOperator
  REPORT-135233 调整TplOperator
  REPORT-135233 调整DataBaseTypeOperator
  REPORT-135233 调整TemplateExportOperator
  REPORT-135233 调整OrganizationOperator
  REPORT-135233 调整TemplateChecker
  REPORT-135233 调整VcsAutoCleanOperator
  REPORT-135233 调整DataFetcher,CommitHelper
  REPORT-135233 调整LockInfoOperator
  REPORT-135233 调整ShareEmbeddedConverter
  REPORT-135233 调整TableDataOperator和ConnectionOperator
  REPORT-135233 调整FileNodes
fbp/feature
superman 2 months ago
parent
commit
cb6c2ec717
  1. 7
      designer-base/src/main/java/com/fr/design/actions/file/LocalePane.java
  2. 47
      designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java
  3. 12
      designer-base/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java
  4. 16
      designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java
  5. 12
      designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/setting/TableDataDesensitizationTablePane.java
  6. 26
      designer-base/src/main/java/com/fr/design/file/MultiTemplateTabPane.java
  7. 4
      designer-base/src/main/java/com/fr/design/file/TemplateDirTreePane.java
  8. 26
      designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java
  9. 3
      designer-base/src/main/java/com/fr/design/file/impl/DefaultTemplateResource.java
  10. 10
      designer-base/src/main/java/com/fr/design/gui/itree/filetree/EnvFileTree.java
  11. 3
      designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileNodeComparator.java
  12. 3
      designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileNodeConstants.java
  13. 5
      designer-base/src/main/java/com/fr/design/gui/itree/filetree/TemplateDirTree.java
  14. 5
      designer-base/src/main/java/com/fr/design/gui/itree/filetree/TemplateFileTree.java
  15. 4
      designer-base/src/main/java/com/fr/design/javascript/EmailPane.java
  16. 4
      designer-base/src/main/java/com/fr/design/lock/TemplateLockInfoReSave.java
  17. 21
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java
  18. 27
      designer-base/src/main/java/com/fr/design/mainframe/ForbiddenPane.java
  19. 16
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java
  20. 44
      designer-base/src/main/java/com/fr/design/mainframe/check/CheckButton.java
  21. 20
      designer-base/src/main/java/com/fr/design/mainframe/vcs/VcsOperatorWorker.java
  22. 8
      designer-base/src/main/java/com/fr/design/mainframe/vcs/VcsRecycleSettingHelper.java
  23. 9
      designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsCacheFileNodeFile.java
  24. 45
      designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java
  25. 19
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/EditFileVersionDialog.java
  26. 5
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionCellEditor.java
  27. 18
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionDialog.java
  28. 20
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionRowPanel.java
  29. 16
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionsPanel.java
  30. 11
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/RecyclePane.java
  31. 13
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsCenterPane.java
  32. 21
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsNewPane.java
  33. 6
      designer-base/src/main/java/com/fr/design/remote/action/RemoteDesignAuthManagerAction.java
  34. 14
      designer-base/src/main/java/com/fr/design/remote/ui/CustomRoleManagerPane.java
  35. 13
      designer-base/src/main/java/com/fr/design/remote/ui/UserManagerPane.java
  36. 2
      designer-base/src/main/java/com/fr/design/roleAuthority/RoleDataWrapper.java
  37. 14
      designer-base/src/main/java/com/fr/design/utils/TemplateUtils.java
  38. 3
      designer-base/src/main/java/com/fr/file/FILEChooserPane.java
  39. 4
      designer-base/src/main/java/com/fr/file/FileNodeFILE.java
  40. 14
      designer-base/src/main/java/com/fr/nx/app/designer/transform/ui/TransformFileTree.java
  41. 20
      designer-form/src/main/java/com/fr/design/mainframe/share/generate/task/ComponentCreator.java
  42. 2
      designer-realize/src/main/java/com/fanruan/boot/env/DesignEnvComponent.java
  43. 23
      designer-realize/src/main/java/com/fanruan/boot/init/DesignWorkContextComponent.java
  44. 2
      designer-realize/src/main/java/com/fanruan/config/LocalConfigSource.java
  45. 23
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/FileSearchManager.java
  46. 2
      designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/desensitization/model/UpdateDataWorker.java

7
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;
}

47
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,18 @@ 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 +88,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 +516,7 @@ public class PreferencePane extends BasicPane {
new SwingWorker<Boolean, Void>() {
@Override
protected Boolean doInBackground() throws Exception {
return WorkContext.getCurrent().get(VcsAutoCleanOperator.class).isSupport();
return VcsRepository.getInstance().isSupport();
}
@Override
protected void done() {
@ -1175,12 +1150,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);
}
}
}
@ -1238,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;
}

12
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<E extends JTemplate<?, ?>> 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);
}

16
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<List<String>, Void> getSupportedTypesWorker = new SwingWorker<List<String>, Void>() {
@Override
protected List<String> 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 {

12
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;

26
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());
}
}
}

4
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();
}

26
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.fr.workspace.server.repository.template.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());
}

3
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;

10
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);
}

3
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;

3
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;

5
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;

5
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;

4
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;

4
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));
}
};

21
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;
@ -52,14 +53,12 @@ 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;
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;
@ -67,22 +66,10 @@ 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 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;
@ -252,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);

27
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

16
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,18 +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.WorkplaceConstants;
import com.fr.workspace.server.repository.connection.ConnectionRepository;
import com.fr.workspace.server.repository.template.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;
@ -937,12 +931,12 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
// 目标本地文件
!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 {

44
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<String> check(JTemplate jtemplate) {
String path = jtemplate.getEditingFILE().getEnvFullName();
Set<String> fontSet = WorkContext.getCurrent().get(TemplateChecker.class, new ExceptionHandler<Void>() {
@Override
public Void callHandler(RPCInvokerExceptionInfo rpcInvokerExceptionInfo) {
imageLabel.setIcon(new LazyIcon("error", 20));
message.setText("<html>" + Toolkit.i18nText("Fine_Designer_Check_Font_Upgrade") + "</html>");
okButton.setEnabled(true);
return null;
}
}).checkFont(path);
Set<String> fontSet = null;
try {
fontSet = TemplateRepository.getInstance().checkFont(path);
} catch (Exception e) {
imageLabel.setIcon(new LazyIcon("error", 20));
message.setText("<html>" + Toolkit.i18nText("Fine_Designer_Check_Font_Upgrade") + "</html>");
okButton.setEnabled(true);
return null;
}
return fontSet;
}

20
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);
}

8
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));
}
});
}

9
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")

45
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<VcsEntity> updatedList = WorkContext.getCurrent().get(VcsOperator.class).getVersions(path.replaceFirst(VCS_FILE_SLASH, StringUtils.EMPTY));
List<VcsEntity> 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<VcsEntity> oldVcsEntities = operator.getVersions(oldPath);
List<VcsEntity> 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<VcsEntity> updatedList = WorkContext.getCurrent().get(VcsOperator.class).getVersions(path.replaceFirst(VCS_FILE_SLASH, StringUtils.EMPTY));
List<VcsEntity> 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());

19
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() {

5
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);
}

18
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<VcsEntity> vcsEntities = WorkContext.getCurrent().get(VcsOperator.class).getFilterVersions(fileName, start, end, textField.getText());
List<VcsEntity> vcsEntities = VcsRepository.getInstance().getVersions(new VcsQuery(fileName, start, end, textField.getText()));
FileVersionTable.getInstance().updateModel(1, vcsEntities);
}

20
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());
}

16
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() {

11
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<VcsTableEntity>
@Override
protected List<VcsTableEntity> getTableList() {
List<VcsEntity> entityList = WorkContext.getCurrent().get(VcsOperator.class).getRecycleEntities();
List<VcsEntity> entityList = VcsRepository.getInstance().getRecycleEntities();
List<VcsTableEntity> tableEntities = new ArrayList<>();
for (VcsEntity entity : entityList) {
tableEntities.add(new VcsTableEntity(entity));

13
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<VcsTableEntity> getTableList() {
List<VcsEntity> entities = WorkContext.getCurrent().get(VcsOperator.class).getEveryVersion();
List<VcsEntity> entities = VcsRepository.getInstance().getEveryVersion();
List<VcsTableEntity> tableEntities = new ArrayList<>();
for (VcsEntity entity : entities) {
tableEntities.add(new VcsTableEntity(entity));

21
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<VcsTableEntity> getTableList() {
List<VcsEntity> entityList = WorkContext.getCurrent().get(VcsOperator.class).getVersions(VcsFileUtils.dealWithFilePath(filePath));
List<VcsEntity> entityList = VcsRepository.getInstance().getVersions(new VcsQuery(VcsFileUtils.dealWithFilePath(filePath)));
List<VcsTableEntity> tableEntities = new ArrayList<>();
for (VcsEntity entity : entityList) {
tableEntities.add(new VcsTableEntity(entity));

6
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<DesignAuthority> userAuthorities = new ArrayList<DesignAuthority>();
List<DesignAuthority> customAuthorities = new ArrayList<DesignAuthority>();
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);
}

14
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<RemoteDesignMember> 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<RemoteDesignMember> 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);
}
}

13
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<RemoteDesignMember> 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<RemoteDesignMember> 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);
}
}

2
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; /** * 将权限细粒度的角色数据包装一下,区分报表平台管理角色和数据决策系统角色 * <p/> * Author : daisy * Date: 13-8-30 * Time: 下午3:42 */ public class RoleDataWrapper implements ChildrenNodesLoader { private List<String> rolelist = new ArrayList<String>(); 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<String> 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; } }
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; /** * 将权限细粒度的角色数据包装一下,区分报表平台管理角色和数据决策系统角色 * <p/> * Author : daisy * Date: 13-8-30 * Time: 下午3:42 */ public class RoleDataWrapper implements ChildrenNodesLoader { private List<String> rolelist = new ArrayList<String>(); 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<String> 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; } }

14
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;

3
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;

4
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;

14
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);
}

20
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<String, TableData> map = embeddedConverter.convertToEmbeddedTableData(tpl, paraMap);
Map<String, TableData> map = convertToEmbeddedTableData(tpl, paraMap);
Iterator<Map.Entry<String, TableData>> iterator = map.entrySet().iterator();
while (iterator.hasNext()) {
Map.Entry<String, TableData> entry = iterator.next();
@ -123,6 +125,16 @@ public class ComponentCreator extends AbstractComponentCreatorProcessor {
return tpl;
}
private Map<String, TableData> convertToEmbeddedTableData(TableDataSource tableDataSource, Map parameterMap) throws Exception {
PreviewSourceBean bean = new PreviewSourceBean(tableDataSource, StringUtils.EMPTY, parameterMap , -1, -1 ,new String[0], new int[0]);
List<TableDataBean> beanList = TableDataRepository.getInstance().convertToEmbeddedTableData(bean);
Map<String, TableData> ans = new HashMap<>();
for (TableDataBean tableDataBean : beanList) {
ans.put(tableDataBean.getName(), tableDataBean.getTableData());
}
return ans;
}
@NotNull
protected DefaultSharableEditor createSharableEditor(Form form, Map<String, Object> paraMap, Widget widget, DefaultSharableWidget info) {

2
designer-realize/src/main/java/com/fanruan/boot/env/DesignEnvComponent.java vendored

@ -27,6 +27,7 @@ import com.fanruan.kv.factory.KVStoreFactory;
import com.fanruan.kv.manager.CarinaKVManager;
import com.fanruan.kv.store.KVStore;
import com.fanruan.kv.store.KVStoreHolder;
import com.fanruan.repository.LocalConfigSourceShell;
import com.fanruan.workplace.http.RepositoryManager;
import com.fr.cbb.dialect.security.InsecurityElementFactory;
import com.fr.cluster.ClusterBridge;
@ -102,7 +103,6 @@ import com.fr.transaction.HibernateTransactor;
import com.fr.transaction.RemoteTransactor;
import com.fr.transaction.TransactorFactory;
import com.fr.workspace.WorkContext;
import com.fr.workspace.server.repository.config.LocalConfigSourceShell;
import java.net.URI;
import java.sql.Connection;

23
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;
@ -31,13 +28,13 @@ 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;
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 +47,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;
@ -58,17 +60,14 @@ 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.fanruan.workplace.network.RemoteNetworkRepository;
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;
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 +93,7 @@ public class DesignWorkContextComponent {
public void prepare() {
supplementalExtra();
supplementalCommon();
RepositorySourceRegister.registerRepositorySource();
}
@ -177,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())
);
}

2
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;
/**
* 本地配置资源

23
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)) {

2
designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/desensitization/model/UpdateDataWorker.java

@ -4,7 +4,7 @@ import com.fr.data.desensitize.rule.base.DesensitizationRule;
import com.fr.data.desensitize.rule.base.DesensitizationRuleSource;
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;

Loading…
Cancel
Save