Package org.apache.wiki.pages
Interface PageManager
- 
- All Superinterfaces:
- java.util.EventListener,- WikiEventListener
 - All Known Implementing Classes:
- DefaultPageManager
 
 public interface PageManager extends WikiEventListener 
- 
- 
Field SummaryFields Modifier and Type Field Description static java.lang.StringPROP_LOCKEXPIRYThe property value for setting the amount of time before the page locks expire.static java.lang.StringPROP_PAGEPROVIDERThe property value for setting the current page provider.static java.lang.StringPROP_USECACHEThe property value for setting the cache on/off.
 - 
Method SummaryAll Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description voiddeletePage(java.lang.String pageName)Deletes a page or an attachment completely, including all versions.voiddeletePage(Page page)Deletes an entire page, all versions, all traces.voiddeleteVersion(Page page)Deletes only a specific version of a WikiPage.java.util.List<PageLock>getActiveLocks()Returns a list of currently applicable locks.java.util.Collection<Page>getAllPages()Returns all pages in some random order.PageLockgetCurrentLock(Page page)Returns the current lock owner of a page.java.lang.StringgetCurrentProvider()Returns the provider name.PagegetPage(java.lang.String pagereq)Finds the corresponding WikiPage object based on the page name.PagegetPage(java.lang.String pagereq, int version)Finds the corresponding WikiPage object base on the page name and version.PagegetPageInfo(java.lang.String pageName, int version)Finds a WikiPage object describing a particular page and version.PageSortergetPageSorter()Returns the configuredPageSorter.java.lang.StringgetPageText(java.lang.String pageName, int version)Fetches the page text from the repository.PageProvidergetProvider()Returns the page provider currently in use.java.lang.StringgetProviderDescription()Returns a human-readable description of the current provider.java.lang.StringgetPureText(java.lang.String page, int version)Returns the pure text of a page, no conversions.default java.lang.StringgetPureText(Page page)Returns the pure text of a page, no conversions.java.util.Set<Page>getRecentChanges()Returns a Collection of WikiPages, sorted in time order of last change (i.e. first object is the most recently changed).default java.lang.StringgetText(java.lang.String page)Returns the un-HTMLized text of the latest version of a page.java.lang.StringgetText(java.lang.String page, int version)Returns the un-HTMLized text of the given version of a page.default java.lang.StringgetText(Page page)Returns the un-HTMLized text of the given version of a page in the given context.intgetTotalPageCount()Returns the total count of all pages in the repository.<T extends Page>
 java.util.List<T>getVersionHistory(java.lang.String pageName)Gets a version history of page.PageLocklockPage(Page page, java.lang.String user)Locks page for editing.booleanpageExists(java.lang.String pageName)Returns true, if the page exists (any version) on the underlying WikiPageProvider.booleanpageExists(java.lang.String pageName, int version)Checks for existence of a specific page and version on the underlying WikiPageProvider.default booleanpageExists(Page page)Checks for existence of a specific page and version denoted by a WikiPage on the underlying WikiPageProvider.voidputPageText(Page page, java.lang.String content)Puts the page text into the repository.voidsaveText(Context context, java.lang.String text)Writes the WikiText of a page into the page repository.voidunlockPage(PageLock lock)Marks a page free to be written again.booleanwikiPageExists(java.lang.String page)Returns true, if the requested page (or an alias) exists.booleanwikiPageExists(java.lang.String page, int version)Returns true, if the requested page (or an alias) exists with the requested version.default booleanwikiPageExists(Page page)Returns true, if the requested page (or an alias) exists, with the specified version in the WikiPage.- 
Methods inherited from interface org.apache.wiki.event.WikiEventListeneractionPerformed
 
- 
 
- 
- 
- 
Field Detail- 
PROP_PAGEPROVIDERstatic final java.lang.String PROP_PAGEPROVIDER The property value for setting the current page provider. Value is "jspwiki.pageProvider".- See Also:
- Constant Field Values
 
 - 
