подправил кеширование отображаемых данных ( чтобы не распаковывать каждый раз список имен групп и прочее)

This commit is contained in:
2024-09-18 13:37:11 +03:00
parent f55a3a6324
commit 0cef474233
18 changed files with 181 additions and 85 deletions

17
.idea/workspace.xml generated
View File

@@ -7,7 +7,24 @@
</component> </component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="e42177c3-2328-4b27-8a01-35779b2beb99" name="Default Changelist" comment=""> <list default="true" id="e42177c3-2328-4b27-8a01-35779b2beb99" name="Default Changelist" comment="">
<change afterPath="$PROJECT_DIR$/src/Common/UI/VisualCache/ConfigurationCache.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/Common/UI/VisualCache/VisualCache.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/Common/UI/VisualCache/VisualCaches.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/Common/Database/DataSet.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Common/Database/DataSet.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/TestingSystem/Common/Configuration/Configuration.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/TestingSystem/Common/Configuration/Configuration.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/TestingSystem/DVM/DVMConfiguration/DVMConfigurationDBTable.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/TestingSystem/DVM/DVMConfiguration/DVMConfigurationDBTable.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/DeleteConfiguration.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/DeleteConfiguration.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/DeleteGroup.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/DeleteGroup.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/DeleteSapforConfiguration.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/DeleteSapforConfiguration.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/DeleteSapforConfigurationCommand.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/DeleteSapforConfigurationCommand.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/DeleteTest.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/DeleteTest.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/ShowCurrentDVMConfigurationTests.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/ShowCurrentDVMConfigurationTests.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/StartSelectedDVMConfigurations.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/StartSelectedDVMConfigurations.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/StartSelectedDVMConfigurations.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/StartSelectedDVMConfigurations.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/DeleteServerObjects.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/Server/DeleteServerObjects.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/DeleteTestingPackages.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/DeleteTestingPackages.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/Server/DeleteServerObject.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/Server/DeleteServerObject.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/Server/EditServerObject.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/Server/EditServerObject.java" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />

View File

@@ -17,8 +17,8 @@ import java.util.Vector;
import java.util.stream.Collectors; import java.util.stream.Collectors;
public class DataSet<K, D extends DBObject> extends DataSetAnchestor { public class DataSet<K, D extends DBObject> extends DataSetAnchestor {
//- //-
public static LinkedHashMap<Class, Object> selections = new LinkedHashMap<>(); public LinkedHashMap<Class, Object> selections = new LinkedHashMap<>();
//- //---
public String Name; public String Name;
public Class<K> k; //класс первичного ключа. public Class<K> k; //класс первичного ключа.
public Class<D> d; //класс объектов. public Class<D> d; //класс объектов.

View File

@@ -0,0 +1,57 @@
package Common.UI.VisualCache;
import Common.Global;
import Common.Utils.Utils;
import TestingSystem.Common.Configuration.Configuration;
import TestingSystem.Common.Group.Group;
import TestingSystem.Common.Group.Json.GroupJson;
import TestingSystem.Common.Group.Json.GroupsJson;
import TestingSystem.Common.Test.Json.TestJson;
import TestingSystem.Common.Test.Json.TestsJson;
import TestingSystem.Common.Test.Test;
import java.util.Vector;
public class ConfigurationCache extends VisualCache{
public GroupsJson groupsJson = null;
public Vector<String> groupsDescriptions = null;
public TestsJson testsJson = null;
//--
public ConfigurationCache(Configuration configuration) {
if (configuration.packedGroupsJson.isEmpty())
groupsJson = new GroupsJson(); //просто пустой
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);
}
//-
groupsDescriptions = new Vector<>();
for (GroupJson groupJson : groupsJson.array)
groupsDescriptions.add(groupJson.description);
}
public int getTestsCount() {
return testsJson.array.size();
}
public Vector<String> getGroupsDescriptions() {
return groupsDescriptions;
}
public Vector<Group> getGroups(){
Vector<Group> groups = new Vector<>();
for (GroupJson groupJson : groupsJson.array){
if (Global.testingServer.db.groups.containsKey(groupJson.id))
groups.add(Global.testingServer.db.groups.get(groupJson.id));
}
return groups;
}
public Vector<Test> getTests(){
Vector<Test> tests = new Vector<>();
for (TestJson testJson : testsJson.array){
if (Global.testingServer.db.tests.containsKey(testJson.id))
tests.add(Global.testingServer.db.tests.get(testJson.id));
}
return tests;
}
}

