Fixed code to comply with uuid property rename to id

This commit is contained in:
Luca Frosini 2023-04-28 11:46:13 +02:00
parent a60aa315fe
commit 71a9acae34
2 changed files with 8 additions and 8 deletions

View File

@ -110,23 +110,23 @@ public class ContextCache {
this.contexts = new ArrayList<>(); this.contexts = new ArrayList<>();
for(Context c : contexts) { for(Context c : contexts) {
UUID uuid = c.getUUID(); UUID uuid = c.getID();
Context context = new ContextImpl(c.getName()); Context context = new ContextImpl(c.getName());
context.setMetadata(c.getMetadata()); context.setMetadata(c.getMetadata());
context.setUUID(uuid); context.setID(uuid);
this.contexts.add(context); this.contexts.add(context);
this.uuidToContext.put(uuid, context); this.uuidToContext.put(uuid, context);
} }
for(Context c : contexts) { for(Context c : contexts) {
UUID uuid = c.getUUID(); UUID uuid = c.getID();
Context context = this.uuidToContext.get(uuid); Context context = this.uuidToContext.get(uuid);
if(c.getParent()!=null) { if(c.getParent()!=null) {
IsParentOf ipo = c.getParent(); IsParentOf ipo = c.getParent();
UUID parentUUID = ipo.getSource().getUUID(); UUID parentUUID = ipo.getSource().getID();
Context parent = this.uuidToContext.get(parentUUID); Context parent = this.uuidToContext.get(parentUUID);
IsParentOf isParentOf = new IsParentOfImpl(parent, context); IsParentOf isParentOf = new IsParentOfImpl(parent, context);
isParentOf.setUUID(parentUUID); isParentOf.setID(parentUUID);
isParentOf.setMetadata(ipo.getMetadata()); isParentOf.setMetadata(ipo.getMetadata());
parent.addChild(isParentOf); parent.addChild(isParentOf);
context.setParent(isParentOf); context.setParent(isParentOf);
@ -136,7 +136,7 @@ public class ContextCache {
for(Context context : contexts) { for(Context context : contexts) {
UUID uuid = context.getUUID(); UUID uuid = context.getID();
String fullName = getContextFullName(context); String fullName = getContextFullName(context);
this.uuidToContextFullName.put(uuid, fullName); this.uuidToContextFullName.put(uuid, fullName);
this.contextFullNameToUUID.put(fullName, uuid); this.contextFullNameToUUID.put(fullName, uuid);
@ -149,7 +149,7 @@ public class ContextCache {
IsParentOf ipo = context.getParent(); IsParentOf ipo = context.getParent();
if(ipo!=null) { if(ipo!=null) {
Context c = ipo.getSource(); Context c = ipo.getSource();
c = uuidToContext.get(c.getUUID()); c = uuidToContext.get(c.getID());
String parentFullName = getContextFullName(c); String parentFullName = getContextFullName(c);
stringBuilder.append(parentFullName); stringBuilder.append(parentFullName);
} }

View File

@ -55,7 +55,7 @@ public class ContextUtility {
try { try {
Map<UUID, String> uuidToContextFullNameAssociation = contextCache.getUUIDToContextFullNameAssociation(); Map<UUID, String> uuidToContextFullNameAssociation = contextCache.getUUIDToContextFullNameAssociation();
if(!uuidToContextFullNameAssociation.keySet().containsAll(uuids)) { if(!uuidToContextFullNameAssociation.keySet().containsAll(uuids)) {
logger.debug("{} does not contain all the contexts identified by the following UUID list. Trying to invalidate the cache", ContextCache.class.getSimpleName(), uuids); logger.debug("{} does not contain all the contexts identified by the following UUID list {}. Trying to invalidate the cache", ContextCache.class.getSimpleName(), uuids);
contextCache.cleanCache(); contextCache.cleanCache();
uuidToContextFullNameAssociation = contextCache.getUUIDToContextFullNameAssociation(); uuidToContextFullNameAssociation = contextCache.getUUIDToContextFullNameAssociation();
} }