Browse Source

init: REPORT-106900【远程设计性能】远程设计协议重构

- 适配 FunctionalHttpRequest
- 基本跑通门槛用例
new-design
Harrison 12 months ago
parent
commit
4201640fce
  1. 2
      designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java
  2. 14
      designer-base/src/main/java/com/fr/design/mainframe/vcs/VcsExceptionUtils.java
  3. 25
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsMovePanel.java
  4. 7
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsNewPane.java
  5. 2
      designer-base/src/main/java/com/fr/design/versioncheck/VersionCheckUtils.java
  6. 4
      designer-base/src/test/java/com/fr/design/EnvChangeEntranceTest.java
  7. 13
      designer-realize/src/main/java/com/fr/design/actions/file/newReport/NewPolyReportAction.java
  8. 4
      designer-realize/src/main/java/com/fr/design/actions/file/newReport/NewWorkBookAction.java

2
designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java

@ -46,7 +46,7 @@ import com.fr.workspace.WorkspaceSwitchProcess;
import com.fr.workspace.base.WorkspaceAPI; import com.fr.workspace.base.WorkspaceAPI;
import com.fr.workspace.connect.WorkspaceConnectionInfo; import com.fr.workspace.connect.WorkspaceConnectionInfo;
import com.fr.workspace.engine.base.FineObjectPool; import com.fr.workspace.engine.base.FineObjectPool;
import com.fr.workspace.engine.channel.http.FunctionalHttpRequest; import com.fr.workspace.engine.client.utils.FunctionalHttpRequest;
import com.fr.workspace.engine.exception.WorkspaceConnectionException; import com.fr.workspace.engine.exception.WorkspaceConnectionException;
import com.fr.workspace.engine.rpc.WorkspaceProxyPool; import com.fr.workspace.engine.rpc.WorkspaceProxyPool;
import static javax.swing.JOptionPane.QUESTION_MESSAGE; import static javax.swing.JOptionPane.QUESTION_MESSAGE;

14
designer-base/src/main/java/com/fr/design/mainframe/vcs/VcsExceptionUtils.java

