using System; using System.Collections.Generic; using System.Text; using ScrewTurn.Wiki.SearchEngine; namespace ScrewTurn.Wiki.PluginFramework { /// /// It is the interface that must be implemented in order to create a custom Pages Storage Provider for ScrewTurn Wiki. /// /// A class that implements this interface should not have any kind of data caching. public interface IPagesStorageProviderV30 : IStorageProviderV30 { /// /// Gets a namespace. /// /// The name of the namespace. /// The , or null if no namespace is found. /// If is null. /// If is empty. NamespaceInfo GetNamespace(string name); /// /// Gets all the sub-namespaces. /// /// The sub-namespaces, sorted by name. NamespaceInfo[] GetNamespaces(); /// /// Adds a new namespace. /// /// The name of the namespace. /// The correct object. /// If is null. /// If is empty. NamespaceInfo AddNamespace(string name); /// /// Renames a namespace. /// /// The namespace to rename. /// The new name of the namespace. /// The correct object. /// If or are null. /// If is empty. NamespaceInfo RenameNamespace(NamespaceInfo nspace, string newName); /// /// Sets the default page of a namespace. /// /// The namespace of which to set the default page. /// The page to use as default page, or null. /// The correct object. /// If is null. NamespaceInfo SetNamespaceDefaultPage(NamespaceInfo nspace, PageInfo page); /// /// Removes a namespace. /// /// The namespace to remove. /// true if the namespace is removed, false otherwise. /// If is null. bool RemoveNamespace(NamespaceInfo nspace); /// /// Moves a page from its namespace into another. /// /// The page to move. /// The destination namespace (null for the root). /// A value indicating whether to copy the page categories in the destination /// namespace, if not already available. /// The correct instance of . /// If is null. PageInfo MovePage(PageInfo page, NamespaceInfo destination, bool copyCategories); /// /// Gets a category. /// /// The full name of the category. /// The , or null if no category is found. /// If is null. /// If is empty. CategoryInfo GetCategory(string fullName); /// /// Gets all the Categories in a namespace. /// /// The namespace. /// All the Categories in the namespace, sorted by name. CategoryInfo[] GetCategories(NamespaceInfo nspace); /// /// Gets all the categories of a page. /// /// The page. /// The categories, sorted by name. /// If is null. CategoryInfo[] GetCategoriesForPage(PageInfo page); /// /// Adds a Category. /// /// The target namespace (null for the root). /// The Category name. /// The correct CategoryInfo object. /// The method should set category's Pages to an empty array. /// If is null. /// If is empty. CategoryInfo AddCategory(string nspace, string name); /// /// Renames a Category. /// /// The Category to rename. /// The new Name. /// The correct CategoryInfo object. /// If or are null. /// If is empty. CategoryInfo RenameCategory(CategoryInfo category, string newName); /// /// Removes a Category. /// /// The Category to remove. /// True if the Category has been removed successfully. /// If is null. bool RemoveCategory(CategoryInfo category); /// /// Merges two Categories. /// /// The source Category. /// The destination Category. /// The correct object. /// The destination Category remains, while the source Category is deleted, and all its Pages re-bound /// in the destination Category. /// If or are null. CategoryInfo MergeCategories(CategoryInfo source, CategoryInfo destination); /// /// Performs a search in the index. /// /// The search parameters. /// The results. /// If is null. SearchResultCollection PerformSearch(SearchParameters parameters); /// /// Rebuilds the search index. /// void RebuildIndex(); /// /// Gets some statistics about the search engine index. /// /// The total number of documents. /// The total number of unique words. /// The total number of word-document occurrences. /// The approximated size, in bytes, of the search engine index. void GetIndexStats(out int documentCount, out int wordCount, out int occurrenceCount, out long size); /// /// Gets a value indicating whether the search engine index is corrupted and needs to be rebuilt. /// bool IsIndexCorrupted { get; } /// /// Gets a page. /// /// The full name of the page. /// The , or null if no page is found. /// If is null. /// If is empty. PageInfo GetPage(string fullName); /// /// Gets all the Pages in a namespace. /// /// The namespace (null for the root). /// All the Pages in the namespace, sorted by name. PageInfo[] GetPages(NamespaceInfo nspace); /// /// Gets all the pages in a namespace that are bound to zero categories. /// /// The namespace (null for the root). /// The pages, sorted by name. PageInfo[] GetUncategorizedPages(NamespaceInfo nspace); /// /// Gets the Content of a Page. /// /// The Page. /// The Page Content object, null if the page does not exist or is null, /// or an empty instance if the content could not be retrieved (). PageContent GetContent(PageInfo page); /// /// Gets the content of a draft of a Page. /// /// The Page. /// The draft, or null if no draft exists. /// If is null. PageContent GetDraft(PageInfo page); /// /// Deletes a draft of a Page. /// /// The page. /// true if the draft is deleted, false otherwise. /// If is null. bool DeleteDraft(PageInfo page); /// /// Gets the Backup/Revision numbers of a Page. /// /// The Page to get the Backups of. /// The Backup/Revision numbers. /// If is null. int[] GetBackups(PageInfo page); /// /// Gets the Content of a Backup of a Page. /// /// The Page to get the backup of. /// The Backup/Revision number. /// The Page Backup. /// If is null. /// If is less than zero. PageContent GetBackupContent(PageInfo page, int revision); /// /// Forces to overwrite or create a Backup. /// /// The Backup content. /// The revision. /// True if the Backup has been created successfully. /// If is null. /// If is less than zero. bool SetBackupContent(PageContent content, int revision); /// /// Adds a Page. /// /// The target namespace (null for the root). /// The Page Name. /// The creation Date/Time. /// The correct PageInfo object or null. /// This method should not create the content of the Page. /// If is null. /// If is empty. PageInfo AddPage(string nspace, string name, DateTime creationDateTime); /// /// Renames a Page. /// /// The Page to rename. /// The new Name. /// The correct object. /// If or are null. /// If is empty. PageInfo RenamePage(PageInfo page, string newName); /// /// Modifies the Content of a Page. /// /// The Page. /// The Title of the Page. /// The Username. /// The Date/Time. /// The Comment of the editor, about this revision. /// The Page Content. /// The keywords, usually used for SEO. /// The description, usually used for SEO. /// The save mode for this modification. /// true if the Page has been modified successfully, false otherwise. /// If saveMode equals Draft and a draft already exists, it is overwritten. /// If , or are null. /// If or are empty. bool ModifyPage(PageInfo page, string title, string username, DateTime dateTime, string comment, string content, string[] keywords, string description, SaveMode saveMode); /// /// Performs the rollback of a Page to a specified revision. /// /// The Page to rollback. /// The Revision to rollback the Page to. /// true if the rollback succeeded, false otherwise. /// If is null. /// If is less than zero. bool RollbackPage(PageInfo page, int revision); /// /// Deletes the Backups of a Page, up to a specified revision. /// /// The Page to delete the backups of. /// The newest revision to delete (newer revision are kept) or -1 to delete all the Backups. /// true if the deletion succeeded, false otherwise. /// If is null. /// If is less than -1. bool DeleteBackups(PageInfo page, int revision); /// /// Removes a Page. /// /// The Page to remove. /// True if the Page is removed successfully. /// If is null. bool RemovePage(PageInfo page); /// /// Binds a Page with one or more Categories. /// /// The Page to bind. /// The Categories to bind the Page with. /// True if the binding succeeded. /// After a successful operation, the Page is bound with all and only the categories passed as argument. /// If or are null. bool RebindPage(PageInfo page, string[] categories); /// /// Gets the Page Messages. /// /// The Page. /// The list of the first-level Messages, containing the replies properly nested, sorted by date/time. /// If is null. Message[] GetMessages(PageInfo page); /// /// Gets the total number of Messages in a Page Discussion. /// /// The Page. /// The number of messages. /// If is null. int GetMessageCount(PageInfo page); /// /// Removes all messages for a page and stores the new messages. /// /// The page. /// The new messages to store. /// true if the messages are stored, false otherwise. /// If or are null. bool BulkStoreMessages(PageInfo page, Message[] messages); /// /// Adds a new Message to a Page. /// /// The Page. /// The Username. /// The Subject. /// The Date/Time. /// The Body. /// The Parent Message ID, or -1. /// True if the Message is added successfully. /// If , , or are null. /// If or are empty. /// If is less than -1. bool AddMessage(PageInfo page, string username, string subject, DateTime dateTime, string body, int parent); /// /// Removes a Message. /// /// The Page. /// The ID of the Message to remove. /// A value specifying whether or not to remove the replies. /// True if the Message is removed successfully. /// If is null. /// If is less than zero. bool RemoveMessage(PageInfo page, int id, bool removeReplies); /// /// Modifies a Message. /// /// The Page. /// The ID of the Message to modify. /// The Username. /// The Subject. /// The Date/Time. /// The Body. /// True if the Message is modified successfully. /// If , , or are null. /// If is less than zero. /// If or are empty. bool ModifyMessage(PageInfo page, int id, string username, string subject, DateTime dateTime, string body); /// /// Gets all the Navigation Paths in a Namespace. /// /// The Namespace. /// All the Navigation Paths, sorted by name. NavigationPath[] GetNavigationPaths(NamespaceInfo nspace); /// /// Adds a new Navigation Path. /// /// The target namespace (null for the root). /// The Name of the Path. /// The Pages array. /// The correct object. /// If or are null. /// If or are empty. NavigationPath AddNavigationPath(string nspace, string name, PageInfo[] pages); /// /// Modifies an existing navigation path. /// /// The navigation path to modify. /// The new pages array. /// The correct object. /// If or are null. /// If is empty. NavigationPath ModifyNavigationPath(NavigationPath path, PageInfo[] pages); /// /// Removes a Navigation Path. /// /// The navigation path to remove. /// true if the path is removed, false otherwise. /// If is null. bool RemoveNavigationPath(NavigationPath path); /// /// Gets all the snippets. /// /// All the snippets, sorted by name. Snippet[] GetSnippets(); /// /// Adds a new snippet. /// /// The name of the snippet. /// The content of the snippet. /// The correct object. /// If or are null. /// If is empty. Snippet AddSnippet(string name, string content); /// /// Modifies an existing snippet. /// /// The name of the snippet to modify. /// The content of the snippet. /// The correct object. /// If or are null. /// If is empty. Snippet ModifySnippet(string name, string content); /// /// Removes a new Snippet. /// /// The Name of the Snippet to remove. /// true if the snippet is removed, false otherwise. /// If is null. /// If is empty. bool RemoveSnippet(string name); /// /// Gets all the content templates. /// /// All the content templates, sorted by name. ContentTemplate[] GetContentTemplates(); /// /// Adds a new content template. /// /// The name of template. /// The content of the template. /// The correct object. /// If or are null. /// If is empty. ContentTemplate AddContentTemplate(string name, string content); /// /// Modifies an existing content template. /// /// The name of the template to modify. /// The content of the template. /// The correct object. /// If or are null. /// If is empty. ContentTemplate ModifyContentTemplate(string name, string content); /// /// Removes a content template. /// /// The name of the template to remove. /// true if the template is removed, false otherwise. /// If is null. /// If is empty. bool RemoveContentTemplate(string name); } /// /// Lists legal saving modes. /// public enum SaveMode { /// /// Save the content. /// Normal, /// /// Backup the previous content, then save the current content. /// Backup, /// /// Save the content as draft. /// Draft } }