каскадное изменение информации о группе в конфигурациях в случае ее редактирования
This commit is contained in:
@@ -4,12 +4,15 @@ import Common.Database.Objects.DBObject;
|
||||
import Common.Database.Objects.riDBObject;
|
||||
import Common.Utils.TextLog;
|
||||
import Common.Utils.Utils_;
|
||||
import _VisualDVM.ServerObjectsCache.ConfigurationCache;
|
||||
import _VisualDVM.TestingSystem.Common.Group.Group;
|
||||
import _VisualDVM.TestingSystem.Common.Group.Json.GroupJson;
|
||||
import _VisualDVM.TestingSystem.Common.Group.Json.GroupsJson;
|
||||
import _VisualDVM.TestingSystem.Common.Settings.Json.SettingsArrayJson;
|
||||
import _VisualDVM.TestingSystem.Common.Settings.Settings;
|
||||
import _VisualDVM.TestingSystem.Common.Test.Json.TestsJson;
|
||||
import _VisualDVM.TestingSystem.Common.Test.Test;
|
||||
import _VisualDVM.Utils;
|
||||
import com.sun.org.glassfish.gmbal.Description;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -39,7 +42,9 @@ public class Configuration extends riDBObject {
|
||||
public String printAuto() {
|
||||
return autoTesting > 0 ? "Да" : "Нет";
|
||||
}
|
||||
public String printEthalon(){return (ethalon_id == CommonConstants.Nan) ? "—" : String.valueOf(ethalon_id);}
|
||||
public String printEthalon() {
|
||||
return (ethalon_id == CommonConstants.Nan) ? "—" : String.valueOf(ethalon_id);
|
||||
}
|
||||
public void SwitchAuto() {
|
||||
autoTesting = (autoTesting == 0) ? 1 : 0;
|
||||
}
|
||||
@@ -62,7 +67,7 @@ public class Configuration extends riDBObject {
|
||||
super.SynchronizeFields(src);
|
||||
Configuration c = (Configuration) src;
|
||||
//--
|
||||
ethalon_id=c.ethalon_id;
|
||||
ethalon_id = c.ethalon_id;
|
||||
maxtime = c.maxtime;
|
||||
autoTesting = c.autoTesting;
|
||||
kernels = c.kernels;
|
||||
@@ -79,4 +84,40 @@ public class Configuration extends riDBObject {
|
||||
public String getDialogName() {
|
||||
return description;
|
||||
}
|
||||
//--
|
||||
//работает со стороны сервера.
|
||||
public boolean tryUpdateGroup(Group group) {
|
||||
ConfigurationCache unpacked = new ConfigurationCache(this);
|
||||
for (GroupJson groupJson : unpacked.groupsJson.array) {
|
||||
if (groupJson.id == group.id) {
|
||||
groupJson.description = group.description;
|
||||
groupJson.language = String.valueOf(group.language);
|
||||
packedGroupsJson = Utils_.gson.toJson(unpacked.groupsJson);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/*
|
||||
public void updateTest(Test test){
|
||||
ConfigurationCache unpacked = new ConfigurationCache(this);
|
||||
for (TestJson testJson : unpacked.testsJson.array) {
|
||||
if (testJson.id == test.id) {
|
||||
testJson.description = test.description;
|
||||
testJson.language = String.valueOf(group.language);
|
||||
}
|
||||
}
|
||||
packedGroupsJson = Utils_.gson.toJson(unpacked);
|
||||
}
|
||||
|
||||
public boolean containsTest(int test_id) {
|
||||
ConfigurationCache unpacked = new ConfigurationCache(this);
|
||||
for (TestJson testJson : unpacked.testsJson.array) {
|
||||
if (testJson.id == test_id) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ import _VisualDVM.TestingSystem.Common.MachineProcess.MachineProcessSet;
|
||||
import _VisualDVM.TestingSystem.Common.Test.Test;
|
||||
import _VisualDVM.TestingSystem.Common.Test.TestType;
|
||||
import _VisualDVM.TestingSystem.Common.TestingPackageToKill.TestingPackageToKill;
|
||||
import _VisualDVM.TestingSystem.DVM.DVMConfiguration.DVMConfiguration;
|
||||
import _VisualDVM.TestingSystem.DVM.DVMPackage.DVMPackage;
|
||||
import _VisualDVM.TestingSystem.DVM.DVMPackage.DVMPackage_json;
|
||||
import _VisualDVM.TestingSystem.DVM.DVMTestingChecker;
|
||||
@@ -102,6 +103,23 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
||||
}
|
||||
}
|
||||
@Override
|
||||
protected void afterEditAction(DBObject object) throws Exception {
|
||||
if (object instanceof Group) {
|
||||
Group group = (Group) object;
|
||||
//-
|
||||
for (DVMConfiguration dvmConfiguration : db.dvmConfigurations.Data.values()) {
|
||||
if (dvmConfiguration.tryUpdateGroup(group)){
|
||||
db.Update(dvmConfiguration);
|
||||
}
|
||||
}
|
||||
for (SapforConfiguration sapforConfiguration : db.sapforConfigurations.Data.values()) {
|
||||
if (sapforConfiguration.tryUpdateGroup(group)){
|
||||
db.Update(sapforConfiguration);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void afterDeleteAction(DBObject object) throws Exception {
|
||||
if (object instanceof Test) {
|
||||
Test test = (Test) object;
|
||||
|
||||
@@ -38,7 +38,7 @@ import java.util.Comparator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Vector;
|
||||
public class TestsDatabase extends SQLiteDatabase {
|
||||
public DVMConfigurationDBTable dvm_configurations;
|
||||
public DVMConfigurationDBTable dvmConfigurations;
|
||||
public TestDBTable tests;
|
||||
public GroupsDBTable groups;
|
||||
public DVMPackageDBTable dvmPackages;
|
||||
@@ -60,7 +60,7 @@ public class TestsDatabase extends SQLiteDatabase {
|
||||
}
|
||||
@Override
|
||||
protected void initAllTables() throws Exception {
|
||||
addTable(dvm_configurations = new DVMConfigurationDBTable());
|
||||
addTable(dvmConfigurations = new DVMConfigurationDBTable());
|
||||
addTable(groups = new GroupsDBTable());
|
||||
addTable(tests = new TestDBTable());
|
||||
addTable(dvmPackages = new DVMPackageDBTable());
|
||||
@@ -312,7 +312,7 @@ public class TestsDatabase extends SQLiteDatabase {
|
||||
public void UnselectAllGTC() {
|
||||
groups.getUI().SelectAll(false);
|
||||
tests.getUI().SelectAll(false);
|
||||
dvm_configurations.getUI().SelectAll(false);
|
||||
dvmConfigurations.getUI().SelectAll(false);
|
||||
}
|
||||
public void CheckTestsPackagesDependencies(Vector<Integer> testsIds, TextLog Log) {
|
||||
//определить есть ли активные пакеты в которые входят упомянутые тесты
|
||||
|
||||
Reference in New Issue
Block a user