рефакторинг серверной части сапфора.
This commit is contained in:
@@ -13,7 +13,9 @@ import TestingSystem.DVM.DVMPackage.DVMPackageDBTable;
|
||||
import TestingSystem.DVM.TasksPackage.TasksPackageState;
|
||||
import TestingSystem.SAPFOR.SapforConfiguration.SapforConfigurationDBTable;
|
||||
import TestingSystem.SAPFOR.SapforConfigurationCommand.SapforConfigurationCommandsDBTable;
|
||||
import TestingSystem.SAPFOR.SapforPackage.SapforPackage;
|
||||
import TestingSystem.SAPFOR.SapforPackage.SapforPackageDBTable;
|
||||
import TestingSystem.SAPFOR.SapforTasksPackage.SapforTasksPackage;
|
||||
import TestingSystem.SAPFOR.ServerSapfor.ServerSapforsDBTable;
|
||||
import Visual_DVM_2021.Passes.PassCode_2021;
|
||||
|
||||
@@ -105,4 +107,34 @@ public class TestsDatabase extends SQLiteDatabase {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public SapforPackage getFirstActiveSapforPackage() {
|
||||
SapforPackage first_active = null;
|
||||
SapforPackage first_queued = null;
|
||||
if (!sapforPackages.Data.isEmpty()) {
|
||||
for (SapforPackage p : sapforPackages.Data.values()) {
|
||||
switch (p.state) {
|
||||
case Done:
|
||||
case Aborted:
|
||||
break;
|
||||
case Queued:
|
||||
if (first_queued == null) first_queued = p;
|
||||
break;
|
||||
default:
|
||||
if (first_active == null) first_active = p; //это и будет первый активный.
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (first_active != null) return first_active;
|
||||
if (first_queued != null) {
|
||||
first_queued.state = TasksPackageState.TestsSynchronize;
|
||||
try {
|
||||
Update(first_queued);
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
return first_queued;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user