каскадное удаление информации о тестах вконфигурации при удалении теста
This commit is contained in:
@@ -11,6 +11,7 @@ import _VisualDVM.TestingSystem.Common.Group.Json.GroupsJson;
|
||||
import _VisualDVM.TestingSystem.Common.Settings.Json.SettingsArrayJson;
|
||||
import _VisualDVM.TestingSystem.Common.Settings.Json.SettingsJson;
|
||||
import _VisualDVM.TestingSystem.Common.Settings.Settings;
|
||||
import _VisualDVM.TestingSystem.Common.Test.Json.TestJson;
|
||||
import _VisualDVM.TestingSystem.Common.Test.Json.TestsJson;
|
||||
import _VisualDVM.TestingSystem.Common.Test.Test;
|
||||
import com.sun.org.glassfish.gmbal.Description;
|
||||
@@ -141,6 +142,22 @@ public class Configuration extends riDBObject {
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
public boolean tryDeleteTest(Test test) {
|
||||
boolean flag = false;
|
||||
ConfigurationCache unpacked = new ConfigurationCache(this);
|
||||
List<TestJson> actualTests = new Vector<>();
|
||||
for (TestJson testJson : unpacked.testsJson.array) {
|
||||
if (testJson.id == test.id)
|
||||
flag = true;
|
||||
else actualTests.add(testJson);
|
||||
}
|
||||
if (flag) {
|
||||
unpacked.testsJson.array = actualTests;
|
||||
packedTestsJson = Utils_.gson.toJson(unpacked.testsJson);
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/*
|
||||
public void updateTest(Test test){
|
||||
ConfigurationCache unpacked = new ConfigurationCache(this);
|
||||
|
||||
@@ -118,7 +118,8 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
||||
db.Update(sapforConfiguration);
|
||||
}
|
||||
}
|
||||
} else if (object instanceof DVMSettings) {
|
||||
}
|
||||
else if (object instanceof DVMSettings) {
|
||||
DVMSettings dvmSettings = (DVMSettings) object;
|
||||
//-
|
||||
for (DVMConfiguration dvmConfiguration : db.dvmConfigurations.Data.values()) {
|
||||
@@ -126,7 +127,8 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
||||
db.Update(dvmConfiguration);
|
||||
}
|
||||
}
|
||||
} else if (object instanceof SapforSettings) {
|
||||
}
|
||||
else if (object instanceof SapforSettings) {
|
||||
SapforSettings sapforSettings = (SapforSettings) object;
|
||||
for (SapforConfiguration sapforConfiguration : db.sapforConfigurations.Data.values()) {
|
||||
if (sapforConfiguration.tryUpdateSettings(sapforSettings)) {
|
||||
@@ -141,6 +143,19 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
||||
Test test = (Test) object;
|
||||
Utils_.forceDeleteWithCheck(test.getArchive());
|
||||
Utils_.forceDeleteWithCheck(test.getServerPath());
|
||||
//--
|
||||
//-
|
||||
for (DVMConfiguration dvmConfiguration : db.dvmConfigurations.Data.values()) {
|
||||
if (dvmConfiguration.tryDeleteTest(test)) {
|
||||
db.Update(dvmConfiguration);
|
||||
}
|
||||
}
|
||||
for (SapforConfiguration sapforConfiguration : db.sapforConfigurations.Data.values()) {
|
||||
if (sapforConfiguration.tryDeleteTest(test)) {
|
||||
db.Update(sapforConfiguration);
|
||||
}
|
||||
}
|
||||
//--
|
||||
} else if (object instanceof Group) {
|
||||
Group group = (Group) object;
|
||||
Vector<Test> tests = new Vector<>();
|
||||
@@ -156,11 +171,13 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
||||
//--
|
||||
for (DVMConfiguration dvmConfiguration : db.dvmConfigurations.Data.values()) {
|
||||
if (dvmConfiguration.tryDeleteGroup(group)) {
|
||||
//todo удалить все тесты связанные с группой из конфигурации
|
||||
db.Update(dvmConfiguration);
|
||||
}
|
||||
}
|
||||
for (SapforConfiguration sapforConfiguration : db.sapforConfigurations.Data.values()) {
|
||||
if (sapforConfiguration.tryDeleteGroup(group)) {
|
||||
//todo удалить все тесты связанные с группой из конфигурации
|
||||
db.Update(sapforConfiguration);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user