2023-11-19 02:12:44 +03:00
|
|
|
package Visual_DVM_2021.Passes.All;
|
2024-10-07 22:04:09 +03:00
|
|
|
import Common.Utils.CommonUtils;
|
2024-10-07 00:58:29 +03:00
|
|
|
import _VisualDVM.Global;
|
2024-10-09 22:01:19 +03:00
|
|
|
import _VisualDVM.Utils;
|
2023-11-19 02:12:44 +03:00
|
|
|
import Repository.BugReport.BugReport;
|
|
|
|
|
import Repository.BugReport.BugReportInterface;
|
|
|
|
|
import Repository.Server.ServerCode;
|
|
|
|
|
import Repository.Server.ServerExchangeUnit_2021;
|
|
|
|
|
import Visual_DVM_2021.Passes.Server.ComponentsRepositoryPass;
|
2023-09-17 22:13:42 +03:00
|
|
|
public class DownloadBugReport extends ComponentsRepositoryPass<BugReport> {
|
|
|
|
|
@Override
|
|
|
|
|
protected boolean canStart(Object... args) {
|
|
|
|
|
target = (BugReport) args[0];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return !BugReportInterface.getArchiveFile(target).exists();
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
protected void performPreparation() throws Exception {
|
|
|
|
|
Utils.CheckDirectory(Global.BugReportsDirectory);
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
protected void ServerAction() throws Exception {
|
|
|
|
|
Command(new ServerExchangeUnit_2021(ServerCode.ReceiveBugReport, target.id));
|
2024-10-07 22:04:09 +03:00
|
|
|
CommonUtils.bytesToFile((byte[]) response.object, BugReportInterface.getArchiveFile(target));
|
2023-09-17 22:13:42 +03:00
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
protected boolean validate() {
|
|
|
|
|
return BugReportInterface.getArchiveFile(target).exists();
|
|
|
|
|
}
|
|
|
|
|
}
|