Cleans up more IContentService and IMediaService and removes any string filtering methods
This commit is contained in:
@@ -147,18 +147,6 @@ namespace Umbraco.Core.Services
|
||||
IEnumerable<IContent> GetPagedContentInRecycleBin(long pageIndex, int pageSize, out long totalRecords,
|
||||
IQuery<IContent> filter = null, Ordering ordering = null);
|
||||
|
||||
/// <summary>
|
||||
/// Gets child documents of a parent.
|
||||
/// </summary>
|
||||
/// <param name="id">The parent identifier.</param>
|
||||
/// <param name="pageIndex">The page number.</param>
|
||||
/// <param name="pageSize">The page size.</param>
|
||||
/// <param name="totalRecords">Total number of documents.</param>
|
||||
/// <param name="filter">Search text filter.</param>
|
||||
/// <param name="ordering">Ordering infos.</param>
|
||||
IEnumerable<IContent> GetPagedChildren(int id, long pageIndex, int pageSize, out long totalRecords,
|
||||
string filter = null, Ordering ordering = null);
|
||||
|
||||
/// <summary>
|
||||
/// Gets child documents of a parent.
|
||||
/// </summary>
|
||||
@@ -169,20 +157,7 @@ namespace Umbraco.Core.Services
|
||||
/// <param name="filter">Query filter.</param>
|
||||
/// <param name="ordering">Ordering infos.</param>
|
||||
IEnumerable<IContent> GetPagedChildren(int id, long pageIndex, int pageSize, out long totalRecords,
|
||||
IQuery<IContent> filter, Ordering ordering = null);
|
||||
|
||||
/// <summary>
|
||||
/// Gets descendant documents of a given parent.
|
||||
/// </summary>
|
||||
/// <param name="id">The parent identifier.</param>
|
||||
/// <param name="pageIndex">The page number.</param>
|
||||
/// <param name="pageSize">The page size.</param>
|
||||
/// <param name="totalRecords">Total number of documents.</param>
|
||||
/// <param name="orderBy">A field to order by.</param>
|
||||
/// <param name="orderDirection">The ordering direction.</param>
|
||||
/// <param name="filter">Search text filter.</param>
|
||||
IEnumerable<IContent> GetPagedDescendants(int id, long pageIndex, int pageSize, out long totalRecords,
|
||||
string filter = null, Ordering ordering = null);
|
||||
IQuery<IContent> filter = null, Ordering ordering = null);
|
||||
|
||||
/// <summary>
|
||||
/// Gets descendant documents of a given parent.
|
||||
@@ -196,7 +171,7 @@ namespace Umbraco.Core.Services
|
||||
/// <param name="orderBySystemField">A flag indicating whether the ordering field is a system field.</param>
|
||||
/// <param name="filter">Query filter.</param>
|
||||
IEnumerable<IContent> GetPagedDescendants(int id, long pageIndex, int pageSize, out long totalRecords,
|
||||
IQuery<IContent> filter, Ordering ordering = null);
|
||||
IQuery<IContent> filter = null, Ordering ordering = null);
|
||||
|
||||
/// <summary>
|
||||
/// Gets paged documents of a content content
|
||||
|
||||
@@ -78,20 +78,6 @@ namespace Umbraco.Core.Services
|
||||
/// <returns><see cref="IMedia"/></returns>
|
||||
IMedia GetById(int id);
|
||||
|
||||
/// <summary>
|
||||
/// Gets a collection of <see cref="IMedia"/> objects by Parent Id
|
||||
/// </summary>
|
||||
/// <param name="id">Id of the Parent to retrieve Children from</param>
|
||||
/// <param name="pageIndex">Page number</param>
|
||||
/// <param name="pageSize">Page size</param>
|
||||
/// <param name="totalRecords">Total records query would return without paging</param>
|
||||
/// <param name="orderBy">Field to order by</param>
|
||||
/// <param name="orderDirection">Direction to order by</param>
|
||||
/// <param name="filter">Search text filter</param>
|
||||
/// <returns>An Enumerable list of <see cref="IContent"/> objects</returns>
|
||||
IEnumerable<IMedia> GetPagedChildren(int id, long pageIndex, int pageSize, out long totalRecords,
|
||||
string filter = null, Ordering ordering = null);
|
||||
|
||||
/// <summary>
|
||||
/// Gets a collection of <see cref="IMedia"/> objects by Parent Id
|
||||
/// </summary>
|
||||
@@ -105,21 +91,7 @@ namespace Umbraco.Core.Services
|
||||
/// <param name="filter"></param>
|
||||
/// <returns>An Enumerable list of <see cref="IContent"/> objects</returns>
|
||||
IEnumerable<IMedia> GetPagedChildren(int id, long pageIndex, int pageSize, out long totalRecords,
|
||||
IQuery<IMedia> filter, Ordering ordering = null);
|
||||
|
||||
/// <summary>
|
||||
/// Gets a collection of <see cref="IMedia"/> objects by Parent Id
|
||||
/// </summary>
|
||||
/// <param name="id">Id of the Parent to retrieve Descendants from</param>
|
||||
/// <param name="pageIndex">Page number</param>
|
||||
/// <param name="pageSize">Page size</param>
|
||||
/// <param name="totalRecords">Total records query would return without paging</param>
|
||||
/// <param name="orderBy">Field to order by</param>
|
||||
/// <param name="orderDirection">Direction to order by</param>
|
||||
/// <param name="filter">Search text filter</param>
|
||||
/// <returns>An Enumerable list of <see cref="IContent"/> objects</returns>
|
||||
IEnumerable<IMedia> GetPagedDescendants(int id, long pageIndex, int pageSize, out long totalRecords,
|
||||
string filter = null, Ordering ordering = null);
|
||||
IQuery<IMedia> filter = null, Ordering ordering = null);
|
||||
|
||||
/// <summary>
|
||||
/// Gets a collection of <see cref="IMedia"/> objects by Parent Id
|
||||
@@ -134,7 +106,7 @@ namespace Umbraco.Core.Services
|
||||
/// <param name="filter"></param>
|
||||
/// <returns>An Enumerable list of <see cref="IContent"/> objects</returns>
|
||||
IEnumerable<IMedia> GetPagedDescendants(int id, long pageIndex, int pageSize, out long totalRecords,
|
||||
IQuery<IMedia> filter, Ordering ordering = null);
|
||||
IQuery<IMedia> filter = null, Ordering ordering = null);
|
||||
|
||||
/// <summary>
|
||||
/// Gets paged documents of a content content
|
||||
@@ -146,7 +118,7 @@ namespace Umbraco.Core.Services
|
||||
/// <param name="filter">Search text filter.</param>
|
||||
/// <param name="ordering">Ordering infos.</param>
|
||||
IEnumerable<IMedia> GetPagedOfType(int contentTypeId, long pageIndex, int pageSize, out long totalRecords,
|
||||
IQuery<IMedia> filter, Ordering ordering = null);
|
||||
IQuery<IMedia> filter = null, Ordering ordering = null);
|
||||
|
||||
/// <summary>
|
||||
/// Gets paged documents for specified content types
|
||||
@@ -158,7 +130,7 @@ namespace Umbraco.Core.Services
|
||||
/// <param name="filter">Search text filter.</param>
|
||||
/// <param name="ordering">Ordering infos.</param>
|
||||
IEnumerable<IMedia> GetPagedOfTypes(int[] contentTypeIds, long pageIndex, int pageSize, out long totalRecords,
|
||||
IQuery<IMedia> filter, Ordering ordering = null);
|
||||
IQuery<IMedia> filter = null, Ordering ordering = null);
|
||||
|
||||
/// <summary>
|
||||
/// Gets a collection of <see cref="IMedia"/> objects, which reside at the first level / root
|
||||
|
||||
@@ -406,7 +406,8 @@ namespace Umbraco.Core.Services.Implement
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public IEnumerable<IContent> GetPagedOfType(int contentTypeId, long pageIndex, int pageSize, out long totalRecords, IQuery<IContent> filter, Ordering ordering = null)
|
||||
public IEnumerable<IContent> GetPagedOfType(int contentTypeId, long pageIndex, int pageSize, out long totalRecords
|
||||
, IQuery<IContent> filter = null, Ordering ordering = null)
|
||||
{
|
||||
if(pageIndex < 0) throw new ArgumentOutOfRangeException(nameof(pageIndex));
|
||||
if (pageSize <= 0) throw new ArgumentOutOfRangeException(nameof(pageSize));
|
||||
@@ -564,18 +565,7 @@ namespace Umbraco.Core.Services.Implement
|
||||
|
||||
/// <inheritdoc />
|
||||
public IEnumerable<IContent> GetPagedChildren(int id, long pageIndex, int pageSize, out long totalChildren,
|
||||
string filter = null, Ordering ordering = null)
|
||||
{
|
||||
var filterQuery = filter.IsNullOrWhiteSpace()
|
||||
? null
|
||||
: Query<IContent>().Where(x => x.Name.Contains(filter));
|
||||
|
||||
return GetPagedChildren(id, pageIndex, pageSize, out totalChildren, filterQuery, ordering);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public IEnumerable<IContent> GetPagedChildren(int id, long pageIndex, int pageSize, out long totalChildren,
|
||||
IQuery<IContent> filter, Ordering ordering = null)
|
||||
IQuery<IContent> filter = null, Ordering ordering = null)
|
||||
{
|
||||
if (pageIndex < 0) throw new ArgumentOutOfRangeException(nameof(pageIndex));
|
||||
if (pageSize <= 0) throw new ArgumentOutOfRangeException(nameof(pageSize));
|
||||
@@ -594,18 +584,7 @@ namespace Umbraco.Core.Services.Implement
|
||||
|
||||
/// <inheritdoc />
|
||||
public IEnumerable<IContent> GetPagedDescendants(int id, long pageIndex, int pageSize, out long totalChildren,
|
||||
string filter = null, Ordering ordering = null)
|
||||
{
|
||||
var filterQuery = filter.IsNullOrWhiteSpace()
|
||||
? null
|
||||
: Query<IContent>().Where(x => x.Name.Contains(filter));
|
||||
|
||||
return GetPagedDescendants(id, pageIndex, pageSize, out totalChildren, filterQuery, ordering);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public IEnumerable<IContent> GetPagedDescendants(int id, long pageIndex, int pageSize, out long totalChildren,
|
||||
IQuery<IContent> filter, Ordering ordering = null)
|
||||
IQuery<IContent> filter = null, Ordering ordering = null)
|
||||
{
|
||||
if (ordering == null)
|
||||
ordering = Ordering.By("Path");
|
||||
|
||||
@@ -365,7 +365,7 @@ namespace Umbraco.Core.Services.Implement
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public IEnumerable<IMedia> GetPagedOfType(int contentTypeId, long pageIndex, int pageSize, out long totalRecords, IQuery<IMedia> filter, Ordering ordering = null)
|
||||
public IEnumerable<IMedia> GetPagedOfType(int contentTypeId, long pageIndex, int pageSize, out long totalRecords, IQuery<IMedia> filter = null, Ordering ordering = null)
|
||||
{
|
||||
if (pageIndex < 0) throw new ArgumentOutOfRangeException(nameof(pageIndex));
|
||||
if (pageSize <= 0) throw new ArgumentOutOfRangeException(nameof(pageSize));
|
||||
@@ -383,7 +383,7 @@ namespace Umbraco.Core.Services.Implement
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public IEnumerable<IMedia> GetPagedOfTypes(int[] contentTypeIds, long pageIndex, int pageSize, out long totalRecords, IQuery<IMedia> filter, Ordering ordering = null)
|
||||
public IEnumerable<IMedia> GetPagedOfTypes(int[] contentTypeIds, long pageIndex, int pageSize, out long totalRecords, IQuery<IMedia> filter = null, Ordering ordering = null)
|
||||
{
|
||||
if (pageIndex < 0) throw new ArgumentOutOfRangeException(nameof(pageIndex));
|
||||
if (pageSize <= 0) throw new ArgumentOutOfRangeException(nameof(pageSize));
|
||||
@@ -481,41 +481,9 @@ namespace Umbraco.Core.Services.Implement
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a collection of <see cref="IMedia"/> objects by Parent Id
|
||||
/// </summary>
|
||||
/// <param name="id">Id of the Parent to retrieve Children from</param>
|
||||
/// <param name="pageIndex">Page index (zero based)</param>
|
||||
/// <param name="pageSize">Page size</param>
|
||||
/// <param name="totalChildren">Total records query would return without paging</param>
|
||||
/// <param name="orderBy">Field to order by</param>
|
||||
/// <param name="orderDirection">Direction to order by</param>
|
||||
/// <param name="filter">Search text filter</param>
|
||||
/// <returns>An Enumerable list of <see cref="IMedia"/> objects</returns>
|
||||
/// <inheritdoc />
|
||||
public IEnumerable<IMedia> GetPagedChildren(int id, long pageIndex, int pageSize, out long totalChildren,
|
||||
string filter = null, Ordering ordering = null)
|
||||
{
|
||||
var filterQuery = filter.IsNullOrWhiteSpace()
|
||||
? null
|
||||
: Query<IMedia>().Where(x => x.Name.Contains(filter));
|
||||
|
||||
return GetPagedChildren(id, pageIndex, pageSize, out totalChildren, filterQuery, ordering);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a collection of <see cref="IMedia"/> objects by Parent Id
|
||||
/// </summary>
|
||||
/// <param name="id">Id of the Parent to retrieve Children from</param>
|
||||
/// <param name="pageIndex">Page index (zero based)</param>
|
||||
/// <param name="pageSize">Page size</param>
|
||||
/// <param name="totalChildren">Total records query would return without paging</param>
|
||||
/// <param name="orderBy">Field to order by</param>
|
||||
/// <param name="orderDirection">Direction to order by</param>
|
||||
/// <param name="orderBySystemField">Flag to indicate when ordering by system field</param>
|
||||
/// <param name="filter"></param>
|
||||
/// <returns>An Enumerable list of <see cref="IMedia"/> objects</returns>
|
||||
public IEnumerable<IMedia> GetPagedChildren(int id, long pageIndex, int pageSize, out long totalChildren,
|
||||
IQuery<IMedia> filter, Ordering ordering = null)
|
||||
IQuery<IMedia> filter = null, Ordering ordering = null)
|
||||
{
|
||||
if (pageIndex < 0) throw new ArgumentOutOfRangeException(nameof(pageIndex));
|
||||
if (pageSize <= 0) throw new ArgumentOutOfRangeException(nameof(pageSize));
|
||||
@@ -532,41 +500,9 @@ namespace Umbraco.Core.Services.Implement
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a collection of <see cref="IMedia"/> objects by Parent Id
|
||||
/// </summary>
|
||||
/// <param name="id">Id of the Parent to retrieve Descendants from</param>
|
||||
/// <param name="pageIndex">Page number</param>
|
||||
/// <param name="pageSize">Page size</param>
|
||||
/// <param name="totalChildren">Total records query would return without paging</param>
|
||||
/// <param name="orderBy">Field to order by</param>
|
||||
/// <param name="orderDirection">Direction to order by</param>
|
||||
/// <param name="filter">Search text filter</param>
|
||||
/// <returns>An Enumerable list of <see cref="IMedia"/> objects</returns>
|
||||
/// <inheritdoc />
|
||||
public IEnumerable<IMedia> GetPagedDescendants(int id, long pageIndex, int pageSize, out long totalChildren,
|
||||
string filter = null, Ordering ordering = null)
|
||||
{
|
||||
var filterQuery = filter.IsNullOrWhiteSpace()
|
||||
? null
|
||||
: Query<IMedia>().Where(x => x.Name.Contains(filter));
|
||||
|
||||
return GetPagedDescendants(id, pageIndex, pageSize, out totalChildren, filterQuery, ordering);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a collection of <see cref="IMedia"/> objects by Parent Id
|
||||
/// </summary>
|
||||
/// <param name="id">Id of the Parent to retrieve Descendants from</param>
|
||||
/// <param name="pageIndex">Page number</param>
|
||||
/// <param name="pageSize">Page size</param>
|
||||
/// <param name="totalChildren">Total records query would return without paging</param>
|
||||
/// <param name="orderBy">Field to order by</param>
|
||||
/// <param name="orderDirection">Direction to order by</param>
|
||||
/// <param name="orderBySystemField">Flag to indicate when ordering by system field</param>
|
||||
/// <param name="filter"></param>
|
||||
/// <returns>An Enumerable list of <see cref="IMedia"/> objects</returns>
|
||||
public IEnumerable<IMedia> GetPagedDescendants(int id, long pageIndex, int pageSize, out long totalChildren,
|
||||
IQuery<IMedia> filter, Ordering ordering = null)
|
||||
IQuery<IMedia> filter = null, Ordering ordering = null)
|
||||
{
|
||||
if (ordering == null)
|
||||
ordering = Ordering.By("Path");
|
||||
|
||||
@@ -71,10 +71,6 @@ namespace Umbraco.Tests.UmbracoExamine
|
||||
|
||||
contentService = Mock.Of<IContentService>(
|
||||
x => x.GetPagedDescendants(
|
||||
It.IsAny<int>(), It.IsAny<long>(), It.IsAny<int>(), out longTotalRecs, It.IsAny<string>(), It.IsAny<Ordering>())
|
||||
==
|
||||
allRecs
|
||||
&& x.GetPagedDescendants(
|
||||
It.IsAny<int>(), It.IsAny<long>(), It.IsAny<int>(), out longTotalRecs, It.IsAny<IQuery<IContent>>(), It.IsAny<Ordering>())
|
||||
==
|
||||
allRecs);
|
||||
@@ -114,11 +110,6 @@ namespace Umbraco.Tests.UmbracoExamine
|
||||
// MOCK!
|
||||
var mediaServiceMock = new Mock<IMediaService>();
|
||||
|
||||
mediaServiceMock
|
||||
.Setup(x => x.GetPagedDescendants(
|
||||
It.IsAny<int>(), It.IsAny<long>(), It.IsAny<int>(), out totalRecs, It.IsAny<string>(), It.IsAny<Ordering>())
|
||||
).Returns(() => allRecs);
|
||||
|
||||
mediaServiceMock
|
||||
.Setup(x => x.GetPagedDescendants(
|
||||
It.IsAny<int>(), It.IsAny<long>(), It.IsAny<int>(), out totalRecs, It.IsAny<IQuery<IMedia>>(), It.IsAny<Ordering>())
|
||||
|
||||
Reference in New Issue
Block a user