KickJava   Java API By Example, From Geeks To Geeks.

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


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.repository.RepositoryException;
19 import org.outerj.daisy.repository.VariantKey;
20 import org.xml.sax.ContentHandler JavaDoc;
21 import org.xml.sax.SAXException JavaDoc;
22 import org.xml.sax.helpers.AttributesImpl JavaDoc;
23
24 import java.util.List JavaDoc;
25 import java.util.Map JavaDoc;
26
27 public class ErrorNode implements Node {
28     private String JavaDoc message;
29
30     public ErrorNode(String JavaDoc message) {
31         this.message = message;
32     }
33
34     public void searchPath(String JavaDoc[] path, int pos, long branchId, long languageId, Node[] foundPath) throws RepositoryException {
35         // empty
36
}
37
38     public List JavaDoc searchDocument(VariantKey document) throws RepositoryException {
39         return null;
40     }
41
42     public void populateNodeLookupMap(Map JavaDoc map, String JavaDoc path) throws RepositoryException {
43         // empty
44
}
45
46     public boolean checkId(String JavaDoc id, long branchId, long languageId) {
47         return false;
48     }
49
50     public boolean isExpandable() throws RepositoryException {
51         return false;
52     }
53
54     public List JavaDoc getExpandedChildList() throws RepositoryException {
55         return null;
56     }
57
58     public void generateXml(ContentHandler JavaDoc contentHandler, Node[] activeNodePath, int pos, boolean contextualized, String JavaDoc path, long userId, long[] roleIds) throws RepositoryException, SAXException JavaDoc {
59         generateXml(contentHandler, 0, null, userId, roleIds);
60     }
61
62     public void generateXml(ContentHandler JavaDoc contentHandler, int depth, String JavaDoc path, long userId, long[] roleIds) throws RepositoryException, SAXException JavaDoc {
63         AttributesImpl JavaDoc attrs = new AttributesImpl JavaDoc();
64         attrs.addAttribute("", "message", "message", "CDATA", message);
65         contentHandler.startElement(NAVIGATION_NS, "error", "error", attrs);
66         contentHandler.endElement(NAVIGATION_NS, "error", "error");
67     }
68
69     public boolean isIdentifiable() {
70         return false;
71     }
72
73     public String JavaDoc getId() {
74         return null;
75     }
76
77     public boolean isVisible(long userId, long[] roleIds, Node[] activeNodePath, int activeNodePathPos) throws RepositoryException {
78         return true;
79     }
80 }
81
Popular Tags