Project

General

Profile

« Previous | Next » 

Revision 72

Added by bojilova about 24 years ago

Included new features about writing XML documents into db
This includes writing data into db XML Catalog, document data into xml_documents,
comments into xml_nodes, added nodeindex for the order of elements by given parent element.

View differences:

BasicElement.java
8 8
 *     Version: '$Id$'
9 9
 */
10 10

  
11
package edu.ucsb.nceas.metacat;
11
//package edu.ucsb.nceas.metacat;
12 12

  
13 13
import java.io.IOException;
14 14
import java.util.Hashtable;
......
21 21
    private String		tagname;
22 22
    private StringBuffer	content;
23 23
    private long		parent_id;
24
    private Hashtable		attributes;
24
    private Hashtable	attributes;
25
    private int         childNum;
26
    private int         nodeIndex;
25 27

  
26 28
    /** Construct a Basic Element */
27 29
    public BasicElement () {
......
33 35
     *
34 36
     * @param tagname the name of the element
35 37
     * @param parent_id the id number of the parent element
38
     * @param nodeIndex - number of the element in the order for a given parent node
39
     * Every element initializes childNum to 0 when created and has interface incChildNum
40
     * when new child is created
36 41
     */
37
    public BasicElement (String tagname, long parent_id) {
42
    public BasicElement (String tagname, long parent_id, int nodeIndex) {
38 43
      this();
39 44
      this.tagname = tagname;
40 45
      this.parent_id = parent_id;
46
      this.nodeIndex = nodeIndex;
47
      this.childNum = 0;
41 48
    }
42 49
    
43 50
    /** Construct a Basic Element 
......
46 53
     * @param tagname the name of the element
47 54
     * @param parent_id the id number of the parent element
48 55
     */
49
    public BasicElement (long element_id, String tagname, long parent_id) {
50
      this(tagname,parent_id);
56
    public BasicElement (long element_id, String tagname, long parent_id, int nodeIndex) {
57
      this(tagname,parent_id,nodeIndex);
51 58
      this.element_id = element_id;
52 59
    }
53 60

  
......
149 156
    public String getContent() {
150 157
      return this.content.toString();
151 158
    }
159

  
160
    /** Get nodeIndex of the element */
161
    public int getNodeIndex() {
162
      return this.nodeIndex;
163
    }
164

  
165
    /** increase childNum when new child for the element is created */
166
    public int incChildNum() {
167
      return ++this.childNum;    
168
    }    
152 169
}

Also available in: Unified diff