Files
VisualSapfor/src/Visual_DVM_2021/Passes/StartTestingPackage.java
2024-10-09 23:37:58 +03:00

50 lines
1.8 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;
import Common.Current_;
import Common.Visual.CommonUI;
import _VisualDVM.Current;
import _VisualDVM.Global;
import _VisualDVM.TestingSystem.Common.TestingPackage.TestingPackage;
import _VisualDVM.TestingSystem.Common.TestingServer;
import _VisualDVM.TestingSystem.Common.TasksPackageState;
import Visual_DVM_2021.Passes.Server.PublishServerObject;
public abstract class StartTestingPackage<P extends TestingPackage> extends PublishServerObject<TestingServer, P> {
public StartTestingPackage(Class<P> p_in) {
super(Global.testingServer, p_in);
}
@Override
protected int getTimeout() {
return 0;
}
@Override
public String getIconPath() {
return "/icons/Start.png";
}
protected abstract Current getCurrentName();
@Override
protected boolean canStart(Object... args) throws Exception {
if (!Current.getAccount().CheckRegistered(Log)) {
return false;
}
if (Current_.Check(Log, getCurrentName())) {
target = (P) Current_.get(getCurrentName());
//-
if (!target.state.equals(TasksPackageState.Draft)) {
Log.Writeln_("Возможно запустить только пакет, готовящийся к публикации!");
return false;
}
if (target.tasksCount == 0) {
Log.Writeln_("В пакете отсутствуют задачи.");
return false;
}
if (CommonUI.Question("Будет запущено:\n"
+ target.tasksCount + " задач.\n" +
"Продолжить")) {
target.state = TasksPackageState.Queued;
return true;
}
}
return false;
}
}