PROP_USECACHEstatic final java.lang.String PROP_USECACHE The property value for setting the cache on/off. Value is "jspwiki.usePageCache".- See Also:
- Constant Field Values
 
 - 
PROP_LOCKEXPIRYstatic final java.lang.String PROP_LOCKEXPIRY The property value for setting the amount of time before the page locks expire. Value is "jspwiki.lockExpiryTime".- See Also:
- Constant Field Values
 
 
- 
 - 
Method Detail- 
getProviderPageProvider getProvider() Returns the page provider currently in use.- Returns:
- A WikiPageProvider instance.
 
 - 
getAllPagesjava.util.Collection<Page> getAllPages() throws ProviderException Returns all pages in some random order. If you need just the page names, please seeReferenceManager#findCreated(), which is probably a lot faster. This method may cause repository access.- Returns:
- A Collection of WikiPage objects.
- Throws:
- ProviderException- If the backend has problems.
 
 - 
getPageTextjava.lang.String getPageText(java.lang.String pageName, int version) throws ProviderException Fetches the page text from the repository. This method also does some sanity checks, like checking for the pageName validity, etc. Also, if the page repository has been modified externally, it is smart enough to handle such occurrences.- Parameters:
- pageName- The name of the page to fetch.
- version- The version to find
- Returns:
- The page content as a raw string
- Throws:
- ProviderException- If the backend has issues.
 
 - 
getPureTextjava.lang.String getPureText(java.lang.String page, int version) Returns the pure text of a page, no conversions. Use this if you are writing something that depends on the parsing of the page. Note that you should always check for page existence through pageExists() before attempting to fetch the page contents. This method is pretty similar togetPageText(String, int), except that it doesn't throwProviderException, it logs and swallows them.- Parameters:
- page- The name of the page to fetch.
- version- If WikiPageProvider.LATEST_VERSION, then uses the latest version.
- Returns:
- The page contents. If the page does not exist, returns an empty string.
 
 - 
getPureTextdefault java.lang.String getPureText(Page page) Returns the pure text of a page, no conversions. Use this if you are writing something that depends on the parsing the page. Note that you should always check for page existence through pageExists() before attempting to fetch the page contents. This method is pretty similar togetPageText(String, int), except that it doesn't throwProviderException, it logs and swallows them.- Parameters:
- page- A handle to the WikiPage
- Returns:
- String of WikiText.
- Since:
- 2.1.13, moved to PageManager on 2.11.0.
 
 - 
getTextjava.lang.String getText(java.lang.String page, int version) Returns the un-HTMLized text of the given version of a page. This method also replaces the < and & -characters with their respective HTML entities, thus making it suitable for inclusion on an HTML page. If you want to have the page text without any conversions, usegetPureText(String, int).- Parameters:
- page- WikiName of the page to fetch
- version- Version of the page to fetch
- Returns:
- WikiText.
 
 - 
getTextdefault java.lang.String getText(java.lang.String page) Returns the un-HTMLized text of the latest version of a page. This method also replaces the < and & -characters with their respective HTML entities, thus making it suitable for inclusion on an HTML page. If you want to have the page text without any conversions, usegetPureText(String, int).- Parameters:
- page- WikiName of the page to fetch.
- Returns:
- WikiText.
 
 - 
getTextdefault java.lang.String getText(Page page) Returns the un-HTMLized text of the given version of a page in the given context. USE THIS METHOD if you don't know what doing.This method also replaces the < and & -characters with their respective HTML entities, thus making it suitable for inclusion on an HTML page. If you want to have the page text without any conversions, use getPureText(Page).- Parameters:
- page- A page reference (not an attachment)
- Returns:
- The page content as HTMLized String.
- Since:
- 1.9.15.
- See Also:
- getPureText(Page)
 
 - 
