2023-11-19 02:12:44 +03:00
|
|
|
|
package Visual_DVM_2021.Passes.All;
|
2023-09-17 22:13:42 +03:00
|
|
|
|
import Common.Current;
|
2023-12-21 17:42:20 +03:00
|
|
|
|
import Common.UI.Menus_2023.PassButton;
|
2023-09-17 22:13:42 +03:00
|
|
|
|
import Common.UI.UI;
|
|
|
|
|
|
import Common.Utils.Utils;
|
2023-11-19 02:12:44 +03:00
|
|
|
|
import Repository.Server.ServerCode;
|
|
|
|
|
|
import Repository.Server.ServerExchangeUnit_2021;
|
|
|
|
|
|
import Visual_DVM_2021.Passes.Server.TestingSystemPass;
|
2023-09-17 22:13:42 +03:00
|
|
|
|
import org.apache.commons.io.FileUtils;
|
|
|
|
|
|
|
2023-12-21 17:42:20 +03:00
|
|
|
|
import javax.swing.*;
|
2023-09-17 22:13:42 +03:00
|
|
|
|
import java.io.File;
|
|
|
|
|
|
public class SynchronizeTests extends TestingSystemPass<Object> {
|
|
|
|
|
|
File new_db_file;
|
|
|
|
|
|
@Override
|
|
|
|
|
|
protected boolean canStart(Object... args) throws Exception {
|
|
|
|
|
|
return Current.getAccount().CheckRegistered(Log);
|
|
|
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public String getIconPath() {
|
|
|
|
|
|
return "/icons/ComponentsActual.png";
|
|
|
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public String getButtonText() {
|
|
|
|
|
|
return "";
|
|
|
|
|
|
}
|
|
|
|
|
|
@Override
|
2023-12-21 17:42:20 +03:00
|
|
|
|
public JButton createButton() {
|
|
|
|
|
|
return new PassButton(this);
|
|
|
|
|
|
}
|
|
|
|
|
|
@Override
|
2023-09-17 22:13:42 +03:00
|
|
|
|
protected void showPreparation() throws Exception {
|
|
|
|
|
|
server.db.SaveLastSelections();
|
2024-03-13 19:19:32 +03:00
|
|
|
|
//--
|
|
|
|
|
|
// server.db.machines _testing_system
|
|
|
|
|
|
//--
|
2023-09-17 22:13:42 +03:00
|
|
|
|
server.db.configurations.ClearUI();
|
|
|
|
|
|
server.db.groups.ClearUI();
|
|
|
|
|
|
server.db.sapforConfigurations.ClearUI();
|
2023-11-13 17:12:16 +03:00
|
|
|
|
server.db.serverSapfors.ClearUI();
|
2023-12-13 02:26:20 +03:00
|
|
|
|
server.db.dvmPackages.ClearUI();
|
2023-12-15 18:38:05 +03:00
|
|
|
|
server.db.sapforPackages.ClearUI();
|
2023-09-17 22:13:42 +03:00
|
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
|
|
|
protected void ServerAction() throws Exception {
|
|
|
|
|
|
Command(new ServerExchangeUnit_2021(ServerCode.ReceiveTestsDatabase));
|
|
|
|
|
|
response.Unpack(new_db_file = Utils.getTempFileName("tdb"));
|
|
|
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
|
|
|
protected void performDone() throws Exception {
|
|
|
|
|
|
super.performDone();
|
|
|
|
|
|
server.db.Disconnect();
|
|
|
|
|
|
Utils.forceDeleteWithCheck(server.db.getFile());
|
|
|
|
|
|
FileUtils.moveFile(new_db_file, server.db.getFile());
|
|
|
|
|
|
server.db.Connect();
|
|
|
|
|
|
server.db.prepareTablesStatements();
|
|
|
|
|
|
server.db.Synchronize();
|
|
|
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
|
|
|
protected void showDone() throws Exception {
|
2023-11-13 17:12:16 +03:00
|
|
|
|
if (UI.HasMainWindow()) {
|
2024-03-13 19:19:32 +03:00
|
|
|
|
//server.db.machines
|
2023-09-17 22:13:42 +03:00
|
|
|
|
server.db.configurations.ShowUI();
|
|
|
|
|
|
server.db.groups.ShowUI();
|
|
|
|
|
|
server.db.sapforConfigurations.ShowUI();
|
2023-11-13 17:12:16 +03:00
|
|
|
|
server.db.serverSapfors.ShowUI();
|
2023-12-13 02:26:20 +03:00
|
|
|
|
server.db.dvmPackages.ShowUI();
|
2023-12-15 18:38:05 +03:00
|
|
|
|
server.db.sapforPackages.ShowUI();
|
2024-03-13 19:19:32 +03:00
|
|
|
|
server.db.RestoreLastSelections(); //---- ? объединить с RestoreCredentials
|
2023-10-11 01:31:38 +03:00
|
|
|
|
UI.getMainWindow().ShowCheckedTestsCount();
|
2023-09-17 22:13:42 +03:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|