Class ParagraphService
- Namespace
- Dynamicweb.Content
- Assembly
- Dynamicweb.dll
Provides methods for querying and persisting paragraphs.
public class ParagraphService : ICacheStorage<int, Paragraph>, ICacheStorage<int>, ICacheStorage
- Inheritance
-
ParagraphService
- Implements
- Inherited Members
Methods
ClearCache()
Resets all keys to the default value for objects stored in the object cache
public void ClearCache()
ClearCache(IEnumerable<int>)
Resets the specified keys to the default value for objects stored in the object cache
public void ClearCache(IEnumerable<int> keys)
Parameters
keys
IEnumerable<int>Keys to reset
ClearCache(int)
Resets the specified key to the default value for objects stored in the object cache
public void ClearCache(int key)
Parameters
key
intKey to reset
ClearTrashBin(int)
Deletes the Paragraph with the specified id form trashbin
public void ClearTrashBin(int paragraphId)
Parameters
paragraphId
intThe id of the paragraph to delete
Exceptions
CopyTo(int, int)
Copies the paragraph with the specified source ID to the page with the specified ID.
public Paragraph CopyTo(int pageID, int source)
Parameters
Returns
CopyTo(int, int, bool)
Copies the paragraph with the specified source ID to the page with the specified ID.
public Paragraph CopyTo(int pageID, int source, bool isExperiment)
Parameters
pageID
intThe page ID to move the paragraph to.
source
intThe id of the paragraph to copy.
isExperiment
boolSpecifies whether the source paragraph is copied as a part of an experiment.
Returns
CreateFromMaster(int, int, bool)
Creates a paragraph from master and link them.
public void CreateFromMaster(int masterParagraphId, int onPageId, bool show)
Parameters
masterParagraphId
intThe master paragraph ID.
onPageId
intThe on page ID.
show
boolif set to
true
[show].
Delete(int)
Deletes the Paragraph with the specified id
public void Delete(int paragraphId)
Parameters
paragraphId
intThe id of the paragraph to delete
Exceptions
DeleteAllPageParagraphs(Page)
Deletes all paragraphs associated with the specified area
public ApplicationResponse DeleteAllPageParagraphs(Page page)
Parameters
page
PageThe page for which to delete all associated paragraphs
Returns
- ApplicationResponse
A ApplicationResponse indicating the success or failure of the operation
DeleteAllParagraphs(Area)
Deletes all paragraphs associated with the specified area
public ApplicationResponse DeleteAllParagraphs(Area area)
Parameters
area
AreaThe area for which to delete all associated paragraphs
Returns
- ApplicationResponse
A ApplicationResponse indicating the success or failure of the operation
DeleteParagraphItem(int)
Deletes the paragraph item
public void DeleteParagraphItem(int paragraphId)
Parameters
paragraphId
intThe id of the paragraph to delete its item
ForceRefreshIndex(int)
Forces the specific item from the index to be force-refreshed from the repository.
public bool ForceRefreshIndex(int paragraphId)
Parameters
paragraphId
intId of paragraph to be refreshed
Returns
GetAvailableParagraphDefinitions(Page, string?)
Gets the collection of available paragraph definitions for specified page.
public IEnumerable<ParagraphDefinition> GetAvailableParagraphDefinitions(Page parent, string? container)
Parameters
Returns
- IEnumerable<ParagraphDefinition>
IEnumerable(Of ParagraphDefinition).
GetCache(IEnumerable<int>)
public IEnumerable<Paragraph> GetCache(IEnumerable<int> keys)
Parameters
keys
IEnumerable<int>
Returns
GetCache(int)
public Paragraph? GetCache(int key)
Parameters
key
int
Returns
GetDeletedParagraphs(int)
Gets the collection of deleted paragraphs in specified area
public IEnumerable<Paragraph> GetDeletedParagraphs(int areaId)
Parameters
areaId
intThe area id.
Returns
- IEnumerable<Paragraph>
A collection of paragraphs
GetLanguageVersionsForParagraph(int)
public IEnumerable<Paragraph> GetLanguageVersionsForParagraph(int paragraphId)
Parameters
paragraphId
int
Returns
GetLatestModifiedParagraphs(int)
public IEnumerable<Paragraph> GetLatestModifiedParagraphs(int count)
Parameters
count
int
Returns
GetParagraph(int)
Gets the Paragraph with the specified id
public Paragraph? GetParagraph(int paragraphId)
Parameters
paragraphId
intThe id of the paragraph to get
Returns
- Paragraph
The paragraph with the specified id
Exceptions
GetParagraphByParagraphOrPageIds(List<int>, List<int>)
Gets the paragraph by paragraph or page ids.
public IEnumerable<Paragraph> GetParagraphByParagraphOrPageIds(List<int> paragraphIds, List<int> pageIds)
Parameters
Returns
- IEnumerable<Paragraph>
IEnumerable(Of Paragraph).
GetParagraphDraft(int)
Gets the draft version of the paragraph with the specified id if any.
public Paragraph? GetParagraphDraft(int paragraphId)
Parameters
paragraphId
intTh id of the paragraph for which to get the draft version
Returns
- Paragraph
The draft version of the paragraph with the specified id if any, otherwise null (Nothing)
Exceptions
GetParagraphDraft(int, DateTime)
Gets the draft version of the paragraph with the specified id if any.
public Paragraph? GetParagraphDraft(int paragraphId, DateTime previewDate)
Parameters
paragraphId
intTh id of the paragraph for which to get the draft version
previewDate
DateTimeThe preview date of the draft version
Returns
- Paragraph
The draft version of the paragraph with the specified id if any, otherwise null (Nothing)
Exceptions
GetParagraphForItem(string, string)
Gets the paragraph for the item with the specified name and id
public Paragraph? GetParagraphForItem(string itemType, string itemId)
Parameters
Returns
- Paragraph
The paragraph associated with the specified item
GetParagraphFromVersion(int, int)
Gets the paragraph with the specified id, but with its values populated from the version with the specified versionId
public Paragraph? GetParagraphFromVersion(int paragraphId, int versionId)
Parameters
paragraphId
intThe id of the paragraph to get
versionId
intThe id of the version from which the paragraph should have its data populated
Returns
- Paragraph
A paragraph with data populated from the version with the given versionId
Exceptions
GetParagraphOrLanguage(int, int)
Gets the page with the specified id - if the passed areaid does not match the pageid, the language version will be returned if found
public Paragraph? GetParagraphOrLanguage(int paragraphId, int areaId)
Parameters
Returns
- Paragraph
The page with the specified id or its language version for the specified area. If a page with the Id is not found,
null
is returned. If areaid is not more than 0, exception will be thrown
GetParagraphs()
Gets all the paragraphs in the systen
public IEnumerable<Paragraph> GetParagraphs()
Returns
- IEnumerable<Paragraph>
A ParagraphCollection with all the paragraphs registred in the systen
GetParagraphsByAreaID(int)
Gets all the paragraphs associated with the specified area id
public IEnumerable<Paragraph> GetParagraphsByAreaID(int areaID)
Parameters
areaID
intThe id of the area for which to get all associated Paragraphs
Returns
- IEnumerable<Paragraph>
A collection of Paragraphs associated with the specified Area id
GetParagraphsByIds(IEnumerable<int>)
Gets the paragraphs matching the id's in the list
public IEnumerable<Paragraph> GetParagraphsByIds(IEnumerable<int> ids)
Parameters
ids
IEnumerable<int>A list of paragraph ids for which to get the matching Paragraphs
Returns
- IEnumerable<Paragraph>
A collection of Paragraphs matching the ids in the specified list
GetParagraphsByItemTypes(IEnumerable<string>)
Gets the paragraphs that has one of the ItemTypes specified in the itemTypes list
public IEnumerable<Paragraph> GetParagraphsByItemTypes(IEnumerable<string> itemTypes)
Parameters
itemTypes
IEnumerable<string>A list of itemTypes for which to get Paragraphs
Returns
- IEnumerable<Paragraph>
A collection of Paragraphs
GetParagraphsByModuleName(string)
Gets all the paragraphs that have the specified module name
public IEnumerable<Paragraph> GetParagraphsByModuleName(string moduleName)
Parameters
moduleName
stringThe module name for which to get all paragraphs
Returns
- IEnumerable<Paragraph>
A ParagraphCollection with all paragraphs having the specified module name
GetParagraphsByPageId(int)
Gets all the paragraphs belonging to the page with the specified id
public IEnumerable<Paragraph> GetParagraphsByPageId(int pageId)
Parameters
pageId
intThe id of the page for which to get all its paragraphs
Returns
- IEnumerable<Paragraph>
A collection of Paragraphs
Exceptions
GetParagraphsByPageId(int, ParagraphSort)
Gets all the paragraphs belonging to the page with the specified id sorted by the specified sort value
public IEnumerable<Paragraph> GetParagraphsByPageId(int pageId, ParagraphSort sortBy)
Parameters
pageId
intThe id of the page for which to get all its paragraphs
sortBy
ParagraphSortA value indicating of the collection of Paragraphs should be sorted
Returns
- IEnumerable<Paragraph>
A sorted collection of Paragraphs
Exceptions
GetTemplateParentPage(int)
Get paragraph template folder
public Page? GetTemplateParentPage(int areaId)
Parameters
areaId
intThe area id.
Returns
- Page
The paragraph template folder
Move(int, int, int)
Moves the specified Paragrah from the source page to the target page
public Paragraph Move(int paragraphId, int sourcePageId, int targetPageId)
Parameters
paragraphId
intThe id of the paragraph to move
sourcePageId
intThe id of the page from which to move the paragraph
targetPageId
intThe id of the page to which the paragraph should be moved
Returns
- Paragraph
The newly moved Paragraph
RestoreParagraph(int)
Restore the paragraph with the specified id
public void RestoreParagraph(int paragraphId)
Parameters
paragraphId
intThe id of the paragraph to restore
Remarks
It is expected that paragraph parent grid row and page are not deleted. Otherwise they needs to be restored at first.
Exceptions
SaveAsTemplate(Paragraph, string, string, string, string)
Saves the specified paragraph as a template
public Paragraph? SaveAsTemplate(Paragraph paragraph, string name, string description, string image, string category)
Parameters
paragraph
ParagraphThe paragraph to save as a template
name
stringThe name of the new template
description
stringA description of the template
image
stringAn image for the template
category
stringA category of the template
Returns
- Paragraph
The paragraph template
SaveParagraph(Paragraph)
Saves the specified paragraph to persistance
public Paragraph SaveParagraph(Paragraph paragraph)
Parameters
paragraph
ParagraphThe paragraph to save
Returns
- Paragraph
The newly saved paragraph
ToggleActive(Paragraph, bool)
Include or exclude a paragraph in the layout of the webpage
public void ToggleActive(Paragraph paragraph, bool active)
Parameters
paragraph
ParagraphThe paragraph to include or exclude
active
boolWhether a paragraph is included or excluded
UpdateSortIndex(int, int, string?)
Updates the paragraph sorting index and container in layout.
public void UpdateSortIndex(int paragraphId, int sortIndex, string? container)