Batch loading of nodes doesn't pull back deleted nodes; search-NodeService interaction fix

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@31998 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2011-11-15 16:28:10 +00:00
parent 3ba462a1a0
commit b18da4e3cf
3 changed files with 12 additions and 4 deletions

View File

@@ -722,6 +722,7 @@
<foreach item="item" index="index" collection="uuids" open="(" separator="," close=")"> <foreach item="item" index="index" collection="uuids" open="(" separator="," close=")">
#{item} #{item}
</foreach> </foreach>
<if test="deleted != null">and node.node_deleted = #{deleted}</if>
</select> </select>
<select id="select_NodesByIds" parameterType="NodeBatchLoad" resultMap="result_Node"> <select id="select_NodesByIds" parameterType="NodeBatchLoad" resultMap="result_Node">

View File

@@ -3819,14 +3819,14 @@ public abstract class AbstractNodeDAOImpl implements NodeDAO, BatchingDAO
if (batch.size() >= batchSize) if (batch.size() >= batchSize)
{ {
// Preload // Preload
cacheNodesNoBatch(selectNodesByUuids(storeId, batch)); cacheNodesNoBatch(selectNodesByUuids(storeId, batch, Boolean.FALSE));
batch.clear(); batch.clear();
} }
} }
// Load any remaining nodes // Load any remaining nodes
if (batch.size() > 0) if (batch.size() > 0)
{ {
cacheNodesNoBatch(selectNodesByUuids(storeId, batch)); cacheNodesNoBatch(selectNodesByUuids(storeId, batch, Boolean.FALSE));
} }
} }
@@ -4047,7 +4047,7 @@ public abstract class AbstractNodeDAOImpl implements NodeDAO, BatchingDAO
protected abstract int deleteNodesByCommitTime(boolean deletedOnly, long maxTxnCommitTimeMs); protected abstract int deleteNodesByCommitTime(boolean deletedOnly, long maxTxnCommitTimeMs);
protected abstract NodeEntity selectNodeById(Long id, Boolean deleted); protected abstract NodeEntity selectNodeById(Long id, Boolean deleted);
protected abstract NodeEntity selectNodeByNodeRef(NodeRef nodeRef, Boolean deleted); protected abstract NodeEntity selectNodeByNodeRef(NodeRef nodeRef, Boolean deleted);
protected abstract List<Node> selectNodesByUuids(Long storeId, SortedSet<String> uuids); protected abstract List<Node> selectNodesByUuids(Long storeId, SortedSet<String> uuids, Boolean deleted);
protected abstract List<Node> selectNodesByIds(SortedSet<Long> ids, Boolean deleted); protected abstract List<Node> selectNodesByIds(SortedSet<Long> ids, Boolean deleted);
protected abstract Map<NodeVersionKey, Map<NodePropertyKey, NodePropertyValue>> selectNodeProperties(Set<Long> nodeIds); protected abstract Map<NodeVersionKey, Map<NodePropertyKey, NodePropertyValue>> selectNodeProperties(Set<Long> nodeIds);
protected abstract Map<NodeVersionKey, Map<NodePropertyKey, NodePropertyValue>> selectNodeProperties(Long nodeId); protected abstract Map<NodeVersionKey, Map<NodePropertyKey, NodePropertyValue>> selectNodeProperties(Long nodeId);

View File

@@ -410,11 +410,18 @@ public class NodeDAOImpl extends AbstractNodeDAOImpl
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Override @Override
protected List<Node> selectNodesByUuids(Long storeId, SortedSet<String> uuids) protected List<Node> selectNodesByUuids(Long storeId, SortedSet<String> uuids, Boolean deleted)
{ {
NodeBatchLoadEntity nodeBatchLoadEntity = new NodeBatchLoadEntity(); NodeBatchLoadEntity nodeBatchLoadEntity = new NodeBatchLoadEntity();
// Store ID
nodeBatchLoadEntity.setStoreId(storeId); nodeBatchLoadEntity.setStoreId(storeId);
// UUID
nodeBatchLoadEntity.setUuids(new ArrayList<String>(uuids)); nodeBatchLoadEntity.setUuids(new ArrayList<String>(uuids));
// Deleted
if (deleted != null)
{
nodeBatchLoadEntity.setDeleted(deleted);
}
return (List<Node>) template.selectList(SELECT_NODES_BY_UUIDS, nodeBatchLoadEntity); return (List<Node>) template.selectList(SELECT_NODES_BY_UUIDS, nodeBatchLoadEntity);
} }