ALF-11957: Merged PATCHES/V3.4.6 to HEAD

32617: ALF-11879: IMAP performance
      - Fix node batch loading - batch load ContentData to avoid N+1 problem with content properties
      - During cache preloading, use distinct transactions for each folder search, thus avoiding blowing the transactional caches
   32619: ALF-11879: Fixed typo
   32652: ALF-11879: Deactivate auto-versioning and auditing (and run as system) whilst setting magic IMAP aspect properties


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@32673 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Dave Ward
2011-12-09 12:54:10 +00:00
parent ce7f4f8345
commit 658e968320
6 changed files with 186 additions and 72 deletions

View File

@@ -179,6 +179,14 @@ public abstract class AbstractContentDataDAOImpl implements ContentDataDAO
return entityPair;
}
public void cacheContentDataForNodes(Set<Long> nodeIds)
{
for (ContentDataEntity entity : getContentDataEntitiesForNodes(nodeIds))
{
contentDataCache.setValue(entity.getId(), makeContentData(entity));
}
}
/**
* {@inheritDoc}
*/
@@ -494,6 +502,13 @@ public abstract class AbstractContentDataDAOImpl implements ContentDataDAO
*/
protected abstract ContentDataEntity getContentDataEntity(Long id);
/**
* @param nodeIds the node ID
* @return Returns the associated entities or <tt>null</tt> if none exist
*/
protected abstract List<ContentDataEntity> getContentDataEntitiesForNodes(Set<Long> nodeIds);
/**
* Update an existing <b>alf_content_data</b> entity
*

View File

@@ -69,6 +69,12 @@ public interface ContentDataDAO
*/
Pair<Long, ContentData> getContentData(Long id);
/**
* @param nodeIds the nodeIds
* @throws AlfrescoRuntimeException if an ID provided is invalid
*/
public void cacheContentDataForNodes(Set<Long> nodeIds);
/**
* Delete an instance of content.
* @param id the unique ID of the entity

View File

@@ -19,6 +19,7 @@
package org.alfresco.repo.domain.contentdata.ibatis;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
@@ -54,6 +55,7 @@ public class ContentDataDAOImpl extends AbstractContentDataDAOImpl
private static final String SELECT_CONTENT_URLS_ORPHANED = "alfresco.content.select_ContentUrlsOrphaned";
private static final String SELECT_CONTENT_DATA_BY_ID = "alfresco.content.select_ContentDataById";
private static final String SELECT_CONTENT_DATA_BY_NODE_AND_QNAME = "alfresco.content.select_ContentDataByNodeAndQName";
private static final String SELECT_CONTENT_DATA_BY_NODE_IDS = "alfresco.content.select_ContentDataByNodeIds";
private static final String INSERT_CONTENT_URL = "alfresco.content.insert.insert_ContentUrl";
private static final String INSERT_CONTENT_DATA = "alfresco.content.insert.insert_ContentData";
private static final String UPDATE_CONTENT_URL_ORPHAN_TIME = "alfresco.content.update_ContentUrlOrphanTime";
@@ -209,6 +211,20 @@ public class ContentDataDAOImpl extends AbstractContentDataDAOImpl
return contentDataEntity;
}
@SuppressWarnings("unchecked")
@Override
protected List<ContentDataEntity> getContentDataEntitiesForNodes(Set<Long> nodeIds)
{
if (nodeIds.size() == 0)
{
// There will be no results
return Collections.emptyList();
}
IdsEntity idsEntity = new IdsEntity();
idsEntity.setIds(new ArrayList<Long>(nodeIds));
return template.queryForList(SELECT_CONTENT_DATA_BY_NODE_IDS, idsEntity);
}
@Override
protected int updateContentDataEntity(ContentDataEntity entity)
{