@ -1,8 +1,8 @@
package com.fr.design.mainframe.vcs; package com.fr.design.mainframe.vcs;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.workspace.server.vcs.v2.VcsTaskResult.ErrorType;
import java.io.IOException;
import java.util.HashMap; import java.util.HashMap;
/** /**
@ -14,10 +14,10 @@ import java.util.HashMap;
*/ */
public class VcsExceptionUtils { public class VcsExceptionUtils {
public static final HashMap<Class, String> EXCEPTION_MAP = new HashMap<Class, String>() { public static final HashMap<ErrorType, String> EXCEPTION_MAP = new HashMap<ErrorType, String>() {
{ {
put(IOException.class, Toolkit.i18nText("Fine-Design_Vcs_Exception_IO")); put(ErrorType.IO_EXCEPTION, Toolkit.i18nText("Fine-Design_Vcs_Exception_IO"));
put(UnsupportedOperationException.class, Toolkit.i18nText("Fine-Design_Vcs_Exception_Un_Support")); put(ErrorType.UNSUPPORTED_OPERATION, Toolkit.i18nText("Fine-Design_Vcs_Exception_Un_Support"));
} }
}; };
@ -25,9 +25,9 @@ public class VcsExceptionUtils {
/** /**
* 根据异常返回结果描述文案 * 根据异常返回结果描述文案
*/ */
public static String createDetailByException(Exception e) { public static String createDetailByException(ErrorType e) {
for (Class key : EXCEPTION_MAP.keySet()) { for (ErrorType key : EXCEPTION_MAP.keySet()) {
if (key.isAssignableFrom(e.getClass())) { if (key.equals(e)) {
return EXCEPTION_MAP.get(key); return EXCEPTION_MAP.get(key);
} }
} }

25
designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsMovePanel.java

@ -10,7 +10,6 @@ import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ibutton.UIRadioButton; import com.fr.design.gui.ibutton.UIRadioButton;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.iprogressbar.ModernUIProgressBarUI; import com.fr.design.gui.iprogressbar.ModernUIProgressBarUI;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.i18n.LocaleLinkProvider; import com.fr.design.i18n.LocaleLinkProvider;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
@ -26,8 +25,12 @@ import com.fr.design.widget.FRWidgetFactory;
import com.fr.general.FRFont; import com.fr.general.FRFont;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.workspace.server.vcs.v2.VcsTaskResult;
import com.fr.workspace.server.vcs.v2.VcsTaskResult.ErrorType;
import com.fr.workspace.server.vcs.v2.move.VcsMoveService; import com.fr.workspace.server.vcs.v2.move.VcsMoveService;
import com.fr.workspace.server.vcs.v2.move.VcsMoveService.BaseMoveServiceWhileMoving;
import com.fr.workspace.server.vcs.v2.move.VcsMoveStrategy; import com.fr.workspace.server.vcs.v2.move.VcsMoveStrategy;
import static javax.swing.JOptionPane.YES_OPTION;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.ButtonGroup; import javax.swing.ButtonGroup;
@ -36,7 +39,10 @@ import javax.swing.JPanel;
import javax.swing.JProgressBar; import javax.swing.JProgressBar;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import javax.swing.SwingWorker; import javax.swing.SwingWorker;
import java.awt.*; import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Color;
import java.awt.Cursor;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
@ -44,9 +50,6 @@ import java.awt.event.MouseEvent;
import java.util.List; import java.util.List;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
import static javax.swing.JOptionPane.YES_NO_CANCEL_OPTION;
import static javax.swing.JOptionPane.YES_OPTION;
/** /**
* 迁移面板 * 迁移面板
@ -462,21 +465,27 @@ public class VcsMovePanel extends BasicPane {
protected Boolean doInBackground() throws Exception { protected Boolean doInBackground() throws Exception {
try { try {
//开始迁移 //开始迁移
VcsMoveService.getInstance().startMove(new VcsMoveService.BaseMoveServiceWhileMoving() { VcsTaskResult vcsTaskResult = VcsMoveService.getInstance().startMove(new BaseMoveServiceWhileMoving() {
@Override @Override
public void publishProgress() { public void publishProgress() {
int num = VcsMoveService.getInstance().getCurrentMove(); int num = VcsMoveService.getInstance().getCurrentMove();
publish(num); publish(num);
} }
@Override @Override
public void prepare4Move() { public void prepare4Move() {
PROGRESS_BAR.setMaximum(VcsMoveService.getInstance().getTotal()); PROGRESS_BAR.setMaximum(VcsMoveService.getInstance().getTotal());
} }
}, strategy); }, strategy);
if (vcsTaskResult != null && !vcsTaskResult.isSuccess()) {
ErrorType errorType = vcsTaskResult.getErrorType();
detail = VcsExceptionUtils.createDetailByException(errorType);
}
} catch (Exception e) { } catch (Exception e) {
VcsMoveService.getInstance().stopMoving();
detail = VcsExceptionUtils.createDetailByException(e);
return false; return false;
} finally {
VcsMoveService.getInstance().stopMoving();
} }
return true; return true;
} }

7
designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsNewPane.java

@ -17,8 +17,6 @@ import com.fr.design.mainframe.vcs.common.VcsCacheFileNodeFile;
import com.fr.design.mainframe.vcs.common.VcsHelper; import com.fr.design.mainframe.vcs.common.VcsHelper;
import com.fr.file.FileNodeFILE; import com.fr.file.FileNodeFILE;
import com.fr.file.filetree.FileNode; 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.InconsistentLockException;
import com.fr.report.entity.VcsEntity; import com.fr.report.entity.VcsEntity;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
@ -29,6 +27,7 @@ import com.fr.workspace.resource.WorkResource;
import com.fr.workspace.server.vcs.VcsFileUtils; import com.fr.workspace.server.vcs.VcsFileUtils;
import com.fr.workspace.server.vcs.VcsOperator; import com.fr.workspace.server.vcs.VcsOperator;
import com.fr.workspace.server.vcs.v2.VcsTaskResult; import com.fr.workspace.server.vcs.v2.VcsTaskResult;
import com.fr.workspace.server.vcs.v2.VcsTaskResult.ErrorType;
import javax.swing.Icon; import javax.swing.Icon;
import javax.swing.JComponent; import javax.swing.JComponent;
@ -36,7 +35,7 @@ import javax.swing.JOptionPane;
import javax.swing.JTable; import javax.swing.JTable;
import javax.swing.SwingWorker; import javax.swing.SwingWorker;
import javax.swing.UIManager; import javax.swing.UIManager;
import java.awt.*; import java.awt.Point;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionAdapter; import java.awt.event.MouseMotionAdapter;
@ -216,7 +215,7 @@ public class VcsNewPane extends RecyclePane {
} }
DesignerContext.getDesignerFrame().openTemplate(new FileNodeFILE(new FileNode(filePath, false))); DesignerContext.getDesignerFrame().openTemplate(new FileNodeFILE(new FileNode(filePath, false)));
} else { } else {
if (result.getException() instanceof FileNotFoundException) { if (ErrorType.FILE_NOT_FOUND.equals(result.getErrorType())) {
FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Warning_Template_Do_Not_Exsit")); FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Warning_Template_Do_Not_Exsit"));
} else { } else {
FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Vcs_Open_Lock_Tip"), UIManager.getString("OptionPane.messageDialogTitle"), JOptionPane.ERROR_MESSAGE); FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Vcs_Open_Lock_Tip"), UIManager.getString("OptionPane.messageDialogTitle"), JOptionPane.ERROR_MESSAGE);

2
designer-base/src/main/java/com/fr/design/versioncheck/VersionCheckUtils.java

@ -35,7 +35,7 @@ import com.fr.workspace.WorkContext;
import com.fr.workspace.base.WorkspaceAPI; import com.fr.workspace.base.WorkspaceAPI;
import com.fr.workspace.connect.WorkspaceConnectionInfo; import com.fr.workspace.connect.WorkspaceConnectionInfo;
import com.fr.workspace.engine.base.FineObjectPool; import com.fr.workspace.engine.base.FineObjectPool;
import com.fr.workspace.engine.channel.http.FunctionalHttpRequest; import com.fr.workspace.engine.client.utils.FunctionalHttpRequest;
import com.fr.workspace.engine.exception.WorkspaceConnectionException; import com.fr.workspace.engine.exception.WorkspaceConnectionException;
import com.fr.workspace.engine.rpc.WorkspaceProxyPool; import com.fr.workspace.engine.rpc.WorkspaceProxyPool;
import com.fr.workspace.server.check.VersionInfoOperator; import com.fr.workspace.server.check.VersionInfoOperator;

4
designer-base/src/test/java/com/fr/design/EnvChangeEntranceTest.java

@ -1,6 +1,5 @@
package com.fr.design; package com.fr.design;
import com.fr.design.plugin.remind.PluginErrorDesignReminder;
import com.fr.plugin.error.PluginErrorRemindHandler; import com.fr.plugin.error.PluginErrorRemindHandler;
import com.fr.design.env.DesignerWorkspaceInfo; import com.fr.design.env.DesignerWorkspaceInfo;
import com.fr.design.env.DesignerWorkspaceType; import com.fr.design.env.DesignerWorkspaceType;
@ -9,9 +8,8 @@ import com.fr.design.env.RemoteDesignerWorkspaceInfo;
import com.fr.env.CheckServiceDialog; import com.fr.env.CheckServiceDialog;
import com.fr.invoke.Reflect; import com.fr.invoke.Reflect;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import com.fr.workspace.Workspace;
import com.fr.workspace.connect.WorkspaceConnectionInfo; import com.fr.workspace.connect.WorkspaceConnectionInfo;
import com.fr.workspace.engine.channel.http.FunctionalHttpRequest; import com.fr.workspace.engine.client.utils.FunctionalHttpRequest;
import org.easymock.EasyMock; import org.easymock.EasyMock;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;

13
designer-realize/src/main/java/com/fr/design/actions/file/newReport/NewPolyReportAction.java

@ -1,18 +1,13 @@
package com.fr.design.actions.file.newReport; package com.fr.design.actions.file.newReport;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import javax.swing.KeyStroke;
import com.fr.base.svg.IconUtils;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JPolyWorkBook; import com.fr.design.mainframe.JPolyWorkBook;
import javax.swing.KeyStroke;
import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER; import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
public class NewPolyReportAction extends UpdateAction { public class NewPolyReportAction extends UpdateAction {

4
designer-realize/src/main/java/com/fr/design/actions/file/newReport/NewWorkBookAction.java

@ -3,18 +3,16 @@ package com.fr.design.actions.file.newReport;
import com.fr.base.svg.IconUtils; import com.fr.base.svg.IconUtils;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JWorkBook; import com.fr.design.mainframe.JWorkBook;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
import javax.swing.Icon; import javax.swing.Icon;
import javax.swing.KeyStroke; import javax.swing.KeyStroke;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent; import java.awt.event.KeyEvent;
import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER;
public class NewWorkBookAction extends UpdateAction { public class NewWorkBookAction extends UpdateAction {
public NewWorkBookAction() { public NewWorkBookAction() {

Loading…
Cancel
Save