source: main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/BasicDocument.java@ 26040

Last change on this file since 26040 was 26040, checked in by kjdon, 12 years ago

renaming these classes to get rid of Simple from the names - Simple has specific meaning for document type

File size: 2.3 KB
Line 
1/*
2 * SimpleDocument.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 */
19package org.greenstone.gsdl3.util;
20
21import org.apache.log4j.*;
22import org.w3c.dom.Document;
23import org.w3c.dom.Element;
24
25public class SimpleDocument extends AbstractSimpleDocument {
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.SimpleDocument.class.getName());
33
34 public SimpleDocument(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}
Note: See TracBrowser for help on using the repository browser.