|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--com.ecyrd.jspwiki.ReferenceManager
Keeps track of wikipage references:
This class contains two HashMaps, m_refersTo and m_referredBy. The first is indexed by WikiPage names and contains a Collection of all WikiPages the page refers to. (Multiple references are not counted, naturally.) The second is indexed by WikiPage names and contains a HashSet of all pages that refer to the indexing page. (Notice - the keys of both HashMaps should be kept in sync.)
When a page is added or edited, its references are parsed, a Collection is received, and we crudely replace anything previous with this new Collection. We then check each referenced page name and make sure they know they are referred to by the new page.
Based on this information, we can perform non-optimal searches for e.g. unreferenced pages, top ten lists, etc.
The owning class must take responsibility of filling in any pre-existing information, probably by loading each and every WikiPage and calling this class to update the references when created.
| Constructor Summary | |
ReferenceManager(WikiEngine engine,
java.util.Collection pages)
Builds a new ReferenceManager with default (null) entries for the WikiPages contained in the pages Collection. |
|
| Method Summary | |
java.util.Collection |
findReferrers(java.lang.String pagename)
Find all pages that refer to this page. |
java.util.Collection |
findUncreated()
Finds all references to non-existant pages. |
java.util.Collection |
findUnreferenced()
Finds all unreferenced pages. |
void |
updateReferences(java.lang.String page,
java.util.Collection references)
Updates the referred pages of a new or edited WikiPage. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public ReferenceManager(WikiEngine engine,
java.util.Collection pages)
The collection should contain an entry for all currently existing WikiPages.
pages - a Collection of WikiPages| Method Detail |
public void updateReferences(java.lang.String page,
java.util.Collection references)
This is the method to call when a new page has been created and we want to a) set up its references and b) notify the referred pages of the references. Use this method during run-time.
page - Name of the page to update.references - A Collection of Strings, each one pointing to a page this page references.public java.util.Collection findUnreferenced()
public java.util.Collection findUncreated()
Returns a Collection containing Strings of unreferenced page names. Each non-existant page name is shown only once - we don't return information on who referred to it.
public java.util.Collection findReferrers(java.lang.String pagename)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||