saveTextvoid saveText(Context context, java.lang.String text) throws WikiException Writes the WikiText of a page into the page repository. If thejspwiki.propertiesfile contains the propertyjspwiki.approver.workflow.saveWikiPageand its value resolves to a valid user,GrouporRole, this method will place aDecisionin the approver's workflow inbox and throw aDecisionRequiredException. If the submitting user is authenticated and the page save is rejected, a notification will be placed in the user's decision queue.- Parameters:
- context- The current WikiContext
- text- The Wiki markup for the page.
- Throws:
- WikiException- if the save operation encounters an error during the save operation. If the page-save operation requires approval, the exception will be of type- DecisionRequiredException. Individual PageFilters, such as the- SpamFiltermay also throw a- RedirectException.
- Since:
- 2.1.28, moved to PageManager on 2.11.0
 
 - 
putPageTextvoid putPageText(Page page, java.lang.String content) throws ProviderException Puts the page text into the repository. Note that this method does NOT update JSPWiki internal data structures, and therefore you should always use saveText()- Parameters:
- page- Page to save
- content- Wikimarkup to save
- Throws:
- ProviderException- If something goes wrong in the saving phase
 
 - 
lockPagePageLock lockPage(Page page, java.lang.String user) Locks page for editing. Note, however, that the PageManager will in no way prevent you from actually editing this page; the lock is just for information.- Parameters:
- page- WikiPage to lock
- user- Username to use for locking
- Returns:
- null, if page could not be locked.
 
 - 
unlockPagevoid unlockPage(PageLock lock) Marks a page free to be written again. If there has not been a lock, will fail quietly.- Parameters:
- lock- A lock acquired in lockPage(). Safe to be null.
 
 - 
getCurrentLockPageLock getCurrentLock(Page page) Returns the current lock owner of a page. If the page is not locked, will return null.- Parameters:
- page- The page to check the lock for
- Returns:
- Current lock, or null, if there is no lock
 
 - 
getActiveLocksjava.util.List<PageLock> getActiveLocks() Returns a list of currently applicable locks. Note that by the time you get the list, the locks may have already expired, so use this only for informational purposes.- Returns:
- List of PageLock objects, detailing the locks. If no locks exist, returns an empty list.
- Since:
- 2.0.22.
 
 - 
getPagePage getPage(java.lang.String pagereq) Finds the corresponding WikiPage object based on the page name. It always finds the latest version of a page.- Parameters:
- pagereq- The name of the page to look for.
- Returns:
- A WikiPage object, or null, if the page by the name could not be found.
 
 - 
