рефакторинг отправления бага. была избыточная команда

This commit is contained in:
2025-02-03 23:50:09 +03:00
parent 26434b21ab
commit 505d151ee5
7 changed files with 47 additions and 35 deletions

View File

@@ -1,27 +1,25 @@
package _VisualDVM.Passes.All;
import Common.Utils.Utils_;
import _VisualDVM.Global;
import _VisualDVM.Passes.Server.ComponentsRepositoryPass;
import _VisualDVM.Passes.Server.ClientPass;
import _VisualDVM.Repository.BugReport.BugReport;
import _VisualDVM.Repository.BugReport.BugReportState;
import _VisualDVM.Repository.Server.ComponentsServer;
import _VisualDVM.Repository.Server.ServerCode;
import _VisualDVM.Repository.Server.ServerExchangeUnit_2021;
public class SendBugReport extends ComponentsRepositoryPass<BugReport> {
public class SendBugReport extends ClientPass<ComponentsServer,BugReport> {
@Override
protected void ServerAction() throws Exception {
protected boolean canStart(Object... args) throws Exception {
target = Global.componentsServer.db.bugReports.getUI().getCurrent();
if (!target.project_version.isEmpty()) {
//отправить архив.
Command(new ServerExchangeUnit_2021(ServerCode.SendBugReport,
target.id,
Utils_.fileToBytes(target.getArchiveFile())
));
}
// синхрон бд
Command(new ServerExchangeUnit_2021(ServerCode.PublishObject, "", target));
if (!target.project_version.isEmpty())
target.packed_archive = Utils_.fileToBytes(target.getArchiveFile());
return SendRequest(ServerCode.PublishObject, "", target);
}
@Override
protected void performFail() throws Exception {
target.state = BugReportState.draft;
}
@Override
protected ComponentsServer getServer() {
return Global.componentsServer;
}
}