AVM DAO refactor

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@16138 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Jan Vonka
2009-09-08 09:55:22 +00:00
parent bae58d6ee7
commit c2cca0311b
113 changed files with 9654 additions and 3923 deletions

View File

@@ -395,7 +395,7 @@ public class EntityLookupCache<K extends Serializable, V extends Object, VK exte
else
{
// ... it did exist
return new Pair<K, V>(key, value);
return getByKey(key);
}
}
// Resolve it
@@ -412,7 +412,7 @@ public class EntityLookupCache<K extends Serializable, V extends Object, VK exte
cache.put(valueCacheKey, key);
cache.put(
new CacheRegionKey(cacheRegion, key),
(value == null ? VALUE_NULL : value));
(entityPair.getSecond() == null ? VALUE_NULL : entityPair.getSecond()));
}
// Done
return entityPair;
@@ -451,6 +451,10 @@ public class EntityLookupCache<K extends Serializable, V extends Object, VK exte
if (entityPair == null)
{
entityPair = entityLookup.createValue(value);
// Cache the value
cache.put(
new CacheRegionKey(cacheRegion, entityPair.getFirst()),
(entityPair.getSecond() == null ? VALUE_NULL : entityPair.getSecond()));
}
return entityPair;
}
@@ -602,8 +606,11 @@ public class EntityLookupCache<K extends Serializable, V extends Object, VK exte
{
// Get the value key and remove it
VK valueKey = entityLookup.getValueKey(value);
CacheRegionValueKey valueCacheKey = new CacheRegionValueKey(cacheRegion, valueKey);
cache.remove(valueCacheKey);
if (valueKey != null)
{
CacheRegionValueKey valueCacheKey = new CacheRegionValueKey(cacheRegion, valueKey);
cache.remove(valueCacheKey);
}
}
cache.remove(keyCacheKey);
}