diff --git a/source/java/org/alfresco/repo/domain/node/AbstractNodeDAOImpl.java b/source/java/org/alfresco/repo/domain/node/AbstractNodeDAOImpl.java
index 9553fe5c58..d73f9f7353 100644
--- a/source/java/org/alfresco/repo/domain/node/AbstractNodeDAOImpl.java
+++ b/source/java/org/alfresco/repo/domain/node/AbstractNodeDAOImpl.java
@@ -169,9 +169,9 @@ public abstract class AbstractNodeDAOImpl implements NodeDAO, BatchingDAO
* Cache for the Node parent assocs:
* KEY: NodeVersionKey
* VALUE: ParentAssocs
- * VALUE KEY: ChildByNameKey
+ * VALUE KEY: None
*/
- private EntityLookupCache parentAssocsCache;
+ private EntityLookupCache parentAssocsCache;
/**
* Constructor. Set up various instance-specific members such as caches and locks.
@@ -186,7 +186,7 @@ public abstract class AbstractNodeDAOImpl implements NodeDAO, BatchingDAO
nodesCache = new EntityLookupCache(new NodesCacheCallbackDAO());
aspectsCache = new EntityLookupCache, Serializable>(new AspectsCallbackDAO());
propertiesCache = new EntityLookupCache, Serializable>(new PropertiesCallbackDAO());
- parentAssocsCache = new EntityLookupCache(new ParentAssocsCallbackDAO());
+ parentAssocsCache = new EntityLookupCache(new ParentAssocsCallbackDAO());
}
/**
@@ -338,9 +338,9 @@ public abstract class AbstractNodeDAOImpl implements NodeDAO, BatchingDAO
*
* @param parentAssocsCache the cache
*/
- public void setParentAssocsCache(SimpleCache parentAssocsCache)
+ public void setParentAssocsCache(SimpleCache parentAssocsCache)
{
- this.parentAssocsCache = new EntityLookupCache(
+ this.parentAssocsCache = new EntityLookupCache(
parentAssocsCache,
CACHE_REGION_PARENT_ASSOCS,
new ParentAssocsCallbackDAO());
@@ -2990,52 +2990,9 @@ public abstract class AbstractNodeDAOImpl implements NodeDAO, BatchingDAO
}
}
- // TODO: Take out the reverse-entity lookup, which is broken for non-primary assocs
public Pair getChildAssoc(Long parentNodeId, QName assocTypeQName, String childName)
{
- ChildByNameKey valueKey = new ChildByNameKey(parentNodeId, assocTypeQName, childName);
-
- // cache-only operation: try reverse lookup on parentAssocs (note: for primary assoc only)
- NodeVersionKey childNodeVersionKey = parentAssocsCache.getKey(valueKey);
- if (childNodeVersionKey != null)
- {
- Long childNodeId = childNodeVersionKey.getNodeId();
- NodeVersionKey nodeVersionKeyInCache = getNodeNotNull(childNodeId).getNodeVersionKey();
- if (!nodeVersionKeyInCache.equals(childNodeVersionKey))
- {
- // The child node linked in the cache does not match our current node entry
- invalidateNodeCaches(childNodeId);
- throw new ConcurrencyFailureException(
- "Child node found in parent-child lookup does not match current node entry: \n" +
- " Child node from parentAssocsCache: " + childNodeVersionKey + "\n" +
- " Child node from nodeCache: " + nodeVersionKeyInCache);
- }
- Pair value = parentAssocsCache.getByKey(childNodeVersionKey);
- if (value != null)
- {
- ChildAssocEntity assoc = value.getSecond().getPrimaryParentAssoc();
- if (assoc == null)
- {
- return null;
- }
-
- Pair result = assoc.getPair(qnameDAO);
- if (result.getSecond().getTypeQName().equals(assocTypeQName))
- {
- return result;
- }
- }
- }
-
- // TODO could refactor as single select to get parent assocs by child name
ChildAssocEntity assoc = selectChildAssoc(parentNodeId, assocTypeQName, childName);
- if (assoc != null)
- {
- childNodeVersionKey = assoc.getChildNode().getNodeVersionKey();
- // additional lookup to populate cache - note: also pulls in 2ndary assocs
- parentAssocsCache.getByKey(childNodeVersionKey);
- }
-
return assoc == null ? null : assoc.getPair(qnameDAO);
}
@@ -3476,7 +3433,7 @@ public abstract class AbstractNodeDAOImpl implements NodeDAO, BatchingDAO
* @author Derek Hulley
* @since 3.4
*/
- private class ParentAssocsCallbackDAO extends EntityLookupCallbackDAOAdaptor
+ private class ParentAssocsCallbackDAO extends EntityLookupCallbackDAOAdaptor
{
public Pair createValue(ParentAssocsInfo value)
{
@@ -3519,24 +3476,6 @@ public abstract class AbstractNodeDAOImpl implements NodeDAO, BatchingDAO
// Done
return new Pair(nodeVersionKey, value);
}
-
- @Override
- public ChildByNameKey getValueKey(ParentAssocsInfo value)
- {
- ChildAssocEntity entity = value.getPrimaryParentAssoc();
-
- if (entity != null)
- {
- return new ChildByNameKey(entity.getParentNode().getId(), qnameDAO.getQName(entity.getTypeQNameId()).getSecond(), entity.getChildNodeName());
- }
-
- return null;
- }
-
- public Pair findByValue(ParentAssocsInfo value)
- {
- return findByKey(value.getPrimaryParentAssoc().getChildNode().getNodeVersionKey());
- }
}
/*