2023-11-17 00:04:21 +03:00
|
|
|
package TestingSystem.Common;
|
2023-11-14 20:08:19 +03:00
|
|
|
import Common.Constants;
|
2023-09-17 22:13:42 +03:00
|
|
|
import Common.Database.SQLITE.SQLiteDatabase;
|
|
|
|
|
import GlobalData.Settings.SettingName;
|
2023-11-17 00:04:21 +03:00
|
|
|
import TestingSystem.SAPFOR.SapforConfiguration.SapforConfigurationDBTable;
|
|
|
|
|
import TestingSystem.SAPFOR.SapforConfigurationCommand.SapforConfigurationCommandsDBTable;
|
|
|
|
|
import TestingSystem.SAPFOR.ServerSapfor.ServerSapforsDBTable;
|
|
|
|
|
import TestingSystem.DVM.Configuration.UI.ConfigurationDBTable;
|
|
|
|
|
import TestingSystem.Common.Group.GroupsDBTable;
|
|
|
|
|
import TestingSystem.Common.TSetting.TSetting;
|
|
|
|
|
import TestingSystem.Common.TSetting.TSettingsDBTable;
|
|
|
|
|
import TestingSystem.Common.Test.TestDBTable;
|
2023-11-16 16:20:20 +03:00
|
|
|
import Visual_DVM_2021.Passes.PassCode_2021;
|
2023-09-17 22:13:42 +03:00
|
|
|
|
|
|
|
|
import java.nio.file.Paths;
|
|
|
|
|
public class TestsDatabase extends SQLiteDatabase {
|
|
|
|
|
public ConfigurationDBTable configurations;
|
|
|
|
|
public TestDBTable tests;
|
|
|
|
|
public GroupsDBTable groups;
|
|
|
|
|
public TSettingsDBTable settings;
|
|
|
|
|
//--
|
|
|
|
|
public SapforConfigurationDBTable sapforConfigurations;
|
|
|
|
|
public SapforConfigurationCommandsDBTable sapforConfigurationCommands;
|
2023-10-04 00:25:36 +03:00
|
|
|
//----
|
2023-10-03 15:07:17 +03:00
|
|
|
public ServerSapforsDBTable serverSapfors;
|
2023-09-17 22:13:42 +03:00
|
|
|
public TestsDatabase() {
|
2023-11-14 20:08:19 +03:00
|
|
|
super(Paths.get(System.getProperty("user.dir"), "Data", Constants.tests_db_name + ".sqlite").toFile());
|
2023-09-17 22:13:42 +03:00
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
protected void initAllTables() throws Exception {
|
|
|
|
|
addTable(configurations = new ConfigurationDBTable());
|
|
|
|
|
addTable(groups = new GroupsDBTable());
|
|
|
|
|
addTable(tests = new TestDBTable());
|
|
|
|
|
addTable(settings = new TSettingsDBTable());
|
|
|
|
|
//-
|
|
|
|
|
addTable(sapforConfigurations = new SapforConfigurationDBTable());
|
|
|
|
|
addTable(sapforConfigurationCommands = new SapforConfigurationCommandsDBTable());
|
2023-10-03 15:07:17 +03:00
|
|
|
addTable(serverSapfors = new ServerSapforsDBTable());
|
2023-09-17 22:13:42 +03:00
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
public void Init() throws Exception {
|
|
|
|
|
if (!settings.containsKey(SettingName.TaskMaxId))
|
|
|
|
|
Insert(new TSetting(SettingName.TaskMaxId, 63128));
|
|
|
|
|
if (!settings.containsKey(SettingName.SapforTaskMaxId))
|
|
|
|
|
Insert(new TSetting(SettingName.SapforTaskMaxId, 0));
|
|
|
|
|
}
|
2023-11-16 16:20:20 +03:00
|
|
|
@Override
|
|
|
|
|
public PassCode_2021 getSynchronizePassCode() {
|
|
|
|
|
return PassCode_2021.SynchronizeTests;
|
|
|
|
|
}
|
2023-09-17 22:13:42 +03:00
|
|
|
public long IncMaxTaskId() throws Exception {
|
|
|
|
|
TSetting setting = settings.get(SettingName.TaskMaxId);
|
|
|
|
|
long res = setting.value;
|
|
|
|
|
setting.value++;
|
|
|
|
|
Update(setting);
|
|
|
|
|
return res;
|
|
|
|
|
}
|
|
|
|
|
public long IncSapforMaxTaskId() throws Exception {
|
|
|
|
|
TSetting setting = settings.get(SettingName.SapforTaskMaxId);
|
|
|
|
|
long res = setting.value;
|
|
|
|
|
setting.value++;
|
|
|
|
|
Update(setting);
|
|
|
|
|
return res;
|
|
|
|
|
}
|
|
|
|
|
}
|