2023-12-10 02:26:28 +03:00
|
|
|
package Visual_DVM_2021.Passes.All;
|
|
|
|
|
import Common.Current;
|
|
|
|
|
import Common.Global;
|
|
|
|
|
import Common.UI.UI;
|
|
|
|
|
import Repository.Server.ServerCode;
|
|
|
|
|
import Repository.Server.ServerExchangeUnit_2021;
|
2023-12-14 23:00:50 +03:00
|
|
|
import TestingSystem.DVM.DVMPackage.DVMPackage;
|
2023-12-10 02:26:28 +03:00
|
|
|
import TestingSystem.DVM.Tasks.TestRunTask;
|
|
|
|
|
import TestingSystem.DVM.TasksPackage.TasksPackage;
|
|
|
|
|
import TestingSystem.DVM.TasksPackage.TasksPackageState;
|
|
|
|
|
import Visual_DVM_2021.Passes.Server.TestingSystemPass;
|
|
|
|
|
import javafx.util.Pair;
|
|
|
|
|
|
|
|
|
|
import java.util.Vector;
|
2023-12-14 23:00:50 +03:00
|
|
|
public class ActualizeDVMPackages extends TestingSystemPass<Vector<Pair<Integer, TasksPackageState>>> {
|
2023-12-10 02:26:28 +03:00
|
|
|
@Override
|
|
|
|
|
protected boolean needsAnimation() {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
protected boolean canStart(Object... args) throws Exception {
|
|
|
|
|
target = new Vector<>();
|
2023-12-14 23:00:50 +03:00
|
|
|
for (DVMPackage dvmPackage : Global.testingServer.db.dvmPackages.Data.values()) {
|
|
|
|
|
if (dvmPackage.state.isActive())
|
|
|
|
|
target.add(new Pair(dvmPackage.id, dvmPackage.state));
|
2023-12-10 02:26:28 +03:00
|
|
|
}
|
|
|
|
|
return !target.isEmpty();
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
protected void ServerAction() throws Exception {
|
2023-12-14 23:00:50 +03:00
|
|
|
Command(new ServerExchangeUnit_2021(ServerCode.UpdateActiveDVMPackages, "", target));
|
2023-12-10 02:26:28 +03:00
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
protected void performDone() throws Exception {
|
2023-12-14 23:00:50 +03:00
|
|
|
Vector<DVMPackage> res = (Vector<DVMPackage>) response.object;
|
|
|
|
|
Global.testingServer.db.BeginTransaction();
|
|
|
|
|
for (DVMPackage dvmPackage : res)
|
|
|
|
|
Global.testingServer.db.UpdateWithCheck(dvmPackage);
|
|
|
|
|
Global.testingServer.db.Commit();
|
2023-12-10 02:26:28 +03:00
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
protected void showDone() throws Exception {
|
2023-12-14 23:00:50 +03:00
|
|
|
Global.testingServer.db.dvmPackages.RefreshUI();
|
2023-12-10 02:26:28 +03:00
|
|
|
}
|
|
|
|
|
}
|