Adds interfaces for IContent, IMedia, IContentBase.
Adds interfaces for IContentTypeBase, IContentTypeComposition, IContentType and IMediaType. This includes the inheritance structure for Content and Media, as well as ContentType and MediaType which is basically the same except for Templates and Compositions.
This commit is contained in:
56
src/Umbraco.Core/Models/IContent.cs
Normal file
56
src/Umbraco.Core/Models/IContent.cs
Normal file
@@ -0,0 +1,56 @@
|
||||
using System;
|
||||
|
||||
namespace Umbraco.Core.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines a Content object
|
||||
/// </summary>
|
||||
public interface IContent : IContentBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Alias of the template used by the Content
|
||||
/// This is used to override the default one from the ContentType
|
||||
/// </summary>
|
||||
string Template { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Boolean indicating whether the Content is Published or not
|
||||
/// </summary>
|
||||
bool Published { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Language of the data contained within the Content object
|
||||
/// </summary>
|
||||
string Language { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Guid Id of the Content's Version
|
||||
/// </summary>
|
||||
Guid Version { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets the date the Content should be released and thus be published
|
||||
/// </summary>
|
||||
DateTime? ReleaseDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets the date the Content should expire and thus be unpublished
|
||||
/// </summary>
|
||||
DateTime? ExpireDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Changes the <see cref="IContentType"/> for the current content object
|
||||
/// </summary>
|
||||
/// <param name="contentType">New ContentType for this content</param>
|
||||
/// <remarks>Leaves PropertyTypes intact after change</remarks>
|
||||
void ChangeContentType(IContentType contentType);
|
||||
|
||||
/// <summary>
|
||||
/// Changes the <see cref="IContentType"/> for the current content object and removes PropertyTypes,
|
||||
/// which are not part of the new ContentType.
|
||||
/// </summary>
|
||||
/// <param name="contentType">New ContentType for this content</param>
|
||||
/// <param name="clearProperties">Boolean indicating whether to clear PropertyTypes upon change</param>
|
||||
void ChangeContentType(IContentType contentType, bool clearProperties);
|
||||
}
|
||||
}
|
||||
105
src/Umbraco.Core/Models/IContentBase.cs
Normal file
105
src/Umbraco.Core/Models/IContentBase.cs
Normal file
@@ -0,0 +1,105 @@
|
||||
using System.Collections.Generic;
|
||||
using Umbraco.Core.Models.EntityBase;
|
||||
|
||||
namespace Umbraco.Core.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines the base for a Content object with properties that
|
||||
/// are shared between Content and Media.
|
||||
/// </summary>
|
||||
public interface IContentBase : IAggregateRoot
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or Sets the Id of the Parent for the Content
|
||||
/// </summary>
|
||||
int ParentId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets the Name of the Content
|
||||
/// </summary>
|
||||
string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Url name of the Content
|
||||
/// </summary>
|
||||
string UrlName { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets the Sort Order of the Content
|
||||
/// </summary>
|
||||
int SortOrder { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets the Level of the Content
|
||||
/// </summary>
|
||||
int Level { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets the Path of the Content
|
||||
/// </summary>
|
||||
string Path { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Id of the user who created the Content
|
||||
/// </summary>
|
||||
int UserId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Boolean indicating whether this Content is Trashed or not.
|
||||
/// If Content is Trashed it will be located in the Recyclebin.
|
||||
/// </summary>
|
||||
bool Trashed { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Integer Id of the default ContentType
|
||||
/// </summary>
|
||||
int ContentTypeId { get; }
|
||||
|
||||
/// <summary>
|
||||
/// List of properties, which make up all the data available for this Content object
|
||||
/// </summary>
|
||||
/// <remarks>Properties are loaded as part of the Content object graph</remarks>
|
||||
PropertyCollection Properties { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// List of PropertyGroups available on this Content object
|
||||
/// </summary>
|
||||
/// <remarks>PropertyGroups are kind of lazy loaded as part of the object graph</remarks>
|
||||
IEnumerable<PropertyGroup> PropertyGroups { get; }
|
||||
|
||||
/// <summary>
|
||||
/// List of PropertyTypes available on this Content object
|
||||
/// </summary>
|
||||
/// <remarks>PropertyTypes are kind of lazy loaded as part of the object graph</remarks>
|
||||
IEnumerable<PropertyType> PropertyTypes { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the content object has a property with the supplied alias
|
||||
/// </summary>
|
||||
/// <param name="propertyTypeAlias">Alias of the PropertyType</param>
|
||||
/// <returns>True if Property with given alias exists, otherwise False</returns>
|
||||
bool HasProperty(string propertyTypeAlias);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the value of a Property
|
||||
/// </summary>
|
||||
/// <param name="propertyTypeAlias">Alias of the PropertyType</param>
|
||||
/// <returns><see cref="Property"/> Value as an <see cref="object"/></returns>
|
||||
object GetValue(string propertyTypeAlias);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the value of a Property
|
||||
/// </summary>
|
||||
/// <typeparam name="TPassType">Type of the value to return</typeparam>
|
||||
/// <param name="propertyTypeAlias">Alias of the PropertyType</param>
|
||||
/// <returns><see cref="Property"/> Value as a <see cref="TPassType"/></returns>
|
||||
TPassType GetValue<TPassType>(string propertyTypeAlias);
|
||||
|
||||
/// <summary>
|
||||
/// Sets the value of a Property
|
||||
/// </summary>
|
||||
/// <param name="propertyTypeAlias">Alias of the PropertyType</param>
|
||||
/// <param name="value">Value to set for the Property</param>
|
||||
void SetValue(string propertyTypeAlias, object value);
|
||||
}
|
||||
}
|
||||
20
src/Umbraco.Core/Models/IContentType.cs
Normal file
20
src/Umbraco.Core/Models/IContentType.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Umbraco.Core.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines a ContentType, which Content is based on
|
||||
/// </summary>
|
||||
public interface IContentType : IContentTypeComposition
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or Sets the path to the default Template of the ContentType
|
||||
/// </summary>
|
||||
string DefaultTemplate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets a list of Template names/paths which are allowed for the ContentType
|
||||
/// </summary>
|
||||
IEnumerable<string> AllowedTemplates { get; set; }
|
||||
}
|
||||
}
|
||||
77
src/Umbraco.Core/Models/IContentTypeBase.cs
Normal file
77
src/Umbraco.Core/Models/IContentTypeBase.cs
Normal file
@@ -0,0 +1,77 @@
|
||||
using System.Collections.Generic;
|
||||
using Umbraco.Core.Models.EntityBase;
|
||||
|
||||
namespace Umbraco.Core.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines the base for a ContentType with properties that
|
||||
/// are shared between ContentTypes and MediaTypes.
|
||||
/// </summary>
|
||||
public interface IContentTypeBase : IAggregateRoot
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or Sets the Alias of the ContentType
|
||||
/// </summary>
|
||||
string Alias { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets the Name of the ContentType
|
||||
/// </summary>
|
||||
string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets the Id of Parent of the ContentType
|
||||
/// </summary>
|
||||
int ParentId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets the Level of the Content
|
||||
/// </summary>
|
||||
int Level { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets the Path of the Content
|
||||
/// </summary>
|
||||
string Path { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets the Description for the ContentType
|
||||
/// </summary>
|
||||
string Description { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets the Sort Order of the ContentType
|
||||
/// </summary>
|
||||
int SortOrder { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets the Icon for the ContentType
|
||||
/// </summary>
|
||||
string Icon { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets the Thumbnail for the ContentType
|
||||
/// </summary>
|
||||
string Thumbnail { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets the Id of the User who created the ContentType
|
||||
/// </summary>
|
||||
int UserId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets a list of integer Ids of the ContentTypes allowed under the ContentType
|
||||
/// </summary>
|
||||
IEnumerable<int> AllowedContentTypes { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets a collection of Property Groups
|
||||
/// </summary>
|
||||
PropertyGroupCollection PropertyGroups { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets an enumerable list of Property Types aggregated for all groups
|
||||
/// </summary>
|
||||
IEnumerable<PropertyType> PropertyTypes { get; }
|
||||
}
|
||||
}
|
||||
52
src/Umbraco.Core/Models/IContentTypeComposition.cs
Normal file
52
src/Umbraco.Core/Models/IContentTypeComposition.cs
Normal file
@@ -0,0 +1,52 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Umbraco.Core.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines the Composition of a ContentType
|
||||
/// </summary>
|
||||
public interface IContentTypeComposition : IContentTypeBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets a list of ContentTypes that make up a composition of PropertyGroups and PropertyTypes for the current ContentType
|
||||
/// </summary>
|
||||
List<IContentTypeComposition> ContentTypeComposition { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a list of <see cref="PropertyGroup"/> objects from the composition
|
||||
/// </summary>
|
||||
IEnumerable<PropertyGroup> CompositionPropertyGroups { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a list of <see cref="PropertyType"/> objects from the composition
|
||||
/// </summary>
|
||||
IEnumerable<PropertyType> CompositionPropertyTypes { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Adds a new ContentType to the list of composite ContentTypes
|
||||
/// </summary>
|
||||
/// <param name="contentType"><see cref="IContentType"/> to add</param>
|
||||
/// <returns>True if ContentType was added, otherwise returns False</returns>
|
||||
bool AddContentType(IContentTypeComposition contentType);
|
||||
|
||||
/// <summary>
|
||||
/// Removes a ContentType with the supplied alias from the the list of composite ContentTypes
|
||||
/// </summary>
|
||||
/// <param name="alias">Alias of a <see cref="IContentType"/></param>
|
||||
/// <returns>True if ContentType was removed, otherwise returns False</returns>
|
||||
bool RemoveContentType(string alias);
|
||||
|
||||
/// <summary>
|
||||
/// Checks if a ContentType with the supplied alias exists in the list of composite ContentTypes
|
||||
/// </summary>
|
||||
/// <param name="alias">Alias of a <see cref="IContentType"/></param>
|
||||
/// <returns>True if ContentType with alias exists, otherwise returns False</returns>
|
||||
bool ContentTypeCompositionExists(string alias);
|
||||
|
||||
/// <summary>
|
||||
/// Gets a list of ContentType aliases from the current composition
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
IEnumerable<string> CompositionAliases();
|
||||
}
|
||||
}
|
||||
20
src/Umbraco.Core/Models/IMedia.cs
Normal file
20
src/Umbraco.Core/Models/IMedia.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
namespace Umbraco.Core.Models
|
||||
{
|
||||
public interface IMedia : IContentBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Changes the <see cref="IMediaType"/> for the current content object
|
||||
/// </summary>
|
||||
/// <param name="contentType">New ContentType for this content</param>
|
||||
/// <remarks>Leaves PropertyTypes intact after change</remarks>
|
||||
void ChangeContentType(IMediaType contentType);
|
||||
|
||||
/// <summary>
|
||||
/// Changes the <see cref="IMediaType"/> for the current content object and removes PropertyTypes,
|
||||
/// which are not part of the new ContentType.
|
||||
/// </summary>
|
||||
/// <param name="contentType">New ContentType for this content</param>
|
||||
/// <param name="clearProperties">Boolean indicating whether to clear PropertyTypes upon change</param>
|
||||
void ChangeContentType(IMediaType contentType, bool clearProperties);
|
||||
}
|
||||
}
|
||||
10
src/Umbraco.Core/Models/IMediaType.cs
Normal file
10
src/Umbraco.Core/Models/IMediaType.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
namespace Umbraco.Core.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines a ContentType, which Media is based on
|
||||
/// </summary>
|
||||
public interface IMediaType : IContentTypeBase
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -99,6 +99,13 @@
|
||||
<Compile Include="Models\EntityBase\ICanBeDirty.cs" />
|
||||
<Compile Include="Models\EntityBase\IEntity.cs" />
|
||||
<Compile Include="Models\EntityBase\IValueObject.cs" />
|
||||
<Compile Include="Models\IContent.cs" />
|
||||
<Compile Include="Models\IContentBase.cs" />
|
||||
<Compile Include="Models\IContentType.cs" />
|
||||
<Compile Include="Models\IContentTypeBase.cs" />
|
||||
<Compile Include="Models\IContentTypeComposition.cs" />
|
||||
<Compile Include="Models\IMedia.cs" />
|
||||
<Compile Include="Models\IMediaType.cs" />
|
||||
<Compile Include="Models\Property.cs" />
|
||||
<Compile Include="Models\PropertyCollection.cs" />
|
||||
<Compile Include="Models\PropertyGroup.cs" />
|
||||
|
||||
Reference in New Issue
Block a user