каскадное изменение информации о группе в конфигурациях в случае ее редактирования
This commit is contained in:
11
.idea/workspace.xml
generated
11
.idea/workspace.xml
generated
@@ -8,9 +8,14 @@
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="e42177c3-2328-4b27-8a01-35779b2beb99" name="Default Changelist" comment="">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/properties" beforeDir="false" afterPath="$PROJECT_DIR$/properties" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/SAPFOR/SapforConfiguration/UI/SapforConfigurationsForm.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/SAPFOR/SapforConfiguration/UI/SapforConfigurationsForm.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/SAPFOR/SapforTestingPlanner.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/SAPFOR/SapforTestingPlanner.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/StartSelectedDVMConfigurations.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/StartSelectedDVMConfigurations.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/SynchronizeTests.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/SynchronizeTests.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/ServerObjectsCache/ConfigurationCache.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/ServerObjectsCache/ConfigurationCache.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/ServerObjectsCache/VisualCaches.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/ServerObjectsCache/VisualCaches.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/Common/Configuration/Configuration.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/Common/Configuration/Configuration.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/Common/TestingServer.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/Common/TestingServer.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/Common/TestsDatabase.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/Common/TestsDatabase.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/Visual/Windows/TestingForm.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Visual/Windows/TestingForm.java" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
|
||||
@@ -51,10 +51,10 @@ public class StartSelectedDVMConfigurations extends PublishServerObject<TestingS
|
||||
if (!compiler.versionLoaded)
|
||||
Global.mainModule.getPass(PassCode.ShowCompilerVersion).Do(compiler, false);
|
||||
//-----
|
||||
if (!Global.testingServer.db.dvm_configurations.getUI().CheckSelectedOrCurrent(Log)) {
|
||||
if (!Global.testingServer.db.dvmConfigurations.getUI().CheckSelectedOrCurrent(Log)) {
|
||||
return false;
|
||||
}
|
||||
Vector<DVMConfiguration> configurations = Global.testingServer.db.dvm_configurations.getUI().getSelectedOrCurrent();
|
||||
Vector<DVMConfiguration> configurations = Global.testingServer.db.dvmConfigurations.getUI().getSelectedOrCurrent();
|
||||
//---
|
||||
target = new DVMPackage(
|
||||
Global.mainModule.getAccount(),
|
||||
|
||||
@@ -5,6 +5,11 @@ import _VisualDVM.Global;
|
||||
import _VisualDVM.Passes.Server.TestingSystemPass;
|
||||
import _VisualDVM.Repository.Server.ServerCode;
|
||||
import _VisualDVM.Repository.Server.ServerExchangeUnit_2021;
|
||||
import _VisualDVM.ServerObjectsCache.VisualCaches;
|
||||
import _VisualDVM.TestingSystem.DVM.DVMConfiguration.DVMConfiguration;
|
||||
import _VisualDVM.TestingSystem.DVM.DVMPackage.DVMPackage;
|
||||
import _VisualDVM.TestingSystem.SAPFOR.SapforConfiguration.SapforConfiguration;
|
||||
import _VisualDVM.TestingSystem.SAPFOR.SapforPackage.SapforPackage;
|
||||
import _VisualDVM.Utils;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
|
||||
@@ -34,7 +39,7 @@ public class SynchronizeTests extends TestingSystemPass<Object> {
|
||||
//--
|
||||
// server.db.machines _testing_system
|
||||
//--
|
||||
server.db.dvm_configurations.ClearUI();
|
||||
server.db.dvmConfigurations.ClearUI();
|
||||
server.db.groups.ClearUI();
|
||||
server.db.sapforConfigurations.ClearUI();
|
||||
server.db.serverSapfors.ClearUI();
|
||||
@@ -61,8 +66,14 @@ public class SynchronizeTests extends TestingSystemPass<Object> {
|
||||
@Override
|
||||
protected void showDone() throws Exception {
|
||||
if (Global.mainModule.getUI().hasMainWindow()) {
|
||||
//--
|
||||
//--
|
||||
VisualCaches.ClearDataForClass(DVMConfiguration.class);
|
||||
VisualCaches.ClearDataForClass(SapforConfiguration.class);
|
||||
VisualCaches.ClearDataForClass(DVMPackage.class);
|
||||
VisualCaches.ClearDataForClass(SapforPackage.class);
|
||||
//server.db.machines
|
||||
server.db.dvm_configurations.ShowUI();
|
||||
server.db.dvmConfigurations.ShowUI();
|
||||
server.db.groups.ShowUI();
|
||||
server.db.sapforConfigurations.ShowUI();
|
||||
server.db.serverSapfors.ShowUI();
|
||||
|
||||
@@ -21,25 +21,20 @@ public class ConfigurationCache extends VisualCache {
|
||||
public Vector<String> groupsSummary = null;
|
||||
//--
|
||||
public ConfigurationCache(Configuration configuration) {
|
||||
if (configuration.packedGroupsJson.isEmpty()) {
|
||||
if (configuration.packedGroupsJson.isEmpty())
|
||||
groupsJson = new GroupsJson(); //просто пустой
|
||||
} else {
|
||||
else
|
||||
groupsJson = Utils_.gson.fromJson(configuration.packedGroupsJson, GroupsJson.class);
|
||||
}
|
||||
//--
|
||||
if (testsJson == null) {
|
||||
if (configuration.packedTestsJson.isEmpty())
|
||||
testsJson = new TestsJson(); //просто пустой
|
||||
else
|
||||
testsJson = Utils_.gson.fromJson(configuration.packedTestsJson, TestsJson.class);
|
||||
}
|
||||
//-
|
||||
if (settingsJson == null) {
|
||||
if (configuration.packedSettingsJson.isEmpty())
|
||||
settingsJson = new SettingsArrayJson(); //просто пустой
|
||||
else
|
||||
settingsJson = Utils_.gson.fromJson(configuration.packedSettingsJson, SettingsArrayJson.class);
|
||||
}
|
||||
//-
|
||||
LinkedHashMap<String, Vector<String>> gmap = new LinkedHashMap<>();
|
||||
for (GroupJson groupJson : groupsJson.array) {
|
||||
|
||||
@@ -6,7 +6,7 @@ import _VisualDVM.TestingSystem.DVM.DVMConfiguration.DVMConfiguration;
|
||||
import _VisualDVM.TestingSystem.SAPFOR.SapforConfiguration.SapforConfiguration;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
//нужен для серверных объектов, чтобы в сокет не класть лишнего.
|
||||
//нужен со стороны клиента для серверных объектов, чтобы в сокет не класть лишнего.
|
||||
public class VisualCaches {
|
||||
static LinkedHashMap<Class, LinkedHashMap<Object, VisualCache>> allData = new LinkedHashMap<>();
|
||||
static LinkedHashMap<Object, VisualCache> getDataForClass(Class class_) {
|
||||
@@ -19,14 +19,16 @@ public class VisualCaches {
|
||||
}
|
||||
return data;
|
||||
}
|
||||
public static void ClearDataForClass(Class class_) {
|
||||
if (allData.containsKey(class_)) {
|
||||
allData.get(class_).clear();
|
||||
}
|
||||
}
|
||||
//чтобы не трогать сами объекты и не сбить сериализацию
|
||||
static VisualCache createCache(Object object) {
|
||||
if (object instanceof SapforConfiguration)
|
||||
return new SapforConfigurationCache((Configuration) object);
|
||||
if (object instanceof DVMConfiguration)
|
||||
return new DVMConfigurationCache((Configuration) object);
|
||||
if (object instanceof TestingPackage)
|
||||
return new PackageCache((TestingPackage) object);
|
||||
if (object instanceof SapforConfiguration) return new SapforConfigurationCache((Configuration) object);
|
||||
if (object instanceof DVMConfiguration) return new DVMConfigurationCache((Configuration) object);
|
||||
if (object instanceof TestingPackage) return new PackageCache((TestingPackage) object);
|
||||
return new VisualCache();
|
||||
}
|
||||
public static VisualCache GetCache(DBObject object) {
|
||||
@@ -58,8 +60,7 @@ public class VisualCaches {
|
||||
public static void DeleteCache(Class class_, Object pk) {
|
||||
// System.out.println("Delete cache for " + pk+" "+class_);
|
||||
LinkedHashMap<Object, VisualCache> data = getDataForClass(class_);
|
||||
if (data.containsKey(pk))
|
||||
data.remove(pk);
|
||||
if (data.containsKey(pk)) data.remove(pk);
|
||||
}
|
||||
public static void Print() {
|
||||
System.out.println("alldata size=" + allData.size());
|
||||
|
||||
@@ -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) {
|
||||
//определить есть ли активные пакеты в которые входят упомянутые тесты
|
||||
|
||||
@@ -126,7 +126,7 @@ public class TestingForm implements FormWithSplitters, TestingWindow {
|
||||
Global.mainModule.getDb().users.mountUI(usersPanel);
|
||||
Global.mainModule.getDb().compilers.mountUI(compilersPanel);
|
||||
//-
|
||||
Global.testingServer.db.dvm_configurations.mountUI(configurationsPanel);
|
||||
Global.testingServer.db.dvmConfigurations.mountUI(configurationsPanel);
|
||||
Global.testingServer.db.dvmPackages.mountUI(dvmPackagesPanel);
|
||||
Global.testingServer.db.dvmRunTasks.mountUI(dvmRunTasksPanel);
|
||||
Global.testingServer.db.sapforConfigurations.mountUI(sapforConfigurationsPanel);
|
||||
@@ -147,7 +147,7 @@ public class TestingForm implements FormWithSplitters, TestingWindow {
|
||||
@Override
|
||||
public void ShowAll() {
|
||||
Global.mainModule.getDb().machines.ShowUI();
|
||||
Global.testingServer.db.dvm_configurations.ShowUI();
|
||||
Global.testingServer.db.dvmConfigurations.ShowUI();
|
||||
Global.testingServer.db.dvmPackages.ShowUI();
|
||||
Global.testingServer.db.sapforPackages.ShowUI();
|
||||
//--
|
||||
|
||||
Reference in New Issue
Block a user