2023-11-19 01:53:56 +03:00
|
|
|
package Common.Passes.All;
|
2023-09-17 22:13:42 +03:00
|
|
|
import Common.Global;
|
|
|
|
|
import Common.Utils.Utils;
|
2023-11-19 01:53:56 +03:00
|
|
|
import Repository.ComponentsServer.Component.BugReport.BugReport;
|
|
|
|
|
import Repository.ComponentsServer.Component.BugReport.BugReportInterface;
|
|
|
|
|
import Repository.ServerCode;
|
|
|
|
|
import Repository.ServerExchangeUnit_2021;
|
|
|
|
|
import Common.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));
|
|
|
|
|
Utils.unpackFile((byte[]) response.object, BugReportInterface.getArchiveFile(target));
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
protected boolean validate() {
|
|
|
|
|
return BugReportInterface.getArchiveFile(target).exists();
|
|
|
|
|
}
|
|
|
|
|
}
|