| org.outerj.daisy.navigation.NavigationManager
All known Subclasses: org.outerj.daisy.navigation.impl.NavigationManagerImpl, org.outerj.daisy.navigation.clientimpl.RemoteNavigationManager,
NavigationManager | public interface NavigationManager (Code) | | The NavigationManager generates hierarchical navigation trees from an XML
navigation tree specification. The navigation tree specification is read from
a Daisy repository document (from the content of the "NavigationData" part) and
can contain a literal enumeration of documents but also queries.
The navigation trees support quite some features, we refer to the Daisy documentation
for more information on this.
This is an optional repository extension component.
The NavigationManager is obtained from the
org.outerj.daisy.repository.Repository Repository as
follows:
NavigationManager navManager = (NavigationManager)repository.getExtension("NavigationManager");
In the remote repository API, the NavigationManager extension can be registered as follows:
RemoteRepositoryManager repositoryManager = ...;
repositoryManager.registerExtension("NavigationManager",
new Packages.org.outerj.daisy.navigation.clientimpl.RemoteNavigationManagerProvider());
|
Method Summary | |
public void | generateNavigationTree(ContentHandler contentHandler, NavigationParams navigationParams, VariantKey activeDocument, boolean handleErrors) Generates a navigation tree as XML.
If the document specified in the NavigationParams as 'activeDocument' cannot be found,
a 'closed' tree will be produced (i.e. | public void | generatePreviewNavigationTree(ContentHandler contentHandler, String navigationTreeXml, long branchId, long languageId, Locale locale) Generates a navigation tree based on the XML given in the navigationTreeXml parameter.
This allows to generate navigation trees from an XML description not stored in the repository.
The branch and language parameters should be the branch and language that are or will be used
on the site where this navigation tree is published (and thus the branch and language under which
the navigation tree would normally be stored in the repository). | public void | generatePreviewNavigationTree(ContentHandler contentHandler, String navigationTreeXml, long branchId, long languageId) Same as the other generatePreviewNavigationTree method, but without Locale parameter
(defaults to Locale.US), for backwards compatibility. | public NavigationLookupResult | lookup(String navigationPath, long requestedBranchId, long requestedLanguageId, LookupAlternative[] lookupAlternatives) Resolves a path (of the form id/id/...) against a (series of) navigation tree(s),
giving a certain result. | public String | reverseLookup(VariantKey document, VariantKey navigationDoc, NavigationVersionMode versionMode) Searches a possible path in the navigation tree for the given document, or null if none
exists. | public String | reverseLookup(VariantKey document, VariantKey navigationDoc) Same as the other reverseLookup method, but defaults to the live version mode. |
generateNavigationTree | public void generateNavigationTree(ContentHandler contentHandler, NavigationParams navigationParams, VariantKey activeDocument, boolean handleErrors) throws RepositoryException, SAXException(Code) | | Generates a navigation tree as XML.
If the document specified in the NavigationParams as 'activeDocument' cannot be found,
a 'closed' tree will be produced (i.e. a tree generated to node depth level 1) if contextualized is true.
If contextualized is false, a full tree will be genereated.
The same holds if the the 'activeDocument', or one of the nodes on the path leading to
that document, is not readable by the current user and role.
Parameters: contentHandler - resulting XML will be pushed on this ContentHandler Parameters: activeDocument - the document that should be marked as 'selected' (null for none) Parameters: handleErrors - if true, the navigation tree generation output will first be buffered so thatin case an error occurs, some information about this error can be streamedinstead of the normal navigation tree outpus throws: NavigationException - in case some error occurs throws: SAXException - never thrown by us, but unavoidable when pushing things to a ContentHandler. |
generatePreviewNavigationTree | public void generatePreviewNavigationTree(ContentHandler contentHandler, String navigationTreeXml, long branchId, long languageId, Locale locale) throws RepositoryException, SAXException(Code) | | Generates a navigation tree based on the XML given in the navigationTreeXml parameter.
This allows to generate navigation trees from an XML description not stored in the repository.
The branch and language parameters should be the branch and language that are or will be used
on the site where this navigation tree is published (and thus the branch and language under which
the navigation tree would normally be stored in the repository). They are used as default branch and language
there where one is needed (eg. document and import nodes).
|
generatePreviewNavigationTree | public void generatePreviewNavigationTree(ContentHandler contentHandler, String navigationTreeXml, long branchId, long languageId) throws RepositoryException, SAXException(Code) | | Same as the other generatePreviewNavigationTree method, but without Locale parameter
(defaults to Locale.US), for backwards compatibility.
|
lookup | public NavigationLookupResult lookup(String navigationPath, long requestedBranchId, long requestedLanguageId, LookupAlternative[] lookupAlternatives) throws RepositoryException(Code) | | Resolves a path (of the form id/id/...) against a (series of) navigation tree(s),
giving a certain result. See
NavigationLookupResult .
This method is best understood with the structure of the Daisy Wiki, where each 'site'
is associated with a collection and a navigation tree, and the branch and language of the
navigation tree document correspond to the 'default' branch and language for that site.
The algortihm followed is described below.
Is the navigationPath found in the navigation tree of the first lookup alternative?
- 1. If yes, what is the type of node it addresses?
- 1-a. If it is a group node, set the result to a redirect to the first (depth-first) document child
descendant of the group node. If the group node does not have any such children, set the result to 'path not found'.
- 1-b. If it is a document node, check if the branch and language of the navtree node match the
requested branch and language (if not -1)
- 1-b-i. If they match, set the result to 'match'.
- 1-b-ii. If no, search among the lookup alternatives.
- 2. If no, then does the path end on a numeric ID?
- 2-a. If no, set the result to 'path not found'.
- 2-b. If yes, follow the following algorithm:
- Determine the branch and language (is either the requested branch and language, or those of the navtree
of the first lookup alternative)
- Retrieve the collections the document belongs to. If this fails for whathever reason (usually permissions
or existence), just set the result to 'match'. When the front end will then try
to display the document, it will run into this error and show it to the user.
- Run over the lookup alternatives:
- If the collection, navtree-branch and navtree-language of a lookup alternative match those of the document:
- If this is the first match, remember it as "firstMatch"
- If found in the navtree of this lookup alternative, set the result to a redirect to this lookup alternative
and navigation path. Done.
- If we ran over all the lookup alternatives and none matched:
- If 'firstMatch' is set and is different from first lookup alternative, set result to redirect to the lookup alternative
- Otherwise set result to 'match' (as if it was found at whatever location that was requested).
Parameters: requestedBranchId - if the branch of the document differs the one in the navtree node, this argumentspecifies the branch ID, otherwise supply -1. Parameters: requestedLanguageId - dito as for requestedBranchId Parameters: lookupAlternatives - should at least contain one entry |
|
|