Changes recycle bin service queries to paged

This commit is contained in:
Shannon
2018-11-01 10:22:45 +11:00
parent 082d860a5b
commit 76a8cd6dcf
6 changed files with 21 additions and 17 deletions

View File

@@ -141,11 +141,11 @@ namespace Umbraco.Core.Services
/// </summary>
IEnumerable<IContent> GetContentForRelease();
//fixme: should be paged
/// <summary>
/// Gets documents in the recycle bin.
/// </summary>
IEnumerable<IContent> GetContentInRecycleBin();
IEnumerable<IContent> GetPagedContentInRecycleBin(long pageIndex, int pageSize, out long totalRecords,
IQuery<IContent> filter = null, Ordering ordering = null);
/// <summary>
/// Gets child documents of a parent.

View File

@@ -170,7 +170,8 @@ namespace Umbraco.Core.Services
/// Gets a collection of an <see cref="IMedia"/> objects, which resides in the Recycle Bin
/// </summary>
/// <returns>An Enumerable list of <see cref="IMedia"/> objects</returns>
IEnumerable<IMedia> GetMediaInRecycleBin();
IEnumerable<IMedia> GetPagedMediaInRecycleBin(long pageIndex, int pageSize, out long totalRecords,
IQuery<IMedia> filter = null, Ordering ordering = null);
/// <summary>
/// Moves an <see cref="IMedia"/> object to a new location

View File

@@ -727,13 +727,17 @@ namespace Umbraco.Core.Services.Implement
/// Gets a collection of an <see cref="IContent"/> objects, which resides in the Recycle Bin
/// </summary>
/// <returns>An Enumerable list of <see cref="IContent"/> objects</returns>
public IEnumerable<IContent> GetContentInRecycleBin()
public IEnumerable<IContent> GetPagedContentInRecycleBin(long pageIndex, int pageSize, out long totalRecords,
IQuery<IContent> filter = null, Ordering ordering = null)
{
using (var scope = ScopeProvider.CreateScope(autoComplete: true))
{
if (ordering == null)
ordering = Ordering.By("Path");
scope.ReadLock(Constants.Locks.ContentTree);
var query = Query<IContent>().Where(x => x.Path.StartsWith(Constants.System.RecycleBinContentPathPrefix));
return _documentRepository.Get(query);
return _documentRepository.GetPage(query, pageIndex, pageSize, out totalRecords, filter, ordering);
}
}

View File

@@ -643,17 +643,18 @@ namespace Umbraco.Core.Services.Implement
}
}
/// <summary>
/// Gets a collection of an <see cref="IMedia"/> objects, which resides in the Recycle Bin
/// </summary>
/// <returns>An Enumerable list of <see cref="IMedia"/> objects</returns>
public IEnumerable<IMedia> GetMediaInRecycleBin()
/// <inheritdoc />
public IEnumerable<IMedia> GetPagedMediaInRecycleBin(long pageIndex, int pageSize, out long totalRecords,
IQuery<IMedia> filter = null, Ordering ordering = null)
{
using (var scope = ScopeProvider.CreateScope(autoComplete: true))
{
if (ordering == null)
ordering = Ordering.By("Path");
scope.ReadLock(Constants.Locks.MediaTree);
var query = Query<IMedia>().Where(x => x.Path.StartsWith(Constants.System.RecycleBinMediaPathPrefix));
return _mediaRepository.Get(query);
return _mediaRepository.GetPage(query, pageIndex, pageSize, out totalRecords, filter, ordering);
}
}