On advice from Derek, pre-load node details when wrapping CQ results as higher level objects, for Calendar, Wiki, Links and Discussions

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@29796 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Nick Burch
2011-08-16 14:59:58 +00:00
parent 4d361282bd
commit 9f67fd6ded
9 changed files with 146 additions and 9 deletions

View File

@@ -34,6 +34,7 @@ import org.alfresco.query.PagingRequest;
import org.alfresco.query.PagingResults;
import org.alfresco.repo.calendar.cannedqueries.GetCalendarEntriesCannedQuery;
import org.alfresco.repo.calendar.cannedqueries.GetCalendarEntriesCannedQueryFactory;
import org.alfresco.repo.domain.node.NodeDAO;
import org.alfresco.repo.node.getchildren.GetChildrenCannedQuery;
import org.alfresco.repo.node.getchildren.GetChildrenCannedQueryFactory;
import org.alfresco.repo.site.SiteServiceImpl;
@@ -75,6 +76,7 @@ public class CalendarServiceImpl implements CalendarService
@SuppressWarnings("unused")
private static Log logger = LogFactory.getLog(CalendarServiceImpl.class);
private NodeDAO nodeDAO;
private NodeService nodeService;
private SiteService siteService;
private TaggingService taggingService;
@@ -82,6 +84,11 @@ public class CalendarServiceImpl implements CalendarService
private TransactionService transactionService;
private NamedObjectRegistry<CannedQueryFactory<? extends Object>> cannedQueryRegistry;
public void setNodeDAO(NodeDAO nodeDAO)
{
this.nodeDAO = nodeDAO;
}
public void setNodeService(NodeService nodeService)
{
this.nodeService = nodeService;
@@ -320,6 +327,10 @@ public class CalendarServiceImpl implements CalendarService
*/
private PagingResults<CalendarEntry> wrap(final PagingResults<NodeRef> results, final NodeRef container)
{
// Pre-load the nodes before we create them
nodeDAO.cacheNodes(results.getPage());
// Wrap
return new PagingResults<CalendarEntry>()
{
@Override