каскадное изменение информации о группе в конфигурациях в случае ее редактирования

This commit is contained in:
2024-11-15 00:44:23 +03:00
parent 901eb0f623
commit e0fa7abeb4
9 changed files with 109 additions and 38 deletions

View File

@@ -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;
}
*/
}