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@31935 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2011-11-14 14:34:04 +00:00
parent 19392e1ad9
commit d6ffc3d21e
4 changed files with 20 additions and 4 deletions

View File

@@ -735,6 +735,7 @@
<foreach item="item" index="index" collection="ids" open="(" separator="," close=")"> <foreach item="item" index="index" collection="ids" open="(" separator="," close=")">
#{item} #{item}
</foreach> </foreach>
<if test="deleted != null">and node.node_deleted = #{deleted}</if>
</select> </select>
<sql id="select_NodeProperty_Results"> <sql id="select_NodeProperty_Results">

View File

@@ -3840,14 +3840,14 @@ public abstract class AbstractNodeDAOImpl implements NodeDAO, BatchingDAO
if (batch.size() >= batchSize) if (batch.size() >= batchSize)
{ {
// Preload // Preload
cacheNodesNoBatch(selectNodesByIds(batch)); cacheNodesNoBatch(selectNodesByIds(batch, Boolean.FALSE));
batch.clear(); batch.clear();
} }
} }
// Load any remaining nodes // Load any remaining nodes
if (batch.size() > 0) if (batch.size() > 0)
{ {
cacheNodesNoBatch(selectNodesByIds(batch)); cacheNodesNoBatch(selectNodesByIds(batch, Boolean.FALSE));
} }
} }
@@ -4048,7 +4048,7 @@ public abstract class AbstractNodeDAOImpl implements NodeDAO, BatchingDAO
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);
protected abstract List<Node> selectNodesByIds(SortedSet<Long> ids); 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);
protected abstract Map<NodeVersionKey, Map<NodePropertyKey, NodePropertyValue>> selectNodeProperties(Long nodeId, Set<Long> qnameIds); protected abstract Map<NodeVersionKey, Map<NodePropertyKey, NodePropertyValue>> selectNodeProperties(Long nodeId, Set<Long> qnameIds);

View File

@@ -31,6 +31,7 @@ public class NodeBatchLoadEntity
private Long storeId; private Long storeId;
private List<String> uuids; private List<String> uuids;
private List<Long> ids; private List<Long> ids;
private Boolean deleted;
public Long getStoreId() public Long getStoreId()
{ {
@@ -56,4 +57,12 @@ public class NodeBatchLoadEntity
{ {
this.ids = ids; this.ids = ids;
} }
public Boolean getDeleted()
{
return deleted;
}
public void setDeleted(Boolean deleted)
{
this.deleted = deleted;
}
} }

View File

@@ -421,10 +421,16 @@ public class NodeDAOImpl extends AbstractNodeDAOImpl
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Override @Override
protected List<Node> selectNodesByIds(SortedSet<Long> ids) protected List<Node> selectNodesByIds(SortedSet<Long> ids, Boolean deleted)
{ {
NodeBatchLoadEntity nodeBatchLoadEntity = new NodeBatchLoadEntity(); NodeBatchLoadEntity nodeBatchLoadEntity = new NodeBatchLoadEntity();
// IDs
nodeBatchLoadEntity.setIds(new ArrayList<Long>(ids)); nodeBatchLoadEntity.setIds(new ArrayList<Long>(ids));
// Deleted
if (deleted != null)
{
nodeBatchLoadEntity.setDeleted(deleted);
}
return (List<Node>) template.selectList(SELECT_NODES_BY_IDS, nodeBatchLoadEntity); return (List<Node>) template.selectList(SELECT_NODES_BY_IDS, nodeBatchLoadEntity);
} }