Interface IItemService
Interface for a service that provides operations on items.
Namespace: DataWeb.Structure
Assembly: DataWeb.Core.dll
Syntax
public interface IItemService
Methods
CloneSectionPartAsync(SectionPart, SectionPart, CancellationToken)
Clones the properties of one section part to another.
Declaration
Task CloneSectionPartAsync(Item.SectionPart sectionPart, Item.SectionPart sectionPartCloned, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
Item.SectionPart | sectionPart | The Item.SectionPart to clone from. |
Item.SectionPart | sectionPartCloned | The Item.SectionPart to clone to. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task | A Task representing the asynchronous operation. |
ComputeLabelAsync(Item, Element, IEnumerable<Section>, CancellationToken)
Computes the label for an item based on its properties.
Declaration
Task<string> ComputeLabelAsync(Item item, Element element, IEnumerable<Section> elementSections, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
Item | item | The Item to compute the label for. |
Element | element | The Element the item belongs to. |
IEnumerable<Section> | elementSections | The Section of the element. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<string> | A Task representing the asynchronous operation, which when completed will return a string representing the label of the item. |
DeleteAsync(string, CancellationToken)
Deletes an item with the specified IdMaster.
Declaration
Task DeleteAsync(string itemIdMaster, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | itemIdMaster | The Id of the item to delete. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task | A task representing the asynchronous operation. |
DeleteInactiveVersionAsync(string, Section, string, CancellationToken)
Sets Deleted status for an inactive version.
Declaration
Task DeleteInactiveVersionAsync(string itemIdMaster, Section section, string versionName, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | itemIdMaster | The IdMaster of the item. |
Section | section | The Section of the item. |
string | versionName | The name of the version. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task |
DeleteMasterPartFromStorageAsync(string, CancellationToken)
Deletes the master part of an item with the specified IdMaster.
Declaration
Task DeleteMasterPartFromStorageAsync(string itemIdMaster, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | itemIdMaster | The Id of the item to delete the master part of. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task | A task representing the asynchronous operation. |
DeleteRelationPartsFromStorageAsync(string, CancellationToken)
Deletes the relation parts of an item with the specified IdMaster.
Declaration
Task DeleteRelationPartsFromStorageAsync(string itemIdMaster, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | itemIdMaster | The Id of the item to delete the relation parts of. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task | A task representing the asynchronous operation. |
DeleteWithChildrenAsync(string, bool, Navigation, CancellationToken)
Deletes an item and its children from the database.
Declaration
Task<ItemService.DeleteResult> DeleteWithChildrenAsync(string itemIdMaster, bool isDeleteFromAll, Navigation navigation, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | itemIdMaster | The Id of the item to delete. |
bool | isDeleteFromAll | Whether to delete the item from all areas or just the current area. |
Navigation | navigation | The Navigation object containing the current area and language. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<ItemService.DeleteResult> | A Task representing the asynchronous operation, which when completed will return a ItemService.DeleteResult object with details of the deletion. |
GetAncestorsAsync(string, CancellationToken)
Gets the ancestors of the specified item.
Declaration
Task<IEnumerable<Relation>> GetAncestorsAsync(string itemIdMaster, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | itemIdMaster | The Id of the item to get the ancestors for. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<IEnumerable<Relation>> | A task representing the asynchronous operation. |
GetChildrenAsync(string, string, CancellationToken)
Gets the children of the specified item in the specified section.
Declaration
Task<IEnumerable<Relation>> GetChildrenAsync(string itemIdMaster, string sectionName = null, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | itemIdMaster | The Id of the item to get the children for. |
string | sectionName | The name of the section to get the children for. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<IEnumerable<Relation>> | A task representing the asynchronous operation. |
GetContextItemAsync(ContextItemFilter, CancellationToken)
Gets a single context item based on the specified filter.
Declaration
Task<ContextItem> GetContextItemAsync(ContextItemFilter filter, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
ContextItemFilter | filter | The ContextItemFilter to apply. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<ContextItem> | A task that represents the asynchronous operation. The task result contains a context item that matches the filter, or |
GetContextItemsAsync(ContextItemFilter, CancellationToken)
Gets a collection of context items based on the specified filter.
Declaration
Task<IEnumerable<ContextItem>> GetContextItemsAsync(ContextItemFilter filter, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
ContextItemFilter | filter | The ContextItemFilter to apply. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<IEnumerable<ContextItem>> | A task that represents the asynchronous operation. The task result contains a collection of context items that match the filter. |
GetContextItemsCountAsync(ContextItemFilter, CancellationToken)
Gets the count of context items based on the specified filter.
Declaration
Task<long> GetContextItemsCountAsync(ContextItemFilter filter, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
ContextItemFilter | filter | The ContextItemFilter to apply. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<long> | A task that represents the asynchronous operation. The task result contains the count of context items that match the filter. |
GetDateModifiedAsync(string, CancellationToken)
Gets the last modified date of the item.
Declaration
Task<DateTimeOffset?> GetDateModifiedAsync(string itemIdMaster, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | itemIdMaster | The Id of the item to get the date for. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<DateTimeOffset?> | A Task representing the asynchronous operation, which when completed will return a DateTimeOffset representing the last modified date of the item. |
GetDescendantsAsync(string, CancellationToken)
Gets the descendants of the specified item.
Declaration
Task<IEnumerable<Relation>> GetDescendantsAsync(string itemIdMaster, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | itemIdMaster | The Id of the item to get the descendants for. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<IEnumerable<Relation>> | A task representing the asynchronous operation. |
GetItem(MasterPart)
Gets an item with the specified master part.
Declaration
Item GetItem(Item.MasterPart masterPart)
Parameters
Type | Name | Description |
---|---|---|
Item.MasterPart | masterPart | The master part of the item to retrieve. |
Returns
Type | Description |
---|---|
Item | The item with the specified master part, or null if no item is found. |
GetItemAsync(string, CancellationToken)
Retrieves an item by its IdMaster.
Declaration
Task<Item> GetItemAsync(string itemIdMaster, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | itemIdMaster | The Id of the item to retrieve. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<Item> | The item with the specified IdMaster, or null if no item is found. |
GetItemPreviewCountAsync(string, IEnumerable<Section>, Navigation, CancellationToken)
Gets the preview count of an item.
Declaration
Task<long> GetItemPreviewCountAsync(string itemIdMaster, IEnumerable<Section> elementSections, Navigation navigation, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | itemIdMaster | The id of the item. |
IEnumerable<Section> | elementSections | The Section objects of the element. |
Navigation | navigation | The Navigation settings. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<long> | The preview count of the item. |
GetItemVersionAsync(string, Section, VersionFilter, CancellationToken)
Gets the version of an item with the given itemIdMaster
and section
.
Declaration
Task<ItemVersion> GetItemVersionAsync(string itemIdMaster, Section section, VersionFilter filter, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | itemIdMaster | The IdMaster of the item. |
Section | section | The Section of the item. |
VersionFilter | filter | The VersionFilter used to retrive versions. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<ItemVersion> | A Task representing the asynchronous operation. The task result contains the version of the item. |
GetItemVersionsAsync(string, Section, VersionFilter, CancellationToken)
Gets the versions of an item.
Declaration
Task<IEnumerable<ItemVersion>> GetItemVersionsAsync(string itemIdMaster, Section section, VersionFilter filter, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | itemIdMaster | The id of the item. |
Section | section | The Section. |
VersionFilter | filter | The VersionFilter used to retrive versions. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<IEnumerable<ItemVersion>> | The versions of the item. |
GetNewHistoryVersionNameAsync(string, string, Section, CancellationToken)
Gets a new version name for a given item and section.
Declaration
Task<string> GetNewHistoryVersionNameAsync(string itemIdMaster, string parentVersionName, Section section, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | itemIdMaster | The IdMaster of the item. |
string | parentVersionName | The parent version name. |
Section | section | The Section of the item. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<string> | A new history version name. |
GetNewItemAsync(CancellationToken)
Creates a new item with default values.
Declaration
Task<Item> GetNewItemAsync(CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<Item> | A new item. |
GetNewVersionNameAsync(string, Section, CancellationToken)
Gets a new version name for an item.
Declaration
Task<string> GetNewVersionNameAsync(string itemIdMaster, Section section, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | itemIdMaster | The id of the item. |
Section | section | The Section. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<string> | The new version name. |
GetParentVersionName(string)
Gets the parent version name for a given history version name.
Declaration
string GetParentVersionName(string historyVersionName)
Parameters
Type | Name | Description |
---|---|---|
string | historyVersionName | The history version name. |
Returns
Type | Description |
---|---|
string | The parent version name. |
GetRelationCountAsync(string, CancellationToken)
Gets the number of relations for the specified item.
Declaration
Task<long> GetRelationCountAsync(string itemIdMaster, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | itemIdMaster | The Id of the item to get the relation count for. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<long> | A task representing the asynchronous operation. |
GetRelationsAsync(string, CancellationToken)
Gets the relations for the specified item.
Declaration
Task<IEnumerable<Relation>> GetRelationsAsync(string itemIdMaster, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | itemIdMaster | The Id of the item to get the relations for. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<IEnumerable<Relation>> | A task representing the asynchronous operation. |
GetVersionLocalizationsAsync(string, Section, CancellationToken)
Gets the localizations of a version.
Declaration
Task<IEnumerable<string>> GetVersionLocalizationsAsync(string itemIdMaster, Section section, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | itemIdMaster | The id of the item. |
Section | section | The Section. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<IEnumerable<string>> | The localizations of the version. |
IsHistoryRateLimitAsync(string, string, Section, CancellationToken)
Gets the localizations of a version.
Declaration
Task<bool> IsHistoryRateLimitAsync(string itemIdMaster, string versionName, Section section, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | itemIdMaster | The id of the item. |
string | versionName | The parent version name of the item. |
Section | section | The Section. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<bool> | The localizations of the version. |
IsVersionStatusAvailable(ItemVersion, IEnumerable<ItemVersion>, VersionStatus)
Determines if a version status is available for an item.
Declaration
bool IsVersionStatusAvailable(ItemVersion version, IEnumerable<ItemVersion> versions, VersionStatus providedStatus)
Parameters
Type | Name | Description |
---|---|---|
ItemVersion | version | The current ItemVersion. |
IEnumerable<ItemVersion> | versions | The ItemVersion objects of the item. |
VersionStatus | providedStatus | The provided VersionStatus. |
Returns
Type | Description |
---|---|
bool | True if the status is available, otherwise false. |
RelationExistsAsync(string, string, string, CancellationToken)
Checks if a relation between two items exists.
Declaration
Task<bool> RelationExistsAsync(string itemIdMaster, string parentIdMaster, string sectionName, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | itemIdMaster | The Id of the item to check for relation. |
string | parentIdMaster | The Id of the parent item to check for relation. |
string | sectionName | The name of the section to check for relation. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<bool> | A Task representing the asynchronous operation, which when completed will return a bool indicating whether a relation exists between the two items. |
RelationMoveAsync(string, string, RelationMoveMode, string, string, int, CancellationToken)
Moves the relation for the specified item and parent item in the specified section to the specified target item.
Declaration
Task RelationMoveAsync(string itemIdMaster, string targetIdMaster, RelationMoveMode Mode, string parentIdMaster, string sectionName, int movingItemsCount, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | itemIdMaster | The Id of the item to move the relation from. |
string | targetIdMaster | The Id of the target item to move the relation to. |
RelationMoveMode | Mode | The RelationMoveMode for the relation. |
string | parentIdMaster | The Id of the parent item to move the relation from. |
string | sectionName | The name of the section to move the relation from. |
int | movingItemsCount | The number of items to move. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task | A task representing the asynchronous operation. |
RelationRemoveAsync(string, string, string, CancellationToken)
Removes the relation for the specified item and parent item in the specified section.
Declaration
Task RelationRemoveAsync(string itemIdMaster, string parentIdMaster, string sectionName, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | itemIdMaster | The Id of the item to remove the relation from. |
string | parentIdMaster | The Id of the parent item to remove the relation from. |
string | sectionName | The name of the section to remove the relation from. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task | A task representing the asynchronous operation. |
RelationSaveAsync(string, string, string, CancellationToken)
Saves a relation between two items.
Declaration
Task RelationSaveAsync(string itemIdMaster, string parentIdMaster, string sectionName, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | itemIdMaster | The Id of the item to save relation for. |
string | parentIdMaster | The Id of the parent item to save relation for. |
string | sectionName | The name of the section to save relation for. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task | A Task representing the asynchronous operation. |
SetHistoryVersionAsync(Item, Section, string, string, Dictionary<string, object>, CancellationToken)
Sets a new history version for the item.
Declaration
Task<string> SetHistoryVersionAsync(Item item, Section section, string versionName, string versionCulture, Dictionary<string, object> sectionData, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
Item | item | The Item of the item. |
Section | section | The Section of the item. |
string | versionName | The parent version name of the item. |
string | versionCulture | The parent version culture of the item. |
Dictionary<string, object> | sectionData | The parent data. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<string> | The history version name. |
SetStatusAsync(string, ItemStatus, CancellationToken)
Sets the status of an item with the specified IdMaster.
Declaration
Task SetStatusAsync(string itemIdMaster, ItemStatus status, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | itemIdMaster | The Id of the item to update. |
ItemStatus | status | The new ItemStatus of the item. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task | A task representing the asynchronous operation. |
SetVersionLinkedValuesAsync(string, Section, string, Dictionary<string, object>, CancellationToken)
Sets the linked values of the specified item version.
Declaration
Task SetVersionLinkedValuesAsync(string itemIdMaster, Section section, string versionName, Dictionary<string, object> linkedValues, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | itemIdMaster | The Id of the item. |
Section | section | The Section of the item. |
string | versionName | The name of the version to update. |
Dictionary<string, object> | linkedValues | The linked values to set for the version. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task | A task that represents the asynchronous operation. |
SetVersionStatusAndCultureAsync(string, Section, string, string, VersionStatus, IEnumerable<string>, CancellationToken)
Sets the status and culture of the specified item version.
Declaration
Task<VersionUpdateResult> SetVersionStatusAndCultureAsync(string itemIdMaster, Section section, string versionName, string versionCulture, VersionStatus versionStatus, IEnumerable<string> cultures, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | itemIdMaster | The Id of the item. |
Section | section | The Section of the item. |
string | versionName | The name of the version to update. |
string | versionCulture | The culture of the version to update. |
VersionStatus | versionStatus | The VersionStatus to set for the version. |
IEnumerable<string> | cultures | The cultures to update. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<VersionUpdateResult> | The result of the operation. |