示例#1
0
        public async Task <IDictionary <int, PageRenderDetails> > ExecuteAsync(GetPageRenderDetailsByIdRangeQuery query, IExecutionContext executionContext)
        {
            var dbPages = await GetPagesAsync(query, executionContext);

            var pageRoutesQuery = new GetPageRoutesByIdRangeQuery(GetAllPageIds(dbPages));
            var pageRoutes      = await _queryExecutor.ExecuteAsync(pageRoutesQuery, executionContext);

            var pages = dbPages
                        .Select(p => _pageMapper.Map(p, pageRoutes))
                        .ToList();

            MapPageRoutes(pages, pageRoutes);

            var dbPageBlocks = await QueryPageBlocks(pages).ToListAsync();

            var allBlockTypes = await _queryExecutor.ExecuteAsync(new GetAllPageBlockTypeSummariesQuery(), executionContext);

            await _entityVersionPageBlockMapper.MapRegionsAsync(
                dbPageBlocks,
                pages.SelectMany(p => p.Regions),
                allBlockTypes,
                query.PublishStatus,
                executionContext
                );

            return(pages.ToDictionary(d => d.PageId));
        }
        public async Task <IDictionary <int, ICollection <PageRoutingInfo> > > ExecuteAsync(GetPageRoutingInfoByCustomEntityIdRangeQuery query, IExecutionContext executionContext)
        {
            var idSets = await IdSetQuery(query).ToListAsync();

            if (!idSets.Any())
            {
                return(new Dictionary <int, ICollection <PageRoutingInfo> >());
            }

            var customEntityRoutesQueries = GetCustomEntityRoutingQuery(idSets);

            var customEntityRoutes = new Dictionary <int, CustomEntityRoute>();

            foreach (var customEntityRoutesQuery in customEntityRoutesQueries)
            {
                // Probably cached so should be quick
                var routes = await _queryExecutor.ExecuteAsync(customEntityRoutesQuery, executionContext);

                foreach (var route in routes)
                {
                    if (!customEntityRoutes.ContainsKey(route.CustomEntityId))
                    {
                        customEntityRoutes.Add(route.CustomEntityId, route);
                    }
                }
            }

            var pageRoutesQuery = new GetPageRoutesByIdRangeQuery(idSets.Select(p => p.PageId).Distinct());
            var pageRoutes      = await _queryExecutor.ExecuteAsync(pageRoutesQuery, executionContext);

            return(await MapAsync(executionContext, idSets, customEntityRoutes, pageRoutes));
        }
示例#3
0
        public async Task <IDictionary <int, PageRoute> > ExecuteAsync(GetPageRoutesByIdRangeQuery query, IExecutionContext executionContext)
        {
            var allPageRoutes = await _queryExecutor.ExecuteAsync(new GetAllPageRoutesQuery(), executionContext);

            var result = allPageRoutes
                         .Where(r => query.PageIds.Contains(r.PageId))
                         .ToDictionary(r => r.PageId);

            return(result);
        }
        public async Task <IDictionary <int, PageRoute> > ExecuteAsync(GetPageRoutesByIdRangeQuery query, IExecutionContext executionContext)
        {
            var allPageRoutes = await _queryExecutor.ExecuteAsync(new GetPageRouteLookupQuery(), executionContext);

            var result = allPageRoutes
                         .FilterByKeys(query.PageIds)
                         .ToDictionary(r => r.PageId);

            return(result);
        }
示例#5
0
        public async Task <IDictionary <int, PageRenderSummary> > ExecuteAsync(GetPageRenderSummariesByIdRangeQuery query, IExecutionContext executionContext)
        {
            var dbPages = await GetPagesAsync(query, executionContext);

            var allPageIds      = dbPages.Select(p => p.PageId);
            var pageRoutesQuery = new GetPageRoutesByIdRangeQuery(allPageIds);
            var pageRoutes      = await _queryExecutor.ExecuteAsync(pageRoutesQuery, executionContext);

            var pages = dbPages
                        .Select(p => _pageRenderSummaryMapper.Map <PageRenderSummary>(p, pageRoutes))
                        .ToList();

            return(pages.ToDictionary(d => d.PageId));
        }
        public Task <IDictionary <int, PageRoute> > AsRoutesAsync()
        {
            var query = new GetPageRoutesByIdRangeQuery(_pageIds);

            return(ExtendableContentRepository.ExecuteQueryAsync(query));
        }
示例#7
0
        /// <summary>
        /// Returns page routing data for a set of pages by their database ids. The
        /// PageRoute projection is a small page object focused on providing
        /// routing data only. Data returned from this query is cached by
        /// default as it's core to routing and often incorporated in more detailed
        /// page projections.
        /// </summary>
        /// <param name="pageIds">Database ids of the pages to fetch routing data for.</param>
        /// <param name="executionContext">Optional execution context to use when executing the query. Useful if you need to temporarily elevate your permission level.</param>
        public Task <IDictionary <int, PageRoute> > GetPageRoutesByIdRangeAsync(IEnumerable <int> pageIds, IExecutionContext executionContext = null)
        {
            var query = new GetPageRoutesByIdRangeQuery(pageIds);

            return(_queryExecutor.ExecuteAsync(query, executionContext));
        }
示例#8
0
 public IEnumerable <IPermissionApplication> GetPermissions(GetPageRoutesByIdRangeQuery query)
 {
     yield return(new PageReadPermission());
 }
示例#9
0
        public IContentRepositoryQueryContext <IDictionary <int, PageRoute> > AsRoutes()
        {
            var query = new GetPageRoutesByIdRangeQuery(_pageIds);

            return(ContentRepositoryQueryContextFactory.Create(query, ExtendableContentRepository));
        }