рефакторинг. неудачные наименования классов, и остатки старых вариантов
This commit is contained in:
@@ -3,7 +3,7 @@ import Common.Database.SQLITE.SQLiteDatabase;
|
||||
import GlobalData.Settings.SettingName;
|
||||
import SapforTestingSystem.SapforConfiguration.SapforConfigurationDBTable;
|
||||
import SapforTestingSystem.SapforConfigurationCommand.SapforConfigurationCommandsDBTable;
|
||||
import SapforTestingSystem.SapforScenario.SapforScenariosDBTable;
|
||||
import SapforTestingSystem.SapforTasksPackage.SapforTasksPackage;
|
||||
import SapforTestingSystem.SapforTasksPackage.SapforTasksPackagesDBTable;
|
||||
import SapforTestingSystem.ServerSapfor.ServerSapforsDBTable;
|
||||
import TestingSystem.Configuration.UI.ConfigurationDBTable;
|
||||
@@ -11,6 +11,7 @@ import TestingSystem.Group.GroupsDBTable;
|
||||
import TestingSystem.MachineMaxKernels.MachineMaxKernelsDBTable;
|
||||
import TestingSystem.TSetting.TSetting;
|
||||
import TestingSystem.TSetting.TSettingsDBTable;
|
||||
import TestingSystem.TasksPackage.TasksPackageState;
|
||||
import TestingSystem.Test.TestDBTable;
|
||||
|
||||
import java.nio.file.Paths;
|
||||
@@ -26,8 +27,8 @@ public class TestsDatabase extends SQLiteDatabase {
|
||||
//----
|
||||
public ServerSapforsDBTable serverSapfors;
|
||||
//--
|
||||
public SapforScenariosDBTable sapforScenarios;
|
||||
public SapforTasksPackagesDBTable sapforTasksPackages;
|
||||
// public SapforTasksPackagesDBTable sapforTasksPackages;
|
||||
//--
|
||||
public TestsDatabase() {
|
||||
super(Paths.get(System.getProperty("user.dir"), "Data", TasksDatabase.tests_db_name + ".sqlite").toFile());
|
||||
@@ -43,8 +44,8 @@ public class TestsDatabase extends SQLiteDatabase {
|
||||
addTable(sapforConfigurations = new SapforConfigurationDBTable());
|
||||
addTable(sapforConfigurationCommands = new SapforConfigurationCommandsDBTable());
|
||||
addTable(serverSapfors = new ServerSapforsDBTable());
|
||||
addTable(sapforScenarios = new SapforScenariosDBTable());
|
||||
addTable(sapforTasksPackages = new SapforTasksPackagesDBTable());
|
||||
// addTable(sapforTasksPackages = new SapforTasksPackagesDBTable());
|
||||
}
|
||||
@Override
|
||||
public void Init() throws Exception {
|
||||
@@ -67,4 +68,34 @@ public class TestsDatabase extends SQLiteDatabase {
|
||||
Update(setting);
|
||||
return res;
|
||||
}
|
||||
public SapforTasksPackage getFirstActiveSapforScenario() {
|
||||
SapforTasksPackage first_active = null;
|
||||
SapforTasksPackage first_queued = null;
|
||||
if (!sapforTasksPackages.Data.isEmpty()) {
|
||||
for (SapforTasksPackage s : sapforTasksPackages.Data.values()) {
|
||||
switch (s.state) {
|
||||
case Done:
|
||||
case Aborted:
|
||||
break;
|
||||
case Queued:
|
||||
if (first_queued == null) first_queued = s;
|
||||
break;
|
||||
default:
|
||||
if (first_active == null) first_active = s; //это и будет первый активный.
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (first_active != null) return first_active;
|
||||
if (first_queued != null) {
|
||||
first_queued.state = TasksPackageState.PackageStart;
|
||||
try {
|
||||
Update(first_queued);
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
return first_queued;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user