1 | /*
|
---|
2 | * BasicDocument.java
|
---|
3 | * Copyright (C) 2011 New Zealand Digital Library, http://www.nzdl.org
|
---|
4 | *
|
---|
5 | * This program is free software; you can redistribute it and/or modify
|
---|
6 | * it under the terms of the GNU General Public License as published by
|
---|
7 | * the Free Software Foundation; either version 2 of the License, or
|
---|
8 | * (at your option) any later version.
|
---|
9 | *
|
---|
10 | * This program is distributed in the hope that it will be useful,
|
---|
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
13 | * GNU General Public License for more details.
|
---|
14 | *
|
---|
15 | * You should have received a copy of the GNU General Public License
|
---|
16 | * along with this program; if not, write to the Free Software
|
---|
17 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
---|
18 | */
|
---|
19 | package org.greenstone.gsdl3.util;
|
---|
20 |
|
---|
21 | import org.apache.log4j.*;
|
---|
22 | import org.w3c.dom.Document;
|
---|
23 | import org.w3c.dom.Element;
|
---|
24 |
|
---|
25 | public class BasicDocument extends AbstractBasicDocument {
|
---|
26 |
|
---|
27 |
|
---|
28 | /** the default document type - use if all documents are the same type
|
---|
29 | */
|
---|
30 | protected String default_document_type = null;
|
---|
31 |
|
---|
32 | static Logger logger = Logger.getLogger(org.greenstone.gsdl3.util.BasicDocument.class.getName());
|
---|
33 |
|
---|
34 | public BasicDocument(Document doc, String default_document_type)
|
---|
35 | {
|
---|
36 | super(doc);
|
---|
37 |
|
---|
38 | this.default_document_type = default_document_type;
|
---|
39 | }
|
---|
40 |
|
---|
41 | /** returns the document type of the doc that the specified node
|
---|
42 | belongs to. should be one of
|
---|
43 | GSXML.DOC_TYPE_SIMPLE,
|
---|
44 | GSXML.DOC_TYPE_PAGED,
|
---|
45 | GSXML.DOC_TYPE_HIERARCHY
|
---|
46 | GSXML.DOC_TYPE_PAGEDHIERARCHY
|
---|
47 | default implementation returns GSXML.DOC_TYPE_SIMPLE, over ride
|
---|
48 | if documents can be hierarchical
|
---|
49 | */
|
---|
50 | public String getDocType(String node_id) {
|
---|
51 | if (default_document_type != null) {
|
---|
52 | return default_document_type;
|
---|
53 | }
|
---|
54 | return GSXML.DOC_TYPE_SIMPLE;
|
---|
55 | }
|
---|
56 |
|
---|
57 | /** returns true if the node has child nodes
|
---|
58 | * default implementation returns false, over ride if documents can be
|
---|
59 | * hierarchical
|
---|
60 | */
|
---|
61 | public boolean hasChildren(String node_id) {
|
---|
62 | return false;
|
---|
63 | }
|
---|
64 |
|
---|
65 | /** returns true if the node has a parent
|
---|
66 | * default implementation returns false, over ride if documents can be
|
---|
67 | * hierarchical*/
|
---|
68 | public boolean hasParent(String node_id) {
|
---|
69 | return false;
|
---|
70 | }
|
---|
71 | } |
---|