KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > outerj > daisy > navigation > impl > NavigationManagerImpl


1 /*
2  * Copyright 2004 Outerthought bvba and Schaubroeck nv
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.outerj.daisy.navigation.impl;
17
18 import org.outerj.daisy.navigation.*;
19 import org.outerj.daisy.repository.Repository;
20 import org.outerj.daisy.repository.RepositoryException;
21 import org.outerj.daisy.repository.VariantKey;
22 import org.xml.sax.ContentHandler JavaDoc;
23 import org.xml.sax.SAXException JavaDoc;
24
25 /**
26  * Implementation of NavigationManager, instantiated on a per-Repository instance
27  * basis, forwards real work to {@link CommonNavigationManager}.
28  */

29 public class NavigationManagerImpl implements NavigationManager {
30     private Repository repository;
31     private CommonNavigationManager commonNavigationManager;
32
33     public NavigationManagerImpl(Repository repository, CommonNavigationManager commonNavigationManager) {
34         this.repository = repository;
35         this.commonNavigationManager = commonNavigationManager;
36     }
37
38     public void generateNavigationTree(ContentHandler JavaDoc contentHandler, NavigationParams navigationParams,
39             VariantKey activeDocument, boolean handleErrors) throws NavigationException, SAXException JavaDoc {
40         commonNavigationManager.generateNavigationTree(contentHandler, navigationParams, activeDocument,
41                 handleErrors, repository.getUserId(), repository.getActiveRoleIds());
42     }
43
44     public void generatePreviewNavigationTree(ContentHandler JavaDoc contentHandler, String JavaDoc navigationTreeXml,
45             long branchId, long languageId) throws NavigationException, SAXException JavaDoc {
46         commonNavigationManager.generatePreviewNavigationTree(contentHandler, navigationTreeXml, branchId, languageId,
47                 repository.getUserId(), repository.getActiveRoleIds());
48     }
49
50     public NavigationLookupResult lookup(String JavaDoc navigationPath, long requestedBranchId, long requestedLanguageId, LookupAlternative[] lookupAlternatives) throws RepositoryException {
51         return commonNavigationManager.lookup(navigationPath, requestedBranchId, requestedLanguageId, lookupAlternatives, repository.getUserId(), repository.getActiveRoleIds());
52     }
53
54     public String JavaDoc reverseLookup(VariantKey document, VariantKey navigationDoc, NavigationVersionMode versionMode) throws RepositoryException {
55         return commonNavigationManager.reverseLookup(document, navigationDoc, versionMode);
56     }
57
58     public String JavaDoc reverseLookup(VariantKey document, VariantKey navigationDoc) throws RepositoryException {
59         return commonNavigationManager.reverseLookup(document, navigationDoc, NavigationVersionMode.LIVE);
60     }
61 }
62
Popular Tags