исправление бага с кешированием.
This commit is contained in:
5
.idea/workspace.xml
generated
5
.idea/workspace.xml
generated
@@ -8,7 +8,12 @@
|
|||||||
<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 beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" 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/UI/VisualCache/ConfigurationCache.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Common/UI/VisualCache/ConfigurationCache.java" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/src/Common/UI/VisualCache/VisualCaches.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Common/UI/VisualCache/VisualCaches.java" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/src/Common/UI/VisualCache/VisualCaches.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Common/UI/VisualCache/VisualCaches.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/SaveCurrentConfiguration.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/SaveCurrentConfiguration.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/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/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" />
|
||||||
|
|||||||
@@ -16,14 +16,10 @@ public class ConfigurationCache extends VisualCache{
|
|||||||
public TestsJson testsJson = null;
|
public TestsJson testsJson = null;
|
||||||
//--
|
//--
|
||||||
public ConfigurationCache(Configuration configuration) {
|
public ConfigurationCache(Configuration configuration) {
|
||||||
// System.out.println("configuration cache new instance for "+configuration.id);
|
|
||||||
// System.out.println("packageGroupsJson="+Utils.Brackets(configuration.packedGroupsJson));
|
|
||||||
if (configuration.packedGroupsJson.isEmpty()) {
|
if (configuration.packedGroupsJson.isEmpty()) {
|
||||||
// System.out.println("empty");
|
|
||||||
groupsJson = new GroupsJson(); //просто пустой
|
groupsJson = new GroupsJson(); //просто пустой
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// System.out.println("not empty");
|
|
||||||
groupsJson = Utils.gson.fromJson(configuration.packedGroupsJson, GroupsJson.class);
|
groupsJson = Utils.gson.fromJson(configuration.packedGroupsJson, GroupsJson.class);
|
||||||
}
|
}
|
||||||
//--
|
//--
|
||||||
|
|||||||
@@ -29,8 +29,8 @@ public class VisualCaches {
|
|||||||
VisualCache res = null;
|
VisualCache res = null;
|
||||||
LinkedHashMap<Object, VisualCache> data = getDataForClass(object.getClass());
|
LinkedHashMap<Object, VisualCache> data = getDataForClass(object.getClass());
|
||||||
if (!data.containsKey(object.getPK())) {
|
if (!data.containsKey(object.getPK())) {
|
||||||
// System.out.println("get visual cache for " + object.getPK()+" "+object.getClass());
|
// System.out.println("get visual cache for " + object.getPK()+" "+object.getClass());
|
||||||
// System.out.println("cache not found, creating...");
|
// System.out.println("cache not found, creating...");
|
||||||
data.put(object.getPK(), res = createCache(object));
|
data.put(object.getPK(), res = createCache(object));
|
||||||
} else {
|
} else {
|
||||||
// System.out.println("cache found");
|
// System.out.println("cache found");
|
||||||
@@ -38,11 +38,22 @@ public class VisualCaches {
|
|||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
//Принудительно удалить старый и записать новый.
|
||||||
|
public static void RefreshCache(DBObject object){
|
||||||
|
// System.out.println("refresh cache for " + object.getPK()+" "+object.getClass().getSimpleName());
|
||||||
|
LinkedHashMap<Object, VisualCache> data = getDataForClass(object.getClass());
|
||||||
|
//--
|
||||||
|
if (data.containsKey(object.getPK())) {
|
||||||
|
data.remove(object.getPK());
|
||||||
|
}
|
||||||
|
data.put(object.getPK(), createCache(object));
|
||||||
|
}
|
||||||
|
|
||||||
public static void DeleteCache(DBObject object){
|
public static void DeleteCache(DBObject object){
|
||||||
DeleteCache(object.getClass(), object.getPK());
|
DeleteCache(object.getClass(), object.getPK());
|
||||||
}
|
}
|
||||||
public static void DeleteCache(Class class_, Object pk){
|
public static void DeleteCache(Class class_, Object pk){
|
||||||
// System.out.println("Delete for " + pk+" "+class_);
|
// System.out.println("Delete cache for " + pk+" "+class_);
|
||||||
LinkedHashMap<Object, VisualCache> data = getDataForClass(class_);
|
LinkedHashMap<Object, VisualCache> data = getDataForClass(class_);
|
||||||
if (data.containsKey(pk))
|
if (data.containsKey(pk))
|
||||||
data.remove(pk);
|
data.remove(pk);
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package Visual_DVM_2021.Passes;
|
package Visual_DVM_2021.Passes;
|
||||||
import Common.Current;
|
import Common.Current;
|
||||||
import Common.Global;
|
import Common.Global;
|
||||||
|
import Common.UI.UI;
|
||||||
import Common.UI.VisualCache.ConfigurationCache;
|
import Common.UI.VisualCache.ConfigurationCache;
|
||||||
import Common.UI.VisualCache.VisualCaches;
|
import Common.UI.VisualCache.VisualCaches;
|
||||||
import Common.Utils.Utils;
|
import Common.Utils.Utils;
|
||||||
@@ -45,8 +46,5 @@ public abstract class SaveCurrentConfiguration<C extends Configuration> extends
|
|||||||
target.saveTestsAsJson(tests);
|
target.saveTestsAsJson(tests);
|
||||||
//--
|
//--
|
||||||
super.ServerAction();
|
super.ServerAction();
|
||||||
//--
|
|
||||||
// ConfigurationCache cache = (ConfigurationCache) VisualCaches.GetCache(target);
|
|
||||||
// System.out.println(Utils.Brackets(cache.groupsDescriptions));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -12,11 +12,6 @@ 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.DeleteCache(target);
|
|
||||||
}
|
|
||||||
//Очищаем все связанные таблицы, чтобы не допустить перерисовки во время удаления объекта.
|
//Очищаем все связанные таблицы, чтобы не допустить перерисовки во время удаления объекта.
|
||||||
@Override
|
@Override
|
||||||
protected void showPreparation() throws Exception {
|
protected void showPreparation() throws Exception {
|
||||||
@@ -38,6 +33,7 @@ public class DeleteServerObject<S extends RepositoryServer, D extends DBObject>
|
|||||||
@Override
|
@Override
|
||||||
protected void ServerAction() throws Exception {
|
protected void ServerAction() throws Exception {
|
||||||
DeleteObject(target);
|
DeleteObject(target);
|
||||||
|
VisualCaches.DeleteCache(target);
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
protected void showDone() throws Exception {
|
protected void showDone() throws Exception {
|
||||||
|
|||||||
@@ -48,13 +48,6 @@ 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.DeleteCache(d, key);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//Очищаем все связанные таблицы, чтобы не допустить перерисовки во время удаления объекта.
|
//Очищаем все связанные таблицы, чтобы не допустить перерисовки во время удаления объекта.
|
||||||
@Override
|
@Override
|
||||||
protected void showPreparation() throws Exception {
|
protected void showPreparation() throws Exception {
|
||||||
@@ -78,5 +71,8 @@ public class DeleteServerObjects <S extends RepositoryServer, D extends DBObject
|
|||||||
protected void performFinish() throws Exception {
|
protected void performFinish() throws Exception {
|
||||||
super.performFinish();
|
super.performFinish();
|
||||||
passes.get(getDb().getSynchronizePassCode()).Do();
|
passes.get(getDb().getSynchronizePassCode()).Do();
|
||||||
|
for (Object key: target){
|
||||||
|
VisualCaches.DeleteCache(d, key);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,12 +14,6 @@ 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.DeleteCache(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);
|
||||||
@@ -31,6 +25,7 @@ public class EditServerObject<S extends RepositoryServer, D extends DBObject> ex
|
|||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
protected void showDone() throws Exception {
|
protected void showDone() throws Exception {
|
||||||
|
VisualCaches.RefreshCache(target);
|
||||||
getDb().tables.get(d).ui_.Show(target.getPK());
|
getDb().tables.get(d).ui_.Show(target.getPK());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user