2023-12-16 03:57:01 +03:00
|
|
|
package Visual_DVM_2021.Passes;
|
2024-10-08 00:39:13 +03:00
|
|
|
import Common.CurrentAnchestor;
|
2024-10-07 00:58:29 +03:00
|
|
|
import Common_old.Current;
|
2023-12-16 03:57:01 +03:00
|
|
|
import Repository.Server.ServerCode;
|
|
|
|
|
import Repository.Server.ServerExchangeUnit_2021;
|
|
|
|
|
import TestingSystem.Common.TestingPackage.TestingPackage;
|
|
|
|
|
import TestingSystem.Common.TestingPackageToKill.TestingPackageToKill;
|
|
|
|
|
import Visual_DVM_2021.Passes.Server.TestingSystemPass;
|
|
|
|
|
public abstract class AbortTestingPackage extends TestingSystemPass<TestingPackage> {
|
|
|
|
|
TestingPackageToKill packageToKill = null;
|
|
|
|
|
@Override
|
|
|
|
|
public String getIconPath() {
|
|
|
|
|
return "/icons/Ban.PNG";
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
public String getButtonText() {
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
public abstract Current currentName();
|
|
|
|
|
public abstract int getAbortType();
|
|
|
|
|
@Override
|
|
|
|
|
protected boolean canStart(Object... args) throws Exception {
|
|
|
|
|
packageToKill = null;
|
2024-10-08 00:39:13 +03:00
|
|
|
if (CurrentAnchestor.Check(Log, currentName())) {
|
|
|
|
|
target = (TestingPackage) CurrentAnchestor.get(currentName());
|
2023-12-16 03:57:01 +03:00
|
|
|
switch (target.state) {
|
|
|
|
|
case Done:
|
|
|
|
|
case Aborted:
|
2024-09-25 01:27:02 +03:00
|
|
|
case DoneWithErrors:
|
2023-12-16 03:57:01 +03:00
|
|
|
Log.Writeln_("Пакет уже завершен.");
|
|
|
|
|
break;
|
2024-09-14 01:16:08 +03:00
|
|
|
case Inactive:
|
|
|
|
|
Log.Writeln_("Пакет неактивен.");
|
|
|
|
|
break;
|
2023-12-16 03:57:01 +03:00
|
|
|
default:
|
|
|
|
|
packageToKill = new TestingPackageToKill();
|
|
|
|
|
packageToKill.packageId = target.id;
|
|
|
|
|
packageToKill.type = getAbortType();
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
protected void ServerAction() throws Exception {
|
|
|
|
|
Command(new ServerExchangeUnit_2021(ServerCode.PublishObject, null, packageToKill));
|
|
|
|
|
}
|
|
|
|
|
}
|