View File

@@ -0,0 +1,3 @@
package Common.UI.VisualCache;
public class VisualCache {
}

View File

@@ -0,0 +1,46 @@
package Common.UI.VisualCache;
import Common.Database.DBObject;
import TestingSystem.Common.Configuration.Configuration;
import java.util.LinkedHashMap;
public class VisualCaches {
static LinkedHashMap<Class, LinkedHashMap<Object, VisualCache>> allData = new LinkedHashMap<>();
static LinkedHashMap<Object, VisualCache> getDataForClass(Class class_) {
LinkedHashMap<Object, VisualCache> data;
if (allData.containsKey(class_)) {
data = allData.get(class_);
} else {
data = new LinkedHashMap<>();
allData.put(class_, data);
}
return data;
}
//чтобы не трогать сами объекты и не сбить сериализацию
static VisualCache createCache(Object object) {
if (object instanceof Configuration)
return new ConfigurationCache((Configuration) object);
return new VisualCache();
}
public static VisualCache GetCache(DBObject object) {
// System.out.println("get visual cache for " + object.getPK());
VisualCache res = null;
LinkedHashMap<Object, VisualCache> data = getDataForClass(object.getClass());
if (!data.containsKey(object.getPK())) {
// System.out.println("cache not found, creating...");
data.put(object.getPK(), res = createCache(object));
} else {
// System.out.println("cache found");
res = data.get(object.getPK());
}
return res;
}
public static void DeleteCahce(DBObject object){
DeleteCahce(object.getClass(), object.getPK());
}
public static void DeleteCahce(Class class_, Object pk){
LinkedHashMap<Object, VisualCache> data = getDataForClass(class_);
if (data.containsKey(pk))
data.remove(pk);
}
}

View File

