2023-12-16 03:57:01 +03:00
|
|
|
package Visual_DVM_2021.Passes;
|
2024-10-07 00:58:29 +03:00
|
|
|
import Common.Database.Tables.iDBTable;
|
|
|
|
|
import _VisualDVM.Global;
|
2023-12-16 03:57:01 +03:00
|
|
|
import Repository.Server.ServerCode;
|
|
|
|
|
import Repository.Server.ServerExchangeUnit_2021;
|
|
|
|
|
import TestingSystem.Common.TestingPackage.TestingPackage;
|
|
|
|
|
import Visual_DVM_2021.Passes.Server.TestingSystemPass;
|
|
|
|
|
import javafx.util.Pair;
|
|
|
|
|
|
|
|
|
|
import java.util.Vector;
|
|
|
|
|
public abstract class ActualizeTestingPackages<P extends TestingPackage> extends TestingSystemPass<Vector<Pair<Integer, Long>>> {
|
|
|
|
|
Class p;
|
|
|
|
|
public ActualizeTestingPackages(Class<P> p_in) {
|
|
|
|
|
p = p_in;
|
|
|
|
|
}
|
|
|
|
|
iDBTable<P> getTable() {
|
|
|
|
|
return (iDBTable<P>) Global.testingServer.db.tables.get(p);
|
|
|
|
|
}
|
|
|
|
|
protected abstract ServerCode getCheckCode();
|
|
|
|
|
@Override
|
|
|
|
|
protected boolean needsAnimation() {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
protected boolean canStart(Object... args) throws Exception {
|
|
|
|
|
target = new Vector<>();
|
|
|
|
|
for (P testingPackage : getTable().Data.values()) {
|
|
|
|
|
if (testingPackage.state.isActive()) {
|
|
|
|
|
target.add(new Pair(testingPackage.id, testingPackage.ChangeDate));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return !target.isEmpty();
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
protected void ServerAction() throws Exception {
|
|
|
|
|
Command(new ServerExchangeUnit_2021(getCheckCode(), "", target));
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
protected void performDone() throws Exception {
|
|
|
|
|
Vector<P> res = (Vector<P>) response.object;
|
|
|
|
|
Global.testingServer.db.BeginTransaction();
|
|
|
|
|
for (P actual : res)
|
|
|
|
|
Global.testingServer.db.UpdateWithCheck(actual);
|
|
|
|
|
Global.testingServer.db.Commit();
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
protected void showDone() throws Exception {
|
2023-12-17 17:27:23 +03:00
|
|
|
getTable().RefreshUI();
|
2023-12-16 03:57:01 +03:00
|
|
|
}
|
|
|
|
|
}
|