2023-11-19 01:53:56 +03:00
|
|
|
package Common.Passes.All;
|
2023-10-17 00:22:06 +03:00
|
|
|
import Common.Current;
|
2023-11-19 01:53:56 +03:00
|
|
|
import Repository.ServerCode;
|
|
|
|
|
import Repository.ServerExchangeUnit_2021;
|
|
|
|
|
import Repository.TestingSystem.SAPFOR.SapforTasksPackage.SapforTasksPackage;
|
|
|
|
|
import Repository.TestingSystem.Common.TasksPackageToKill.TasksPackageToKill;
|
|
|
|
|
import Common.Passes.Server.TestingSystemPass;
|
2023-10-17 01:13:13 +03:00
|
|
|
|
|
|
|
|
import java.util.Vector;
|
2023-10-17 00:22:06 +03:00
|
|
|
public class AbortSapforTaskPackage extends TestingSystemPass<SapforTasksPackage> {
|
2023-10-17 01:13:13 +03:00
|
|
|
Vector<TasksPackageToKill> packagesToKill;
|
2023-10-17 00:22:06 +03:00
|
|
|
@Override
|
|
|
|
|
public String getIconPath() {
|
|
|
|
|
return "/icons/Ban.PNG";
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
public String getButtonText() {
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
protected boolean canStart(Object... args) throws Exception {
|
2023-10-17 01:13:13 +03:00
|
|
|
if (Current.Check(Log, Current.SapforTasksPackage)) {
|
|
|
|
|
packagesToKill = new Vector<>();
|
2023-10-17 00:22:06 +03:00
|
|
|
target = Current.getSapforTasksPackage();
|
2023-10-17 01:13:13 +03:00
|
|
|
switch (target.state) {
|
|
|
|
|
case Done:
|
|
|
|
|
case Aborted:
|
2023-10-18 14:05:51 +03:00
|
|
|
Log.Writeln_("Пакет уже завершен.");
|
2023-10-17 01:13:13 +03:00
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
TasksPackageToKill tasksPackageToKill = new TasksPackageToKill();
|
2023-11-17 22:03:13 +03:00
|
|
|
tasksPackageToKill.packageName = String.valueOf(target.id);
|
2023-10-17 01:13:13 +03:00
|
|
|
packagesToKill.add(tasksPackageToKill);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
;
|
2023-10-17 00:22:06 +03:00
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
protected void ServerAction() throws Exception {
|
2023-10-17 01:13:13 +03:00
|
|
|
Command(new ServerExchangeUnit_2021(ServerCode.PublishAccountObjects, Current.getAccount().email, packagesToKill));
|
2023-10-17 00:22:06 +03:00
|
|
|
}
|
|
|
|
|
}
|