Files
VisualSapfor/src/Visual_DVM_2021/Passes/All/DownloadSapforTasksPackage.java

41 lines
1.3 KiB
Java
Raw Normal View History

2023-10-25 02:20:57 +03:00
package Visual_DVM_2021.Passes.All;
import Common.Current;
import Common.Utils.Utils;
import Repository.Server.ServerCode;
import Repository.Server.ServerExchangeUnit_2021;
import SapforTestingSystem.SapforTasksPackage.SapforTasksPackage;
import TestingSystem.TasksPackage.TasksPackageState;
import Visual_DVM_2021.Passes.TestingSystemPass;
import java.io.File;
public class DownloadSapforTasksPackage extends TestingSystemPass<SapforTasksPackage> {
@Override
public String getIconPath() {
return "/icons/DownloadAll.png";
}
@Override
public String getButtonText() {
return "";
}
File dst = null;
@Override
protected boolean canStart(Object... args) throws Exception {
if (Current.Check(Log, Current.SapforTasksPackage)) {
target = Current.getSapforTasksPackage();
if (target.state.equals(TasksPackageState.Done)) return true;
else Log.Writeln_("Пакет не завершен.");
}
return false;
}
@Override
protected void ServerAction() throws Exception {
Command(new ServerExchangeUnit_2021(ServerCode.DownloadSapforTasksPackage, Current.getAccount().email, target.id));
response.Unpack(dst = Utils.getTempFileName(target.id));
}
@Override
protected boolean validate() {
return dst!=null&&dst.exists();
}
}