| java.lang.Object com.ecyrd.jspwiki.modules.ModuleManager com.ecyrd.jspwiki.PageManager
PageManager | public class PageManager extends ModuleManager implements WikiEventListener(Code) | | Manages the WikiPages. This class functions as an unified interface towards
the page providers. It handles initialization and management of the providers,
and provides utility methods for accessing the contents.
author: Janne Jalkanen since: 2.0 |
Inner Class :public static class PreSaveWikiPageTask extends Task | |
Inner Class :public static class SaveWikiPageTask extends Task | |
Method Summary | |
public void | actionPerformed(WikiEvent event) Listens for
com.ecyrd.jspwiki.event.WikiSecurityEvent.PROFILE_NAME_CHANGED events. | protected boolean | changeAcl(WikiPage page, Principal[] oldPrincipals, Principal newPrincipal) For a single wiki page, replaces all Acl entries matching a supplied array of Principals
with a new Principal. | public void | deletePage(WikiPage page) Deletes an entire page, all versions, all traces. | public void | deleteVersion(WikiPage page) Deletes only a specific version of a WikiPage. | final protected void | fireEvent(int type, String pagename) Fires a WikiPageEvent of the provided type and page name
to all registered listeners. | public List | getActiveLocks() Returns a list of currently applicable locks. | public Collection | getAllPages() Returns all pages in some random order. | public PageLock | getCurrentLock(WikiPage page) Returns the current lock owner of a page. | public WikiEngine | getEngine() Returns the WikiEngine to which this PageManager belongs to. | public WikiPage | getPageInfo(String pageName, int version) Finds a WikiPage object describing a particular page and version. | public String | getPageText(String pageName, int version) Fetches the page text from the repository. | public WikiPageProvider | getProvider() Returns the page provider currently in use. | public String | getProviderDescription() Returns a human-readable description of the current provider. | public int | getTotalPageCount() Returns the total count of all pages in the repository. | public List | getVersionHistory(String pageName) Gets a version history of page. | public PageLock | lockPage(WikiPage page, String user) Locks page for editing. | public Collection | modules() | public boolean | pageExists(String pageName) Returns true, if the page exists (any version).
Parameters: pageName - Name of the page. | public boolean | pageExists(String pageName, int version) Checks for existence of a specific page and version. | public void | putPageText(WikiPage page, String content) Puts the page text into the repository. | public void | unlockPage(PageLock lock) Marks a page free to be written again. |
FACT_CURRENT_TEXT | final public static String FACT_CURRENT_TEXT(Code) | | Fact name for storing the current text. Value is
.
|
FACT_DIFF_TEXT | final public static String FACT_DIFF_TEXT(Code) | | Fact name for storing a diff text. Value is
.
|
FACT_IS_AUTHENTICATED | final public static String FACT_IS_AUTHENTICATED(Code) | | |
FACT_PAGE_NAME | final public static String FACT_PAGE_NAME(Code) | | Fact name for storing the page name. Value is
.
|
FACT_PROPOSED_TEXT | final public static String FACT_PROPOSED_TEXT(Code) | | Fact name for storing the proposed (edited) text. Value is
.
|
PRESAVE_TASK_MESSAGE_KEY | final public static String PRESAVE_TASK_MESSAGE_KEY(Code) | | |
PRESAVE_WIKI_CONTEXT | final public static String PRESAVE_WIKI_CONTEXT(Code) | | |
PROP_LOCKEXPIRY | final public static String PROP_LOCKEXPIRY(Code) | | The property value for setting the amount of time before the page locks expire.
Value is
.
|
PROP_PAGEPROVIDER | final public static String PROP_PAGEPROVIDER(Code) | | The property value for setting the current page provider. Value is
.
|
PROP_USECACHE | final public static String PROP_USECACHE(Code) | | The property value for setting the cache on/off. Value is
.
|
SAVE_DECISION_MESSAGE_KEY | final public static String SAVE_DECISION_MESSAGE_KEY(Code) | | |
SAVE_REJECT_MESSAGE_KEY | final public static String SAVE_REJECT_MESSAGE_KEY(Code) | | |
SAVE_TASK_MESSAGE_KEY | final public static String SAVE_TASK_MESSAGE_KEY(Code) | | |
PageManager | public PageManager(WikiEngine engine, Properties props) throws WikiException(Code) | | Creates a new PageManager.
Parameters: engine - WikiEngine instance Parameters: props - Properties to use for initialization throws: WikiException - If anything goes wrong, you get this. |
actionPerformed | public void actionPerformed(WikiEvent event)(Code) | | Listens for
com.ecyrd.jspwiki.event.WikiSecurityEvent.PROFILE_NAME_CHANGED events. If a user profile's name changes, each page ACL is inspected. If an entry contains
a name that has changed, it is replaced with the new one. No events are emitted
as a consequence of this method, because the page contents are still the same; it is
only the representations of the names within the ACL that are changing.
Parameters: event - The event |
changeAcl | protected boolean changeAcl(WikiPage page, Principal[] oldPrincipals, Principal newPrincipal)(Code) | | For a single wiki page, replaces all Acl entries matching a supplied array of Principals
with a new Principal.
Parameters: page - the wiki page whose Acl is to be modified Parameters: oldPrincipals - an array of Principals to replace; all AclEntry objects whoseAclEntry.getPrincipal method returns one of these Principals will be replaced Parameters: newPrincipal - the Principal that should receive the old Principals' permissions true if the Acl was actually changed; false otherwise |
fireEvent | final protected void fireEvent(int type, String pagename)(Code) | | Fires a WikiPageEvent of the provided type and page name
to all registered listeners.
See Also: com.ecyrd.jspwiki.event.WikiPageEvent Parameters: type - the event type to be fired Parameters: pagename - the wiki page name as a String |
getActiveLocks | public List getActiveLocks()(Code) | | 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.
List of PageLock objects, detailing the locks. If no locks exist, returnsan empty list. since: 2.0.22. |
getCurrentLock | public PageLock getCurrentLock(WikiPage page)(Code) | | 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 Current lock, or null, if there is no lock |
getEngine | public WikiEngine getEngine()(Code) | | Returns the WikiEngine to which this PageManager belongs to.
The WikiEngine object. |
getPageInfo | public WikiPage getPageInfo(String pageName, int version) throws ProviderException(Code) | | Finds a WikiPage object describing a particular page and version.
Parameters: pageName - The name of the page Parameters: version - A version number 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 |
getPageText | public String getPageText(String pageName, int version) throws ProviderException(Code) | | 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. Parameters: version - The version to find The page content as a raw string throws: ProviderException - If the backend has issues. |
getProvider | public WikiPageProvider getProvider()(Code) | | Returns the page provider currently in use.
A WikiPageProvider instance. |
getProviderDescription | public String getProviderDescription()(Code) | | Returns a human-readable description of the current provider.
A human-readable description. |
getTotalPageCount | public int getTotalPageCount()(Code) | | 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.
The number of pages, or -1, if there is an error. |
getVersionHistory | public List getVersionHistory(String pageName) throws ProviderException(Code) | | Gets a version history of page. Each element in the returned
List is a WikiPage.
Parameters: pageName - The name of the page to fetch history for If the page does not exist, returns null, otherwise a Listof WikiPages. throws: ProviderException - If the repository fails. |
lockPage | public PageLock lockPage(WikiPage page, String user)(Code) | | 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 Parameters: user - Username to use for locking null, if page could not be locked. |
pageExists | public boolean pageExists(String pageName) throws ProviderException(Code) | | Returns true, if the page exists (any version).
Parameters: pageName - Name of the page. A boolean value describing the existence of a page throws: ProviderException - If the backend fails or the name is illegal. |
pageExists | public boolean pageExists(String pageName, int version) throws ProviderException(Code) | | Checks for existence of a specific page and version.
since: 2.3.29 Parameters: pageName - Name of the page Parameters: version - The version to check true if the page exists, false otherwise throws: ProviderException - If backend fails or name is illegal |
putPageText | public void putPageText(WikiPage page, String content) throws ProviderException(Code) | | Puts the page text into the repository. Note that this method does NOT update
JSPWiki internal data structures, and therefore you should always use WikiEngine.saveText()
Parameters: page - Page to save Parameters: content - Wikimarkup to save throws: ProviderException - If something goes wrong in the saving phase |
unlockPage | public void unlockPage(PageLock lock)(Code) | | 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. |
|
|