@@ -1,17 +1,13 @@
package TestingSystem.Common.Configuration; package TestingSystem.Common.Configuration;
import Common.Database.DBObject; import Common.Database.DBObject;
import Common.Database.riDBObject; import Common.Database.riDBObject;
import Common.Global;
import Common.Utils.Utils; import Common.Utils.Utils;
import TestingSystem.Common.Group.Group; import TestingSystem.Common.Group.Group;
import TestingSystem.Common.Group.Json.GroupJson;
import TestingSystem.Common.Group.Json.GroupsJson; import TestingSystem.Common.Group.Json.GroupsJson;
import TestingSystem.Common.Test.Json.TestJson;
import TestingSystem.Common.Test.Json.TestsJson; import TestingSystem.Common.Test.Json.TestsJson;
import TestingSystem.Common.Test.Test; import TestingSystem.Common.Test.Test;
import com.sun.org.glassfish.gmbal.Description; import com.sun.org.glassfish.gmbal.Description;
import java.util.LinkedHashMap;
import java.util.Vector; import java.util.Vector;
public class Configuration extends riDBObject { public class Configuration extends riDBObject {
//конфигурация = данные для пакета. //конфигурация = данные для пакета.
@@ -34,14 +30,13 @@ public class Configuration extends riDBObject {
public String packedGroupsJson = ""; public String packedGroupsJson = "";
@Description("DEFAULT ''") @Description("DEFAULT ''")
public String packedTestsJson = ""; public String packedTestsJson = "";
//---- //--
//---данные для отображения. кешировать их где-то еще? проблема что отправляются на сервер почем зря. public void saveGroupsAsJson(Vector<Group> groups) {
@Description("IGNORE") packedGroupsJson = Utils.jsonToPrettyFormat(Utils.gson.toJson(new GroupsJson(groups)));
public GroupsJson groupsJson = null; }
@Description("IGNORE") public void saveTestsAsJson(Vector<Test> tests) {
public Vector<String> groupsDescriptions = null; packedTestsJson = Utils.jsonToPrettyFormat(Utils.gson.toJson(new TestsJson(tests)));
@Description("IGNORE") }
public TestsJson testsJson = null;
//-- //--
@Override @Override
public void SynchronizeFields(DBObject src) { public void SynchronizeFields(DBObject src) {
@@ -55,60 +50,4 @@ public class Configuration extends riDBObject {
packedTestsJson = c.packedTestsJson; packedTestsJson = c.packedTestsJson;
} }
//- //-
public void saveGroupsAsJson(Vector<Group> groups) {
packedGroupsJson = Utils.jsonToPrettyFormat(Utils.gson.toJson(new GroupsJson(groups)));
}
void unpackGroupsAsJson() {
if (groupsJson == null) {
if (packedGroupsJson.isEmpty())
groupsJson = new GroupsJson(); //просто пустой
else
groupsJson = Utils.gson.fromJson(packedGroupsJson, GroupsJson.class);
}
}
public Vector<String> getGroupsDescriptions() {
if (groupsDescriptions==null) {
unpackGroupsAsJson();
groupsDescriptions = new Vector<>();
for (GroupJson groupJson : groupsJson.array)
groupsDescriptions.add(groupJson.description);
}
return groupsDescriptions;
}
public Vector<Group> getGroups() {
//здесь обращение реже так что буферизовать список групп не надо, тем более может меняться.
unpackGroupsAsJson();
Vector<Group> res = new Vector<>();
for (GroupJson groupJson: groupsJson.array){
if (Global.testingServer.db.groups.containsKey(groupJson.id))
res.add(Global.testingServer.db.groups.get(groupJson.id));
}
return res;
}
//--------------------------------------------------------------------->>>
public void saveTestsAsJson(Vector<Test> tests) {
packedTestsJson = Utils.jsonToPrettyFormat(Utils.gson.toJson(new TestsJson(tests)));
}
void unpackTestsAsJson() {
if (testsJson == null) {
if (packedTestsJson.isEmpty())
testsJson = new TestsJson(); //просто пустой
else
testsJson = Utils.gson.fromJson(packedTestsJson, TestsJson.class);
}
}
public int getTestsCount(){
unpackTestsAsJson();
return testsJson.array.size();
}
public Vector<Test> getTests() {
//здесь обращение реже так что буферизовать список групп не надо, тем более может меняться.
unpackTestsAsJson();
Vector<Test> res = new Vector<>();
for (TestJson testJson: testsJson.array){
if (Global.testingServer.db.tests.containsKey(testJson.id))
res.add(Global.testingServer.db.tests.get(testJson.id));
}
return res;
}
} }

View File

@@ -2,8 +2,12 @@ package TestingSystem.DVM.DVMConfiguration;
import Common.Current; import Common.Current;
import Common.Database.DBObject; import Common.Database.DBObject;
import Common.Database.iDBTable; import Common.Database.iDBTable;
import Common.Global;
import Common.UI.DataSetControlForm; import Common.UI.DataSetControlForm;
import Common.UI.Tables.TableRenderers; import Common.UI.Tables.TableRenderers;
import Common.UI.VisualCache.ConfigurationCache;
import Common.UI.VisualCache.VisualCache;
import Common.UI.VisualCache.VisualCaches;
import Common.UI.VisualiserStringList; import Common.UI.VisualiserStringList;
import Common.UI.Windows.Dialog.DBObjectDialog; import Common.UI.Windows.Dialog.DBObjectDialog;
import Common.Utils.Utils; import Common.Utils.Utils;
@@ -62,23 +66,24 @@ public class DVMConfigurationDBTable extends iDBTable<DVMConfiguration> {
} }
@Override @Override
public Object getFieldAt(DVMConfiguration object, int columnIndex) { public Object getFieldAt(DVMConfiguration object, int columnIndex) {
ConfigurationCache cache = (ConfigurationCache) VisualCaches.GetCache(object);
switch (columnIndex) { switch (columnIndex) {
case 2: case 2:
return object.description; return object.description;
case 3: case 3:
return object.sender_name; return object.sender_name;
//---
case 4: case 4:
return object.printAuto(); return object.printAuto();
case 5: case 5:
return object.getGroupsDescriptions(); return cache.getGroupsDescriptions();
case 6: case 6:
return object.getTestsCount(); return cache.getTestsCount();
//--- //todo упростить. и флаги и окружение будут просто одной строкой. мульти не актуально.
case 7: case 7:
return Utils.unpackStrings(object.flags, true); return Utils.unpackStrings(object.flags, true);
case 8: case 8:
return Utils.unpackStrings(object.environments, true); return Utils.unpackStrings(object.environments, true);
//------------------------------------------------------------------------------------
case 9: case 9:
return object.c_maxtime; return object.c_maxtime;
case 10: case 10:

View File

@@ -2,7 +2,7 @@ package Visual_DVM_2021.Passes.All;
import Common.Global; import Common.Global;
import TestingSystem.Common.TestingServer; import TestingSystem.Common.TestingServer;
import TestingSystem.DVM.DVMConfiguration.DVMConfiguration; import TestingSystem.DVM.DVMConfiguration.DVMConfiguration;
import Visual_DVM_2021.Passes.DeleteServerObjects; import Visual_DVM_2021.Passes.Server.DeleteServerObjects;
public class DeleteConfiguration extends DeleteServerObjects<TestingServer, DVMConfiguration> { public class DeleteConfiguration extends DeleteServerObjects<TestingServer, DVMConfiguration> {
public DeleteConfiguration() { public DeleteConfiguration() {
super(Global.testingServer, DVMConfiguration.class); super(Global.testingServer, DVMConfiguration.class);

View File

@@ -2,7 +2,7 @@ package Visual_DVM_2021.Passes.All;
import Common.Global; import Common.Global;
import TestingSystem.Common.Group.Group; import TestingSystem.Common.Group.Group;
import TestingSystem.Common.TestingServer; import TestingSystem.Common.TestingServer;
import Visual_DVM_2021.Passes.DeleteServerObjects; import Visual_DVM_2021.Passes.Server.DeleteServerObjects;
public class DeleteGroup extends DeleteServerObjects<TestingServer, Group> { public class DeleteGroup extends DeleteServerObjects<TestingServer, Group> {
public DeleteGroup() { public DeleteGroup() {
super(Global.testingServer, Group.class); super(Global.testingServer, Group.class);

View File

@@ -2,7 +2,7 @@ package Visual_DVM_2021.Passes.All;
import Common.Global; import Common.Global;
import TestingSystem.Common.TestingServer; import TestingSystem.Common.TestingServer;
import TestingSystem.SAPFOR.SapforConfiguration.SapforConfiguration; import TestingSystem.SAPFOR.SapforConfiguration.SapforConfiguration;
import Visual_DVM_2021.Passes.DeleteServerObjects; import Visual_DVM_2021.Passes.Server.DeleteServerObjects;
public class DeleteSapforConfiguration extends DeleteServerObjects<TestingServer, SapforConfiguration> { public class DeleteSapforConfiguration extends DeleteServerObjects<TestingServer, SapforConfiguration> {
public DeleteSapforConfiguration() { public DeleteSapforConfiguration() {
super(Global.testingServer, SapforConfiguration.class); super(Global.testingServer, SapforConfiguration.class);

View File

@@ -2,7 +2,7 @@ package Visual_DVM_2021.Passes.All;
import Common.Global; import Common.Global;
import TestingSystem.Common.TestingServer; import TestingSystem.Common.TestingServer;
import TestingSystem.SAPFOR.SapforConfigurationCommand.SapforConfigurationCommand; import TestingSystem.SAPFOR.SapforConfigurationCommand.SapforConfigurationCommand;
import Visual_DVM_2021.Passes.DeleteServerObjects; import Visual_DVM_2021.Passes.Server.DeleteServerObjects;
public class DeleteSapforConfigurationCommand extends DeleteServerObjects<TestingServer, SapforConfigurationCommand> { public class DeleteSapforConfigurationCommand extends DeleteServerObjects<TestingServer, SapforConfigurationCommand> {
public DeleteSapforConfigurationCommand() { public DeleteSapforConfigurationCommand() {
super(Global.testingServer, SapforConfigurationCommand.class); super(Global.testingServer, SapforConfigurationCommand.class);

View File

@@ -2,7 +2,7 @@ package Visual_DVM_2021.Passes.All;
import Common.Global; import Common.Global;
import TestingSystem.Common.Test.Test; import TestingSystem.Common.Test.Test;
import TestingSystem.Common.TestingServer; import TestingSystem.Common.TestingServer;
import Visual_DVM_2021.Passes.DeleteServerObjects; import Visual_DVM_2021.Passes.Server.DeleteServerObjects;
public class DeleteTest extends DeleteServerObjects<TestingServer, Test> { public class DeleteTest extends DeleteServerObjects<TestingServer, Test> {
public DeleteTest() { public DeleteTest() {
super(Global.testingServer, Test.class); super(Global.testingServer, Test.class);

View File

@@ -1,6 +1,8 @@
package Visual_DVM_2021.Passes.All; package Visual_DVM_2021.Passes.All;
import Common.Current; import Common.Current;
import Common.Global; import Common.Global;
import Common.UI.VisualCache.ConfigurationCache;
import Common.UI.VisualCache.VisualCaches;
import TestingSystem.Common.Group.Group; import TestingSystem.Common.Group.Group;
import TestingSystem.Common.Test.Test; import TestingSystem.Common.Test.Test;
import TestingSystem.DVM.DVMConfiguration.DVMConfiguration; import TestingSystem.DVM.DVMConfiguration.DVMConfiguration;
@@ -32,8 +34,9 @@ public class ShowCurrentDVMConfigurationTests extends Pass_2021<DVMConfiguration
@Override @Override
protected void showDone() throws Exception { protected void showDone() throws Exception {
System.out.println("package="+target.id); System.out.println("package="+target.id);
Vector<Group> groups = target.getGroups(); ConfigurationCache cache = (ConfigurationCache) VisualCaches.GetCache(target);
Vector<Test> tests = target.getTests(); Vector<Group> groups = cache.getGroups();
Vector<Test> tests = cache.getTests();
//----- //-----
//-- //--
for (Group group: groups) for (Group group: groups)

View File

@@ -2,6 +2,8 @@ package Visual_DVM_2021.Passes.All;
import Common.Current; import Common.Current;
import Common.Global; import Common.Global;
import Common.UI.UI; import Common.UI.UI;
import Common.UI.VisualCache.ConfigurationCache;
import Common.UI.VisualCache.VisualCaches;
import Common.Utils.Utils; import Common.Utils.Utils;
import GlobalData.Compiler.CompilerType; import GlobalData.Compiler.CompilerType;
import GlobalData.Machine.MachineType; import GlobalData.Machine.MachineType;
@@ -141,8 +143,9 @@ public class StartSelectedDVMConfigurations extends PublishServerObject<TestingS
); );
//---- //----
for (DVMConfiguration configuration: configurations) { for (DVMConfiguration configuration: configurations) {
groups = configuration.getGroups(); ConfigurationCache cache = (ConfigurationCache) VisualCaches.GetCache(configuration);
tests = configuration.getTests(); groups = cache.getGroups();
tests = cache.getTests();
//- //-
for (Group group: groups){ for (Group group: groups){
Vector<Test> groupTests = new Vector<>(); Vector<Test> groupTests = new Vector<>();

View File

@@ -4,10 +4,11 @@ import Common.Global;
import Common.Utils.Utils; import Common.Utils.Utils;
import TestingSystem.Common.TestingPackage.TestingPackage; import TestingSystem.Common.TestingPackage.TestingPackage;
import TestingSystem.Common.TestingServer; import TestingSystem.Common.TestingServer;
import Visual_DVM_2021.Passes.Server.DeleteServerObjects;
import java.io.File; import java.io.File;
import java.util.Vector; import java.util.Vector;
public abstract class DeleteTestingPackages<P extends TestingPackage> extends DeleteServerObjects<TestingServer, P>{ public abstract class DeleteTestingPackages<P extends TestingPackage> extends DeleteServerObjects<TestingServer, P> {
boolean delete_draft; boolean delete_draft;
public DeleteTestingPackages(Class<P> p) { public DeleteTestingPackages(Class<P> p) {
super(Global.testingServer, p); super(Global.testingServer, p);

View File

@@ -1,5 +1,7 @@
package Visual_DVM_2021.Passes.Server; package Visual_DVM_2021.Passes.Server;
import Common.Database.DBObject; import Common.Database.DBObject;
import Common.UI.VisualCache.VisualCache;
import Common.UI.VisualCache.VisualCaches;
import Repository.RepositoryServer; import Repository.RepositoryServer;
public class DeleteServerObject<S extends RepositoryServer, D extends DBObject> extends ServerObjectPass<S, D> { public class DeleteServerObject<S extends RepositoryServer, D extends DBObject> extends ServerObjectPass<S, D> {
@Override @Override
@@ -11,6 +13,11 @@ public class DeleteServerObject<S extends RepositoryServer, D extends DBObject>
target = (D) getDb().tables.get(d).getCurrent(); target = (D) getDb().tables.get(d).getCurrent();
return getDb().tables.get(d).CheckCurrent(Log) && getDb().tables.get(d).ShowDeleteObjectDialog(target); return getDb().tables.get(d).CheckCurrent(Log) && getDb().tables.get(d).ShowDeleteObjectDialog(target);
} }
@Override
protected void performPreparation() throws Exception {
super.performPreparation();
VisualCaches.DeleteCahce(target);
}
//Очищаем все связанные таблицы, чтобы не допустить перерисовки во время удаления объекта. //Очищаем все связанные таблицы, чтобы не допустить перерисовки во время удаления объекта.
@Override @Override
protected void showPreparation() throws Exception { protected void showPreparation() throws Exception {

View File

@@ -1,9 +1,10 @@
package Visual_DVM_2021.Passes; package Visual_DVM_2021.Passes.Server;
import Common.Current; import Common.Current;
import Common.Database.DBObject; import Common.Database.DBObject;
import Common.Database.DBTable; import Common.Database.DBTable;
import Common.Database.Database; import Common.Database.Database;
import Common.UI.UI; import Common.UI.UI;
import Common.UI.VisualCache.VisualCaches;
import Repository.RepositoryServer; import Repository.RepositoryServer;
import Repository.Server.ServerCode; import Repository.Server.ServerCode;
import Repository.Server.ServerExchangeUnit_2021; import Repository.Server.ServerExchangeUnit_2021;
@@ -48,6 +49,13 @@ public class DeleteServerObjects <S extends RepositoryServer, D extends DBObject
return false; return false;
} }
} }
@Override
protected void performPreparation() throws Exception {
super.performPreparation();
for (Object key: target){
VisualCaches.DeleteCahce(d, key);
}
}
//Очищаем все связанные таблицы, чтобы не допустить перерисовки во время удаления объекта. //Очищаем все связанные таблицы, чтобы не допустить перерисовки во время удаления объекта.
@Override @Override
protected void showPreparation() throws Exception { protected void showPreparation() throws Exception {

View File

@@ -1,5 +1,6 @@
package Visual_DVM_2021.Passes.Server; package Visual_DVM_2021.Passes.Server;
import Common.Database.DBObject; import Common.Database.DBObject;
import Common.UI.VisualCache.VisualCaches;
import Repository.RepositoryServer; import Repository.RepositoryServer;
public class EditServerObject<S extends RepositoryServer, D extends DBObject> extends ServerObjectPass<S, D> { public class EditServerObject<S extends RepositoryServer, D extends DBObject> extends ServerObjectPass<S, D> {
//-- //--
@@ -13,6 +14,12 @@ public class EditServerObject<S extends RepositoryServer, D extends DBObject> ex
target = (D) getDb().tables.get(d).getCurrent(); target = (D) getDb().tables.get(d).getCurrent();
return getDb().tables.get(d).CheckCurrent(Log) && getDb().tables.get(d).ShowEditObjectDialog(target); return getDb().tables.get(d).CheckCurrent(Log) && getDb().tables.get(d).ShowEditObjectDialog(target);
} }
@Override
protected void performPreparation() throws Exception {
super.performPreparation();
//очистить кэш.
VisualCaches.DeleteCahce(target);
}
//-- //--
public EditServerObject(S server_in, Class<D> d_in) { public EditServerObject(S server_in, Class<D> d_in) {
super(server_in, d_in); super(server_in, d_in);