getPagePage getPage(java.lang.String pagereq, int version) Finds the corresponding WikiPage object base on the page name and version.- Parameters:
- pagereq- The name of the page to look for.
- version- The version number to look for. May be WikiProvider.LATEST_VERSION, in which case it will look for the latest version (and this method then becomes the equivalent of getPage(String).
- Returns:
- A WikiPage object, or null, if the page could not be found; or if there is no such version of the page.
- Since:
- 1.6.7 (moved to PageManager on 2.11.0).
 
 - 
getPageInfoPage getPageInfo(java.lang.String pageName, int version) throws ProviderException Finds a WikiPage object describing a particular page and version.- Parameters:
- pageName- The name of the page
- version- A version number
- Returns:
- A WikiPage object, or null, if the page does not exist
- Throws:
- ProviderException- If there is something wrong with the page name or the repository
 
 - 
getVersionHistory<T extends Page> java.util.List<T> getVersionHistory(java.lang.String pageName) Gets a version history of page. Each element in the returned List is a WikiPage.- Parameters:
- pageName- The name of the page or attachment to fetch history for
- Returns:
- If the page does not exist or there's some problem retrieving the version history, returns null, otherwise a List of WikiPages / Attachments, each corresponding to a different revision of the page / attachment.
 
 - 
getCurrentProviderjava.lang.String getCurrentProvider() Returns the provider name.- Returns:
- The full class name of the current page provider.
 
 - 
getProviderDescriptionjava.lang.String getProviderDescription() Returns a human-readable description of the current provider.- Returns:
- A human-readable description.
 
 - 
getTotalPageCountint getTotalPageCount() Returns the total count of all pages in the repository. This method is equivalent of calling getAllPages().size(), but it swallows the ProviderException and returns -1 instead of any problems.- Returns:
- The number of pages, or -1, if there is an error.
 
 - 
getRecentChangesjava.util.Set<Page> getRecentChanges() Returns a Collection of WikiPages, sorted in time order of last change (i.e. first object is the most recently changed). This method also includes attachments.- Returns:
- Set of WikiPage objects.
 
 - 
pageExistsboolean pageExists(java.lang.String pageName) throws ProviderException Returns true, if the page exists (any version) on the underlying WikiPageProvider.- Parameters:
- pageName- Name of the page.
- Returns:
- A boolean value describing the existence of a page
- Throws:
- ProviderException- If the backend fails or the name is illegal.
 
 - 
pageExistsboolean pageExists(java.lang.String pageName, int version) throws ProviderException Checks for existence of a specific page and version on the underlying WikiPageProvider.- Parameters:
- pageName- Name of the page
- version- The version to check
- Returns:
- trueif the page exists,- falseotherwise
- Throws:
- ProviderException- If backend fails or name is illegal
- Since:
- 2.3.29
 
 - 
pageExistsdefault boolean pageExists(Page page) throws ProviderException Checks for existence of a specific page and version denoted by a WikiPage on the underlying WikiPageProvider.- Parameters:
- page- A WikiPage object describing the name and version.
- Returns:
- true, if the page (or alias, or attachment) exists.
- Throws:
- ProviderException- If something goes badly wrong.
- Since:
- 2.0
 
 - 
wikiPageExistsboolean wikiPageExists(java.lang.String page) Returns true, if the requested page (or an alias) exists. Will consider any version as existing. Will check for all types of WikiPages: wiki pages themselves, attachments and special pages (non-existant references to other pages).- Parameters:
- page- WikiName of the page.
- Returns:
- true, if page (or attachment) exists.
 
 - 
wikiPageExistsboolean wikiPageExists(java.lang.String page, int version) throws ProviderException Returns true, if the requested page (or an alias) exists with the requested version. Will check for all types of WikiPages: wiki pages themselves, attachments and special pages (non-existant references to other pages).- Parameters:
- page- Page name
- version- Page version
- Returns:
- True, if page (or alias, or attachment) exists
- Throws:
- ProviderException- If the provider fails.
 
 - 
wikiPageExistsdefault boolean wikiPageExists(Page page) throws ProviderException Returns true, if the requested page (or an alias) exists, with the specified version in the WikiPage. Will check for all types of WikiPages: wiki pages themselves, attachments and special pages (non-existant references to other pages).- Parameters:
- page- A WikiPage object describing the name and version.
- Returns:
- true, if the page (or alias, or attachment) exists.
- Throws:
- ProviderException- If something goes badly wrong.
- Since:
- 2.0
 
 - 
deleteVersionvoid deleteVersion(Page page) throws ProviderException Deletes only a specific version of a WikiPage.- Parameters:
- page- The page to delete.
- Throws:
- ProviderException- if the page fails
 
 - 
deletePagevoid deletePage(java.lang.String pageName) throws ProviderException Deletes a page or an attachment completely, including all versions. If the page does not exist, does nothing.- Parameters:
- pageName- The name of the page.
- Throws:
- ProviderException- If something goes wrong.
 
 - 
deletePagevoid deletePage(Page page) throws ProviderException Deletes an entire page, all versions, all traces.- Parameters:
- page- The WikiPage to delete
- Throws:
- ProviderException- If the repository operation fails
 
 - 
getPageSorterPageSorter getPageSorter() Returns the configuredPageSorter.- Returns:
- the configured PageSorter.
 
 
- 
 
-