Files
VisualSapfor/src/Visual_DVM_2021/Passes/All/AbortSelectedPackages.java
2023-11-17 00:04:21 +03:00

46 lines
1.7 KiB
Java
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package Visual_DVM_2021.Passes.All;
import Common.Current;
import Repository.Server.ServerCode;
import Repository.Server.ServerExchangeUnit_2021;
import TestingSystem.DVM.TasksPackage.TasksPackage;
import TestingSystem.Common.TasksPackageToKill.TasksPackageToKill;
import Visual_DVM_2021.Passes.Server.TestingSystemPass;
import java.util.Vector;
public class AbortSelectedPackages extends TestingSystemPass<Vector<TasksPackage>> {
Vector<TasksPackageToKill> packagesToKill;
@Override
public String getIconPath() {
return "/icons/Ban.PNG";
}
@Override
public String getButtonText() {
return "";
}
@Override
protected boolean canStart(Object... args) throws Exception {
target = server.account_db.packages.getCheckedItems();
packagesToKill = new Vector<>();
for (TasksPackage tasksPackage : target) {
switch (tasksPackage.state) {
case Done:
case Aborted:
break;
default:
TasksPackageToKill tasksPackageToKill = new TasksPackageToKill();
tasksPackageToKill.packageName = tasksPackage.id;
packagesToKill.add(tasksPackageToKill);
break;
}
}
if (packagesToKill.isEmpty()) {
Log.Writeln_("Не отмечено ни одного активного пакета для удаления");
}
return true;
}
@Override
protected void ServerAction() throws Exception {
Command(new ServerExchangeUnit_2021(ServerCode.PublishAccountObjects, Current.getAccount().email, packagesToKill));
}
}