59 lines
2.0 KiB
Java
59 lines
2.0 KiB
Java
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 SapforTestingSystem.SapforTasksPackage.SapforTasksPackageInterface;
|
|
import TestingSystem.TasksPackage.TasksPackageState;
|
|
import Visual_DVM_2021.Passes.PassCode_2021;
|
|
import Visual_DVM_2021.Passes.TestingSystemPass;
|
|
|
|
import java.io.File;
|
|
public class DownloadSapforTasksPackage extends TestingSystemPass<SapforTasksPackage> {
|
|
@Override
|
|
public String getIconPath() {
|
|
return "/icons/DownloadBugReport.png";
|
|
}
|
|
@Override
|
|
public String getButtonText() {
|
|
return "";
|
|
}
|
|
File tmpArchive = null;
|
|
@Override
|
|
protected boolean canStart(Object... args) throws Exception {
|
|
if (args.length > 0) {
|
|
target = (SapforTasksPackage) args[0];
|
|
} else {
|
|
if (Current.Check(Log, Current.SapforTasksPackage))
|
|
target = Current.getSapforTasksPackage();
|
|
else return false;
|
|
}
|
|
//-
|
|
if (!target.state.equals(TasksPackageState.Done)) {
|
|
Log.Writeln_("Пакет не завершен.");
|
|
return false;
|
|
}
|
|
if (SapforTasksPackageInterface.isLoaded(target)) {
|
|
System.out.println("Пакет уже загружен");
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
@Override
|
|
protected void ServerAction() throws Exception {
|
|
Command(new ServerExchangeUnit_2021(ServerCode.DownloadSapforTasksPackage, Current.getAccount().email, target.id));
|
|
response.Unpack(tmpArchive = Utils.getTempFileName(target.id));
|
|
}
|
|
@Override
|
|
protected boolean validate() {
|
|
return tmpArchive != null && tmpArchive.exists();
|
|
}
|
|
@Override
|
|
protected void performDone() throws Exception {
|
|
super.performDone();
|
|
passes.get(PassCode_2021.UnpackSapforTasksPackage).Do(tmpArchive, target);
|
|
}
|
|
}
|
|
|