Class ParagraphService
- Namespace
- Dynamicweb.Content
- Assembly
- Dynamicweb.dll
Provides methods for querying and persisting paragraphs.
public class ParagraphService : IParagraphService, IRecyclable<Paragraph>, ICacheStorage<int, Paragraph>, ICacheStorage<int>, ICacheStorage
- Inheritance
-
ParagraphService
- Implements
- Inherited Members
Properties
Repository
Gets the repository for working with the Paragraph aggregate
[Obsolete("Do not use")]
public static IParagraphRepository Repository { get; set; }
Property Value
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
int- Key to reset
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
int- The page ID to move the paragraph to.
source
int- The id of the paragraph to copy.
isExperiment
bool- Specifies whether the source paragraph is copied as a part of an
.
Returns
Delete(int)
Deletes the Paragraph with the specified id
public void Delete(int paragraphId)
Parameters
paragraphId
int- The id of the paragraph to delete
Exceptions
DeleteAllPageParagraphs(Page)
Deletes all paragraphs associated with the specified area
public ApplicationResponse DeleteAllPageParagraphs(Page page)
Parameters
page
Page- The 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
Area- The 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
int- The 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
int- Id 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
GetLanguageVersionsForParagraph(int)
Gets the language versions of the Paragraph with the specified id
public IEnumerable<Paragraph> GetLanguageVersionsForParagraph(int paragraphId)
Parameters
paragraphId
int- The id of the Paragraph for which to get the language versions
Returns
- IEnumerable<Paragraph>
- A collection of Paragraph language versions
GetLatestModifiedParagraphs(int)
Gets latest modified paragraph
public IEnumerable<Paragraph> GetLatestModifiedParagraphs(int count)
Parameters
count
int- Max count of paragraphs to returns
Returns
GetParagraph(int)
Gets the Paragraph with the specified id
public Paragraph GetParagraph(int paragraphId)
Parameters
paragraphId
int- The 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
int- Th 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
int- Th id of the paragraph for which to get the draft version
previewDate
DateTime- The 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
int- The id of the paragraph to get
versionId
int- The 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
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
int- The 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
string- The 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
int- The 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
int- The id of the page for which to get all its paragraphs
sortBy
ParagraphSort- A 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
int- The 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
int- The id of the paragraph to move
sourcePageId
int- The id of the page from which to move the paragraph
targetPageId
int- The id of the page to which the paragraph should be moved
Returns
- Paragraph
- The newly moved Paragraph
MoveToBin(Paragraph)
Moves the parahraph into a new recycle bin.
public Guid MoveToBin(Paragraph obj)
Parameters
obj
Paragraph- Object to delete
Returns
- Guid
- unique id of recycle bin
MoveToExistingBin(Paragraph, Guid)
Moves the parahraph into a specific recycle bin.
public void MoveToExistingBin(Paragraph obj, Guid unitId)
Parameters
Restore(object)
Restores the paragraph with the specified id if the current user has permissions for this operation, otherwise nothing is done
public void Restore(object id)
Parameters
id
object- The id of the paragraph to restore
Exceptions
- InvalidOperationException
- Thrown when there is an attempt to restore a paragraph having non-existing relations e.g. parent Page or ItemType.
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
Paragraph- The paragraph to save as a template
name
string- The name of the new template
description
string- A description of the template
image
string- An image for the template
category
string- A category of the template
Returns
- Paragraph
- The paragraph template
SaveParagraph(Paragraph)
Saves the specified paragraph to persistance
public Paragraph SaveParagraph(Paragraph paragraph)
Parameters
paragraph
Paragraph- The 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
Paragraph- The paragraph to include or exclude
active
bool- Whether 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)